DIY remote control app for digital camera (via an Arduino Uno + BLE shield)

Andreas LundquistBlogs, Tutorials

Tweet about this on TwitterShare on FacebookShare on LinkedInShare on Google+

vintage_ixus_70Controlling a camera from an Arduino micro-controller opens up a world of possibilities for us mobile devtool guys; from advanced time lapse, to nature shots of shy game, who keeps stealing from the cookie jar to astronomical observations through a telescope-mounted camera.


You probably already have a phone, and adding an off-the-shelf microcontroller is an inexpensive way of getting it all together, and with many degrees of freedom. BLE goes at least 50 meters, even without an external antenna. In this tutorial, we use an Arduino Uno and a mounted ReadBearLabs BLE shield.

We have been avid users of Canon Hack Development Kit (CHDK) since we first discovered their work many years ago. For those of you who are not familiar with their work, they develop a firmware that enables extra features for supported Canon cameras. The project is mainly focused on point-and-shoot type of cameras. Over the years we have used the software to experiment with timelapse photography and used the enabled functionality to learn more about photography in general.

A couple of months ago, a friend of ours announced that he was get married this August. He revealed that the wedding party would take place in a large barn. Since we know that the barn had a high ceiling we immediately started to think that it would be kind of cool to place a camera up there in the ceiling with a birds-eye view over the party. Given our previous knowledge of CHDKs capacity to use the USB-port for remote triggering, we decided to build a Bluetooth remote controller that enables us to take photos at any given time using a smartphone. In order to build this we used the following hardware:

And this software:

 1. Preparing your camera

You will need to prepare your camera with the latest version of the CHDK. The CHDK community provides a great tutorial on how to do that, you can find it in CHDKs ‘Prepare Your SD card’ guide.

 2. Setting up your camera

Enter the CHDK menu and then navigate to CHDK Settings -> Remote Parameters.

  • Enable Enable Remote.
  • Set Switch Type to None.
  • Set Control Mode to Zoom.

 3. Preparing a USB cable.

Since we figured that we will experiment more with USB Remote triggering at some later point we simply made a prototyping cable by cutting an ordinary cable and soldering pins onto each wire. In order for this example to work, you will need wire #1 (red) and wire #4 (black) as explained in CHDKs Homemade USB Remote Cable instructions. Our cable ended up looking like this:

Camera cable for Arduino

Cable used to connect the Arduino with the camera.

4. Install libraries for the BLE Shield in Arduino IDE.


In order for the BLE Shield to work properly, you need to install two libraries into the Arduino IDE. A great guide for how to do that is RedBearLabs ‘Getting Started with BLE Shield’ guide. To the left a BLE shield mounted on the Arduino Uno, and with the cable attached (compare with Fritzing cirquit sketch below).

5. Hardware setup.

The hardware setup is rather simple in this example, just attach the BLE Shield to the Arduino UNO (It only fits one way). According to the CHDK project, the applied voltage must be 3-5 volt. Since Arduino UNO operates on 5 volt, there is no need for an additional circuit.  Just connect the red pin from the USB-cable to pin 3 and the black pin to ground as seen in the picture below. Note that the BLE Shield is not present in the image, but it provides the same pin numbers when mounted on top.

Arduino wiring for camera remote.

Camera cable connections on the Arduino. Note that the RedBearLabs BLE shield is missing in this drawing.

6. Creating  Arduino application.

The Arduino application will receive data via the BLE Shield and translate it into commands. In this application, the Arduino expects to receive single-byte messages which will be decoded to certain commands. We chose to use the camera in zoom mode meaning that there will be five commands available; (1) zoom-in single step, (2) zoom-out single step, (3) shoot, (4) zoom completely in and (5) zoom completely out. These commands were encoded according to the following table.

Action Byte
Zoom in one step 1
Zoom out one step 2
Shoot 3
Zoom completely in 4
Zoom completely out 5

In zoom mode the camera counts the number of pulses it receives on the USB-port. For the camera to detect one pulse it has to receive a signal that is 100 milliseconds high (5V) followed by 50 milliseconds low (0V). As it turns out the number sent from the smartphone happens to correspond to the number of pulses that the camera needs to detect in order to execute that command. So basically the application receives a number from the BLE link and then outputs the pulse an equivalent number of times on pin 3. We found that we had to increase each period with 20 milliseconds gave the camera a better chance detect the correct signal. So in this sketch, each pulse contains a 120 milliseconds high (5V) followed by a 70 milliseconds low.

You can find the Arduino sketch in the Evothings Gallery repository.

7. Creating the application in Evothings Workbench.

evothings_clientThis application is based on the example arduino-led-onoff-ble which is provided by Evothings. That example simply connects to a preconfigured host and enables the user to turn on and off an LED. In this case we want to send different commands to ensure that the Arduino outputs the correct signals to the attached camera.

The JavaScript libraries arduino-ble.js and easy-ble.js were copied into the project. The arduino-ble.js had to be modified to ensure that it connects to the BLE Shield named RemoteShut. The GUI was created using jquery-mobile to make the application look more app-like and to provide the user with feedback of what’s going on inside the application.

Camera remote app's first view

First connect to the Arduino.

Camera remote app's second view.

The app could easily be extended with more functionality.

When the user taps the Connect-button the application tries to connect to the preconfigured host RemoteShut, when connected a new view is presented where each button represents a different command. When one of those buttons is tapped, a command is sent to the Arduino.

You can find the mobile application code in the Evothings Gallery repository on Github.


This is an example of a complex task you can achieve in just a small amount of time using the techniques presented. There is still a lot of work to do, in order to make this application bullet-proof but in this form it works well enough for its purpose and a generous amount of aerial photographs were taken of the bride and groom and all the other guests.

This example could easily be extended to perform other tasks. CHDK provides a scripting interface (LUA or uBasic) that can be used to write custom scripts on the camera. They also provide an API which makes it possible to detect any signal and react accordingly. Imagine a script that would enable you to take a picture as well as record a movie. Or perhaps you would like to trigger several cameras at once or in a certain sequence.

Known issues

  • The camera doesn’t behave as expected. It seems like the CHDK firmware fails to detect signals or misinterprets signals every now and then. If this happens we found that simply toggling the camera’s context seems to solve the issue. Do this by switching from camera mode to viewing mode and back.