-->
Page 1 of 1

temp returns last result for missing sensors

PostPosted: Wed Dec 16, 2015 10:04 am
by int47
Hello!

I connected 3 DS18b20 and attempted to read all 3. It works with all three sensors present.
But, with disconnected 3rd sensor instead of -127 I get same value 2nd sensor reads.
With only the first sensor connected, all three temperature readings were the same and from the first sensor.
With no sensors connected, all three readings were -127.

Since ESP voltage is 3.3V, sensors VCCs were connected to 3.3V (not parasite mode).
I used "temp" command in a timer. On each timer event only one sensor was read.

Re: temp returns last result for missing sensors

PostPosted: Wed Dec 16, 2015 7:36 pm
by Mmiscool
It initializes the sensors at start up.

Adding or removing them after start up is not advisable.

Re: temp returns last result for missing sensors

PostPosted: Thu Dec 17, 2015 3:52 am
by int47
Re running the program, or restarting the board by removing power makes no difference.
Code below runs once at startup:
Code: Select allmemclear
cls
let t0 = 0
let t1 = 0
let t2 = 0
temp 0 t0
temp 1 t1
temp 2 t2
print t0
print t1
print t2
wait

Re: temp returns last result for missing sensors

PostPosted: Thu Dec 17, 2015 9:05 pm
by heckler
Hey int47,

I tried your code with slight modification to cause it to read the 3 temps every 5 seconds and it appears that if you remove one of the sensors it just reads another sensor twice.

I used some freeze spray (computer dust off turned upside down) to cool one of the sensors and I could see that two of the temperatures went cold together.

I did appear that the sensor was actually read twice in a row as I got two slightly different cold temps so it is not just repeating the second temperature twice.

I also used the freeze spray to figure out which sensor was 1,2,3 etc.

just my 2 cents
dwight