Test DS18B20 sensor

  1. sudo modprobe w1-gpio
  2. sudo modprobe w1-therm
  3. cd /sys/bus/w1/devices
  4. ls
  5. cd 28-xxxx (change this to match what serial number pops up)
  6. cat w1_slave

The interface is a little unreliable, but fortunately it tells us if there is a valid temperature to read. It’s like a file, so all we have to do is read

The response will either have YES or NO at the end of the first line. If it is yes, then the temperature will be at the end of the second line, in 1/000 degrees C. So, in the example above, the temperature is actually read as 20.687 and then 26.125 degrees C.

If you have more than one Sensor connected, you’ll see multiple¬†28-xxx¬†files. Each one will have the unique serial number so you may want to plug one in at a time, look at what file is created, and label the sensor!

Tagged . Bookmark the permalink.

One Response to Test DS18B20 sensor

  1. Pingback: Temp recording and upload live to Google Doc`s - Julian Milligan