Selecting a Microchip

  • 1
  • 2
  • 3
  • Page 2 of 3
Avra
Schreiberling
Avatar
Gender:
Location: Belgrade, Serbia
Age: 54
Homepage: rs.linkedin.com/in…
Posts: 653
Registered: 07 / 2002
Subject:

Re: Selecting a Microchip

 · 
Posted: 31.10.2012 - 13:37  ·  #9
One affordable solution would seam to be a multiple RS485 network with AVR slave relay nodes being accessed by a PC application. You can have your own unique protocol, or use AvrCo existing MODBUS or SLIP slave protocol implementations. MODBUS RTU is faster then MODBUS ASCII but it is binary so making master pc application is a little harder (Delphi MODBUS libraries exist to help you on this one). Although MODBUS RTU slave would fit in any AVR MEGA with 16KB flash I would recommend some 32KB model to avoid surprises in case of future expansion. SLIP protocol is more modest on flash usage but someone else should be more competent to say more about it. Since we are talking RS485, USB support in AVR is totally irrelevant. AVRs with a single COM port are enough since with half duplex RS485 network, single master and each node having unique ID, only one node will reply at a time. On pc side all you need is one or more USB<>RS485 converters that add RS485 as a COM port to your computer. MOXA makes few models. RS485 supports up to total of 127 nodes (including repeaters) on a cable with up to 1200m in total length. After each 32 nodes you must put a repeater. After each 1200m you also must put a repeater. There can be a maximum of 9 repeaters. These rules force you to use 2 RS485 networks (if you are ready to live with a 2*127-NumberOfRepeaters node limitation) or even 3 RS485 networks if you want full capacity of 255 nodes as in your request. This is easy to achieve since you can use multi wire single cable that holds 2 (or 3) RS485 networks. So in a simpler 2 RS485 networks config you would have a PC with 2 USB<>RS485 convertors, and up to 124 AVR nodes with up to 3 repeaters on each RS485 channel, which means that a maximum of AVR nodes with 2 RS485 networks would be 2*124=248. AVR nodes would need a power supply, termination if they are last node in RS485 network, and a way to have a unique address ID (you can hard code it into each node, or use DIP switches for unique IDs). I would personally make 124 green relay boxes, 124 blue relay boxes, 3 green repeater boxes, 3 blue repeater boxes, 2 USB<>RS485 convertors, and 2 terminator endings. Each box would have 1 input and 1 output multi wire cable, with green boxes connecting to RS485 net number 1 (and just passing through wiring of net number 2), and blue boxes connecting to RS485 net number 2 (and just passing through wiring of net number 1). All AVR boxes would have the same MODBUS RTU firmware, with unique ID read from eeprom and printed on the box. That way users would just need to connect node boxes with appropriate cables, terminate last nodes, connect power, and follow simple rules when to put repeaters. PC application then calls one by one both RS485 network nodes in it's initialization, and enables their visualization and control.
rh
Administrator
Avatar
Gender:
Location: Germany
Age: 25
Homepage: e-lab.de
Posts: 5558
Registered: 03 / 2002
Subject:

Re: Selecting a Microchip

 · 
Posted: 31.10.2012 - 14:32  ·  #10
Hi,

because of the wiring length RS485 is a must. For a embedded newbie the SLIP protocol should be preferred. The decision for the controller should tend to use an XMega32A3U because the price sensivity of this project.
Mega32 €4.50
XMega32A4U €2.96
prices from Digikey for 1pc

rolf
Avra
Schreiberling
Avatar
Gender:
Location: Belgrade, Serbia
Age: 54
Homepage: rs.linkedin.com/in…
Posts: 653
Registered: 07 / 2002
Subject:

Re: Selecting a Microchip

 · 
Posted: 31.10.2012 - 23:31  ·  #11
AvrCo MODBUS RTU doesn't work on XMEGA yet, so in that case XMEGA32A3U would still not be an option.
Merlin
Administrator
Avatar
Gender:
Age: 25
Posts: 1420
Registered: 03 / 2005
Subject:

Re: Selecting a Microchip

 · 
Posted: 01.11.2012 - 11:19  ·  #12
Because of the way you wish to number the devices you must have two serial ports - multidrop will not work. However physically RS485 driver chips are (in my experience) more resilient than either RS232 or RS422 chips. (RS485 is usually multidrop but of course you can have a multidrop of just 2). For an newbie RS422 or RS232 might be easier to implement because there is no control line, but RS422 can be implemented using two RS485 chips or a dual RS485 chip.

