3689486770?profile=original

 

I am using the APM 2 for both my quads and it is tricky to get the barometer covered to avoid errant airflow since it is below the daughterboard. To solve this, I ended up pretty much filling up my stack cover with breathable foam. But once that was done, I could barely see the on-board LED indicators.

Fortunately, the current code supports remote indicators without too much trouble.

If you look at the pin-out images on the Wiki, you will see that the AN pins are labeled Motor LEDs. They really don’t have a lot to do with the motors – but they do serve as pretty handy indicators.

3689486868?profile=original

If you look in the code, you will find defines for these pins as follows:

AN4 – Motor or Aux LED

AN5 – Motor or Beeper

AN6 – Motor or GPS

AN7 – Motor

AN8 – Motor

For my purposes, I focused on AN5 for the Beeper, AN6 for GPS indicator and AN7 as an Armed indicator.

The default seems to be to have the beeper enabled and the LEDs on. That is easy to change however. The different possibilities are set using bit masks to build the LED_mode parameter. A bit mask (if you already know, feel free to skip ahead) is simply a way of packing a bunch of on/off settings into one byte of data. A Byte is 8 bits, so you can have 8 different switches in one byte.  If you look at the following table, you will see a single bit is set to ‘1’ and the rest to ‘0’ in each row. To build the mask, you just add all the rows together and convert to a decimal number (or convert then add).

Bit Number

7              6              5              4              3              2              1              0

0              0              0              0              0              0              0              1      =      1              Motor LEDs On/Off

0              0              0              0              0              0              1              0      =      2              GPS On/Off

0              0              0              0              0              1              0              0      =      4              AUX Function On/Off

0              0              0              0              1              0              0              0      =      8              Beeper On/Off

0              0              0              1              0              0              0              0      =      16            Low Battery Flash – fast/slow

0              0              1              0              0              0              0              0      =      32            Motor LEDs NAV blink On/Off

0              1              0              0              0              0              0              0      =      64            GPS LEDs Nav Blink On/Off

1              0              0              0              0              0              0              0      =      128          Not used

 

Note that the NAV settings cause the LEDs (either the motor LEDs, the GPS LED, or both) to blink 3 times when you hit a waypoint in AUTO flight.

The low battery flashing defaults to fast flash so setting that bit to 1 will enable slow flash. 

 

I really only want the beeper, the GPS and the Motor LEDs on, so I set the mode to decimal value 11 (which is binary 00001011). This should equate to: GPS Nav blink off, Motor LED Nav blink off, low battery flash fast, beeper on, AUX off, GPS on, Motor LEDs on..

 

The way you set this to be the value used is through the Mission Planner.

 

Establish a connection with the APM and the Mission Planner software. Go to the parameters list and find LED_Mode. It should be set to something like 9. Change that to 170 (or whatever you decide to use) and write the settings to the APM.


The outputs on the APM are 5V, so for most LEDs, you’ll need a resistor on the positive lead (the longer leg of the LED). In my case, the blue LED I was using required a 100 Ohm resistor and the red one required a 150 Ohm resistor (note – not going to explain it here, but there are a ton of online resources and calculators to figure out the resistor values needed for a given LED). I soldered up the resistors and LEDs to leads and cemented them at the edge of my stack cover’s base. For the beeper, I just used a 5V piezo beeper I happened to have lying around. Radio shack sells one that will work, but it isn’t very loud. If you want volume, you may need to shop around,

 

When you connect to the AN outputs, you need to run the negative lead to the ground pin (the one nearest the edge of the board) and the positive lead goes to the signal pin (the one farthest from the edge of the board). The middle pin is always 5 Volts so if you plugged in there, the LED or beeper would be always on.

 

Beeper goes to AN5, GPS to AN6 and the ARMED light goes to any other motor LED output, but I chose to just use AN7.

 

That’s all there is to it. When you turn on the APM, you the LEDs will stay off until it is booted, then will flash the same as the on-board ones. When a GPS lock is achieved, the GPS LED will stay lit. When the bird is armed, the red LED will blink out and once it is fully armed, it will light a solid red. The beeper will beep twice on arming, and once on disarm.

 

