2.3.2014

foto Petr Bravenec

Petr Bravenec
Twitter: @BravenecPetr
+420 777 566 384
petr.bravenec@hobrasoft.cz

Some time ago, before the world begin to play with Raspberry PI, I started to play with BeagleBone. BeagleBone is small ARM computer similar to Raspberry PI. The main difference I see is in expansion possibilities. In company we built a small system for data collection: FotobotHW. Because we have some Beaglebones left, I started to play a little with it.

I found some DS1820 thermometers. The DS1820 is 1-wire digital thermometer. Driver is contained within Linux kernel so it should not be a problem to connect the thermometer to Beaglebone. Although it's easy, it took me quite a long time. The most difficult part of job was to get the necessary information. So how to do it:

Driver for DS1820 is part of Linux Kernel. I do not use original kernel bundled with Beaglebone (there was no IPv6 support). I compile my own kernel. You can download it here: http://hobrasoft.cz/cs/fotobothw/linux-3.2.34.tar.bz2). Searching in kernel sources I found the appropriate outlets. Also I found that the information is written to console at boot time:

dmesg | grep w1
[    0.463470] BeagleBone cape: initializing w1-gpio
[    0.463592] w1-gpio connected to P8_6

To understand the abbreviation P8_6 we need Beaglebone manual. It is the No. 6 pin on connector P8. The data wire of the bus should be connected here.

To connect thermometer we need ideally three wires - ground, data and power. Ground can be found on P8_1 and P8_2, power on P9_3.

Now the thermometer should be seen by Linux kernel. We can check it in directory /sys/bus/w1/devices:

ls /sys/bus/w1/devices/
28-0000027d912e  28-00000294d39a  w1_bus_master1

Super! Kernel found two thermometers connected to the bus. So what's the temperature?

cat /sys/bus/w1/devices/28-0000027d912e/w1_slave
6f 01 4b 46 7f ff 01 10 67 : crc=67 YES
6f 01 4b 46 7f ff 01 10 67 t=22937

Temperature is listed in parameter t. Decimal point is not shown. The value 22937 corresponds to temperature of 22,937 degrees Celsius.

Now it is very easy to show my office temperature:

http://beagle.bravenec.eu/

Web page is static. It is generated every 15 seconds. Images, CSS and all other is taken from other place.

Hobrasoft s.r.o. | Contact