Skip to content

Dallas 1 Wire Temperature Sensor

Calin Crisan edited this page Apr 9, 2020 · 16 revisions

About

This page will help you install and use a Dallas 1-wire temperature sensor (typically a DS18B20) with qToggleOS.

Instructions

  1. Connect your Dallas sensor to the Raspberry Pi board, on a GPIO of your preference (use GPIO4 if in doubt).

  2. Add the following line to your /data/etc/dtoverlays file:

     w1-gpio gpiopin=4
    

    Replace 4 with the GPIO number you use. Add multiple entries if you plan to use multiple sensors connected to the same board, on different GPIOs.

    For more details on dtoverlays, see this.

  3. Reboot the system:

     # reboot
    
  4. Find the address of your sensor(s):

     # ls -1 /sys/bus/w1/devices/*/w1_slave | grep -oE '28-[^/]+'
     28-00000deadbee
    
  5. Install the qtoggleserver-dallastemp add-on:

     # pip install qtoggleserver-dallastemp
    

    See Installing Add-ons if you're not sure how to do this.

  6. Follow the instructions from qtoggleserver-dallastemp to install and configure the add-on.

  7. Restart qToggleServer:

     # service qtoggleserver restart
    

    The temperature port should show up in your qToggleServer.

Troubleshooting

  • You should see the detected devices in /sys/bus/w1/devices:

      # ls /sys/bus/w1/devices/
      28-00000deadbee w1_bus_master1
    
  • Make sure the modules w1-gpio and w1-thermo are loaded:

      # lsmod | grep w1
      w1_therm               16384  0 
      w1_gpio                16384  0 
      wire                   40960  2 w1_therm,w1_gpio
    
  • Make sure your sensor is properly connected and has the needed resistor between Data and VCC pins.

Clone this wiki locally