Calculating number of boards for a project

Hi everyone,

I need some guidance for my project, I am building an A320 home cockpit simulator. About my programming skills, intermediate level. Some years ago, I worked with opencockpits IO Cards, building a 737 sim, but not with Arduino yet.

The reason for this post is to approach to the numbers/types of boards that I'll need for this project, and have an idea about the budget. I read about Mega 2560 + Multiplexers, the idea is to minimize the numbers of boards as much as I can. I'll list numbers of switches, LEDs, encoders, and displays I am planning to use:

270 LEDs
14 Rotary switches (60 inputs)
220 Pushbuttons
7 MAX7219 *8 digits
9 MAX7219 *4 digits
15 On-off-on
10 On-off
15 Encoders
10 Pots 10k

Thanks in advance

This all looks very familiar

Pompeii:
I read about Mega 2560 + Multiplexers, the idea is to minimize the numbers of boards as much as I can.

I reckon it might take significantly less time to develop this with multiple Megas rather than with one Mega and several multiplexers. Mega clones are not very expensive.

...R

I'm building a home cockpit at the moment. I'll offer my thoughts.

Your plan to limit the number of boards as much as possible sounds reasonable, but consider this. A Mega can be had for $15 online, which is not a lot. You will also need to calculate the cost and number of IO expanders as well. Also, a cockpit is relatively large, so do you want to run, say, 50 individual wires to a central board that is one meter away, or have local "hubs" that everything connects to, which is then connected on some form of network with fewer wires. Technically, everything you mentioned can be accomplished with one Mega and enough IO expanders, but it might not be the easiest or most efficient way.

My plan is to have one Mega as the "central hub", that everything connects to, and that runs the main program that interfaces with FSX. Certain panels (autopilot panel, overhead panel, fuel panel, ect) will have their own Atmega328 and IO expanders as required, and everything will communicate together with I2C (might be out of spec, I know, but if it works, why not?). The final design will be modular, so it will be easy to take apart for storage or transportation. Eg, each panel or module can be disconnected with a single ethernet cable, and a 5V barrel jack.
At this point, I'll have at least:
55+ on-off switches
60 LEDs
33 rotary encoders
6+ potentiometers
7 servos
11x 8 digit 7 segment displays
30+ buttons

The final project will consist of the main Mega, 6x Atmega328s, 5x MCP23017 IO expanders, 4x STP16CPC26 LED drivers (all on custom PCBs.)

Best of Luck! This is project is testing the limits of my woodworking, electronic, programming, 3D printing, and electrical skills.

270 addressable LEDs use one data pin for all. 16 Max7219's use two (or 3, I don't remember.)

220 buttons is kind of a lot. Maybe use a keyboard matrix?

10 pots suggests 10 analog inputs.

For a project of this size and complexity, it would be smart to split it up into modules. Even if the modules are just left and right, this will greatly help during the construction process if you don't have a hundred wires going to a panel that must be opened/removed for servicing.

It's really up to you. I'd say at least two Megas, but then it's a choice of how many multiplexers you want to use and how much work those Megas have to do with the I/O. Do they just collect it and pass it on while lighting some LEDs?

But, as Robin2 says, clones are cheap and I suspect just getting all the instruments, lights and switches is going to make buying ten of them disappear into the rounding for this project.

I would be inclined to give each Mega a small piece of the puzzle. Divide by panel, or function (much the same thing I expect) and you will be able to get that thing going and set it aside. With one or two only, there's a continuous risk of new code breaking something you had working.

You're not the first to take on such a project - what have other airliner sim builders done?

One other thing to consider is how the processors will communicate with the computer(s) running the actual flight simulator. Wifi? Ethernet (my preference)? USB? RS232?

Robin2:
I reckon it might take significantly less time to develop this with multiple Megas rather than with one Mega and several multiplexers. Mega clones are not very expensive.

Cool, I gonna look for clones. I didn't know about it, thanks!

John_S:
Your plan to limit the number of boards as much as possible sounds reasonable

