Camera Controller Finished Box

Arduino Camera Controller

The Arduino Camera Controller project was my first Arduino project, one that sparked my interest in electronics. The objective of this project started by building a sensor-triggered camera controller, similar to the amazing Camera Axe. I followed that project for two years, and it is truly amazing what he/she was able to accomplish with it (as far as I can see, that project can now be considered a professional product). This was my starting inspiration; I wanted to build something that could activate my Canon Rebel XTi from a sensor, and also have the option to take a series of photos for use in a time lapse video. This writeup is how I got from zero knowledge of electronics and mechanical engineering to a (nearly) finished project.

Camera Controller Finished Box

Camera Controller Finished Box


From the very beginning, I wanted this project to fit in a portable box that I could use outside while shooting photos. This meant that the finished product would have to be:

  • Configurable – I need to be able to configure settings (such as duration of a shot or delay between shots) when I got to a location without having to reprogram the Arduino. In other words, a user interface. One of the first things I learned was how to program an LCD and how to detect button presses (thanks, Ladyada!), so the project ended up with an LCD to display a configuration menu, and four buttons to be able to navigate it or to control the camera (i.e. start the time lapse loop).
  • Robust – it has to survive being transported in a backpack (i.e. during hikes). This meant that it could not be just a breadboard with a bunch of wires; it had to be in a closed box.
  • Salvageable – almost any component that I put into it has to be replaceable or salvageable. If I needed an Arduino and didn’t have a spare one, I should be able to rip it out and reprogram it, or to replace it with another one. In other words, the design has to be modular.

Configurations

The Camera Controller so far has the ability to configure the following aspects:

  • Shutter Speed (Time Lapse)
  • Delay Between Photos (Time Lapse)
  • Number of Photos [1 to infinite] (Time Lapse)
  • Focus Before Fire (Time Lapse) – tells the camera to use the auto focus before firing a shot
  • Trigger Type (Sensor) – Low or High, tells the camera controller whether to fire when the value from the sensor is lower than the threshold value, or higher than the threshold value
  • Threshold (Sensor) – the threshold for the sensor below or above which the camera will fire.
  • Delay (Sensor) – how big of a delay there should be after the sensor is tripped before the camera fires
  • Sensor Type – Analog or Digital.
  • Number of photos [1 to infinite] (Sensor)
  • Sensor Value – Get a reading from the sensor and optionally set the current value

Triggering the Camera

The camera is really easy to trigger using a 2.5mm stereo audio cable. There are three contacts on a male jack, the closest to the cable is the camera ground. The middle one is the focus trigger, and the tip is the camera fire trigger. Shorting the focus contact with the camera ground contact will focus the camera (same as pushing the camera “fire” button half way down); shorting the fire contact with the ground will take a picture.

                          _____________
 ________________________|
| fire | focus  | ground |   cable
|______|________|________|
                         |_____________

In electronics, when two wires need to be connected together mechanically, a switch could be used to physically bridge two connections (such as fire and ground to fire the camera). To do it electronically, typically a transistor will do this (in this case an NPN 2N2222 or 2N3904 transistor). In the above example, the “fire” trigger wire (tip) would go to the “emitter” side of the transistor, the ground would go to the collector AND — this is very important — connected to the common ground (i.e. to the same ground as the Arduino), and my electronic trigger (i.e. software trigger) would go to the base.

Transistor Control

Transistor Control

However, the problem with this method is that if there is a power surge or if something bad happens on the Arduino circuit and the Arduino fries, my $700 camera will fry too because it is tied to the common ground. To completely isolate the camera, I used two opto-isolators 4n25 (pictured as 4n35 because Fritzing didn’t have the 4n25 part) which provide no physical contact between the camera and the Arduino, making them much safer:

Optoisolator Trigger

Optoisolator Trigger

By the way, you’ll notice a resistor between Arduino’s digital output and the opto-isolator in the schematic above. This is because opto-isolators contain a small LED that will burn out with too much current, so the transistor becomes necessary (use the Ohm’s Law to find your value). I already destroyed one opto-isolator this way…

Thankfully, though, the lesson to use opto-isolators instead of transistors was a lesson I didn’t need to learn the hard way – everywhere I looked online suggested to use opto-isolators just in case. Skimping on two $1-parts could potentially cost me my camera, and I was not willing to take that risk. But remember, always buy double what you need (i.e. I needed 2 opto-isolators, I bought 4) because you WILL make a mistake at some point (thanks again, Ladyada, for that advice!).

LCD

For connecting the LCD to the Arduino, I just followed (surprise!) Ladyada’s excellent tutorial. As a side note, after a few iterations of trying to make a package for the project I realized two things:

