Aaron
Articles
Code
Darwin
Photos
Links
Resources
Resume
Software

1-Wire on OpenBSD

OpenBSD 4.1 has basic 1-Wire support including support for the Maxim/Dallas DS2490 USB 1-Wire master (uow).

For OpenBSD 4.1, Grange@ commited my patch (thanks!) for a new driver owsbm which adds support for the DS2438 (1-Wire Smart Battery monitor). The driver supports the basic A/D functions for getting the three voltages (VDD, VAD, and CR) and the temperature.

demeter:~ linville$ sysctl hw.sensors
hw.sensors.owtemp0.temp0=22.75 degC
hw.sensors.owsbm0.temp0=22.34 degC (Temp)
hw.sensors.owsbm0.volt0=4.82 VDC (VDD)
hw.sensors.owsbm0.volt1=1.59 VDC (VAD)
hw.sensors.owsbm0.volt2=0.00 VDC (CR)
hw.sensors.owid0.raw0=2541210 (ID)
demeter:~ linville$

I've written a couple small daemons to dump the temperature values into a database. The DS2438 is wired up to an HIH-3605 humidity sensor. VDD is the power supply voltage. VAD is the output from the HIH-3605 and is proportional to the power supply voltage. Here is a paper describing the use of a DS2438 and HIH-3605 to measure humidity. CR is the voltage across two pins and is used to calculate the current (in the case of the circuit I have, it's used to measure solar radiation). If you're interested in this setup, it is a Hobby-Board HTS3-R1-A (Humidity/Temp/Solar). It has been working quite well for me.

A quick PHP script later and we have a really nice graph of the temperature. You'll need an SVG capable browser to view it like Firefox, Opera or Safari. I'll put all the sources up once I remove the hardcoded badness. :-)

Both sensors (owtemp and owsbm) are on the same board and are currently placed right above a vent in my apartment. The spikes in temperature are when the heat pump turns on.

Example Code

These programs are basic examples of how to use forks, threads, signals, and semaphores. They should compile fine in most POSIX environments.

Instructions

Utilities


0.028 secs Copyright © 2010 Aaron Linville