E-mail me when people leave their comments –

You need to be a member of diydrones to add comments!

Join diydrones

Comments

  • This seems to have been asked before, but not answered - is LED_Mode only available in APM:Copter and not APM:Plane?  For the life of me, I can't find it in there.

    If it's not there, any chance of having it added?

  • Hi everybody, I just bought a  Apm 2.6 (clone) and I would like to add an external LED/Buzzer to my board. I do have no idea how to do it. Jani Hirvinen says the jD-IOBoard v1.0, MCU controlled IO Board for driving LEDs, Relays, Servos is needed, but the problem is it is out of stock. I've seen others using similar LEDs without jD-IOBoard. There are no good videos on youtube about this LED boards, some of them just show this board flashing, but not any "how to..."  Remember, i am newbie , so if someone think there is a easy way to get this board working , I'd really appreciate your  help.3701677076?profile=original

  • Sorry noob question here, how do you control the LED? through any command from mission planner? Please guide me as I have tried searching from many site but couldn't understand how to use those auxiliary outputs at the side of the APM. Assistance please..

  • Ok, I am have a problem a sort of. No matter the number I set/11_19_ or what ever,on a6/a7_GPS lock and motor arm,they both work backwards. I am using the 2803 chip, the a pins to chip/chip to neg on LEDs/pos of LEDs to pos of lipo/neg of lipo to neg of chip. It work,but when GPS/motors NOT locked or armed,I get flashing. When locked or armed,they go out. I have a 2.6 with 3.1 firmware.this is useless to me,as I need solid when armed and locked. Can someone advise. Frank.
  • Hi Jani, fully understood... I currently have a LED solution with 2 LED (Smaller ones) and a Buzzer on a switch for when APM connects to PC to eliminate the buzzer sound.  I was thinking out loud regarding I guess my reference to that board is where i went wrong.. i meant to say that having a few more LEDs would be great to show more but then again, do you want a small board then with LEDs or just wire up your copter with strips on the arms.  ;-)

    Many Thank for the contribution, I will for sure buy one for my other copter.  (perhaps handling the APM connect to PC would be a nice addition?)

  • Developer

    LTMNO, IOBoard cannot connect directly to APM and it's not even meant to do that. IOBoard is meant to listen MAVLink packets or other Serial data based data and then act according it's internal program. This LED board already brings those internal LEDs open to the public. Behavior is not exactly as internal ABC leds but output meaning is same. LED board does not show "calibration" blinking but it does show armed/disarmed no gps/gps lock values which are important to users.

  • Does look interesting.. the problem is currently the APM outputs for LED only supports 2 functions.  However, you could use the IOBoard to drive more options in color patterns for that board.  It would be nice to tap into the 3 LEDs onboard the APM and just have the ability to see them externally.

  • Has anyone purchased one of the 3w 4led LED module http://www.goodluckbuy.com/3w-4leds-led-module-led-indicator-v1-0-f... thought it looked good but I am at a loss on the connections?
  • Developer

    William, yes you are correct on that current usage. There are already been some brownout problems on main CPU and having LEDs, Buzzers etc directly on CPU IO Pins is always a big dangerous. That's why we originally made IOBoard to support high current LEDs for original copter leds application.

    To avoid getting in to problems we made new board for Led/Buzzers. It is similar to the board that Charles made but having drivers for everything. 

    This board does not use any current from CPU IO Pins, all of it's parts are transistor driven and it is getting it's power from 5V power rails directly. So no stress to CPU. Connection cable is DF13-5Pin so length of the cable can be easily changed. Also there is an adapter that mounts nicely on top of APM and in future to PX and other boards.

    jD-Ledbuzz_P1.jpg?width=500

    jD-LedBuzz_P3.jpg?width=400And as always, boards can be found from jDrones store

    Use LED_MODE = 11 for these boards. 

    Information board for APM flight controllers
    Great way to know more what happens inside your APM flightcontroller
  • hi Jani, LED_MODE in full parameter list is already there (as I said, I reflashed my fc with new fw) my problem is at standard params. Why is that? Remember this is freshly uploaded fw. I reset and erase it before the fw loaded.

This reply was deleted.