The camera (http://www.banggood.com/Wholesale-Wltoys-V959-Rc-Helicopter-Spare-Parts-Camera-V959-16-p-61599.html) which came with my WLToys V959 RC quadcopter does a reasonably good job of recording video - audio is of course there but never much to listen to with motors buzzing ...
But lately, I've been flying my Bixler more than the V959 and I was thinking about mounting the camera on the Bixler instead - but in order to do that, I need a way to trigger the camera record function (and optionally photo function).
So I did some tinkering and I've managed to find out what the four pins on the V959 flight controller header do:
yellow: +3.3v nominal, pull to ground for 250ms to start or stop video fuction
white: +3.3v nominal, pull to ground for 250ms to take a still photograph
One of the nice folk at 9xforums (Kilrah) suggested I would need some active circuitry between the receiver and camera, pointing me to the rc-cam.com (http://www.rc-cam.com/project1.htm) project page for some examples.
So I decided to get hacking with my Arduino Uno to see if I could power and trigger the V959 camera's video function from my plane's Turnigy 9X8Cv2 receiver :eek:
I hooked up my Arduino Uno to the 9x RX thusly:
+5V from the Uno to +BAT on the RX
GND from the Uno to -BAT on the RX
Digital Input pin 5 on the Uno to channel 8 SIG on the RX
I then used pulseIn to read the pulses on channel 8 which I had mixed as "CH8 100% FULL GEA" in er9x.
I initially just printed out the values - 1400ish when the gear switch was off, 1900ish when the gear switch was on.
A little video of the output from the Arduino's serial monitor is here: http://www.flickr.com/photos/allandrick/8509087140/ (http://www.flickr.com/photos/allandrick/8509087140/)
Next step was to wire up the camera, powered by the Arduino 5V rail, and trigger the camera trigger somehow when the gear switch was toggled..
Kilrah to the rescue again with a little hint that allows you to not need a level converter on the 3.3v pin of the camera by using the Arduino's output as an open collector: When you need it LOW, turn it LOW. When you need it high, do NOT turn it HIGH, but switch it to input mode instead. The camera's pull-up will do its job and hold it at 3.3V. As long as you're careful not to set the pin HIGH you're good.
That made the design a bit simpler! So I ordered some attiny45 chips and, after a bit of googling and micrometer measuring (image search for the win), I found a molex 1.25mm pitch plug/header connector that looked like it was a match for the one on the WLtoys V959 flight controller camera port - that way I wouldn't have to hack up the camera cable and could move it between the plane and the quad as desired :D
I got some servo extension cables from ebay and waited for the deliveries to arrive.
Two days later (today) the packages had landed and I set out building a test circuit on a breadboard. I soldered one of the molex connectors to some jumper cables so I could plug them into the board and prototype with the attiny45 - what a nightmare!
My eyesight isn't that good up close (I wear reading glasses) and even with a magnifying glass, I was struggling. Thankfully, the trusty Multimeter confirmed that there was no short circuit... *phew* - the testing on attiny45 could begin!
Here's a pair of videos demonstrating the functionality (one from my perspective, one from the WLtoys camera which I am triggering with my er9x gear switch :popcorn: ).
My crappy filming view:
WLtoys camera view:
Credit goes to the folks at the High-Low Tech group (MIT) for the great article (http://hlt.media.mit.edu/?p=1695) on how to use the Arduino Uno as an AVRISP for the AtTiny45.
The next task was to package it all up in one small package and try to protect the tiny connector, somehow...
Phew, that was hard work!
Soldering wires to the end of the molex male socket was a pain in the you-know-what. :censored:
The sockets I got were meant for surface mount boards, so I had to gently bend the bottom lugs up into little pins jutting out from the bottom of the connector - I then used the ends of some breadboard jumper wire with the pins removed from the crimped end, pushing the crimp over the tiny pins on the bottom of the molex plug. I then wicked solder into the crimp, making a nice secure connection to each pin on the molex plug - heat-shrinking each joint before starting the next. Rosin Flux for the win!
Even with the smallest heatshrink tube, it was a tight squeeze fitting them in the 1mm gap between each pin - thankfully I only needed 3 out of the 4 pins connected (video mode is all I care about, taking still photos is only as good as a single video frame on this camera anyway). I then pushed the wires through the square end of a servo cable shroud and glued it all together in a neat package:
This should remove any possibility of strain being put on the solder joints.
Soldering the wires to the AtTiny45 pins was easy enough - a bit of rosin flux (dispensed by my handy flux pen) followed by a dab of solder on the chip pins, and the solder on the ends of the tinned wires was enough to make a perfect connection without needing too much heat for too long. Six connections later and it was done :-)
I then twisted the wires gently on each end of the circuit and wrapped them around the chip and servo cable shroud for some extra strain relief and got it ready for heatshrink:
Just like a bought one!
All hooked up ready for installation in my plane:
I tested it and, as with the prototype above, it worked perfectly! I didn't bother adding the LED and resistor, even though the sketch still tries to turn it on, because the camera has an LED status anyway - which was enough for me to confirm I hadn't fried the chip with my soldering efforts nor had I created any shorts between wires in the molex plug end!
Happy days! I now have a remotely controlled camera controller for the princely sum of £2.50 ($4.00) worth of components and a few hours of labour. Given that I didn't have all the right tools for this kind of project, I am rather pleased with the result.
I'll be shooting some remotely activated video this weekend :-)