DS18B20 error on low voltage

premelec

Senior Member
I built a PICAXE 08M reading two DS18B20 temperatures - one close and one 30 feet away. The one thirty feet away was reading 185F which I knew was wrong... when I changed the batteries [3xAA] it read 84F - [they had gone down to around 3v] - Anyhow I thought I'd mention that erronious readings can occur as you go out of supply voltage range - so if you are controlling anything critical with the reading better monitor the supply voltage too...

I'm going to look into it further - stay cool... :)
 

westaust55

Moderator
what size wire were you using for the 30 foot run?

Did you try with an electrolytic capacitor near the remote DS18B20. That might help keep the voltage up as the DS18B20 does use more power while doing the measurement/calculation. The Electro would act as a local "reserve" energy buffer.

when the DS18B20 is performing temperature conversions or copying data from the
scratchpad memory to EEPROM, the operating current can be as high as 1.5mA.
Typical standby current is only 750nA (0.75uA).

Which command were you using - READTEMP or READTEMP12 ? :confused:

READTEMP12 is a 12-bit operation which takes upto 750ms (0.75sec)

READTEMP is an unspecified number of bits but if it is only a 10-bit operation then the time for conversion is only upto 187 ms so less energy required. Or if it was a 9-bit operation then would still give 1 deg resolution takes less that 94ms.
 
Last edited:

Dippy

Moderator
Good points re: cable resistance. Obv a feeble battery will droop more under load too.
Out of interest it might be worth 'scoping both ends.
It's useful to have Real World figures to check voltage levels and digital signal quality.

It also reminds us that battery voltage monitoring is a 'must have' for most battery powered measuring equipment.
It's not difficult. And I don't just say this with 20:20 hindsight :)
 

BeanieBots

Moderator
It's not just obviously erronious readings that you need to look out for.
The fundamental accuracy of the DS18B20 is also affected by voltage. Also, the current drawn during a measurement is enough to cause self heating.
Try it!
Put the DS18B20 in still air at a fixed temperature.
Take a reading say every 20 seconds. Then as quick as possible (every 750mS), then go back to once every 20 seconds to confirm.

Then repeat at 4.5v and at 5.0v
Enjoy!
 

Dippy

Moderator
BB: That's interesting.

Blimey: Looks like Westy's been reading product Data Sheets again. You can tell it's Sunday :)
 

BeanieBots

Moderator
Unfortunatley, the datasheet does not tell you the difference between a PICAXE Readtemp & Readtemp12. My understanding is that both take a full resolution reading using up 750mS. Either way, both commands take 750mS to run.

The self heating and power rail variation can actually be used to advantage.
Without going into detail, you use them to the same effect as an "accelerator resistor" to effectively increase resolution by another bit.
 

Michael 2727

Senior Member
I have an iButton Temperature Button that will self-heat up to 5 Deg C over a
few minutes if left sampling continuously. (Com port on my PC & iButton adapter)
The Temperature Buttons are simply a DS18B20 stuffed into a s/steel can.

For general heating and cooling applications not many things need an updated
temperature 80 times a minute. If you had an application that required such
accuracy then maybe the DS18B20 would not be the best solution.
I don't own a nuclear power station so I'll keep using them ;)
 

premelec

Senior Member
Westaust... I'm doing READTEMP12 and roundning to nearest 1 degF - I measured the wire resistance at less than .5 ohm per lead [some 4 wire tel/control wire]. I think the problem is operating on marginal low voltage - it doesn't show at all on higher voltages - I know about the variety of problems in temperature measurement and was just impressed by the magnitude of this error! [220% could throw off quite a few control situations :)] - A little sun showing I have to go out and shovel snow...
 

premelec

Senior Member
No... and thermistors are excellent - but to get a linear read you need several and more $$ - the "Thermilinear" cofiguration... I also have an analog circuit that linearizes... however on to the DS18B20 which is relatively simple to use because of the READTEMP12 command....

What was particularly interesting was that the 185F reading was consistent over 10 minutes reading about every 20 seconds - not an occasional deviation from the 84F it should have been reading. I don't know a lot:

What would have happened if I'd increased or decreased the DS18B20 Temperature?
Was it an effect of the DS18B20 or the PICAXE read function?
Was it an effect of 'soft' power supply or voltage [dying batts higher internal R]?
Was it an effect of lead length [the other DS18B20 was reading 55F OK]?
[Or temperature?]

So later today I'll connect the assembly to a bench supply and try a few things out -
meantime if anyone has an answer about the above uncertainties please post...

Thanks to you all and Happy PICAXING!
 

BeanieBots

Moderator
It was a result of running it out of spec, so all bets are off anyway!

Three most likely causes:-
1. Internal A2D reference wrong giving false reading.
2. Internal logic levels from A2D miss-read prior to sending.
3. Logic level miss-read by PICAXE. (timing and/or level)

Hard to predict what effect a temperature change would have because if it's a binary value being miss-read, it would depend on the pattern. Also, a change in temp could result in more (or less) bits being incorrectly read due to extra/reduced semiconductor conduction. eg, if bit 6 is always read low, then a change which required bit 6 high would be seen as low, but if it was stuck high, it would be seen as low. Probably several bits affected AND influenced by neighbouring bits. (physically, not mathematically).

The LEAST LIKEY scenario is what you are proposing, ie a straight-forward gain/offset inaccuracy. These would only ever be small and within the limits specified in the datasheet under NORMAL electrical conditions. However, possibility 1 COULD result in a large gain error.

If you work in 1/16's of a degree C, it will be easier to see any patterns.
 

premelec

Senior Member
Hi BB I'm not proposing any straight offset... are you referring to the AD in the DS18B20? I haven't looked into it's internal layout - I guess if it's using the usual semiconductor sense it would have an internal ref V that could go off [DS18B20 supposed to operate down to 3v]. Need to get it on the bench...
 

MPep

Senior Member
Have you tried installing an Electrolytic Capacitor near the DS18B20? Mentioned previously, this may give enough current storage when doing a measurement.
 

premelec

Senior Member
OK.... I did some bench tests with soft supply and low voltages - I could not replicate the original observed behavior and only got errors at less than 2.6 volts - some of these errors were impressive - like 6 deg reported when it was 170 :).

I'm going to let it drop at this point since I think it's only a low voltage artifact and in practical circuitry I can design for that when it's critical.

Thanks for all the comments and suggestions... :)
 

BeanieBots

Moderator
Think you've possibly demonstrated that it's item 3 on my list.
Low voltage and reduced available current probably causing 'sloppy' pulses which could be miss-read. The suggested cap should improve (if not fix) things.
The longer the lead, the worse the problem will be.
 
Top