![]() |
Forum Index : Microcontroller and PC projects : TEMPR=542C....
Author | Message | ||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
This one is another one I can't work out. An 18B20 sensor stuck onto a heater plate, 50% of the time, the result returned is correct - about 37'C. The other 50% of the time, the result is ALWAYS 542'C. I know that cannot be correct, as I doubt I would be alive at 542'C.... Can anyone suggest why that should be? Relevant code is: Smoke makes things work. When the smoke gets out, it stops! |
||||
JohnL Senior Member ![]() Joined: 10/01/2014 Location: SeychellesPosts: 128 |
Deleted |
||||
Solar Mike Guru ![]() Joined: 08/02/2015 Location: New ZealandPosts: 1163 |
Hi Grogster, put your scope between 0v and the data line, at the sensor; you may have noise on the wire stuffing up the readings. I had one of these play up awhile ago whenever a 230 vac fan turned on, ended up being induced mains noise, fixed with ferrite chokes. Cheers Mike |
||||
Phil23 Guru ![]() Joined: 27/03/2016 Location: AustraliaPosts: 1667 |
I've seen occasional errors on mine when the 5V supply is bad or there's interference. But then again mine are on long strings, one exceeding 30m. 542 is a weird result to get though, as it can't be derived from the binary output of the things. 2^6 is the most significant bit, which would allow a maximum reading on 127°C. I do have a vague recollection of some firmware issue relating to DS18B20's, but think that may have been on ARMs or something. |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
Cool, thanks for the suggestions. @ JohnL: Deleted. Now you have made me curious as to what you posted. Do tell. ![]() Smoke makes things work. When the smoke gets out, it stops! |
||||
GoodToGo!![]() Senior Member ![]() Joined: 23/04/2017 Location: AustraliaPosts: 188 |
I wonder if it's a calculation error? 542 is 0000 0010 0001 1110 in binary. According to the datasheet, a valid DS18B20 12 bit reading of that binary number equates to 33.875 degrees. Food for thought? Cheers! GTG! ![]() ...... Don't worry mate, it'll be GoodToGo! |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
Definitely food for thought but I can't see how it's happening. The relevant bit of code in the firmware (V5.3) is fret = (float)((short)(((unsigned short)b2 << 8) | (unsigned short)b1)) / 16.0; Something in the timing that causes a shift of 4 bits to the left? Jim VK7JH MMedit |
||||
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |