#Arduino Pro pin 13 and MCDU keys backlight

1 messages · Page 1 of 1 (latest)

strange valley
#

Hello all!
I'm new with simbuilding and need a little help.
I'm builiding MCDU fo a320 using this PCB: https://oshwlab.com/madmonkeyfpv/mcdu
I already configured buttons in Mobiflight but now I've problem with LED backlighting. I can light up LEDs by connecting power ground to LED gnd hole but I want use FET and arduino to control brightness. In Mobiflight I'm not able to see pin 13 (D13) in dropdown menu for Arduino Pro module. Maybe someone here already used this PCB and can help me with that.

hasty flicker
#

I am not completely sure, but I have seen something about Pin 13 bein correlated to Arduino's onboard LED, that's why it may not be available. (If I am not wrong)

barren mist
#

@strange valley please use search engine in this server. This has been already discussed many times with deep explanation

soft nest
#

although the problem with pin 13 in mega mini is related to use for button input, it should work and be available for led output just fine.

@strange valley Make sure you didnt accidentally assign it for a button already?

#

that is why we often use it for the FET backlight control since that pin does not work for button input.

The added side effect is your backlights in your cockpit will get a techno rave strobe effect when you upgrade your firmware, and when you start Mobiflight and it connects to the arduinos, as that led also blinks when the serial port connects. It does not do that when mobiflight runs normally in use though.

strange valley
#

Yes, I'm 100% sure that it is not used for button.
Also, I tested this pin 13 in Arduino IDE to check if LEDs are working at all. The built-in LED on Arduino is blinking but backlight no. Here is a picture how my PCB looks like.
If I connect FET 2 and 3 pin, backlight works. so LEDs itself are fine.

soft nest
#

you said earlier you didn't see the pin 13 available in the config, did that sort itself out? Can you see 5V between pin 13 and GND when the output is on?

strange valley
soft nest
#

yeah, so does it now work, or is there still trouble with the FET?

strange valley
#

Still doesn't work :/

soft nest
#

so what does the output value look like in the backlight output?

strange valley
#

Sorry but I don't uderstand. How can I check value?

soft nest
#

do you have a multimeter?

#

it is very useful in this stuff, to measure voltage

#

oh wait

#

duh

#

I was thinking other things, so its two things we need to check

#

when you "Run" mobiflight, if you want the backlight to be on, the "Output value" of the backlight output config needs to show something other than 0

#

can you show a screenshot of the output config settings?

#

once we verify that we check the hardware side

buoyant gulch
#

I had experience the same issue last night on pin 13 on the mega pro mini. My button function on pin 13 did not respond. All check out ok with the multi-meter, but no joy via Mobiflight. Luck I was able to move the connection to another pin and worked well.

soft nest
#

yeah, Arduinos have built-in pull-up resistors (~20-50kOhm I think) on the IO-pins that are commonly used when reading button presses, in Arduino code, and also in MobiFlight.

This means the pin is tied to 5V internally and the switch is connected to GND which is then detected by 5V -> 0V change by the DigitalRead() function.

On pin 13 in the mega mini, however, there is also the led and it's current-limitingresistor that is also connected to GND and will have a very small current flow. This will drop the 5V down slightly, but enough, so it makes reading the pin unreliable unless you add your own pull-up resistor as well. So it is possible to make it work, but in practice as it works well for a led output, it's just easier to use it for backlight for example.

strange valley
#

Hi,
Sending my config screenshots. Is this what you asked for?

soft nest
#

and what value does it show in output value when you press "run"?

"Flight sim value" is what is read from simulator, then the modifiers are applied, and the output value is what is sent to the output.

You also want to enable PWM for the FET to do the dimming. The range is 0 to 255, and the percentage you get from tbe sim variable will likely be fine, but if you need more, use for example interpolate modifier to map 0 -> 100 to 0 -> 255.

#

but very often the backlight had plenty of brightness at maximum so less than that will br enough.

strange valley
valid geode
#

The PWM is set according to the value of the output config in the range 0 to 255.

strange valley
#

Hi,
Sorry for late response, been very busy recently and had to pause my home cockpit project. Now we are back on track.
I've enabled PWM. Also here is output value. Bcklit still does not work :/

soft nest
#

so ok, the output is sending value 100 of 255 so it should definitely show something.

  • Can you check between the Arduino pin 13 and any GND pin for voltage - either try with a multimeter, or if you dont have one, try with a spare led for example (with the polarity correct way around) whether it lights up? Or if you get some voltage out of it.
#
  • Then check for continuity (multimeter beeper) between pin 13 and the FET gate pin (the leftmost pin when the metal bit is facing on the back) - if there is no beep, your output is never reaching the FET.
#
  • Finally, you can try connecting the FET GATE pin to 5V pin in the arduino, it should then light up at full brightness, similarly like when you connected source and drain together. If this does not work, the FET is faulty.
strange valley
#

Connecting FET 2 and 3 is working so I guess FET is ok.

#

I'm going to check other things that you mentioned. Thank you

strange valley
#

Ok, if I connect LED to pin 13 and GND, nothing happens. If I use any other PINs that are assigned to buttons, LED lights up.

soft nest
#

it does not really indicate anything about the FET since you are removing it from the circuit and just connect directly. To test the FET you could connect the Gate (the control pin) to 5V.

The FET is like a bit like a water faucet. Your water comes from the pipe that is connected to your house ("source"), and your kitchen has the faucet that lets the water flow out for use ("drain").

The water flow is controlled by a valve ("gate") that is either OFF (0V, output pin is LOW, 0) or ON (output pin is HIGH (5V), or something in between (PWM output 0 <--> 255)

#

So now we need to figure out why pin 13 does not light up a led. Can you check that there is no continuity between pin 13 and GND due to some soldering issue or similar?

#

also show the pin 13 config screenshot, your earlier shot shows "Test output" and now the "Key Brightness" output uses an output called "Brightness". So if you can screenshot what is configured for "Brightness" in mobiflight modules?

strange valley
#

Looks like this Arduino pin 13 is broken.
I decided to control brightness by voltage. I think it will be easier if connect whole pedastal to one potentiometer and control backlit outsied sim.
Anyway thank you for your time. I really appreciate it.