Not enough serial ports on Arduino Mega -- Options?

Click For Summary

Discussion Overview

The discussion revolves around the challenges of using an Arduino Mega to communicate with multiple slave Arduinos over a distance of 500 feet, specifically focusing on the limitations of available serial ports and the choice of communication protocols. Participants explore various options for wired communication, including RS232 and RS485, while considering the implications of distance and device complexity.

Discussion Character

  • Exploratory
  • Technical explanation
  • Debate/contested

Main Points Raised

  • One participant notes the limitation of the Arduino Mega having only 4 serial ports and seeks alternatives for additional serial communication with multiple slave devices.
  • Another suggests using a more dispersed topology, such as multiplexing commands among slaves or utilizing an RS-232 multiplexing switch.
  • A participant points out that RS232 is typically limited to 50 feet and recommends using RS485 or similar line drivers for reliable connections over longer distances.
  • Some participants advocate for RS485 as a simple and effective solution, highlighting its ability to connect multiple devices with fewer wires.
  • One contributor introduces the idea of using CAN bus as an alternative, mentioning available shields and the benefits of a multi-point bus system.
  • Concerns are raised about potential noise and voltage differences over long distances, emphasizing the need for proper precautions in the setup.
  • A historical perspective is shared regarding the challenges of using RS-485 in multi-master networks, particularly issues with ground faults and common mode voltages.
  • Another participant inquires about the possibility of using Ethernet connections, suggesting that CAT5 cable could be a cost-effective solution.
  • The original poster expresses a decision to stick with RS232 communication through network cables, prioritizing simplicity despite the potential for other solutions.

Areas of Agreement / Disagreement

Participants present multiple competing views on the best approach for the communication setup, with no consensus reached on a single solution. Some advocate for RS485, while others suggest sticking with RS232 or exploring CAN bus options.

Contextual Notes

Participants highlight limitations related to distance, device complexity, and the potential for electrical noise, but do not resolve these issues or provide definitive solutions.

Who May Find This Useful

This discussion may be of interest to individuals working on Arduino projects that require long-distance communication, those exploring different serial communication protocols, and anyone considering the implications of device topology in embedded systems.

taylaron
Gold Member
Messages
391
Reaction score
1
Greetings!
I'm working on a project involving multiple different Arduinos spaced about 500 feet apart. I have a master Arduino which I plan on being an Arduino Mega and 5-8 separate slave Arduinos (probably Arduino Nanos) which feed basic data like switch values to the master. I would like to use RS232 as my communication protocol, using 1 serial port on the master Arduino per slave. My problem is there are only 4 serial ports on the Arduino Mega. I was curious if anyone knows of a way to rig more digital I/O pins as serial outputs or if there is something I hadn't considered.

note: I'm fixed on using wired communication, and my speed doesn't need to be very high- 9000 baud is plenty.

I had considered using RS485, but I'm trying to minimize device size and hardware as well as keeping the system simple.

Kind regards
 
Engineering news on Phys.org
Have you considered a more dispersed topology? Perhaps you can use four of the slaves to multiplex commands to the others? If not, how about extra multiplexing slaves colocated with the master? Or you could buy or make an RS-232 multiplexing switch.

This is a problem that's been solved many times. I'm sure an internet search will yield lots of options.
 
Your main problem will be that RS232 is only spec'd to 50ft, sure it can be longer (at slower speeds) and faster (at short distances) but it's designed with high impedance drivers of greater than 3k Ohms. To drive 100+ foot cables you should use a RS4XX (multi-drop) interface or a similar Line Driver if you want to stay pure serial data and still have reliable connections.

http://www.rs485.com/rs485spec.html
8 port repeater hub RS232 to RS485
http://www.rs485.com/pmhubx8.html
 
Last edited:
Lookk into CAN bus - there are some shields, and other low cost options - it is a multi-point bus, and runs with a master, so you should not need to use up the ports. I would first consider the full function shield for the master and the low cost ports for the slaves.
As for the 500ft -- where - that will become a large antenna - likely to pick up noise and if any lightning events - can fry what it is connected to without the proper precautions, as well and pay attention to the power source for each, surprising voltage differences can occur over 500ft.
 
Way back in the day I created an RS-485 multi-master network with a "random delay backoff" as workaround for collisions. A slow cheap ethernet back when ethernet was new.

But over long distances the common mode voltages and ground faults made it unreliable. Even within one room, there can be significant ground spiking. Especially if there are large motors, elevators, etc in the building.

That's why ethernet uses transformers. But, you need to use a coding method like Manchester, 8b10b or longer (like 64b66b), etc to send "AC" data through the transformer.

canbus has +-12V common mode, and requires you only ground at 1 point or use digital isolators. The http://www.ti.com/lit/ds/slls629k/slls629k.pdf looks like a REALLY cool part to get around AC coding. But, I've never worked with it and don't know what its real issues are. Anybody?
 
Last edited by a moderator:
Does the Arduino have an ethernet connection? CAT5 cable is cheap, and cable costs sound like an issue.
 
Thanks for the input everyone! I decided to stick with dedicated RS232 communication through network cables for each of my devices. I'm sure I could've done something with RS485, but I wanted to keep the system simple. I was going to use an arduino Mega anyway, so there posed no problems with available ports.

I appreciate your input!
 

Similar threads

Replies
5
Views
2K
  • · Replies 5 ·
Replies
5
Views
21K
  • · Replies 5 ·
Replies
5
Views
6K
  • · Replies 1 ·
Replies
1
Views
7K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 2 ·
Replies
2
Views
15K
  • · Replies 6 ·
Replies
6
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 5 ·
Replies
5
Views
2K