Connecting a Real Flap Handle (part deux)

Are you building a cockpit, planning to build one or just dreaming, this is your cockpit builder meeting point

Moderators: russ, Ralph

Message
Author
Kaellis991
Posts: 581
Joined: Mon Sep 07, 2020 8:49 am

Re: Connecting a Real Flap Handle (part deux)

#11 Post by Kaellis991 »

jph wrote: Sun Jun 05, 2022 1:19 pm Hi Kirk,
If they are driving the Arduino Analog input then yes. The 1 to 10K rule for the pot applies, and also the series current limiting protection resistor of 220 ohm.

It is ALWAYS essential to use an appropriate resistor in series with the wiper to any ADC input or indeed ANY input that is also capable of being used as a general I/O !
The reason is that if for some reason you accidentally set the Arduino pin to an output when the ADC pot is connected, then, if the ADC wiper is at the gnd end and the I/O port is set high the Arduino ADC input port or general port will be destroyed.
This is actually very easy to do hence the resistor. In the event of this happening then the resistor will act as a buffer and safely limit the current to indefinitely tolerable levels for the Arduino.

In Air Manager it is possible to set the same Analog capable pin - say - A0, to Analog input, AND digital output in the same code :shock:
It is also extremely difficult to easily check in AM which pins have been assigned so you wont get a warning of a pre-assigned pin.
It is also REALLY easy to run the wrong code - or the code for something else with the same Arduino main ID. RIP Arduino..

Oh for the amazing flexibility and logic of MobiFlight when assigning hardware pins ! ;)

Any INPUT to the Arduino should ALWAYS have a 220 ohm resistor in series with the pin as a matter of course, Analog OR digital, it doesn't matter. This is standard good design practice and a 1 cent resistor will save a complete Arduino.

220 ohm is for the 5V version, 180 is fine for 3.3V

Joe
Joe,

Just to be absolutely sure, I will be using one of the analog input pins from A0 thru A5 on my Arduino Micro board...correct?

Also, your comment about using resistors for every INPUT is stating that for every switch I have connected to an Arduino pin I should have a 220 ohm resistor?
I have ignition key leads, panel toggle switches, and a brake toggle for now. More switches to come yet.

Kirk

User avatar
jph
Posts: 2846
Joined: Fri Apr 10, 2020 12:50 pm
Location: Somewhere over the rainbow..

Re: Connecting a Real Flap Handle (part deux)

#12 Post by jph »

Hi Kirk,
Regarding the Analog input, yes, absolutely. For other inputs a series resistor is good practice and sensible engineering. When designing and programming is fluid and subject to change it is only too easy to set a pin to the wrong state in your code and damage the arduino. As an example, If a switch on a pin is connected to ground in one position and you accidentally set the pin to output high then you are shorting the pin to gnd via the switch. A 220 ohm resistor will stop any damage. Of course, if you never flash the wrong state to a pin this won't happen but it is all too easy and your only checks and balances are your notes. All just good old design and build practice.
Joe
Joe. CISSP, MSc.

Kaellis991
Posts: 581
Joined: Mon Sep 07, 2020 8:49 am

Re: Connecting a Real Flap Handle (part deux)

#13 Post by Kaellis991 »

Hey Joe,

Thanks for the insight. I will go back through the 12 switches I have connected and add a 220 resistor to each.
I will continue with that practice for the remaining switches.

Kirk

Post Reply