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


  • 1
    It seems that your RaspberryPi does not see your sensor. Double check that it is connected in the right way (for example if you didn't connect sensor pin 1 as pin 3, etc), double check that you connected data pin to gpio 4, check another sensor (maybe you managed to brake the one you are testing right now). Also, since I don't know if this is a typo, double check if you are using 4.7k Ohm (4700 Ohm) resistor, not 4.7 Ohm. Commented Nov 15, 2012 at 12:36
  • Thanks for the response, that was a typo is is a 4.7k Ohm resistor (yellow, violet, red, gold). I have three temperature sensors and none of them work, it is however possible that I've managed to break all three of them through misswiring. At least there seems to be nothing else jumping out as wrong so I'll start by buying a couple more.
    – Raspnoob
    Commented Nov 15, 2012 at 14:28

6 Answers 6


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:


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

  • This did it for me. Seems this was not necessary for Pi Model 1. I have model 2 and needed this. No modprobe-s were necessary.
    – Oliv
    Commented Jun 7, 2016 at 12:52
  • Was also necessary for my Pi Model 3 B.
    – user100464
    Commented Aug 18, 2017 at 22:11

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?

  • Thanks HeatfanJohn that is exactly what is was. A wiring error. Your picture fixed the problem in seconds. I'm a little confused that though as to me that is pin 7 which a diagram I have labels it as General Purpose Clock. How is it GPIO#4? Thanks again,
    – Raspnoob
    Commented Nov 16, 2012 at 10:17
  • @Raspnoob: See pinout in updated answer, numbering is confusing. GPIO numbering is per main system-on-chip makers spec, but the header pins are organised differently and are separately numbered in a zig-zag way instead of along lines of pins. P.S. please click the tick to accept answer if it helped solve your problem. Commented Nov 16, 2012 at 11:16
  • 1
    Can I use a different GPIO?
    – Andres
    Commented Feb 5, 2014 at 7:41
  • 4
    I couldn't get mine to work with Raspbian 1.4.0 and a model B+ until I did this: Add the following line to the end of /boot/config.txt : dtoverlay=w1-gpio,gpiopin=4 Commented Mar 5, 2015 at 4:31

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.

  • 1
    What are the benefits or disadvantages of using the DS18B20 in parasite mode over the normal mode? Commented Dec 22, 2014 at 4:52
  • (A bit late but) answer added.
    – sanyi
    Commented Mar 18, 2015 at 18:55
  • Thank you. "parasitic power mode ... is especially important when one wants to wire a big number of sensors together" I currently link up as many as 7 probes on a breadboard without using parasite mode. Why is it important in this case to go parasitic? Commented Mar 19, 2015 at 2:34
  • In some scenarios less wires can reduce cost or help avoid mechanical or space problems. This is irrelevant for small hobby projects on someone's desk.
    – sanyi
    Commented Mar 19, 2015 at 19:45
  • 1
    Presumably if you've used an external pull-up, the pullup=1 configuration is not required?
    – piers7
    Commented Jul 29, 2016 at 6:42

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:



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/

  • 1
    In keeping with our policy regarding informationless link-only answers, if this post is not edited to contain information that can stand as an answer, however minimal, in 48 hours it will be converted to Community Wiki to simplify having it corrected by the community.
    – Ghanima
    Commented Feb 8, 2017 at 18:10

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

  • 3
    Hi hello welcome. Please expand your answer, e.g. with links, further descriptions, photos or similar.
    – myhd
    Commented Feb 15, 2014 at 19:57

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