Shooting milk with Arduino

posted in: News | 0
Some kinds of events happen so fast, you need to use specialised techniques to capture the action.

Photography is one of those artforms which allows you to capture amazing things that the eye can see, and also things that it can’t. It might be the image is too dark, like a night time scene with wildlife, or maybe even something outside the visible spectrum like infra-red or ultra-violet. Photography has become increasingly accessible to everyone, with increasingly powerful cameras being fitted to smart phones, everyone is now a professional photographer now, right?

Using real cameras

There are still many types of photography which simply aren’t practical to execute on a smartphone, and the only way to effectively capture is with a camera that is just a camera, not a smartphone. High speed photography is one of those. High speed photography is essentially a type of shooting where you make the capture at an exact point in time, by exact, we mean something that can be captured with millisecond accuracy.

If you wanted to capture something at an exact moment, you need to know a few things:

  1. What event can be predictably monitored before, at or after the moment of the event you want to capture? e.g. a sound, a flash, kinetic energy, an object passing past a certain point.
  2. How quickly can you get that signal to a device that can act upon that signal?
  3. How quickly can you get the camera to capture upon instruction from the device that just found out the event happened?
  4. Does the photo look any good, or do you need to speed up the capture or change the delay between the effect you’re measuring for and when you trigger the capture?
Timing is everything

The above might sound complex, a different way to look at it is below:

  • [preceding event]
  • (delay)
  • [event you want to capture]
  • (delay)
  • [proceeding effect]
  • (delay)
  • [image is captured]

If you know the delays, then you can make your capture happen exactly when you need it to. This even allows you to use prediction to capture events that are over too fast for your equipment to process in time. For instance, if you want to try to capture the fractures propagating through glass being smashed, you could create a predictable delay in the swing of the hammer and use that to decide when to capture, that way the hammer arrives on impact just as the capture is happening. Even before the sound waves can get to any sensor you might be using.

Simple tricks that make a difference

High speed photography can create some amazing images, and it doesn’t have to just be limited to photographers who are able to justify huge costs in specialised equipment. The parts list for a working high speed photography rig can be surprisingly low.

Here are some of the parts you need to build a basic setup.

  • Camera that can do long exposure(10-15+ seconds)
  • External flash.
  • Arduino
  • Some cheap electronic components

Most cameras can do some form of long exposure, the mid-range Canon Powershot cameras will do this, even if you have one of the IXUS models, and it’s one that can have the custom CHDK firmware on it, it will work too.


With the right setup, you can actually capture something at the exact moment, or even before the high speed event occurs.

Imagine you want to capture something splashing into a fish tank full of water. You can measure the item when it passes past a known point and time for exactly when it will hit the water or you can try to sense for the sound of the splash.

If you were trying to measure before the item hits the water, you might use an LED and LDR to create an invisible barrier or photoelectric gate, when an object passes past that barrier we know it’s on its way down to the water where it will splash at a specific time. As long as it travels predictably to the point of impact, we can anticipate when that will be, then fire the flash at just the right moment.

We can rely on the effect of gravity to tell us exactly how long it will take for something to impact the water because gravity will cause the item to travel and accelerate at a known speed.


There are a few things you can do to get a consistent timing

Maybe the object we’re measuring is too big to pass through our photoelectric gate or it tumbles and gives inconsistent timing for our photo. If that’s the case, we can measure the sound, or the kinetic impact of when the object hits the water.

If the item were a pineapple, we might have an interesting challenge, the leaves might not make much of an impact when they hit the water, but the body of the fruit would. Depending on what lands in the water first might determine when we want to capture our image.

We could use a microphone to measure the sound of the impact and capture based on that, or we could also tape a piezo transducer to the fish tank and measure the kinetic impact of the fruit hitting the water. This has a few benefits.

Taping a piezo transducer to the side of the tank can avoid the microphone having to be placed so close to the action that it’s at risk of getting splashed.

According to the Wikipedia, sound travels through air at around 331m/s, this gives us a limited amount of time to recognise our event, process it and send a command to the flash. If we had the transducer taped to the side of the tank, the sound will travel from the point of impact through the water to the transducer much more quickly. Sound travels through water at around 1484m/s, this gives us more time where we can process the impact and choose to fire the flash earlier. What does all this mean in practical terms? More creative options for our photography because we can acquire our signal earlier and choose when to do things.

Getting the timing right

After we’ve obtained our signal from the impact, we need to process then produce another signal that will trigger our flash so we can capture the magical moment.

The Arduino is quite capable of receiving signals from piezo transducers and triggering camera flash units. While the Arduino doesn’t have the processing power of the Raspberry pi, it’s very fast to respond to signals, so if you only wanted a few milliseconds between a splash in water and a flash firing, the Arduino would be up to the task.

When you trigger an external flash, the most common way is with a PC sync cable, this is on most external flashes. Some flashes have a high voltage at their PC sync cable plug, this is not something you want getting into the Arduino, or the smoke might get out.

There are a few components you need to put into your setup in order to avoid any voltages that might exist in your flash unit getting into your Arduino. The most important is an opto-isolator. This device has an LED and a light sensitive transistor, you can’t see the LED, but the transistor can and this optical gap between these two components is what keeps the Arduino’s 3.3-5V separate from a potential 350V inside the flash.

Combining all these components correctly gives you a platform which allows you to capture very interesting images that otherwise would be missed.

Want to build one?

We’ve done a lot of talking about a high speed photography rig, but haven’t provided a lot of detail on what we’ve built. The reason is that we haven’t built one yet, we’ll be building one this Saturday 4th August at the Melbourne Computer Club.

If you are an electronics, photography, computer or project enthusiast, then come along to our meetup where we’ll be working together to construct a basic high speed photography rig. If you have any of your own components, a partial or completely finished project, feel free to bring it along too.