Lightweight newtorking multiple AVR's (2+)

I'm designing a simple proof of concept setup for a "just to see if I can do it" scenario. It likely will evolve into a pseudo-home automation project, geared less toward the management of on/off cycles for powered devices and more toward the monitoring of windows and doors being open/closed. Simple enough to do on one AVR, but my home's design prohibits running additional cable to each portal so I think I'll have to do this with a cluster of smaller AVR's and the copper I have in the walls now.

The idea in my mind would be to have a core ethernet-enabled AVR with an AJAX page to update and display input states, but I don't know the best way to get the remote AVR's to report back to the core AVR. I2C looks like the ticket but has limited distance, and the PCA9600 calculations for the pullup resistors seems unnecessarily ambiguous to say the least. XBee and RS-485 seem viable but I have no experience with either, and frankly don't feel like rolling the dice on either one without some feedback.

A lot of other threads seem to die without resolution. Max run between the furthest remote AVR and the core would be ~300' (as the cable runs).

Any guidance is appreciated.

At 300' I would suggest that RS-485 is the most viable. XBEE will handle that as well but would get a bit expensive I would think.


Rob

I suggest you look at 1-wire network solutions which are designed exactly for this and are inexpensive.

dotJason:
Simple enough to do on one AVR, but my home's design prohibits running additional cable to each portal so I think I'll have to do this with a cluster of smaller AVR's and the copper I have in the walls now.

What copper? How much cable do you have now?

Yea, who didn't see this coming :slight_smile:
The existing four-pair CAT3. Unfortunately, the run was looped throughout the house rather than home run to each plate, so the best I can do is four pairs (8C, and I don't have a landline). So, using the wh/bl pair at the core, wh/or to AVR2 and so on... there are 22 windows and seven exterior doors (including garage) so you can see my dilemma a little better.

Like I mentioned, this is a proof of concept, and I only mention the full scope because with the right configuration, in some capacity this likely will become production. And then there's scope-creep... my nemesis in both professional and personal aspects.

The crap part is I'm a telecom guy and just straight up refuse to rewire my own home! -1 for me I suppose :frowning:

Doesn't sound too bad to me. With RS485 you could have both a send and receive pair which simplifies the protocol a bit. And maybe supply power.

This particular system was posted on this forum in another thread:

http://www.kranenborg.org/ee/picaxe/twowirenetwork.htm

...meant for the picaxe, but there's more than enough info, code, schematics, etc available to implement it on other platforms.

From what I could gather, it should work well for your application (provided you don't need extreme speeds).

He was developing a better version of that but it seems to have died, no info for a long time now.


Rob

Thank you for the link, Nick. Excellent write-up. I assume the code is extensible when substituting MAX485 IC's but perhaps different pinouts, haven't looked. I'm still awaiting the additional AVR's and requisite shields and can't wait to get going on this.

RS485 is probably the "easiest", but the cost of RS485 helper chips may become excessive for 29 windows and doors.

I would lean towards the Dallas Semiconductor OneWire -- already has a library and the hardware is simple. I would not mess with parasite power since you have plenty of conductors. I'd use three parallel conductors for +5VDC, three paralleled for ground, and the final two paralleled for the data signal. As noted in the DS 1Wire docs you may need to play with the pullup resistor value and use other tricks to clean up the signal over long/less-than-ideal conductors. Only thing about the DS1Wire is the really long 64-bit identifiers slows things down a bit. If you don't have any actual DS1Wire devices connected directly to your bus (just AVRs), you might hack the library to shorten that to 8-bit identifiers (thus limiting you to 256 nodes).

Regardless of whether you choose RS485 or 1Wire -- if all your remote nodes are ATTiny AVRs running at low clock speeds, I think you could probably power all 29 of them through the Cat3. At least, I don't think the wires would catch fire from the heat (one 26ga theoretically carries 361mA, and you've got three). Voltage drop could be an issue, but at 4MHz or less the ATTinies should operate down to 1.8V. Running them at 1MHz, putting them to sleep between sensor samples, and putting a reasonably sized cap at each one would probably do the trick (wild guess here).

EDIT: This calculator Voltage Drop Calculator says you could push 5VDC over three parallel 26ga wires for 300 feet and get 1.82V out the other end with a 390mA draw. Of course you shouldn't go anywhere near 390mA but this does look within the realm of possibility.

Tyler, I'll look again at 1wire feasibility, but I should mention it isn't my intention to have each portal monitored by a dedicated AVR, just strategically placing a few around the home and running the nearest (easiest to wire) portal to an AVR. You could think of it as regional placement, like one in the garage monitoring seven portals, one managing two adjacent bedrooms and an office, another in the kitchen monitoring this and the dining room. You get the idea.

It might not invalidate the 1wire strategy but I just wanted to clarify. Thanks for the post.

Makes sense. Even a 1MHz ATTiny will be bored with only one sensor to watch. :slight_smile:

dotJason:
Thank you for the link, Nick. Excellent write-up. I assume the code is extensible when substituting MAX485 IC's but perhaps different pinouts, haven't looked. I'm still awaiting the additional AVR's and requisite shields and can't wait to get going on this.

The code itself doesn't care about the hardware. You could use it with I2C or serial.

You may get away with serial without the RS485 chips. I've got a RFID system for my front door that has a few meters cable run, plain serial (not RS485) that works fine. You could always slow down the baud rate.

So I've ordered some samples of MAX485's and DS18B20+PAR's from Maxim... I'm sure they won't be here too soon, so I also ordered a lot of five "DS18B20" sensors from eBay... hope they'll not be knock-offs, but if they are maybe they'll be decent enough for breadboarding.

On paper the 1-wire solution seems like it will work. I've gone around and made certain the wh/bl pair in my inside wire is commoned, just in case there were any hacks before I inherited this place, so I know for certain I have a single bus on one pair throughout the house.

This leads me to the next question. Assuming I go 1-wire, it's pretty straight-forward to collect temperatures, but I also want to monitor portals as well. On Maxim's website I don't see any 1-wire switches. I do see DS2406+ and DS2406P+ switches that seem to take input to invoke a switch, but I was looking for contact switching. Any easy solutions?

Thanks.

dotJason:
I also want to monitor portals as well. On Maxim's website I don't see any 1-wire switches. I do see DS2406+ and DS2406P+ switches that seem to take input to invoke a switch, but I was looking for contact switching. Any easy solutions?

Can you run new wires from each portal to the nearest AVR? If so, just use an I/O pin for each portal.