1) I needed a ribbon cable and connectors in order to be able to separate the project board from the LCD, so that the LCD can be detached easily, and also so that the wires will bend nicely inside the case. At first I used 22 AWG wire, which is more rigid than a dear in headlights, and that didn’t end well. For connecting stuff, I decided I am almost always going to use a ribbon cable and crimp the connectors and housings to it. As an aside, this was a nice introduction to the world of crimping and connector types.

2) I also needed to minimize the number of wires running from the LCD to the Arduino (if the cable is too fat, it will NOT bend). In LadyAda’s tutorial, you’ll notice that there are 12 pins (out of 16) that are used on the LCD. However, only 6 are data connectors, and one for power and one for ground. So, in reality, I only needed an 8-pin cable instead of a 12-pin cable to connect to the Arduino. The caveat is that the potentiometer must be on that same board (not a problem at all, because really the pot belongs with the LCD not with the Arduino).

The resulting schematic looks like this:

LCD

LCD

And the final board looks like this:

LCD Board (Front)

LCD Board (Front)

LCD Board (Back)

LCD Board (Back)

LCD Mounted on the Board

LCD Mounted on the Board

Input Buttons

Input buttons are straight forward. I did not use interrupts (although, I might change that in the future, especially when the system is waiting for the next shot in a time delay). However, I did have to use 10µF capacitors to reduce button debouncing. Also, remember to wait until buttons are released before launching an action (i.e. equivalent to “touch up inside” event in the iOS SDK).

Another note, I also had to add a way to hold down a button while modifying a setting (for example, delay between pictures) so that the longer the button is held down, the faster the setting will change. However, I did not iron out all the problems with this feature, so I will add another post later.

The buttons can also potentially be put anywhere in the project box, so it is important that they be detachable from the main board where the Arduino is. Therefore, ribbon cable + 6-pin connector (4 for the buttons, one for +5V, one for GND):

LCD, Buttons, and OptoIsolators

LCD, Buttons, and OptoIsolators

And the finished board:

Buttons (Front)

Buttons (Front)

Buttons (Back)

Buttons (Back)

Menu System

Now that I can control the camera from the Arduino, the next part is to make the control configurable. How I created the menu system is actually described in my earlier write-up.

Sensor

For the sensor, I used a photo-resistor (Cadmium Sulfite Cell) that reacts to light, and hooked it up to an analog port. Like the Camera Axe, I wanted to be able to plug different kinds of sensors into the board and adjust the threshold at which to fire the camera once the sensor is tripped. Therefore, the sensor should be pluggable into the board. The nice thing about the Arduino analog input is that it can double as a digital input. To take advantage of this, I added a menu item so that the user can set the type of sensor (analog or digital).

To connect the sensor, I used another stereo audio cable, because the sensor needs +5V, GND, and a Arduino input connection. Also, stereo audio cables are readily available, so if I need to make another sensor, I could easily hook one up at low cost. This is also why I decided to use a 3.5mm jack instead of the camera’s 2.5mm jack – cost and so that it isn’t confused with the camera input.

Camera Controller SchematicHere is the complete schematic of the project.

Lessons Learned

  • Always label connections. You really do not want to trace a connection back to its source with a twisty ribbon cable.
  • Always use connector cables instead of soldering directly onto the board.
  • Headers are your best friend. You can always solder female headers onto a board, and plug an RBBB into it instead of soldering the RBBB directly onto the board. This makes it much easier to remove, and it’s pretty much secure in place. Also, know when to use angled versus straight headers.
  • Double the room you think you will need for construction, especially for your early projects. By trying to miniaturize too much, I shot myself in the foot too many times and had to start over.
  • Write neat notes, and label your schematics properly. This is a life saver when you have to start over (that’s why engineers are so meticulous about writing everything down!) or when you want to make another one. Luckily, I had the foresight to do this.
  • For the love of God, always double-check that you are not shorting an input pin on the Arduino. I fried one Arduino because I made a mistake with the sensor wiring and connected +5V directly to A0.
  • …but that led me to buying an ATMega328P-PU from Jameco, only to find out it had no bootloader. So I learned how to do that, too. Now I can build my own for cheap.

More Project Photos

I don’t yet have any photos from using the Camera Controller, but here are some more photos of the actual project.

Camera Controller Inside the Project Box

Camera Controller Inside the Project Box

Light Sensor Module

Light Sensor Module

Light Sensor Module Closed

Light Sensor Module Closed

Sensor and Camera Connector Board (Back)

Sensor and Camera Connector Board (Back)

Sensor and Camera Connector Board (front)

Sensor and Camera Connector Board (front)

Components outside the box

Components outside the box

Sensor Connector Board Front with a Face

Sensor Connector Board Front with a Face

Second Failed Attempt at Boxing the Project

Second Failed Attempt at Boxing the Project

Project in the Early Stages

Project in the Early Stages

Main Board with the Arduino

Main Board with the Arduino

Leave a Reply