Pages: [1]   Go Down
Author Topic: DS18B20 - occassional zero temp readings  (Read 1376 times)
0 Members and 1 Guest are viewing this topic.
UK
Offline Offline
Newbie
*
Karma: 1
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I run a Uno with 5 DS18B20 digital temp sensors in my central heating sketch.
The sketch can run for hours or days with no problems but occassionally all 5 temp readings go to zero.
Resetting Uno with reset button makes no difference; removing all power from Uno to reset it is the only solution to this problem.

Any ideas, anyone??

thanks
Logged

London
Offline Offline
Full Member
***
Karma: 0
Posts: 146
Ugi was not declared in this scope
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I can't help you with the sensors themselves, but I have been having trouble with a DHT22 temperature and humidity sensor which works for hours and then refuses to read.

My solution was to drive the sensor with power from a digital pin and if I sensed several void readings in a row then I just cut power to the sensor for 5 seconds, restored it for 5 and then carried on.  Side-steps the issues quite effectively!

Don't know how much power your sensors take or whether you can power them easily from your Ardu' but if the wiring is there then a transistor on a digital pin (via a resistor) should allow you to power them all off a single control pin.
Logged

0
Offline Offline
Shannon Member
****
Karma: 216
Posts: 12556
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Unless I've some real information all I can say is "you have a bug".  Circuit?  Code?
Logged

[ I won't respond to messages, use the forum please ]

UK
Offline Offline
Newbie
*
Karma: 1
Posts: 18
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi MarkT

I can't see the problem being circuitry or code as most of the time it runs without problem.

I get the usual, occassional dodgy temp readings from some the DS18B20 sensors (-127C & 85C) but these I get around with coding.

This problem sets all 5 readings from the sensors at 0C!!

As mentioned in the original post, resetting the Arduino Uno via the reset button doesn't solve the problem, only a complete power down works - very strange.

I'm thinking maybe a transient mains spike putting an excess voltage onto the Uno board from the psu which, in turn, spikes the DS18B20 sensors & since a reset,using the reset button, doesn't remove voltage from Uno board or the DS18B20 sensors, that's why a soft reset doesn't work.

I'll try another psu & let you know the outcome.

PS  by the way, I live close to an electricity sub station & my mains incoming voltage is 251V-258V!! (should be 253V max under regs - 230V +- 10%)
Logged

Sussex UK / CT USA
Offline Offline
Edison Member
*
Karma: 0
Posts: 1028
Forums forever
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You "shouldn't" need it, but the following might help...

Have your system pull the data line reading the DS1820s low for two seconds every once in a while. That should reset them.

Also: Don't use parasitic power.

Do use the checksum returned with the temperature readings.

I wonder if there is something in your circuit which slowly charges up a capacitance somewhere, and that is interfering.
Logged

0
Offline Offline
Shannon Member
****
Karma: 216
Posts: 12556
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi MarkT

I can't see the problem being circuitry or code as most of the time it runs without problem.
I can...  But without more information I'm unable to help - you are asking for help.  I've a network of 11 DS18B20s that have run for months without a single bad reading, BTW.
Quote

I get the usual, occassional dodgy temp readings from some the DS18B20 sensors (-127C & 85C) but these I get around with coding.

This problem sets all 5 readings from the sensors at 0C!!

As mentioned in the original post, resetting the Arduino Uno via the reset button doesn't solve the problem, only a complete power down works - very strange.
The effect of a reset and a power down on the state of the microcontroller's RAM isn't identical.
Quote

I'm thinking maybe a transient mains spike putting an excess voltage onto the Uno board from the psu which, in turn, spikes the DS18B20 sensors & since a reset,using the reset button, doesn't remove voltage from Uno board or the DS18B20 sensors, that's why a soft reset doesn't work.

I'll try another psu & let you know the outcome.

PS  by the way, I live close to an electricity sub station & my mains incoming voltage is 251V-258V!! (should be 253V max under regs - 230V +- 10%)
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am experiencing this same problem in my sketch right now.  Did you ever find the culprit and solution?   I have checked my circuitry alone with a simple sketch and it works fine, but when I incorporate it into a sketch with multiple other sensors and a pachube link, I get the occasional zero temp reading.  Which leads me to believe its in the programming.  I have tried the pin mode low for 2 seconds and that did not fix the problem.  please help.  Thanks.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 29
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I had same problem occasionally too, i suppose that was because of long wires to sensors. Problem was solved by adding a 2k2 resistor between signal and ground (if remembered correct. Resistor still exists in bread board, no more wires connected)  smiley-roll
Logged

My software has no bugs, only random features.

Pages: [1]   Go Up
Jump to: