Tuesday, 25 June 2013

Getting the Maxim DS18B20 temperature to work

I have finally got this device working properly. I used Tom Boyd's tutorial here http://sheepdogguides.com/arduino/ar3ne1tt.htm and adjusted his code slightly. Since my sensor was powered from the 5v line rather than using parasitic power, I was able to  issue read slots and wait for a 1, indicating end of conversion. Initially I was getting errors approximately every few hundred readings. The data sheet indicates a 60us minimum period for read slots and 480 us for write slots. Increasing the 60us to 80us reduced the frequency of these errors. However I have now decided to use the Onewire library which includes CRC checking on incoming data.

No comments:

Post a Comment