Multiple AVR Micro Communications , Need comments

Hi,

I want to set up 3 AVR micros, one master and two slaves. One of the slaves is 750 feet from the master and the second slave is 300 feet away from the master in the opposite direction. The two slaves will provide sensor input to the master which will then tell the slaves to turn motor relays and valves on and off. This is an irrigation supply (slave-1) and holding pond (slave-2) and the master (in between). I am looking for something simple, low cost and reliable. I have worked with microcontrollers for a while but have not done anything with communications between micros. This doesn't have to be hi speed since most of the information will be in bits. I am looking for comments and/or suggestions.

Thank you, Andy in Yakima

Reply to
Andy Laberge
Loading thread data ...

RS-422 / RS-485 serial should work for that speed/distance. With a master/slave config, they can all be on the same serial "bus" without collision problems (avoidance isn't hard). If you can get a PPP stack to run over it, it'd be nice for development and future flexibility, but even a simple MODIS protocol can be changed to MODIS over TCP/IP later on.

--
Ron Sharp.
Reply to
Android Cat

"Andy Laberge" skrev i meddelandet news: snipped-for-privacy@4ax.com...

slaves

input to

valves on

and

with

communications

Looks like an excellent application for ISM band RF. YOu may want to check out the Atmel AT86RF211 and similar devices

formatting link

Ulf Samuelsson Atmel

Reply to
Ulf Samuelsson

RS-422/485 is a good alternative for this kind of system.

However, with the devices apparently in the field (not within the same building), you might experience ground potential differences between the sites (due to voltage drops in the neutral mains wire) which might exceed the common mode voltage range (often -7 to +12 V) of the RS-485 transceiver chips. Thus, you might have to use optoisolated transceivers.

With RS-485, remember to turn off the transmitter when the last bit has actually been sent, _not_ when the last character is loaded into the UART.

With low speeds (9600bit/s and below) you might also consider the 20 mA current loop, which is easy to opto-isolate with two optoisolators at each station. You need a floating 20 mA constant current source (powered from at least 24 V) and the receiver (the LED in the receiver optoisolator) and the transmitter (the photo transistor in the transmit optoisolator) are connected in series and all stations are connected in series into the loop. Thus you need a single pair to each slave. The receiving program should ignore the characters transmitted by the same station.

Wires stretching out in opposite direction form a quite effective antenna, thus, any lightnings might induce quite large currents into the wire, so it is a good idea to keep the cable optoisolated from the rest of the system, even if the ground potential differences in a normal situation would not require it.

Paul

Reply to
Paul Keinanen

I agree. Look up the SN75176 or MAX487 - nice RS485 driver/receivers that are easy to use. Either of these can interface to your onboard UART, use another pin to control the tx enable / rx enable lines of the driver/reciever. Thus, the only difference to your software from using RS232 is that you only need to enable the transmitter when you are getting ready to send data, and then disable the transmitter when you are done.

Cheers,

-Brian

--
Brian Dean, bsd@bdmicro.com
BDMICRO - Maker of the MAVRIC ATmega128 Dev Board
http://www.bdmicro.com/
Reply to
Brian Dean

Optoisolation is always a good idea in the Real World.

Depending on the serial 'chip', that can be tricky. As I recall, some will show/interrupt buffer empty while the last byte is still being shifted out--It's a good idea to read the specs. There's usually a seperate status flag that the shifter is empty too, but don't check it until the last character. Hmm, and allow time for the transmitter to turn on/off, but that might have been the serial chip used.

Of course, if there's a break anywhere in the loop, everything is out of touch. However it does make detecting communications failure easy. (The sound of an open-loop ASR-33 TTY is such a classic!)

If it is a factory environment, occasional arc-welders and spikes from heavy equipment. Video arcades were nasty power environments back when. I think of optoisolation as a fire-wall for real fire. (And the sound of every chip suddenly cratering and letting out the magic smoke often offends. :^)

--
Ron Sharp.
; Output character direct to port, switch on 485 drivers.
; Leave drivers on if sending multiple bytes of data, because
; the 8250 handshakes like a dead fish.
Reply to
Android Cat

If only they weren't so damn expensive... *wistful sigh*

Reply to
Lewin A.R.W. Edwards

"Lewin A.R.W. Edwards" skrev i meddelandet news: snipped-for-privacy@posting.google.com...

What expensive, naah, I get them for free..., but You already knew that Lewin :-)

Seriously, How much does it cost to draw that cable? I digged down 300 meter cables during the summer for a nice Electrolux Automower. Now I am happily watching it mow the lawn, but at that time, I can assure you that I gladly would have payed $100 to avoid digging for the cables...

--
Best Regards,
Ulf Samuelsson   ulf@a-t-m-e-l.com
This is a personal view which may or may not be
share by my Employer Atmel Nordic AB
Reply to
Ulf Samuelsson

:)

Actually I was thinking about them for *my* project, which requires wireless.

It's good practice for the ditch-digging jobs we'll all have in ten years, when the only OSes and applications that are legally saleable require cryptographic DRM hardware and all the development work is done in China and India.

Reply to
Lewin A.R.W. Edwards

Thank you all for the response! I think I will start with RS485. This is irrigation country so we are use to digging ditches, although I am from the school that digs shallow ditches. I'll stick my twisted pair cable in PVC pipe just below the surface.

I've thought of using many ideas; RS485, RF, opto using long range LEDs, and even DTMF tones.

I have a portable phone( NOT cellular) that I use on this property. The base is at the master site and it looses reception at the canal site so if I used RF I would need to install an outside antenna at the master site.

The long range LEDs and DTMF tones would need line of site unless I could incorporate them in the cable and RS485 seems the simplest over the cable.

I have down loaded National's application note Ten Ways to Bullet Proof RS485. I've also down loaded Atmel's UART code, and avrfreaks has note on RS485 timing issues. Is there another application note or web site that I should take a look at?

Thanks, Andy in Yakima

Reply to
Andy Laberge

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.