Navigation Lights with digital RGB LEDs together with an APM 2.5

Hello All, 

First I will say, Great job guys (developers).

And now....

I like to show our setup with AdaFruit digital Navigation RGB-Led's:

 

The cool thing with this setup is, each RGB-Led is separated to control.

To let this work well, we decided to use a Nano board to control the Led's.

And we are using the defined COPTER-LED 1 true 6 on the APM2/APM2.5 board.

 

I have included some code in the original leds.pde and system.pde, after some tests I will show the code here soon.

In this code I've added some extra functions like:

 RGB_LED_1 = Armed/DisArmed function
 RGB_LED_2 = GPS Fix function
 RGB_LED_3 = Battery Low
 RGB_LED_4 = AltHold mode
 RGB_LED_5 = Loiter mode
 RGB_LED_6 = Dancing Led's (sensor calibration)

These function are not yet visible on the first showed video's !

Here a first impression video including all functions:

A better video is coming soon, this depends on the weather in Holland :-)

I hope you all like this setup.

Best regards,

Marten

Views: 1255

Tags: APM, APM2, APM2.5, LED, Lights, Navigation, RGB, led's

Comment by Oliver Sumpton on October 11, 2012 at 11:06pm

Dude, this is awesome!! I'm in the process of  attaching some Adafruit strips to my Hexa right now, except I'm using a Pro Mini instead of a Nano to control the strips. Haven't got it all together yet but would love to check out your code sometime on how to integrate mode awareness into the Mini.

Again, so awesome! You rock.

Comment by Tim Powell on October 12, 2012 at 12:47am

It is hard to tell orientation with a copter, but I think you have your red and green backwards.  Red is supposed to be on the left wingtip.  I know it seems arbitrary, but if you are going to do red and green, you should match what full size aircraft use.

Comment by Marten on October 12, 2012 at 2:31am

@ Oliver,

Thanks for your reply and good to hear you like this setup.

Here a small peace of the leds.pde code:

////////////////////////////////////////////////////////

static void RGB_FlightModes(void)
{
  if (g.battery_monitoring == 3 || g.battery_monitoring == 4) // Battery monitor is activated
  {
  if (low_batt = true)
      {digitalWrite(COPTER_LED_3, COPTER_LED_ON);} // Battery is Low !
  else
      {digitalWrite(COPTER_LED_3, COPTER_LED_OFF);} // Battery is OK
  }
  if (g.battery_monitoring == 0)                    // Battery monitor is NOT activated
      {digitalWrite(COPTER_LED_3, COPTER_LED_OFF);}
 
    switch(control_mode)
   {
    case ALT_HOLD:
      digitalWrite(COPTER_LED_4, COPTER_LED_ON);
      digitalWrite(COPTER_LED_5, COPTER_LED_OFF);
      break;
    case AUTO:
    case GUIDED:
    case RTL:
    case LOITER:
      digitalWrite(COPTER_LED_4, COPTER_LED_OFF);
      digitalWrite(COPTER_LED_5, COPTER_LED_ON);
      break;
    case POSITION:
    case LAND:
    case CIRCLE:
    case STABILIZE:
      digitalWrite(COPTER_LED_4, COPTER_LED_OFF);
      digitalWrite(COPTER_LED_5, COPTER_LED_OFF);
      break;
    case TOY_A:
    case TOY_M:
    break;
   }
}

///////////////////////////////////

This code makes it possible to get the right action with the FlightModes.

At this moment I'm only using AltHold / Loiter and Stabilize.

And I'm reading the Battery-monitor status, because we don't use a current/voltage sensor all the time.

So if this option is disabled in Mission Planner, there is nothing happened with the Low-Battery warning...

If it is enabled and the battery is getting to low, it gives a warning to flashing fast with some Led's.

As I said, I will share this complete code soon.

@ Tim,

The video with only the Led's showed on a table is up-side down filmed !

That's why it looks mirrored.

On all other video's you will see the correct Navigation setup.

Regards,

