OpenBSD onewire
Introduction
I recently ran into a situation that called for some environmental monitoring
of some random things on my home property, and had long thought about playing
with Dallas Semiconductor "onewire" devices to do this: specifically monitoring
temperature.
Software Implementation
Conveniently, my home router (a Soekris net4801 runs OpenBSD 4.6,
which supports some of these devices wonderfully, and in a very convenient manner.
I opted to use a USB adapter (DS9490R) with some DS18S20 sensors.
The USB adapter attaches happily as uow(4) and automatically scans the
attached onewire(4) bus for devices.
These choices made this project very simple..
I also wrote a few custom scripts using the Bourne shell and Ruby to do things
with the data that the sysctl(8) interface provides me: I mainly graph the data
using rrdtool for trending and analysis.
Hardware Implementation
I used standard cat5e cable, which I already had plenty of around my house
(I'm a net admin, what can I say..) and RJ45 ends and mod jacks/wall boxes
due to their simplicity and convenience.
The cabling is simple, but involves some soldering to the sensors themselves.
There are 3 pins on a sensor: GND, DQ, and VDD: in my case, I actively use only
2 of them: GND, DQ. VDD is simply jumpered to GND because I'm using them in
"parasitic power mode", which means they draw power from the bus and store it
locally for later use. I used the blue and white-blue pair out of the cat5e,
and consistantly wired the white-blue to GND and blue to DQ as a convention.
I wired all of my sensors in a daisy-chain fashion because it works well for
this project and the layout of my onewire network.
Code
I'll later make my code available for download, but I don't have time right now.
Graphs
Some of my example graphs can currently be found here.
No guarantees that they'll stay available at this point.