Cockpitbuilders.com

Main => Builders Discussions => Topic started by: FSAddon_boss on January 11, 2022, 11:48:43 AM

Title: Landing gear indicators
Post by: FSAddon_boss on January 11, 2022, 11:48:43 AM
Before buying more (and bigger and more expensive) lights, I thought to try and use some of the LED anodes I have in my Ardiuno test kit.
The ' three greens'  and a red ' in trans' light.

Only have to decide to add a 220Ohm resistor to each, or use a 1K resist.... it should work...... no?
Title: Re: Landing gear indicators
Post by: RayS on January 11, 2022, 12:54:11 PM
If driving directly from the Arduino, 220 ohm will work. 1K will work, but the LEDs will be very dim.

I noticed you only have 1 resistor in the circuit. Instead, you'll want to add a 220-ohm resistor for each LED. This ensure uniform brightness across all LEDs, especially when more than 1 are lit at any time.
Title: Re: Landing gear indicators
Post by: FSAddon_boss on January 12, 2022, 02:42:59 AM
Quote from: RayS on January 11, 2022, 12:54:11 PMIf driving directly from the Arduino, 220 ohm will work. 1K will work, but the LEDs will be very dim.

I noticed you only have 1 resistor in the circuit. Instead, you'll want to add a 220-ohm resistor for each LED. This ensure uniform brightness across all LEDs, especially when more than 1 are lit at any time.

Yes, I tested it with one. Will add a resistor to each LED.
With 220 Ohm it is very bright, thought to dim it a little (and save a little on max Ampere), but maybe something between 220 and 1K ?
Title: Re: Landing gear indicators
Post by: Trevor Hale on January 12, 2022, 03:31:41 AM
Quote from: FSAddon_boss on January 12, 2022, 02:42:59 AM
Quote from: RayS on January 11, 2022, 12:54:11 PMIf driving directly from the Arduino, 220 ohm will work. 1K will work, but the LEDs will be very dim.

I noticed you only have 1 resistor in the circuit. Instead, you'll want to add a 220-ohm resistor for each LED. This ensure uniform brightness across all LEDs, especially when more than 1 are lit at any time.

Yes, I tested it with one. Will add a resistor to each LED.
With 220 Ohm it is very bright, thought to dim it a little (and save a little on max Ampere), but maybe something between 220 and 1K ?
Morning, from my experience, 330 Ohm is a great start.


Trev
Title: Re: Landing gear indicators
Post by: FSAddon_boss on January 12, 2022, 05:32:48 AM
Thanks Trevor ! Will need to buy a few more ' flavors'  then  :D

Probably won't make any more progress until after my operation next week...... will report back when I have things working !
Title: Re: Landing gear indicators
Post by: _alioth_ on January 12, 2022, 07:17:41 AM
Quote from: FSAddon_boss on January 11, 2022, 11:48:43 AMBefore buying more (and bigger and more expensive) lights, I thought to try and use some of the LED anodes I have in my Ardiuno test kit.
The ' three greens'  and a red ' in trans' light.

Only have to decide to add a 220Ohm resistor to each, or use a 1K resist.... it should work...... no?

If you are going to use Arduino, you can use PWM pin outs so you can dim the lights with the software.
You use 220ohm to get the max brightness posible, and then with software you can dim the light to your preference.
Or you can build a switch for "night-day" brightness level.
Or you can add a photorresistor to arduino so you can dim the leds with the ambient light.

Arduino is great.
Title: Re: Landing gear indicators
Post by: FSAddon_boss on January 12, 2022, 12:18:29 PM
Hi Alioth, thanks for the ideas. I use Arduino with MobiFlight, but I suppose one can add additional code to that?
Title: Re: Landing gear indicators
Post by: Jason L on January 13, 2022, 05:48:53 AM
Mobiflight doesnt have that capability yet unfortunately.  You could double your 220ohm resistors, (connect them in serial) and see if that is a better brightness for you.  If I remember correctly these arduinos have a limit of 40 LED's if you are running them with 220ohm resistors.
Title: Re: Landing gear indicators
Post by: BushPilotSimmer on January 13, 2022, 09:37:04 AM
220 ohms is much too low for anything but alien invasion warning systems.I am using 5mm red/green LEDs inside 5mm chrome bezels. 5.6k ohms for red and 56k ohms for green. Check voltage on 5V pins, Consider powering anodes of LEDs (or any high current devices) with 5V auxillary supply when voltage drops below that seen on board with no connections. Less likely to happen on UNO and MEGA than smaller NANOs.

Hugh
Title: Re: Landing gear indicators
Post by: FSAddon_boss on January 13, 2022, 09:54:21 AM
Guys, I'm a near 70 year old noob.... sorry.

I keep reading about powering the lights separate..... but no idea how and with what to do that?

I have the Arduino Mega powered by a 12 V adapter (but the lights also work with just the USB connection).
Title: Re: Landing gear indicators
Post by: ame on January 13, 2022, 11:47:47 AM
Flying a plane is probably more complicated than figuring out dropper resistors for LEDs, or how to hook up a switch, so don't worry.

LEDs are lit up with current. Too much current and they pop and cease working. The purpose of the resistor is to limit the current through the LED at the expected supply voltage. There are other techniques, but this is the simplest.

You can get a data sheet for any component, which tells you a lot of technical information about the component. You need to know this when you are designing stuff, but for a lot of things there are ball-park figures you can use.

Let's look at a red LED. Typically it has a forward voltage of 2 V, and a maximum current of 20 mA. Most modern LEDs are actually quite bright at 10 mA or even less. If you have some on your bench you can experiment.

Your power supply is typically 5 V from an Arduino, but a lot of people have 12 V lying around too.

The formula for calculating the dropper resistor value (or current-limiting resistor) is

R = (Vs - Vf) / If

R is the resistance in ohms
Vs is the source voltage in volts
Vf is the LED forward voltage in volts
If is the desired LED current in amps

So, with a typical red LED at 2 V and 10 mA powered from an Arduino at 5 V we get:

R = (5 - 2) / 0.01

R = 3 / 0.01

R = 300

So, a 300 ohm resistor will give you 10 mA through the LED at 5 V.

Different LEDs have different forward voltages. It's different for different colours, so you should look it up. Similarly, different LEDs might look the same brightness with different currents, so it's worth experimenting.

The relationship is linear, so in this example, to get 20 mA (twice the current) you can halve the resistor to 150 ohms. That's probably safe for most LEDs (check the data sheet), and will be the brightest. But it might be too bright for what you want.

Similarly, given a resistor value and supply voltage you can calculate the current the LED and guess if it's safe, and how bright it might be.

Finally, you need to pay attention where the power is coming from. All those LEDs add up.

The maximum current you can draw from an Arduino pin is 40 mA, so that's fine for an LED at 10 mA. But the total limit for all pins is 200 mA, which is only 20 LEDs at 10 mA.

There are ways around these limitations, and there are ways to vary the LED brightness using software, but this is the simple and obvious scenario. If you understand it then you can move on.
Title: Re: Landing gear indicators
Post by: FSAddon_boss on January 13, 2022, 12:11:36 PM
Many thanks again, Ame..... I have 14 less planned, so the Arduino should be able to cope with that.
Will try and find the value of the LEDs I have (they came in a Arduino tester kit)..... or buy new ones with known values if I can't.

Oh, and some different value resistors so I can experiment.

Thank you !
Title: Re: Landing gear indicators
Post by: ame on January 13, 2022, 12:39:47 PM
You can learn the resistor colour code and figure out the value of resistors by looking at them. Or hook them up to a multimeter in resistance mode.