Temp Sensor DS18B20 (Raspberry Pi)

by piddlerintheroot in Circuits > Raspberry Pi

9330 Views, 37 Favorites, 0 Comments

Temp Sensor DS18B20 (Raspberry Pi)

d.jpg

Basic tutorial of how to setup a DS18b20 temp sensor with the raspberry pi.

Parts

vlcsnap-1771-11-10-22h10m59s686.png

Required Parts:

RPI 3 - https://amzn.to/2VA9pQY

4 Amp Power Adapter - https://amzn.to/2CTptWu

16GB micro SD - https://amzn.to/2SFMwd3

120 pcs jumper cable: https://ebay.to/2VAb9cY

ds18b20 sensor - https://amzn.to/2M5yHSN

Setup

vlcsnap-4724-05-09-09h37m05s543.png

1. Edit config.txt

sudo nano /boot/config.txt

add "dtoverlay=w1-gpio" to the bottom of the file

sudo reboot

2. Type the following commands

sudo modprobe w1-gpio
sudo modprobe w1-therm

cd /sys/bus/w1/devices/

ls

3. change directory to sensor instance

cd 28-00000xxxxxxx *serial number is unique
ls

4. check to see if sensor is functional

cat w1_slave

you should see output similar to this

root@raspberrypi:/sys/bus/w1_slave/28-00000495db35# cat w1_slave
a3 01 4b 46 7f ff 0d 10 ce : crc=ce YES

a3 01 4b 46 7f ff 0d 10 ce t=26187

Code

vlcsnap-5873-11-23-00h00m11s289.png

Download and run python script:

Downloads

Additional Info

vlcsnap-4240-06-21-08h51m51s648.png
Temperature Sensor (DS18B20) Raspberry Pi