||| ArdSimX Articles/Guides Project Archive SimVim Panel Baron-58 sim Forum

LEDs connection and control


b58img

Each simulator panel has at least a few annunciators that should be made to look "real". It seems that using LEDs is the simplest way to output information from Arduino.

Direct LED connection to Arduino

Standard way to control LED in Arduino is using one digital pin as output for each one LED, using digitalWrite() function that sets chosen pin to the state 0 or 1. With the the ArdSimX, ArdSim, XPData libraries you don't need do this, they have inbuilt functions to control LEDs directly by datarefs from X-Plane.

Simple connection of the low-power LEDs to Arduino output pin:

Connecting LEDs to Arduino

1. If you need to control a few low-power LEDs with one Arduino simply connect them to output pins (anode) and to the ground (cathode) with serial resistor (R1). This resistor can be varied from 50 to 500 ohm for common LEDs with 10-30 mA current (maximum "damage" current for Arduino I/O pin starts with 40 mA). The resistor used can vary from 50 to 500 ohm for common LEDs with 10-30 mA current. You can select a suitable resistor by trying and checking the brightness you need.

  • For UNO. With this type of connection you can use about 10 LEDs (20mA each) if they could be turned ON all at once ( or more if there will be no one moment of such simultaneous powering ).

  • For Mega. With this type of connection you can use about 20-30 LEDs (20mA each) if they could be turned ON all at once ( or more if there will be no one moment of such simultaneous powering ).

2. If you need to control a high-power LED (more than 40mA)
or several parallel LEDs with Arduino (or filament lamp), use any suitable n-p-n
transistor (or MOSFET) as power switch.

  • Use additional power source (+U) for this connection if connected LEDs
    have summary power consumption more than +5v power supply for Arduino
    can provide or if your LED require higher voltage (6-12 V)




- In older ArdSim library specific function in the Arduino code was usedto control the LED with specified X-Plane dataref.

- In ArdSimX only online Configurator is used to specify the LED and X-Plane parameter that will control it. Nothing to do in Arduino code.



Serial LED connection

To minimize the usage of Arduino pins for output ArdSimX support output to the chain of the shift registers to make the output extension for several LEDs. This is a bit more complex but widely used method of LED output with Arduino. The data is transmitted to registers from one output pin of Arduino, second pin is used for strobe.

This method was used for our Baron 58 panel in the "stand-alone" Arduino program code designed specifically for this panel. Later support of this ouput extension board was added in the XPData library.











© Copyright 2012 - Vlad Sychev