Fork me on GitHub

Project Notes

#219 DS18S20/OneWireReading

Basic interrogation of a DS18S20 using 1-wire protocol

DS18S20

Notes

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).

Basic Operation

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

Family Codes

Model Code
DS18S20 0x10
DS18B20 0x28
DS1822 0x22

Example Code

The OneWireReading.ino sketch is a basic demonstration based on the examples on the OneWire Arduino playground page.

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:

screenshot

Construction

Breadboard

The Schematic

The Build

Credits and References

About LEAP#219 SensorsArduino
Project Source on GitHub Return to the LEAP Catalog

This page is a web-friendly rendering of my project notes shared in the LEAP GitHub repository.

LEAP is my personal collection of electronics projects, usually involving an Arduino or other microprocessor in one way or another. Some are full-blown projects, while many are trivial breadboard experiments, intended to learn and explore something interesting (IMHO!).

The projects are usually inspired by things found wild on the net, or ideas from the sources such as:

Feel free to borrow liberally, and if you spot any issues do let me know. See the individual projects for credits where due. There are even now a few projects contributed by others - send your own over in a pull request if you would also like to add to this collection.