Is one Arduino board enough?

Hi all!

I am new around here, and looking for a few bits of advice.

I am designing a large switch panel for use with a flight simulator (Prepar3d V4). I would like it to contain somewhere around 45 different switches, push buttons and rotary encoders, along with a few small displays for things like Heading, Altitude and Vertical Speed in the Autopilot. It would also, ideally, have some LEDs to indicate things like the position of the landing gear, and status of autopilot functions.

It is a large amount of requirements, is Arduino man enough for it, and can it be done with one board plus some multiplexers etc? If not, does anyone have any suggestions?

Thanks!

Max

One way …

https://playground.arduino.cc/Code/I2CPortExpander8574/

As you are new to this it would be normal for anyone to advise you to start small and work your way up.
Jumping straight into the deep end with visions of grandeur will end in disappointment.

The arduinos are inexpensive, so if you need several it won't break the bank. Lots of ways to multiplex with chips, so a lot of I/Os are available if needed.

The hardest in this mix are the rotary encoders. Those may not work at all on port extenders.

Switches and momentary buttons can be quite easily done on port extenders. You may consider using the interrupt line of those port extenders to save on work load, only scan them when something changed.

Thanks guys, of course it will take me some time to get my head around it, and there will be plenty of learning curves! I have experience with wiring real aircraft but never any form of computer interfacing!

Would you suggest using one board for the switches and push buttons, one for the rotary encoders (and maybe LEDs), and one for the displays?

Which boards would you suggest for this kind of build?

Thanks again!

I think my own preference would be to use a pair of Arduino Megas. Between then you should have more than enough I/O pins without the complexity of port expanders.

With a bit of thought you may find that the project falls into parts that can naturally be allocated to one or the other of the Megas.

…R

I would be inclined to use one Arduino per functional area so that, for example, you have one that controls all the switches and displays associated with the radios. You can then complete that piece as a standalone project and set it aside secure (mostly) in the knowledge that working on other parts of the panel won't break what you've completed.

Also, the pictures of these things I've seen tend to have a rats nest of wires behind the panels. This way keeps that a bit more under control.

For more specific suggestions you have to be more specific in your needs.
How many encoders? All operated by hand?
How many buttons/switches?
How many and what kind of displays?
How many and what kind of other outputs (LEDs, computer interface, ...)?

I'm going to share what I posted on another similar thread about building flight simulators.

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

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

I would start small, and expand if you need to. Also, figure out exactly how many LEDs, rotary encoders, buttons, toggle switches, displays and what kind, ect that you need. That will help point to what hardware is best for the job.

If you use multiple boards (which with these numbers is almost certainly the way to go) you also have to think of how you're communicate all the data back to the central computer - I do assume you have a PC of sorts to do the actual flight simulation - and how to have that computer send the data back to the correct Arduino for display on one of those 7-segment displays.

It sounds as though a few 'Mega' boards, is the way to go. To clarify, it would be;

24x Toggle Switches
3x Rocker Switches
2x Rotary Switches
3x Rotary Encoders with a push button
7x Push Buttons/Tactile Switches
3x Display, either OLED or 8 Digit 7 Segment displays
2x Potentiometers
3x RGB LEDs for use as a gear indicator (Red for travel/Green for down and locked)
14x LEDs for use as indicators i.e Starter engaged/Altitude Hold on etc

and some form of backlighting for the panel, though this can be done independently of everything else, if necessary. All of the above would be hand operated, no servos. PC feedback would trigger the LEDs.

I have a powerful PC setup, with plenty of spare USBs, though if there is a way of cutting down on PC connections, that would be great. I would also like to have a dimmer switch for the displays and LEDs etc.

I've highlighted how many arduino pins you would probably need for the hardware you listed:

24x Toggle Switches 24
3x Rocker Switches 3
2x Rotary Switches 6?... depends how many positions there are
3x Rotary Encoders with a push button 9
7x Push Buttons/Tactile Switches 7
3x Display, either OLED or 8 Digit 7 Segment displays 3 pins for daisychained 7 segment displays with MAX7219 driver
2x Potentiometers 2
3x RGB LEDs for use as a gear indicator (Red for travel/Green for down and locked) if you use the WS2812 LEDs, only one pin is necessary
14x LEDs for use as indicators i.e Starter engaged/Altitude Hold on etc 14 - can use port expander eg. MCP23017

As it is, you need 69 pins. The Mega has 70. I would start with a Mega and a MCP23017 and see how far you get. Good luck!

John_S:
I’ve highlighted how many arduino pins you would probably need for the hardware you listed:

24x Toggle Switches 24
3x Rocker Switches 3
2x Rotary Switches 6?.. depends how many positions there are
3x Rotary Encoders with a push button 9
7x Push Buttons/Tactile Switches 7
3x Display, either OLED or 8 Digit 7 Segment displays 3 pins for daisychained 7 segment displays with MAX7219 driver
2x Potentiometers 2
3x RGB LEDs for use as a gear indicator (Red for travel/Green for down and locked) if you use the WS2812 LEDs, only one pin is necessary
14x LEDs for use as indicators i.e Starter engaged/Altitude Hold on etc 14 - can use port expander eg. MCP23017

As it is, you need 69 pins. The Mega has 70. I would start with a Mega and a MCP23017 and see how far you get. Good luck!

Sorry, 4 Positions each. I wanted a 5 position Key Switch with a spring return from the right, to use as magneto/start switch. Couldn’t find anything suitable, so a 4 way rotary switch and two push buttons will do!

Do the push buttons take any more pins than a standard rotary encoder? These would be uses to engage/disengage something like HDG Hold and selector, altitude etc

Perfect, cheers! Is most of this coding readily available, already?

Much of that can be offloaded to a few chips, such as 74HC165, an input shift register. Add a pullup resistor per input, read a string of them in with SPI.transfer(). Toggle, Rocker, push button/tactile for sure. Load, SCK, MISO.
Displays, LEDs also. MAX7219s for the displays and discrete LEDs, load them up with SPI.transfer. Chip select, SCK, MOSI.
Two color LEDs, maybe use with MAX7219 if have 1 cathode/2 anode parts. Otherwise WS2812B is a good choice.

If you switch to full-breakout Mega, you get 86 IO vs the 70 of the Mega.

You probably could multiplex the simple rhings like the regular LEDs and switches with multiplex chips like the HCT4051, to take some of the load off of the board I/O pins.

esp8266 and mcp23017 then use the ioabstraction arduino library which handles the button and rotary encoder debouncind and treats io like they are native ports on the arduino. i actually have a prototype on seedstudio you can buy 10 of them for 4.90$ that give you 128 i/o and a socket for the esp8266 with a 0.96 oled display. oh and you get wifi :slight_smile:

ps simulators need alot of codespace if done right so mega is good, but esp8266 is way better lots of variable room and program space.