The Pixhawk-CHDK trigger is coming along nicely. The prototype is done and the firmware is almost done.
The firmware is actually very simple. I'm using 32 bit timers for both measuring incoming RC PWM signal for for outputting 5 V pulses of specific lengths and all the USB CDC functionality is copied-and-pasted from a previous project. The most complex part is actually for command-line interface (or "CLI") parser.
To configure the device you plug into your computer using a mini-USB cable and then connect using Telnet, screen or other terminal application.
The command set is pretty simple and supports the following commands:
list -- shows all defined intervals add 1000,1200,85 -- adds a new interval delete 1 -- removes entry 1 change 1=1000,1300,85 -- changes entry 1 pulse 50 -- sends an output pulse of 50 ms show -- shows all settings parameters show <setting> -- shows the value of a single parameter set <settings>=<value> -- changes the specified settings parameter help -- shows available commands ? -- same as "help"
No need to "save" or similar. Everything is stored in EEPROM as soon as it is entered.
The PCB design is also almost done. I just need to check it a couple of times (time well spent, trust me) and verify footprints (likewise time well spent). The size is 5 x 2 cm and even though I probably could squeeze it down some more, I think I'll keep the current size seeing as how I'll be hand-soldering some of the parts and applying solder paste and components all by hand.
Here's a rendering (from the excellent 3D Gerber Viewer from Mayhew Labs:
I have begun creating a CHDK trigger cable for the Pixhawk autopilot in my IRIS+ drone.
It will allow me to control a Canon compact camera (IXUS 60 in my case since I had one of those laying around) from the autopilot.
CHDK is the Canon Hack Development Kit which will allow you to do a whole lot more with a Canon compact camera than what the basic knobs and dials will let you do. It also allows for scripts to be run on the camera – LUA (nice) and Basic (yuck) – and enables remote control through the USB port.
The purpose of this trigger cable is to convert the 3.3 V RC PWM signals from the Pixhawk (PWM with pulses from approximately 1000 µs to 2000 µs; read more here if you want) to 5 V pulses (from about 10 to a couple of hundred milliseconds) for the camera.
With the trigger cable complete and the camera mounted on the IRIS+, I can trigger shots from either the RC transmitter or by using pre-programmed actions in auto-missions. Those images can later be stiched together in Photoshop or Microsoft ICE or similar to create a nice high-resolution aerial photo.
While I'm sure this project could be implemented using less sophisticated hardware, I'm using an LPC11U24 microprocessor since that is my weapon of choice for pretty much anything.
I'm trying to make the device as small as possible so I will be using a 7 x 7 mm HVQFN package which will require the PCB to be reflow soldered (we've come a long way since all ICs had to be 0.1" DIL packages). I will also be using a 1 mm pitch JST-SH connector for MCU programming instead of big 0.1" pin headers. Both power and signal input as well as output signal will use Molex SL connectors with locking tabs (which I use everywhere else on my IRIS+).
The resulting images will look this one from a thread on DIY Drones ( A successful APM aerial survey mission):
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.