User Manual

125
Then reboot with
sudo reboot.
Mount the device drivers and confirm whether the device is effective or not
sudo modprobe w1-gpio
sudo modprobe w1-therm
cd /sys/bus/w1/devices/
ls
The result is as follows:
root@rasberrypi:/sys/bus/w1/devices# ls
28-00000495db35 w1_bus_master1
28-00000495db35 is an external temperature sensor device, but it may vary with every client.
This is the serial number of your ds18b20.
Step 4Check the current temperature
cd 28-00000495db35
ls
The result is as follows:
root@rasberrypi:/sys/bus/w1/devices/28-00000495db35# ls
driver id name power subsystem uevent w1_slave
cat w1_slave
The result is as follows:
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
The second line t=26187 is current temperature value. If you want to convert it to degree
Celsius, you can divide by 1000, that is, the current temperature is 26187/1000=26.187 .
For C language users:
Step 2: Change directory and edit
cd /home/pi/SunFounder_SensorKit_for_RPi2/C/26_ds18b20/
nano ds18b20.c
Find the following line, replace "28-031467805fff" with your sensor address. Save and exit.
char* addr = "/sys/bus/w1/devices/28-031467805fff/w1_slave";
Step 6: Compile
gcc ds18b20.c