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

PaulBarr
  • 153
  • 1
  • 4
  • Altered boot config file to read dtoverlay=w1-gpio-pullup,gpiopin=4 as per http://raspberrypi.stackexchange.com/questions/27470/ds18b20-sensor-not-detecting and still no change – PaulBarr Dec 29 '15 at 19:10
  • and turning off device tree doesn't make any difference – PaulBarr Dec 29 '15 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 '15 at 20:50
  • shall I use that in addition to having device tree off or instead of? Will include information now. – PaulBarr Dec 29 '15 at 20:51
  • You should be using device tree. dtoverlay (device tree overlay) has no meaning otherwise. – joan Dec 29 '15 at 20:59
  • You are using a fairly ancient kernel (in Pi terms). However device tree should work. Against that w1-therm and w1-gpio are not listed. Could you sudo modprobe w1-gpio and sudo modprobe w1-therm. – joan Dec 29 '15 at 21:07
  • I have redone those commands, unfortunately still not appearing in the w1 devices – PaulBarr Dec 29 '15 at 21:09
  • I realised in the above I have not wired the pullup resistor correctly, I have rewired according to: http://www.reuk.co.uk/DS18B20-Temperature-Sensor-with-Raspberry-Pi.htm. However still no difference as no devices found – PaulBarr Dec 29 '15 at 21:41

2 Answers2

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.

Dr.Viper
  • 209
  • 2
  • 7
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.

scherzkrapferl
  • 393
  • 1
  • 4
  • 16