It's unclear from your picture whether you are using the 5v0 or the 3v3 pin for the power rail of your breadboard. If you are using the 3v3 then it is highly unlikely that you have fried your pin. To move forward with our debugging, let's assume you haven't fried your pin.
It looks like you have wired the temperature sensor up correctly with the resistor across the +ve input and data pin. I am unfamiliar with the breakout board that you are using but I have a hunch you hooked the data pin to the wrong port - there is only one pin on the Pi which can read a DS18B20 and that is the GCLK pin (GPIO 4 / physical pin 7).
Once you have it wired up correctly you can debug from a terminal window. First run these from the Linux shell:
sudo modprobe w1-gpio
sudo modprobe w1-therm
Then change directory cd /sys/bus/w1/devices
In this folder if you run ls
you should see another directory in the format 28-xxxxxxxxxxxx
. This should correspond to the ID of the temperature sensor.
If you cd
into this directory (protip: use cd 28*
), you should see a file called w1_slave
. This is the file which holds your temperature data. You can run cat w1_slave
and it should return something along the lines of:
5b 01 4b 46 7f ff 05 10 b5 : crc=b5 YES
5b 01 4b 46 7f ff 05 10 b5 t=21687
In this case, t=21687
is your temperature in Celsius multiplied by 1000, i.e. 21.687 degrees C
.
Sometimes, the top line will read NO
instead of YES
, in that case just wait a little while (10 seconds or so) and run cat w1_slave
again.
I use a Python program to poll this file every 5 minutes which serves as a home temperature monitoring system. I believe the OS reads the device every 10 seconds or so.
w1_slave
file (which is specified to take no more than 750 ms). Not sure about the polling intervals at which it searches the bus for new devices, though. – n.st Apr 06 '14 at 10:44P7
pin solved the issue and created the/sys/bus/w1/devices/28-*/
directory, but I cannot understand why theGPIO4
was mapped asP7
on our breakout board. – MaxChinni Nov 06 '15 at 15:57SCLK
wasGPIO11
(see [https://en.wikipedia.org/wiki/Raspberry_Pi]). We should connect our sensor toGPIO4
(GCLK
), right? – MaxChinni Nov 06 '15 at 16:08