Marten

Comment by Marten on October 12, 2012 at 2:42am

@ All,

I forgot to tell that we hopefully can let it work with a MavLink communication to our Nano or other Arduino based board !

If we understand that protocol better and it will work:

This will make it a lot of easier, because we don't need to edit the original ArduCopter code again and again...

If there is a ArduCopter or other ArduPilot firmware updates, we just can upload this to the APM board and the Led's are still working :-)

A other good thing is, we are not limited to maximum three FlightModes !

If MavLink will work, we can use all FlightModes.

Regards,

Marten

Comment by Oliver Sumpton on October 12, 2012 at 1:41pm

@Martin: very cool. so you're modifying led.pde to indicate 3 different modes to your Nano using two APM pins, or something like that? (side note: i didn't even know led.pde existed, so thank you for that :)

It does seem to make the most sense long term to try to read the MavLink telemetry stream. Do you think this is the best starting point for that: http://qgroundcontrol.org/dev/mavlink_arduino_integration_tutorial#... ?

Comment by Marten on October 12, 2012 at 4:32pm

Hello Oliver,

I didn't modified the on-line sketch.

I've downloaded this .zip file: http://arducopter.googlecode.com/files/ArduCopter-2.7.3.zip

There you will get the complete ArduCopter 2.7.3. map with all the .pde files and other files.

In the map Arducopter you will find the leds.pde

We connecting 6 I/O pins (AN4 true AN9) + the GND to the Nano.

 COPTER_LED_1 = Armed/DisArmed function
 COPTER_LED_2 = GPS Fix function
 COPTER_LED_3 = Battery Low
 COPTER_LED_4 = AltHold mode
 COPTER_LED_5 = Loiter mode
 COPTER_LED_6 = Dancing Led's (sensor calibration)

There is only one thing about the Dancing Led's...

The original dancing_light in the leds.pde sketch isn't used !

static void update_lights()
{   
  digitalWrite(COPTER_LED_6, COPTER_LED_OFF); // Stops RGB LED's Dancing
 
  switch(led_mode) {
    case NORMAL_LEDS:
        update_motor_light();
        update_GPS_light();
        RGB_FlightModes();
        break;
    case AUTO_TRIM_LEDS:
        dancing_light(); 
        break;
    }
}

I've found out that this action can be found in the system.pde.

/*
 *  called by gyro/accel init to flash LEDs so user
 *  has some mesmerising lights to watch while waiting
 */
void flash_leds(bool on)
{
    digitalWrite(A_LED_PIN, on ? LED_OFF : LED_ON);
    digitalWrite(C_LED_PIN, on ? LED_ON : LED_OFF);
    digitalWrite(COPTER_LED_6, COPTER_LED_ON);
}

So I've included the COPTER_LED_6 ON action there.

About MavLink...

Of course many thanks for the link.

I think we already have found all the info what we needed about MavLink.

We only have to find the time to start reading....reading and study this protocol, so we get all that information in our head :-)

Comment by Tom Griep on October 12, 2012 at 4:58pm

Do you have any Schematics on how this is all wired up?

Comment by Marten on October 12, 2012 at 5:29pm

I don't get a schematic at this moment.

But it's a easy setup with the RGB led's and the Nano connection.

Here some pictures from our self designed PowerBoard and the Led's:

I hope this will give a better idea.

Later I will come back with a complete schematic.

Comment by Tom Griep on October 13, 2012 at 6:23am

I am assuming that the Nano reads the pins from the APM and then blinks the LED's. Is that how it works?

Comment by Marten on October 13, 2012 at 1:39pm

Hello Tom,

Yes that's the way how it works.

Comment

You need to be a member of DIY Drones to add comments!

Join DIY Drones

Social Networking

Contests

Season Two of the Trust Time Trial (T3) Contest has now begun. The fourth round is an accuracy round for multicopters, which requires contestants to fly a cube. The deadline is April 14th.

A list of all T3 contests is here

Groups

Advertisement

© 2013   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service