I’ve gotten myself an IRIS+ quadcopter and it is awesome!
It also offers limitless possibilities for creating add-ons – both software and hardware-based.
My first project is a 1W LED front light in order to help with orientation (and look cool).
The light will be mounted to the IRIS+’s front GoPro mount with a 3D printed mount. I’ll print the prototype myself and then order it on Shapeways as a higher quality SLS printed version (here it is).
Power will be supplied from the flight battery through a ZXLD1350 switching regulator-based circuit I designed a while back for another project.
Since the LED driver supports turning output on/off I though I could control the LED from one of the Pixhawk’s relay pins.
Small issue though: the ADJ pin on the ZXLD1350 interprets a voltage of 0 as off (which is fine) and 1.25 V as 100% on. Which is not entirely fine since the relay pins on the Pixhawk toggle between 0 and 3.3 V. So I’ll use a standard NPN transistor so the ADJ pin will toggle between 0 V and floating which will use the internal resistor as pull-up. The schematic looks like this:
And it works like this:
|Pixhawk relay||Pin voltage||ZXLD1350 ADJ pin voltage||result|
|on||3.3 V||0 V||LED off|
|off||0 V||internally pulled up to 1.25 V||LED on|
In other words, relay off means LED on and vice versa.
The transistor is a bog standard BC547 NPN. And since I can’t be bothered to modify the PCB for the LED driver and send off for fabrication and so on, I’ll just solder it on, glue it to the back of the PCB and shrinkwrap the entire mess. Not perfect, but good enough for jazz.
The control pin is attached to the Pixhawk’s AUX OUT 5 signal pin (physical pin no. 54) and power and ground is spliced into the power lead going to the gimbal.
Since the PCB is open to the environment on the backside of the mount and since the pins for VIN and GND are attached directly to the flight battery and are only 0.1" from each other, the entire PCB will be potted using either just hot glue or proper potting compound (e.g. QSil–216) so the battery will not get shorted by a stray drop of water.
In Config/tuning -> Standard parameters, the
First Relay Pin (RELAY_PIN) is set to
Pixhawk FMU AUX5 (this is default).
On the Extended Tuning page,
Ch8 Opt is set to
(If this option is not available, go to Full Parameter List and set
CH8_OPT to "28" for "Relay On/Off" (on APM:Copter 3.3.3; the value might be different on other versions))
This will allow the light to be turned on/off by toggling relay 0 in auto missions (
DO_SET_RELAY) and toggling channel 8 from the transmitter.
Since channel 8 is currently unassigned, I’ll use that to control the relay. I’m using a Taranis TX so setup is as easy as can be:
CH8 MAX Weight(-100%) Switch (!SG↑) R MAX Weight(+100%) Switch (SG↑)
In other words: for channel 8, set value to –100% when switch G is not in the up position. And set value to +100% when switch G is in the up position.
Remember that due to the transistor, relay on means LED off, so a channel 8 value of –100% will turn the LED on. So if switch G is in the up position, the LED is off; otherwise it is on.