Sign up ×
Raspberry Pi Stack Exchange is a question and answer site for users and developers of hardware and software for Raspberry Pi. It's 100% free, no registration required.

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 and has been fairly easy to follow.

I changed the raspi.list file to read "deb 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


share|improve this question
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. –  Krzysztof Adamski Nov 15 '12 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 Nov 15 '12 at 14:28

6 Answers 6

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?

share|improve this answer
+1 for the "If a picture ..." comment –  HeatfanJohn Nov 15 '12 at 22:16
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 Nov 16 '12 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. –  RedGrittyBrick Nov 16 '12 at 11:16
Can I use a different GPIO? –  Andres Feb 5 '14 at 7:41
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 –  David Tinker Mar 5 at 4:31

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:

share|improve this answer

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 ( 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.

share|improve this answer
What are the benefits or disadvantages of using the DS18B20 in parasite mode over the normal mode? –  Matthew Moisen Dec 22 '14 at 4:52
(A bit late but) answer added. –  sanyi Mar 18 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? –  Matthew Moisen Mar 19 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 Mar 19 at 19:45

to setup one wire with the latest Kernel you can follow the direction at:

share|improve this answer

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

share|improve this answer
Hi hello welcome. Please expand your answer, e.g. with links, further descriptions, photos or similar. –  myhd Feb 15 '14 at 19:57

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:


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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