3

I have wired up my Raspberry Pi (RPI-0007) to the pins as outlined by http://www.modmypi.com/blog/ds18b20-one-wire-digital-temperature-sensor-and-the-raspberry-pi. However, when I change directory to /sys/bus/w1/devices nothing is there.

I have added dtoverlay=w1-gpio,gpiopin=4 to the boot config file (sudo nano /boot/config.txt) and rebooted but nothing is working. I have checked the wires, loaded the modules and checked the sensor is receiving power (using an LED on the breadboard). Note I have also tested the sensor on an arduino and it works perfectly - so the issue lies with the pi.

This shows the white wire going to the 3v3 pin and the yellow wire going to gpio4

This shows the black wire going from ground to the ground rail on the breadboard, the other end of the white wire going to the positive rail on the bread board and the red wire taking the power to Pin Three on the sensor

This shows the wiring for the sensor. The red wire carries power to Pin three, the blue wire grounds the sensor and there is a 4.7kohm resistor going from Pin Two to the yellow wire that finishes at GPIO4

The first picture shows the white wire going to the 3v3 pin and the yellow wire going to gpio4

The second picture shows the black wire going from ground to the ground rail on the breadboard, the other end of the white wire going to the positive rail on the bread board and the red wire taking the power to Pin Three on the sensor.

The third picture shows the wiring for the sensor. The red wire carries power to Pin three, the blue wire grounds the sensor and there is a 4.7kohm resistor going from Pin Two to the yellow wire that finishes at GPIO4.

uname -a: Linux raspberry 3.18.7-v7+ #755 SMP PREEMPT Thu Feb 12 17:20:48 GMT 2015 armv71 GNU/Linux

enter image description here enter image description here

9
  • Altered boot config file to read dtoverlay=w1-gpio-pullup,gpiopin=4 as per raspberrypi.stackexchange.com/questions/27470/… and still no change
    – PaulBarr
    Dec 29, 2015 at 19:10
  • and turning off device tree doesn't make any difference
    – PaulBarr
    Dec 29, 2015 at 19:15
  • Could you use dtoverlay=w1-gpio,gpiopin=4 in /boot/config.txt and then reboot. Note, this is different to what you said you used. Then include the following information in your question. Output of uname -a. Output of cat /etc/os-release. Output of lsmod.
    – joan
    Dec 29, 2015 at 20:50
  • shall I use that in addition to having device tree off or instead of? Will include information now.
    – PaulBarr
    Dec 29, 2015 at 20:51
  • You should be using device tree. dtoverlay (device tree overlay) has no meaning otherwise.
    – joan
    Dec 29, 2015 at 20:59

2 Answers 2

2

There are three minimum things to check here:

  1. Which mode is the DS18B20, and whether the connections are done accordingly? If it is a parasitic mode sensor or normal sensor. Typically, the DS18B20 has to be wired as below:

    • (-) ve to GND
    • (+) ve to 3V3
    • S to GPIO.7 (Pin 7)
  2. Configuration.

In /boot/config.txt, add dtoverlay=w1-gpio at the end.

For this run sudo nano /boot/config.txt and then add dtoverlay=w1-gpio in the nano text editor. Click Y to save file while exiting.

Run sudo reboot to reboot the Pi.

  1. Setting it all up You should setup it all next.

Run the following code in terminal:

sudo modprobe w1-gpio sudo modprobe q1-therm

And now check ls /sys/bus/w1/devices/

It should show up.

1
  • Do check @scherzkrapferl's answer below as well.
    – Dr.Viper
    Dec 9, 2016 at 5:37
2

As @Dr. Viper mentioned in his answer, you probably forgot to

sudo modprobe w1-gpio
sudo modprobe w1-therm

To make this work by startup you can edit the /etc/modules by typing

sudo nano /etc/modules

into your terminal and add following lines:

w1-gpio
w1-term

To save this configuration with nano press CTRL+O to save the file and CTRL+X to exit nano. After a reboot the changes should take affect and your temperature-sensor should be shown.

2
  • You may want to replace STRG with CTRL as the majority of potential readers will not understand otherwise.
    – Ghanima
    Nov 23, 2016 at 22:29
  • 1
    sudo modprobe q1-therm should be sudo modprobe w1-therm
    – Archonic
    May 28, 2019 at 3:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.