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

  • Moderator

    For my Hitec Rx the RSSi is not available so for some using the RSSI value won't work, I think it should beep if it's in failsafe, simple. That way if your craft has gone down in a long grass field then just turn off the Tx and the APM would go into failsafe and start to beep.

  • Graham, what exactly do you have in mind for a lost model beeper?  I have one bit left I could use, and that's not a bad idea.  But how would it work?

    I am thinking something like (obviously) if the APM is alive, and the RSSI is very low, then trigger one of the outputs?  But that would require hooking up the RSSI from the Rx, I've never done that.

    On my 450 heli, I now have it set up again.  I found that the 4 LED strips from HK use much less power than the 3 LED strips. I have no idea why.  But anyway, that is what I'm using now.  Have 2 4-led strips driven direct from the APM.

  • Moderator

    This is awesome Scott, thank you! I hadn't done it because I thought it was way more complicated than this. Since I put my APM2 into the smoked default enclosure the LED's are really hard to see, now no problem. I used a 12v beeper as it was all I had so it's not very loud but loud enough to hear from 4-5 paces which is all I need.

    A low battery/lost model beeper would be seriously useful too but I presume it this would require code modifications.

  • @flyboy -
    GPS is 2
    Arming light is 1 (though it is the reverse of what you ask for - it blinks when NOT armed and is on steady when armed.
    Default for low battery is fast flash, so you don't need a value. So if you add, you a mode value of 3
  • @leonardhall - for one of my quads, I am using some no name no label beeper from Hong Kong that I had lying around. It is very loud, but I have no idea where I got it unfortunately. On my other, I am using a Radio Shack one that is not very loud at all.
  • NavBlink blinks the LEDs when it hits a waypoint.  This is just a "nice to have" feature if you're flying waypoints and you can't hear your ground station.

  • Scott, 107, yes 107 makes sense.  That is in fact exactly what I use myself.

    Leonard, I picked up some cheap piezo beeper at Radio Shack in the US when I was down there.  However, be careful as I find it's too quiet.  You can hear it for arming, but once the motors start, you can hear it (it can beep if the battery is low).

    The specified maximum current per pin is 40mA, with a maximum total of 200mA.  However, I have been... apparently running up to 80mA using Hobby King 3-LED modules, without a problem. <shrug>  I had checked a few before using them, and they seemed OK.  But apparently they have widely variant current draw, and I didn't find out the problem until I sat down and measured them all.

    Another easy way to do this, is to use the pin output to drive the gate of a FET.  I do this on both my multirotors.  Very easy to do.

    On my big heli, I use a ULN2803 to drive the LEDs.  I did get a IOBoard a while back, but it seems to have been DOA.  I bought another recently, but haven't gotten to setting it up yet.

  • Thanks Scott, that NAV blink sounds useful, I think I will set it up somehow, have never used Auto mode yet though. I don't think I want my remote GPS or Arm LEDs to ever NAV blink, as their blinking potentially means something else "critical" to proper/safe operation. So a separate LED for that, maybe can combine it with low-battery flashing (haven't tried it)?

    I am driving my repeated GPS/Arm LEDs (VERY bright) with a ULN2803 directly off of the 3s battery. I can see the on-board APM LEDs well enough except in bright sunlight.

  • What number should I enter to get:

    GPS off = blink A6

    GPS on = solid A6

    Motor disarm = solid A7<---

    Motor Arm = blink A7 <---

    Low battery = blink fast A4 <---

  • The JD-IOboard looks interesting.  Problem is there does not seem to be enough documentation explaining how to impliment the exact functionality we are talking about in this thread.  How do you get leds to indicate ARMED and GPS lock.  The IOboard configuration tool shows Flight Modes.  The example program shows how to program the pins or leds not how to monitor the MAVLink.  How do you load the application on the IOBoard?

     

    I am building a quad copter and not that familiar with all the nuances of Arduino programming environment so while this board is be interesting, and I would probably buy one if there was documentation or explaination of how to actually get the leds I desire to work.

This reply was deleted.