Monday, September 15, 2008

Vault-OS : Found an I2C Solution To Long Lines Problem

The link above will show you an implementation of a freely available hub for I2C with free schematics and circuit board layout. The raw parts from Maxim or Digikey will cost you $10.00 or less but you'll need the patience to assemble the hub. This solution was innovated by a guy in the UK who put his circuit in the public domain. HobbyBoards makes a living selling the assembled version but the actual circuit only requires a handful of cheap Maxim ICs.

I just ordered one and I intend to make it my I2C mini-LAN solution for everything including controllers. Theoretically with power supply of 12 volts, this hub will support up to 127 devices if they are all close to the same capacitance levels. That's an awful lot of sensors and controllers, especially if you realize that controllers can interpret commands in an infinitely expandable fashion. For example, an I2C device could be a small microcontroller connected to a parallel port relay bank to control 8, 16, 32 switching lines. This sort of thing comes in handy in my fuel silo, where I may have 16 pumps that need to be individually switched to pump fuel out of a barrel and down the hill into Sparkgap for the genset. You could also use 16 ultrasound monitors or pressure sensors to detect how much fuel is remaining on each barrel. You can see how the number of required inputs adds up pretty quickly once you get ambitious.

My biggest reason for wanting the line to support this many devices is the seismic sensors and minicams I want to run on the line. I found out last week how to send frames from a CCD over I2C, it's a datablock send of the entire grayscale image. The ideal situation is when a seismic sensor is tripped, a CCD camera with IF illuminator sends a frame day or night at that moment when it is polled. This would allow you to instantly flash an alert on your situation map on top of an overlay of your property or shelter. I was thinking that most sensors will profit best from being optionally overlaid on a map of some kind, either of the shelter or the ground topside, so you can see where that reading is coming from. Knowing the temperature and humidity all over the shelter is excellent input for managing the air filtration system.

It is important to note that whether you use this device, another device or the simple serial adapter including the cheap DIY design here, the serial commands sent by Vault-OS will be the same. It won't matter what I2C device you have connected to the UART I/O RS-232 serial port.
This is the absolutely simplest, most generic and adaptable solution I could devise to make this software useful to anybody, including myself. I was originally using RS-485 for the Rabbit 2000 to get readings off sensors and it was just too complicated to implement easily elsewhere. I think the I2C will work with these hubs out to 120 meters of cable and sometimes more.

It's also important to point out that complete optical isolation of your RS-232 port is now available under $25.00, insuring that EMP cannot hurt your shelter electronics, at least not your main controller.

Now we just need to figure out how to convert the output from a CD-715 radiation detector through the headphones jack into an I2C signal, we'll be really set. I have a circuit doing something similar and may be able to cadge that design myself with a little help from the enthusiast group at Yahoo.


Anonymous said...

confident and paranoid said...

Could you expand on how the 6 port hub you link to mitigates the problems relating to long cable runs with I2C? I had a quick look at the site but couldn't find anything that explained this.

Texas Arcane said...

This circuit injects power for a carrier to both drive the device and contribute to contrast when it goes low for I2C/SPI comms. It also keeps the capacitance high to try to keep the voltage/current stable when the line goes low.(for a slave talking on the line or a master polling)

You can not only plug a bunch of RJ45 carrier lines into the 6 ports, you can daisy chain low power devices to share the same line. So this hub could support the 127 device maximum. The MAXIM ICs used were made for this purpose and this circuit was slightly modified from the original MAXIM design to accommodate that quantity.

This device can *even* supply the necessary current for writing EPROM 1-wire devices, which is extremely helpful for a lot of devices that may use caches/buffers for their data until they are polled.

Plenty of 1-wire sensors/ibuttons cam just be connected directly, no circuitry involved.