17

I would really appreciate some advice on this. Being a TOTAL noob I have closely followed a guide on the internet explaining how to use a DS18b20 sensor with my Raspberry Pi. The guide is http://www.cl.cam.ac.uk/freshers/raspberrypi/tutorials/temperature/ and has been fairly easy to follow.

I changed the raspi.list file to read "deb http://archive.raspberrypi.org/debian/ wheezy main untested" and then run apt-get update and apt-get upgrade. All that went without a hitch.

I then connected the DS18b20 to 3v, Ground and Data (gpio#4) connecting the data and 3v via a 4.7 ohm resistor.

I've then used the console to run;

sudo modprobe w1-gpio
sudo modprobe w1-therm
cd /sys/bus/w1/devices/

This all works fine. However, when type ls, the guide tells me that I should see the serial number of the sensor listed followed by w1_bus_master1.

All I actually get is w1_bus_master1 but no serial number. I've tried everything I can think of (which isn't much). Is anybody able to offer some guidance on what the problem might be?

Many thanks

Raspnoob.

Dennis Williamson
  • 1,739
  • 3
  • 13
  • 12
Raspnoob
  • 171
  • 1
  • 1
  • 3

6 Answers6

17

I had the same problem with Pi B+ and solved it by adding a line to /boot/config.txt. Add the following to the bottom:

dtoverlay=w1-gpio,gpiopin=4

found the solution at: www.raspberrypi-spy.co.uk

Ghanima
  • 15,958
  • 17
  • 65
  • 125
waterwombat
  • 171
  • 1
  • 2
15

I suggest double checking your connections. photo of connections
↑ my wiring (which works for me)

Pi header pins ← From pi cheat sheet

screenshot of temp graph and pi commands
↑ commands and example output + RRDTOOL graphs from DS18B20 (the one shown in top photo.)

If a picture is worth a thousand words, why does stack exchange insist on 30 characters?

RedGrittyBrick
  • 611
  • 4
  • 14
3

You can use DS18B20 in parasite power mode, meaning that you only need two wires: ground and data, no need for pullup resistor for the data.

As per the datasheet (http://datasheets.maximintegrated.com/en/ds/DS18B20.pdf page 2): VDD must be grounded for operation in parasite power mode.

DS18B20 needs strong pull-up on the data line in this mode achievable by issuing this commands:

sudo modprobe w1-gpio pullup=1
sudo modprobe w1-therm strong_pullup=1

EDIT (in response of comment):

  • parasitic power mode features simplicity in wiring. Only 2 wires needed for this mode. This is especially important when one want to wire a big number of sensors together.

  • the disadvantage of the parasite mode is that the IO needs strong pullup to be able to provide enough current. However this is not a real problem with this temperature sensors.

  • another disadvantage of the parasite power is the slower communication speed. One have to charge the parasite capacitor and that takes time, in case of this sensor > 500 ms.

sanyi
  • 201
  • 1
  • 4
-1

If you have a newer version of Wheezy, DO NOT enable "Device Tree" in the Configuration program! I find that it cause all kinds of havoc with you Pis' hardware.

Doing so, you WON'T have to add the line from the above mentioned comments:

dtoverlay=w1-gpio,gpiopin=4

piboy
  • 21
-1

to setup one wire with the latest Kernel you can follow the direction at: http://bigfieldsblog.cloudapp.net/keyes-18b20-temperature-sensor-and-raspberry-pi-2/

-2

PIN 3 must be grounded in parasite power mode!, per the datasheet.