Teensy 4.1 Pins


New member
I am building a panel for MS Flight Sim that has 14 single position toggle switches, 3 two position toggle switches, 1 five position rotary switch, 1rocker switch.1 momentary push button, 2 single rotary encoders, 2 dual rotary encoders, and 2 potentometers. This makes a total of 43 signal wires and the teensy only has 41 pins that seem to be easily usable for a dummy like me. The pinout card shows additional pins on the back but I'm not sure how to use them. Can I just solder to the pads or is there some other way to use them? If I were to set up the single position toggle switches on a grid to connect them all to a single pin on the teensy is it still possible to use all of the switches at the same time?
Thanks to anyone that can hep me with this
A single position switch doesn't do anything (!) - do you mean single-throw?

A diode-switch array can be used to scan multiple switches using fewer pins, ie a 4x4 array allows 16 switches to be sensed by 8 pins.

IO expander chips also allow multiple inputs to be sensed using for instance the I2C bus.
For the 14 SPST toggle switches (OFF-ON), 3 SPDT (ON-OFF-ON) toggle switches, rocker switch (OFF-ON), and push button (OFF-(ON), i.e. momentary), I'd use a 4×6 matrix with diodes, using 10 pins, and 12 BAT54C Schottky diodes in SOT23-3 (a common cathode pair of diodes in each package).

For the five position rotary switch, I'd use resistors and an analog input, making it a five-position potentiometer as a voltage divider using four 1k resistors between the rotary positions, and the common as the "wiper". (The 8-bit ADC results would be 0-31, 32-95, 96-159, 160-223, 224-255.) This then only uses one analog pin. With the two potentiometers, you need three analog pins in voltage divider configuration: wiper to the analog input pin, and each end to 3.3V and GND.

For the rotary encoders, you need two pins each for interrupt-based reading, so ten pins.

By my count, you only need 4 digital output pins, 6 digital input pins, 10 digital input pins with interrupts, and 3 analog input pins, or 23 pins total.

The button matrix is simple. You have four output pins, and five input pins. Each SPST ON-OFF toggle switch, rocker switch, and push button connects an input pin to an output pin through a diode. Only one of the four output pins is high at any time, and it selects the group of buttons and switches the input pins will reflect. BAT54C has two Schottky diodes in each package, with a shared Cathode pin. You use one for each pair of buttons connected to the same output, but different inputs. The SPDT ones (ON-ON or ON-OFF-ON or (ON)-OFF-(ON) et cetera), the shared leg is the input, and the two other legs go to different BAT54C packages. (Basically, they're similar to two separate buttons on the same input line.)

All combinations of switch and button states are supported because of the diodes. In keyboard terms, we have "infinite rollover", exactly like each was wired completely separately. You will need to do debouncing in software (instead of in hardware using a capacitor and a resistor), but it is trivial. For such gaming uses, I like to use the dead-time approach, ignoring changes in the state for 10ms-50ms (depending on the physical switch type) after a transition, as this gives immediate response without any delay, with the only effect being that the fastest "peck" or "momentary toggle" takes the full dead-time duration ("release" or "return" being delayed).
Thanks guys> I really appreciate the help and believe that I can probably get it figured out now. My only concern now is that I hope tat it will work with the panel designers way of configuring this thing with Flight Sim. He's using FSUIPC to configure it to flight sim. The code for the teensy looks like it is just to debounce any switches on any of the 54 pins on the board. The code can be found here in the video description