Hi,I'm converting my DJI phantom 2 to use an APM 2.5 and would like to control the tri coloured LEDs that are under each of the 4 arms of the quad.I've figured out, that the LEDs are controlled using PWM and I've written some test code on an arduino UNO to cycle through the possible states, I,e Off, Red, Green and Yellow ( yellow is actually achieved by red and green on at the same time, but its handled by the DJI combined ESC /LED driver board)Ideally I'd like to get the APM to output the necessary PWM on its output pins, but that would require a custom build and I'm not sure what output pins could deliver hardware PMW, ie as I don't want to put too much additional software load on the CPU.So I guess my next best approach is to use small Arduino e.g. nano or micro, or possibly just a bare Atmega328, programmed with code to listen to the Mavlink output.However I can't find a list of the data that is sent by the mavlink. I know it must be documented somewhere, but I'm not sure where.Ideally the LEDs needs to show initially whether the APM IS ready to fly ie it has GPS lock etc, but in flight Id like to use the LEDs to indicate battery voltage warnings and possibly flight mode etcIf anyone could direct me to any useful information in this regard I'd be gratefulThanksRoger ClarkPs.I've posted the pulse width info required to control the LEDs into an existing related posting on converting the DJI phantom, but they are basically 180uS for Red, 280uS for Green and 380uS for Yellow, and around 100uS will be no LEDs, as will pulse widths above about 450us.
You need to be a member of diydrones to add comments!
Otherwise, if you want to use an Arduino to listen to the MAVLink output, it would be easiest to take download the APM source code (https://github.com/diydrones/ardupilot) and import the MAVLink library into your Arduino project.
Roger Clark > Stephen DadeApril 24, 2014 at 5:54pm
Hi Stephen,
My understanding that directly driving the LED's using A4 to A8 are binary controls, i.e they are either on or off.
Unfortunately I need PWM to drive the existing hardware on the DJI Phantom 2.
So as you say, it looks like MAVLink is probably my best option.
Replies
The APM can drive (low-power) LED's directly: http://copter.ardupilot.com/wiki/nav-leds/
Otherwise, if you want to use an Arduino to listen to the MAVLink output, it would be easiest to take download the APM source code (https://github.com/diydrones/ardupilot) and import the MAVLink library into your Arduino project.
Hi Stephen,
My understanding that directly driving the LED's using A4 to A8 are binary controls, i.e they are either on or off.
Unfortunately I need PWM to drive the existing hardware on the DJI Phantom 2.
So as you say, it looks like MAVLink is probably my best option.
I've found some existing projects that use MAVLink, and I'm hoping to modify the code, i.e I've looked at MInimOSD (as it reads MAVLink) and also this tutorial http://qgroundcontrol.org/dev/mavlink_arduino_integration_tutorial and also this code http://autoquad.org/software-downloads/?did=31
Thanks
Roger