More flash hacking…

Arduino flash trigger prototype 1

Up until a few years ago, bolting bits of electronics together to do complex things was quite a steep learning curve.   If you could do it all without any processing, you could connect individual logic gates together to make things happen.  There is a lot to wrap your brain around to get things to work.  Happily, now there are a number of small computers around that are focussed on input and output at a basic level – reading voltages, or on/off states and outputting them on other connections too.

I built an Arduino based robot kit from 4Tronix recently.  It comes with 3 sensors:  an ultrasonic range-finder, active infra-red obstacle detectors and a air of line followers  (detects light or dark surface).   The logic is in software – you write code saying things like “if this sensor says ‘Yes there’s summit there’  then send a signal out of this connector”.  It’s really easy to learn (especially if you wrote code in C 20 years ago, the constructs for loops and blocks are identical, however all the complex bits are gone – we built 25 of these robots and got 13-14 year old school kids to program them.  They all picked it up in about 10 minutes).   In this way you could make the robot move in a certain way depending on what the sensors saw.   This got me thinking:  I know how the object sensors work, and I know now, having messed with Triggertrap mobile app, how to trigger my flash.  Can I put the 2 together?

I bought an Arduino starter kit (well a 3rd party one actually, with a helluva lot more bits in it, but no documentation – I like to live dangerously :P).  I also bought a couple of the infra-red sensors and the range-finder used on the robot from 4tronix.  These are dirt cheap btw, each sensor costing about £5 – even cheaper if you buy from a distributor in China.  First I hooked up one of the obstacle sensors and wrote a very simple program to send the value back to my PC where I could see it on the output window.

Next, the hard part:  connecting my flash radio trigger to the Arduino.  Ideally I wanted to plug in the Triggertrap dongle to the Arduino to make use of the photo-couplers inside it to protect the devices from my dodgy soldering.  The Triggertrap cable is designed to plug into an iPhone’s headphone socket, so I found a cable with one of these sockets on it and chopped the other end off.  After exposing the 3 wires inside (ground, left and right audio channels) I soldered a wire onto each one that ends in a pin, that I could insert into a standard Arduino/breadboard hole.  This took a *long* time.  The wires in the cable are a mixture of cotton fibres and copper and do not solder easily.  I eventually got them connected to the “proper” wire on the pin cables and sealed each joint in heat-shrink wrap.

Now I had to figure out which wire was which.  I powered up the Arduino, and put one of the 3 wires into the “ground” socket on the Arduino.  Then, I inserted each of the 2 other wires into the 5 volt hole one at a time and watched the trigger led on the radio trigger.  After a while, I figured out which one had to be ground and which carried the signal.  I also discovered I needed to connect the signal wire to ground between each try – seems like the radio trigger needs this to signal the end of the trigger pulse.

So, now I had the wiring figured out, I connected the trigger to ground and one one of the digital pins on the Arduino.  I then wrote a simple loop that puts that output pin high for 50 milliseconds, and then low again.  It then waits 2 seconds and repeats from the start.   It worked!  I connected an sB900 to one of the radio receivers and turned it on:  minimum power.  It flashed obediently every 2 seconds.

I then re-connected the obstacle sensor  and wrote some more code to only trigger the flash if the obstacle sensor detected something.  It works very well.  I added a 2 second delay after activating the flash to prevent multiple flashes for each detection (i.e. wait for the object to move away before starting to detect objects again).  Here’s the completed code:-

 

const int lDetect = 12;                               // the number of the detector pin                      
const int flashPin = 7;                               // the number of the flash pin

// the setup routine runs once when you press reset:
void setup()
{
// initialise the input pin for the obstacle sensor
 pinMode (lDetect, INPUT);

// initialise the output of the flash trigger pin
 pinMode(flashPin, OUTPUT);
 digitalWrite(flashPin, 0);
}
void loop()                                     // Everything between the {} after loop() repeats forever
{
 if (digitalRead(lDetect)==0)                   // Object detected - do all of the things between the {}
 {
   digitalWrite(flashPin, HIGH);                // Pulse trigger for 50ms
   delay(50);
   digitalWrite(flashPin, LOW);
   delay(2000);                                 // Wait 2 seconds to avoid multi flash
 }
 delay (50);                                    // Wait 50ms, and then go back and check again 
}

Easy isn’t it?  Even if you never wrote any software in your life, you can see what’s going on.  Here’s a very short video of me testing it.  The USB cable is used to download the code into the Arduino, however it’s  just providing power during this video – the code is already in and running.  The yellow cylinder is the infra-red detector.

 

 

6 thoughts on “More flash hacking…

  1. Chris Steel

    Hi Owen,

    Many moons ago circa 1982, I built an analogue sound operated trigger, basic stuff using a 555 timer and a home made microphone.
    The connectivity was a custom made push fit plug & socket (I can’t remember why I couldn’t use a bought one) low tech but very effective,
    I used it to burst balloons with, you can see the rip from the pin and the balloon collapsing but always with an outline.

    What will you be doing with this one, any ideas ?

    Chris

    Reply
  2. scooter Post author

    Hi Chris – not sure yet. I would like to get some insects in flight next year, and may build a portable rig with 2 sensors crossed in front of the camera (will trigger the camera in this case, which will trigger 2 flash guns in turn etc). Maybe some balloons with flour, water etc inside and generally smashing things with hammers 🙂 I also saw some really cool shots somewhere of exploding veg 😀

    Reply
      1. scooter Post author

        Very nice Chris – I’ve seen this approach used to get on owl in flight – they always take the same path apparentley so put a large frame in the way and they will fly through it. This one is a bit small at 10″ though – might work on bats though I think I’ll aim mine out to cross in front of the camera and chase the insects- no need for a frame. Might need to switch to a laser emitter/detector setup.

        Reply
  3. Phil Walker

    Here’s an idea Owen check out Tim Tadders water wigs just google water wigs. A bsolutely brilliant if you get the flash triggering right.
    Cheers,
    Phil

    Reply
    1. scooter Post author

      Lovely:) bit like the milk dress shots everyone was doing a few months back. Biggest challenge must be for the model not to flinch 🙂 Taking and manipulating liquid splashes seems a big thing with advertising shooters. (see photigy.com )

      Reply

Leave a Reply to Phil Walker Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.