Friday, 23 August 2013

BeagleBone Weather Cape Drivers Merged into Mainline Minix

I received a BeagleBone Weather Cape earlier this week. A cape is an expansion board for the BeagleBone and BeagleBone Black. The weather cape provides sensors for temperature, ambient light, humidity, and pressure. Combined with a BeagleBone, it allows anyone to create an Internet connected weather station.

I've been working hard on drivers to support the devices on the cape in Minix. I developed drivers for the SHT21, BMP085, and TSL2550. The other active device on the board, a CAT24C256 EEPROM, was already supported from my prior work. I also updated Minix's eepromread utility. It works sort of like Linux's i2cdump, but it is also aware of a few EEPROM formats. It has a mode where it can parse and display data fields as label:value pairs. Using the updated eepromread utility, I enhanced the rc script to detect attached capes and run cape specific start-up scripts at boot which load the proper drivers.


Here are the commits:
To sum it up, all of the devices on the Weather Cape are now supported in Minix. If the cape is attached, the drivers are automatically started at boot. To get the sensor values, you just read from the device files of each device. The format should be simple to parse; it's fixed width and also has a delimiter (':'). Here's an example usage:

# cat /dev/sht21b3s40
TEMPERATURE     : 29.126
HUMIDITY        : 45.818
# cat /dev/bmp085b3s77
TEMPERATURE     : 28.5
PRESSURE        : 100432
# cat /dev/tsl2550b3s39
ILLUMINANCE     : 830


Temperature is in Celsius (C), relative humidity is a percentage (%), pressure is in pascals (Pa), and ambient light is in lux (lx). There is a small difference in temperature between the two temperature sensors. I hypothesize the difference is due to some slight heating by the BeagleBone. I got the same results when I tried the board under Linux.

My next steps will be to get a demo application working and properly integrated. I'm hoping to modify the bonescript Weather Station demo (src) to work under Minix. I plan to make a small CGI application / script to expose the sensor values via JSON. Then, I will modify the web interface to make use of the data.

No comments:

Post a Comment