Thanks for your thoughts John_S, and maybe I didn't explain so good. You said the correct word: Efficient. What I wanted to say wasn't reduce as much as I can, it was "to make it as efficient as I can", to prevent purchasing hardware in excess. I'll search for expanders to know how does it work. Thanks

MorganS:
270 addressable LEDs use one data pin for all. 16 Max7219's use two (or 3, I don't remember.)

220 buttons is kind of a lot. Maybe use a keyboard matrix?

10 pots suggests 10 analog inputs.

For a project of this size and complexity, it would be smart to split it up into modules. Even if the modules are just left and right, this will greatly help during the construction process if you don't have a hundred wires going to a panel that must be opened/removed for servicing.

So useful info, thank you very much MorganS. About LEDs, how would be possible to do that?

wildbill:
You're not the first to take on such a project - what have other airliner sim builders done?

Thanks, I'm gonna do some research

wildbill:
One other thing to consider is how the processors will communicate with the computer(s) running the actual flight simulator. Wifi? Ethernet (my preference)? USB? RS232?

What do you recommend? I thought USB

I really appreciate the help you all gave to me. Now I know that it's possible to use maybe a couple of Mega boards as minimum hardware, but that would be a mess of wires and would be recommended to use one Mega for each module (Overhead, Main Panel, Pedestal). So, as a final thought, 3 Megas with the respective keyboard matrix, extender, whatever

"270 addressable LEDs use one data pin for all. "

Addressable as in multicolor? Daisychained WS2812B could be better then.

MAX7219 is better for up to 64 single color per chip. Can daisy chain them also, with SCK/MOSI/SS for quick loading.

I offer a breakout board to make the LEDs easy to wire up with a pair of wires to each for ease of placement.
http://www.crossroadsfencing.com/BobuinoRev17/

Pompeii:
What I wanted to say wasn't reduce as much as I can, it was "to make it as efficient as I can", to prevent purchasing hardware in excess.

The point I was trying to make was, what kind of efficiency are you after? Least number of boards? least amount of wiring? Easiest to troubleshoot and repair? Least amount of components? Cheapest cost? Simplest programming?

You will have to decide what is best for you. It is impossible to have everything.

Eg, you can get addressable LEDs, and use one pin for as many as you want, but either they are SMD and you will possibly need to make circuit boards for each one and do your own assembly, or if you get through hole kinds, they are not less than $4 each. The choice you make will depend on what you value more (number of pins? cost?, assembly time?)

I chose to go with the STP16CPC26 as the LED driver, because I can use any cheap LEDs, don't need to include a resistor for each one (ease of assembly), and they can be daisy-chained with as many as I need and only use 3 pins on the microcontroller. I decided against the MAX7219 for the individual LEDs because for me, wiring them in a matrix would have been challenging and prone to error. But you can do whatever you think is best for your project!

Shift register is also an option here. You can use 74HC595 to control the LEDs and 74HC165 to get data from the switches. You can control as much LEDs / switches as you want using just 3 + 3 = 6 pins of Arduino.

Pompeii:
it was "to make it as efficient as I can", to prevent purchasing hardware in excess.

I don't believe the quantity of hardware can be a useful measure, or even the quantity of a certain part. IMHO what matters is the balance between your time and convenience and total cost.

There are lots of things that can be done without microprocessors and there are lots of parts that are cheaper than microprocessors. But when you factor in the value of your own time (even in non-monetary terms like convenience and the number of extra grey hairs) microprocessors can look like a very good deal.

I'm building a control system for a club model railway which will have 6 or 8 Atmega 328s and two Megas. All the Atmega 328s will have the same program and only three wires (Rx Tx and GND) are needed to connect between them and the Mega. It was originally thought that 1 Mega would be sufficient but when all the switches and LEDs on the control panel were taken into account it was simpler to add a second one than conceive a complex component system to expand the capability of the single Mega. And having made that decision there are other benefits in simplified control panel wiring.

...R