Posted by UAS_Pilot on September 24, 2012 at 7:35am
Is there a simple way to control Navigational lights on and off using the APM 2.0? I would like to use a software switch to enable and disable the lights in flight.
any help or insight would be great.
Thanks
You need to be a member of diydrones to add comments!
You could use an unused servo channel for this. In them Mission planner there is a special waypoint type (DO_SET_SERVO) which can change a servo channel output on APM (that way, it would also be possible to change the lights directly from the Transmitter).
I am using an ATtiny85(~$3) to switch some additional stuff. I am only switching LEDs, you probably would need a FET to switch more powerful lights.
Example ATtiny85 code:
/** * Read PPM signal * * Decode r/c receiver PPM servo signal and turn lights on * according to servo position. * * $Id$ */
// from which pin to read. #define PIN_PPM 0 #define PIN_POS1 3 #define PIN_POS2 4
// the length of the pulse (in microseconds) or 0 if no pulse // started before the timeout (unsigned long) unsignedlong duration, lastgood = 0; intposition= 0;
Replies
I found this great website to help you compare products and brands: http://www.nauticexpo.com/boat-manufacturer/navigation-light-398.html
I just use this controller on my quad, with the really high vis LED's:
http://www.braincube-aero.com/index.php?main_page=product_info&....
Runs off a single channel. Simples. Warning: it's heavier than you might think.
You could use an unused servo channel for this. In them Mission planner there is a special waypoint type (DO_SET_SERVO) which can change a servo channel output on APM (that way, it would also be possible to change the lights directly from the Transmitter).
I am using an ATtiny85(~$3) to switch some additional stuff. I am only switching LEDs, you probably would need a FET to switch more powerful lights.
Example ATtiny85 code:
// from which pin to read.
#define PIN_PPM 0
#define PIN_POS1 3
#define PIN_POS2 4
// the length of the pulse (in microseconds) or 0 if no pulse
// started before the timeout (unsigned long)
unsigned long duration, lastgood = 0;
int position= 0;
void setup() {
pinMode(PIN_PPM, INPUT);
pinMode(PIN_POS1, OUTPUT);
pinMode(PIN_POS2, OUTPUT);
digitalWrite(PIN_POS1, LOW);
digitalWrite(PIN_POS2, LOW);
//Serial.begin(115200);
}
void loop() {
duration = pulseIn(PIN_PPM, HIGH, 20000);
if (duration == 0) {
duration = lastgood;
} else {
lastgood = duration;
}
position = map(lastgood, 1000, 2000, 0, 2);
if (position > 0) {
digitalWrite(PIN_POS1, HIGH);
} else {
digitalWrite(PIN_POS1, LOW);
}
if (position > 1) {
digitalWrite(PIN_POS2, HIGH);
} else {
digitalWrite(PIN_POS2, LOW);
}
}
Best
-S