ZUNO2 strange bahaviour using DS18B20

Discussion about Z-Uno product. Visit http://z-uno.z-wave.me for more details.
Post Reply
AlesKO
Posts: 84
Joined: 24 Nov 2016 09:58

ZUNO2 strange bahaviour using DS18B20

Post by AlesKO »

I have problem playing with DS18B20 temperature sensors > Copy / paste 'Multiple DS18B20 temperature sensors' example.

Problem is in this line of code:
temperature = ds18b20.getTemperature(ADDR(i))

Whenever program executes getTemperature() ZUNO resets. Resets are repeating in infinite loop and ZUNO flashes red LED 4 times.

Where is the problem? It took me half a day to figure out:
#define ADDR_SIZE 8
byte addresses[ADDR_SIZE * N_SENSOR];


Byte array of addresses is to short to store whatever ds18b20.findAllSensors(addresses) writes in. Looks like writing goes over the end and overwrites some compiled code.

What was my solution? I increased addresses[] length (for 5 bytes or more) and the problem is gone:
addresses[(ADDR_SIZE * MAX_TEMP_SENSORS) + 5]

Is there a bug in ZUNO_DS18B20.h library? Am I really the only one having this basic strange behaviour?

ZUNO2 rev.6
Bootloader version: 3.0.10
Arduino IDE 2.0.3
Two DS18B20 temp. sensors
Included + S2
amatilda
Posts: 58
Joined: 26 Sep 2021 22:09

Re: ZUNO2 strange bahaviour using DS18B20

Post by amatilda »

Hello.
Is there a bug in ZUNO_DS18B20.h library? Am I really the only one having this basic strange behaviour?
An error in the example.

It was like this:

Code: Select all

number_of_sensors = ds18b20.findAllSensors(addresses);
And it should be like this:

Code: Select all

number_of_sensors = ds18b20.findAllSensors(addresses, N_SENSOR);
No one seemed to have more than three sensors...
amatilda
Posts: 58
Joined: 26 Sep 2021 22:09

Re: ZUNO2 strange bahaviour using DS18B20

Post by amatilda »

Two DS18B20 temp. sensors
True, you have 2 sensors, it is strange that you have problems.

Can you try with the change I mentioned?
AlesKO
Posts: 84
Joined: 24 Nov 2016 09:58

Re: ZUNO2 strange bahaviour using DS18B20

Post by AlesKO »

Added 'N_SENSOR' solved my problem!

THX, @amatilda.
Post Reply