Community
OpenEnergyMonitor

Community

Ds18b20 hardcoding address

Tags: #<Tag:0x00007f6e03b19b08>

Hello again, again with a little issue, I’m setting up finally my self built solar Batch heater, and I would like to monitor temperature, so since I have an external emontx v3.4 with already connected a Rj45 breakout board with actually 5 ds18b20 working fine. I tried to connect the new probe, a 15m cat 5, but then all sensors go weird reading 300.
Ok too much power draw. So I disconnected one sensor, the new sensor works then fine but the reading goes on the feed of another sensor.
Is there a way to hardcode the address of the probes?
Thanks

Yes. If you’re using the new emonLibCM, then it’s all in the documentation for the library, and only needs the addresses hard-coding into the sketch and a small change to tell the library not to search for them.

If you’re using the “old” emonLib (the discrete sample version) which doesn’t do temperature measurement - it’s handled separately in the sketch, then instead of allowing the Dallas library to search for the sensors, you plug their addresses into the array.

Which are you using?

You probably need a 5 V USB power supply for your emonTx - the a.c. adapter power is only designed for 2 sensors, IIRC.

Hello Robert, could you tell me how to check fo the library?
If i connect the 5v adapter can I daisy chain another breakout board?

Look at the sketch, near the top. It’s #include’ed as either emonLib.h or emonLibCM.h

Yes - provided the cables are fairly short, a ‘star’ configuration is acceptable.

I’m trying to find an example sketch for you to lift the appropriate bits from. The array and the count of sensors is

byte allAddress [MaxOnewire][8];  // 8 bytes per address
byte numSensors;

and I think if you take out the line that has oneWire.search(allAddress[j]) in it, then it’s going to use the array and not search.

Found one! It’s for the emonTx V2, but the temperature bits have not changed [edit] although the I/O pins have.
emontx_temperature_power.zip (3.2 KB)