I have a project in which several Arduinos will be running independent programs. I would like to use an Arduino Mega as the main controller. It will receive input from a variety of switches, as well as data input from 2 Arduino Unos and 3 Arduino Nanos.
Each Nano will run a basic collection of switches and LED displays.
Each Arduino Uno will be connected to a 2 axis joystick and will have several button inputs from the joystick, as well as several 7 segment Led displays and several LED indicator displays.
The Mega would need to gather information of at least 16 bytes from each slave at highest possible speed, and be able to transfer at least 16 bytes to each slave at the same rate. I would also need the clock signal for all devices to default to the Mega.
What would be the best way to begin setting up the program logic to get these boards to interact in a smooth manner without a lot of lag in communication between boards?
Also, what would be the limitations on speed with this sort of com setup between the boards?
If more setup or function information is needed I can add description, just didn't want this post to be overly lengthy.
1 Answer 1
Why do you need so many Arduinos, Nanos and a Mega? You want to read/control 2 joysticks, some switches and some LED. If you do this using a multi-processor environment then you are adding a significant overhead to the processing and the development time which you can probably do without.
So, could you connect everything to a Mega, do you have enough IO pins? If not would the use of GPIO expander ICs, I2C devices, etc help solve this issue.
Connecting the joysticks via interrupts will allow a more responsive system, can you do this?
Is an Arduino even the best platform for this? What about an ESP32 or PI?
You want to minimise the comms overhead, so a star network would be better than a ring.
Serial is going to be the lowest programming overhead solution, but by far the slowest. Using WIFI via an ESP8266 is going to be the simpelist and you can hand off some of the processing to the ESP.
-
I will have to answer your questions in multiple comments due to character limit.B. Guisgand– B. Guisgand2018年04月07日 03:24:38 +00:00Commented Apr 7, 2018 at 3:24
-
1) The different Arduinos are used because each micro-controller will be running a separate panel of the project and have it's own program running. (Nano 1 for instance only deals with the ships Power systems. It accepts input data from the Mega when other ship systems are activated. It runs 3-12 segment bar-graphs, 7 indicator LED's, and 6 toggle switches. The processor only needs to calculate current system power usage and emergency states, so not a heavy processing load.)B. Guisgand– B. Guisgand2018年04月07日 03:31:12 +00:00Commented Apr 7, 2018 at 3:31
-
Arduino Unos along with a USB shield are used to control each joystick individually and change the "position" of the ship, which is displayed via 3 separate 7 segment displays. Additionally the Uno's program will deal with weapons fire, in particular counting how many missiles were fired, and display that number on a second 7 segment display. (this is a pilot and co-pilot setup, co pilot takes control of ship positioning during docking procedures) Also the toggle switches and indicator lights for thrust and weapons are each dedicated to the Uno's.B. Guisgand– B. Guisgand2018年04月07日 03:35:14 +00:00Commented Apr 7, 2018 at 3:35
-
so as far as the number of Arduino's, I think I've minimized it well enough. I don't want the program complexity and length to overwork any individual processor, or overflow the memory capacity.B. Guisgand– B. Guisgand2018年04月07日 03:36:59 +00:00Commented Apr 7, 2018 at 3:36
-
2) Simply making all the different components and systems connect via expansions to a single mass processor doesn't seem to be the solution, but perhaps I'm wrong, might need more clarification on how that could work.B. Guisgand– B. Guisgand2018年04月07日 03:38:50 +00:00Commented Apr 7, 2018 at 3:38
Explore related questions
See similar questions with these tags.
running independent programs
.... your description says otherwise