Also you need to consider the mechanical connection. Personally I would use CAT-5 connectors unless you intend to power the devices over the connectors, when distance and current draw would be factors. The cables are easy to source, relatively cheap and give you plenty of cores whichever approach you finally adopt.
Mr Crusty
 
Avatar
 
Subject:

Re: Selecting a Microchip

 · 
Posted: 01.11.2012 - 15:08  ·  #13
I would agree with Merlin. If you are to have a plug anywhere card and sort out the cards sequence along a cable without setting a physical sequence address on the card, then there has to be a mechanism to find the card ID as you travel up the cable.
You either isolate the comms cable to the next card until this card has logged on to the supervisory PC or you use two ports and do not send messages on until this card is logged on. The advantage with two ports is you get a repeater of types, built in to all cards
This is not new, it's the way most addressable fire alarms work.
Taking a leaf out of fire alarm electronics technology you could use the power cable as the comms cable and modulate a DC supply cable with voltage and current pulses, voltage is usually the master and current is usually the slaves communication channel. However this may be a bit ambitious for our enquirer.
best
Crusty
Avra
Schreiberling
Avatar
Gender:
Location: Belgrade, Serbia
Age: 54
Homepage: rs.linkedin.com/in…
Posts: 653
Registered: 07 / 2002
Subject:

Re: Selecting a Microchip

 · 
Posted: 02.11.2012 - 10:19  ·  #14
Quote by Merlin
Also you need to consider the mechanical connection. Personally I would use CAT-5 connectors unless you intend to power the devices over the connectors, when distance and current draw would be factors. The cables are easy to source, relatively cheap and give you plenty of cores whichever approach you finally adopt.

Although shielded CAT5e sounds tempting, it is 100 ohms while RS485 should be 120 ohms (if I remember well). That should be OK for shorter distances (I have used it without problems in a 200m 5 nodes network), but I would not recommend it in a 1000+ m network with so many slaves, and specially not if that will be an end product that will be offered for sale and not used internally. Of course, twisted pair should be used for the signal and not some random pair of wires in the cable.

Usefull info:
www.modbus-ida.org
Modbus_over_serial_line_V1.pdf
ModbusApplicationProtocol_v1_1.pdf
Merlin
Administrator
Avatar
Gender:
Age: 25
Posts: 1420
Registered: 03 / 2005
Subject:

Re: Selecting a Microchip

 · 
Posted: 02.11.2012 - 10:30  ·  #15
Hi Avra.

The max distance specified was 50m. I am only talking of peer to peer, not multidrop - (so not many slaves!). Under these circumstances I think CAT-5e will be fine. The only problem I see is if power is to be sent over the cable. If it is locally powered (e.g. batteries) or if power consumption is very low, I see no problems at all. Customers like it (because it is easy to plug in or out and easy to get spares).
Jeosist
 
Avatar
 
Subject:

Re: Selecting a Microchip

 · 
Posted: 02.11.2012 - 23:11  ·  #16
Hello to Everybody

There very nice ideas given me so far. Thanks for all firstly.

In my project we will connect to relay cards on fixed lenght cable instead of connecting them each and every one to make less connection problems. Fixed cable will hold 12 relay cards on it and only fixed cables wil have connections sockets that it might be cat5 connection or similar. Client will order fixed relay cable instead of each relay cards. Distance between relay cards on fixed cable will be choised by client at manufacturing phase and max available distance will be 50 meters. Mostly preferable distances are usualy 10 meters. Above 10 meters usualy for special use. let say distances has been choised 20 meters and client wanted 5 sets of fixed cables what each fixed cable has 12 relay cards. So.. Total 60 cards with total 1200 meters distance. But cards are 20 meters away then each others. So I have been recomended to use rs485 repeiter or something similar on each card that signal will be recharged when it passes the cards. Power will send to end of the line such as 35 or 50 DC volt but each card will use 5 volt power only. So power line and data line will be together in fixed cables. I am not so sure this idea works or not but I am willing to test this very soon but I just want to be sure on design phase.
My best regards to everyone who cares so far.
Eddie
  • 1
  • 2
  • 3
  • Page 2 of 3
Selected quotes for multi-quoting:   0

Registered users in this topic

Currently no registered users in this section

The statistic shows who was online during the last 5 minutes. Updated every 90 seconds.
MySQL Queries: 8 · Cache Hits: 14   126   140 · Page-Gen-Time: 0.018128s · Memory Usage: 2 MB · GZIP: on · Viewport: SMXL-HiDPI