Read temperature from 1-wire in Beaglebone Black [BBB] / Raspberry Pi

debian@beaglebone:/$ cd /sys/bus/w1/devices
debian@beaglebone:/sys/bus/w1/devices$ ls
10-00080216a25a  10-00080216c818  28-031644d030ff  28-03164757c8ff  28-041651ca4dff  w1_bus_master1
debian@beaglebone:/sys/bus/w1/devices$ cat 10-00080216a25a/w1_slave
2d 00 4c 47 ff ff 02 10 51 : crc=51 YES
2d 00 4c 47 ff ff 02 10 51 t=22625
debian@beaglebone:/sys/bus/w1/devices$

cd to the folder /sys/bus/w1/devices
list files using ls
if any 1-wire sensors are connected it will appear here as below.
10-00080216a25a 10-00080216c818  28-031644d030ff  28-03164757c8ff  28-041651ca4dff 
Above are connected 1-wire temperature sensors.
DS18S20 [Starts with id 10-xxxx] and DS18B20  [Starts with id 28-xxxx] sensors
To read temperature read the file w1_slave of any sensor using command ‘cat’

Temperature is read as 22.625 ºC

2 thoughts on “Read temperature from 1-wire in Beaglebone Black [BBB] / Raspberry Pi”

  1. Hello, can you tell me with Debian version are you using? I tried 8.9 but mine has not /sys/bus/w1 directory.

    I am running BBB,

    Thanks!

    Like

Leave a comment