soft serial communication on Arduino Micro.

Hello all,

I have a few Arduino Micro units, and need to connect them together (in a mesh network) so that every unit in it is interchangeable, meaning that any unit may be in connection with more than one unit. As the Master/Slave form is out of question at this stage (because any given unit cannot be both Master and Slave at the same time, of course) I decided to go for a simple serial communication.

However the Arduino Micro units (and frankly none of the Arduinos) do not have sufficient serial pins and I was advised to use Soft Serial instead. I was looking into the pin out of the Arduino Micro but cannot quite figure out which pins I can use for the serial comm.; I need 4 to 6 serial communications. If not Micro, what other Arduino (or any other solution) would you suggest?

Each unit needs to have the following information ready at its serial ports:

  • its ID
  • its MAD
  • sensor value (analog or digital)

Any help is much appreciated, as the nature of the problem may not be changed. So I need to solve it as it is.
Karim.

Why not connect them up with RS485 buffers? Then all slaves can listen all the time for a message from the master, the slave being addressed can respond. Only need 1 serial port for each device, all devices are connected in parallel.
Can be half duplex (only one transmitter at a time, master to slave or slave to master, one pair of wires + GND) or full duplex (master and slave can both transmit at the same time, two pair of wires + GND).
Some examples:
http://www.digikey.com/product-search/en?FV=fff40027%2Cfff801a4%2C1140050%2C9080021&k=rs485&mnonly=0&newproducts=0&ColumnSort=1000011&page=1&stock=1&pbfree=0&rohs=0&quantity=&ptm=0&fid=0&pageSize=25

See Figure 8 & 9 for examples.

MAXIM AN763 Guidelines for RS485 wiring.pdf (247 KB)

karimskarim:
However the Arduino Micro units (and frankly none of the Arduinos) do not have sufficient serial pins and I was advised to use Soft Serial instead. I was looking into the pin out of the Arduino Micro but cannot quite figure out which pins I can use for the serial comm.; I need 4 to 6 serial communications. If not Micro, what other Arduino (or any other solution) would you suggest?

SoftwareSerial will not be an answer because it can only listen or talk and only on one instance at any one time.

What @CrossRoads suggests seems like a plan - but it does involve one of the devices acting as master.

If you describe the project you are trying to implement it will be easier to give useful advice.

...R

Any of the devices can be the master - all need to listen to see if they are being addressed. If no one is talking, any can start a conversation.
Can use a 3rd arbitration signal - if it's high, you pull it low & start talking. If it's low, you better be listening to see if someone is talking to you. Can have collisions still, but it helps to minimize them.
Or, just have a master that starts all conversations.

CrossRoads:
Can have collisions still, but it helps to minimize them.

I seem to remember an acronym CSMA-CD

...R

The units must be interchangeable. As a result a simple Master/Slave protocol cannot do the job. I am thinking I need to have multiple 1/2 duplex serial connections, to other units (lets go with 6 of them). That means I need to only use 6 (non-PWM) pins for RX/TX (and may be a clock signal), does it not? Can I use 1/2 duplex for software serial based on:

or should I only use full duplex?

The reason I am asking about non-PWM is based on what is given here:

http://www.pjrc.com/teensy/td_libs_AltSoftSerial.html

I very much appreciate your help.
Karim.

karimskarim:
The units must be interchangeable.

Tell us WHAT the project is (what it will be like for the end-user after it is complete) not HOW you think it might be implemented..

...R

There probably needs to be some master setup to prevent communication conflicts. Is this setup to be wired or wireless?