#219 DS18S20 1-Wire Reading
Basic interrogation of a DS18S20 using 1-wire protocol
The DS18S20 is an inexpensive 1-Wire digital thermometer with a range of -55°C to +125°C, at ±0.5°C Accuracy from -10°C to +85°C.
It comes in TO-92 packaging and may be powered directly (using three pins), or take parasitic power from the data line (using two pins).
The sequence of operations boils down to this:
- Send a search request on the wire to find a device
- Get the device address and ensure the family code is as expected
- Issue conversion command (0x44)
- Wait for conversion, then read the conversion scratchpad from the device
- Process the data received
I’ve refactored a little to make the code more readable.
It constantly polls the DS18S20 device and logs to the serial output. Here’s an example:
Credits and References
- DS18S20 product page and datasheet
- APPLICATION NOTE 4377 1-WIRE PROTOCOL PDF OF DS18S20 VS DS18B20 DIGITAL THERMOMETERS
- OneWire library
- OneWire - Arduino playground page
- ..as mentioned on my blog