If you want to test to make sure the device works, run the following commands:
sudo modprobe w1-gpio sudo modprobe w1-therm
This will setup GPIO pin 4 for data transfer, and setup a thermometer there so make sure it’s connected like it is in the block diagrams.
Then go into the folder housing these devices:
cd /sys/bus/w1/devices/
Now, use the ls
command to list devices connected to 1-wire. You should see something like this:
00-100000000000 28-04165af9d3ff w1_bus_master1
This shows there is an active device. If you only see 0’s for devices, like this:
00-600000000000 00-a00000000000 00-e00000000000 w1_bus_master1
The Pi cannot see your 1-wire device, check your wiring and try again!
Now go into the directory of your device, it may be unique from the one in the example.
cd 28-04165af9d3ff
Once in this directory, you can run cat w1_slave
. The sensor writes to w1_slave file, and so this command will display it, you should see some output similar to this:
d2 01 4b 46 7f ff 0c 10 fc : crc=fc YES d2 01 4b 46 7f ff 0c 10 fc t=29125