Yet another Raspberry Pi thermometer

One of the easiest and cheap awesome Pi hacks is DIY-ing your own thermometer.

  1. Get a hold of a DS18B20 temperature sensor for cheap on Ebay and also a 4.7kOhm resistor. I use a waterproof sensor to be able to monitor the temperature outdoors.
  2. The sensor has 3 wires. Join blue and red through the resistor and hook it up to your Pi like so:
  3. Black goes to ground/0V (PIN 6), which is third from the top, right column. Red to 3.3V (PIN 1), which is top left. Blue to GPIO4 (PIN 7), which fourth from the top, left column.
  4. Log in to your Pi via SSH/console
  5. Enable 1-Wire in raspi-config sudo raspi-config -> “5 Interfacing options” -> “P7 1-wire” -> “Enable”
  6. Reboot
  7. Your sensor should now be listed in ls /sys/bus/w1/devices/
  8. Try and read it! Your sensor will have a unique id. Mine is 28-031650e12eff. So I can simply read it like so: cat /sys/bus/w1/devices/28-031650e12eff/w1_slave
44 00 4b 46 7f ff 0c 10 94 : crc=94 YES
44 00 4b 46 7f ff 0c 10 94 t=4250

Temperature is 4.25 degrees celsius!

Credits: Adafruit

Add a comment