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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s