Z-Uno - negative temperature value from DS18B20

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
michap
Posts: 343
Joined: 26 Mar 2013 10:35
Contact:

Re: Z-Uno - negative temperature value from DS18B20

Post by michap » 22 Jan 2017 21:37

I use the Z-Uno with 4 x DS18B20 - it is working, ...

Maybe you are using 18B20 with parasite power?
You are working with sample sketch - - or can you attach your sketch?

Michael

Ralf.E
Posts: 5
Joined: 10 Jan 2017 20:35
Location: Germany (near Hamburg)

Re: Z-Uno - negative temperature value from DS18B20

Post by Ralf.E » 22 Jan 2017 22:57

michap wrote:Maybe you are using 18B20 with parasite power?
No, not parasite powered.
michap wrote:You are working with sample sketch - - or can you attach your sketch?
Sure - see attached file. It's a modified sample sketch. See the comments for line #25/26 and #34/35...

Thanks
Ralf
Attachments
DS18B20Scanner.zip
(1.37 KiB) Downloaded 137 times

Ralf.E
Posts: 5
Joined: 10 Jan 2017 20:35
Location: Germany (near Hamburg)

Re: Z-Uno - negative temperature value from DS18B20

Post by Ralf.E » 23 Jan 2017 00:45

I just found the reason...

I reduced the space of the array where the addresses of found 1-wire devices is stored. In my test setup I've two DS18B20 attached and assumed it's enough to provide 2x8 bytes for the device address buffer (because of two devices).

DS18B20Sensor::findAllSensors(byte * rom) writes one more device address to the provided device address buffer than devices found. If 4x8 bytes are provided:
- bytes[0..7] report the device address of the first device
- bytes[8..15] report the device address of the second device
- bytes[16..23] report the device address of the second device again
- bytes[24..31] are all zero

Nevertheless, DS18B20Sensor::findAllSensors() returns 2 devices attached to the 1-wire bus.

Not sure if the above is mentioned somewhere, if not it may make sense to extend DS18B20Sensor::findAllSensors() by a second parameter to provide the size of the provided device address buffer, to prevent DS18B20Sensor::findAllSensors() from overwriting other stuff located behind the device address buffer.

Ralf

Post Reply