OpenBSD onewire

From WTFwiki
Revision as of 13:09, 27 September 2011 by Jontow (talk | contribs) (→‎Parts List (examples): add rj11-rj45 adapter/coupler)
Jump to navigation Jump to search

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.

Parts List (examples)

Required

  • DS9490R-A USB 1wire Adapter - 1 of these per installation
  • DS18S20 Temp Sensor - N of these
  • As many feet of cat5e, cat3, thermostat wire, or any suitable 2-3 contact copper media (I use cat5e)
  • RJ45 to RJ11 adapter - 1 of these: I make my own, but have access to an awful lot of telecommunications equipment due to the nature of my profession.. If you don't make your own, you'll also need an RJ45 inline coupler. I just make a short whip that uses an RJ11 male jack on one end and an RJ45 modular (female) jack on the other, getting rid of a few physical connections. You'll already have some of the mods handy if you go the route in the optional section.

Optional

To make the installation pretty, and easier to maintain, I also use the following, at significant additional cost:

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.