# DS1820 digital thermometer with BeagleBone Black


After I locked up the ARM cluster in a rack cabinet, I noticed a loud noise coming from the central PSU. The recent summer heats took its toll, so it wasn’t a surprise to see the devices melting inside the rack. Unfortunately, the cooling system was limited only to a few fans mounted to boards heatsinks, but nothing that would improve the internal airflow. To fix that, I installed a few large fans at the top of the rack, and obviously, that worked but not without side effects. Now, the construction sounds like a beehive, even in the night when the temperature is much lower.

In the end, I used the sensors data (4 sensors in distinct locations) to control the fan speed automatically, but here I’ll only describe how to gather temperature with multiple DS18B20 digital thermometers connected to the BeagleBone Black ARM board.

HCI Data Source: markdown, Import: https://raw.githubusercontent.com/mkaczanowski/ds1820/master/README.md, Section:

Build Status


The project describes how to build a leightweight C HTTP server (based on libmicrohttpd) that:

In addition to the above, I described the process of wiring and system setup with BeagleBone Black board.


The ARM board communicates with the sensors via 1-wire serial protocol that supports multiple devices on one data line. To enable the driver, we'll have to instruct the kernel about physical wiring, so you should make sure the correct GPIO pin is present in the DTS (device tree source) file.

The figure below presents example setup specifically for BeagleBone Black board (P9.22 GPIO pin, 4.7 kOhm resistor), but it should also work for other prototype boards (ie. Arduino):

System setup

Not so recently, kernel overlays have been deprecated, so anything that depends on "bone_capemgr" won't work. Instead, we must configure/load the device tree overlays at the boot time with U-Boot.

At first we need to compile the DTS file:

$ git clone https://github.com/mkaczanowski/ds1820
$ dtc -O dtb -o dts/BB-W1-00A0.dtbo -b 0 -@ BB-W1-00A0.dts 
$ cp BB-W1-00A0.dtbo /lib/firmware/

Now, the dtbo file needs to be loaded via U-Boot:

$ echo "enable_uboot_overlays=1" >> /boot/uEnv.txt
$ echo "uboot_overlay_addr4=/lib/firmware/BB-W1-00A0.dtbo" >> /boot/uEnv.txt

If all goes right, after the reboot you should see sensors exposed via sysfs:

$ ls /sys/bus/w1/devices/
28-0000035f5e27  28-000004b58c5d  w1_bus_master1

Note that the U-Boot configuration is tightly coupled with the BeagleBone Black official Debian image and likely won't be the same on other systems.


It's a standard CMake project, so everything should build smoothly. However dependencies such as libmicrohttpd or sqlite3 must be installed manually (via apt).

$ git clone https://github.com/mkaczanowski/ds1820
$ cd ds1820

$ mkdir build && cd build
$ cmake ../ && make

The server is configured via JSON config, where you have to update sensors sysfs paths:

  "host": "",
  "port": 8888,
  "db_path": "test.db",
  "db_update_rate_secs": 10,
  "email_send_rate_secs": 600,
  "email_recipient": "[email protected]",
  "temperature_scale": 0,
  "sensors_range": {
        "min": -5,
        "max": 17
  "sensors": [

Spawn up the server:

$ ./temperature-server ../config.json

Web interface