Connect a DS18b20 temperature sensor

Connect a DS18b20 temperature sensor to your Raspberry PI as follows. I used a breakout for this. In this example we will just be using terminal commands

pi and ds18b20 and led_schem
pi and ds18b20 and led_schem

Now you need to enter the following at the command prompt:

sudo nano /boot/config.txt

to open the /boot/config.txt file for editing. Then scroll down to the bottom of the file, and add the line:


save the amended file and reboot the Raspberry Pi so that the changes take effect.

Enter the following at a command prompt


sudo modprobe w1-gpio
sudo modprobe w1_therm
cd /sys/bus/w1/devices/
cat /sys/bus/w1/devices/28-0000027a4334/w1_slave


You will see something like the following, the t=20347 is the temperature reading, in this example that is 20.347 celsius

ds18b20 console
ds18b20 console


5PCS/LOT DALLAS DS18B20 Temperature Sensor

1Pcs DS18B20 Digital DIY Temperature Sensor Module

Previous articlePCD8554 LCD example
Next articleDS18b20 python example