Home PageChdk


This article is about making an IXUS remote control to be able to take pictures using any standard infra red remote. (eg your TV remote) To operate it needs CHDK which is a firmware that you can load into many canon cameras. It stands for Canon Hack Development Kit and offers a huge range of additional features. What i especially like is the ability to add scripts with which you can add new features to the camera. Its a really cool ide. Check it out here. This page will not delve into CHDK itself as you can read all about it on the CHDK pages. I have a IXUS960IS which is the camera i used to test all that is stated here.

Simple button ixus remote (take picture only)

Of course i wanted to make a remote control so that i could take pictures at a distance. There is a page dedicated on this on CHDK. The idea is for the switch to power the USB power line on and off and use the get_usb_power statement in the scripting language to detect this and operate the camera. You only need a very simple button and battery circuit like below to make this happen. I did have to experiment a bit with the battery as with me a 3V cell battery did not work. Using 5V from the arduino was fine. So i will use two cells with a diode to drop down the voltage in series for my final circuit.

CHDK Remote circuit
The CHDK IXUS remote LUA script is really simple for taking a picture as shown below.

while 1
  wait_click 1
  if is_key "remote" then shoot

Initially i used a simple switch  like the reset button on the arduino. This worked fine but needed a USB cable between the switch and the IXUS960IS. In practise this is rather inconvenient because the cable gets in the way and you are also restricted as to the distance you can cover.

Using a TSOP1838 as a button (take picture only)

The next step was to look at using a IR remote receiver. I used the TSOP1838 which i also used for decoding the remote control signals using the arduino. Below you can see how the IR signal from the remote control is processed in the receiver. The signal is modulated at about 38kHz to suppress the surrounding IR light for example coming from the sun. Eventually the signal exits the receiver and comes out as a series of pulses. We can use this in our CHDK remote control. When the signal is driven high and the USB port is powered the IXUS is driven to take a picture. The rest of the signal is missed because the IXUS firmware is busy doing other things. Fortunately this does not matter as the result of taking a picture is achieved.

ir signal

So how should we wire the thing together. If you open up the IXUS960IS there is a USB port This is where the circuit should be connected to. The USB port usually has wires with the colours red, green, black and white and they are normally connected as per the diagram below. In our circuit we only use the red and black wires. You need a power source. I used my arduino to deliver 5V but you can also use a battery source.
Connect the battery 5V to both PIN1 of the TSOP1838 and the red USB wire.
Connect battery ground to PIN2 of the TSOP1838.
Connect TSOP1838 PIN3 to the black USB wire.
You use the same very simple CHDK LUA script as above. Thats all. You can now use any button on any IR remote control to operate the camera.

Canon usb connectorCHDK remote IXUS schematicixus usb connection


I came across some USB connector which were perfect for making a small PCB which allows the above function. The resulting PCB you can find below and you can also purchase them from the shop.


Complex IXUS remote using arduino (many functions)

Ok so that is very nice but i would like to do more. CHDKlover came up with the idea to write a script that looks for the length of time that the pulses on the USB port is high or low.
By combining this in a smart way quite complex signals could be transmitted to the IXUS. It is a kind of morse code that can be sent.
There are 4 commands that look at the USB port and these could be used to achieve this.
do p = get_usb_power 0 until p>0             returns the pulse width of the most recent USB power activation
do p = get_usb_power 1 until p>0              returns the current state of USB power ( 0=off, 1=on)
do p = get_usb_power 2 until p>0              returns a buffered pulse width or pulse gap value (width values are positive, gap values are negative)
do p = get_usb_power 3 until p>0              returns the most recent number of pulses in a window (terminates after 1 second of inactivity)
To test if this concept would work i used the following LUA script for the IXUS.
This script either takes a picture or zooms in and out a bit depending on the length of time the button from the first example is pressed.
This demonstrates the ability to detect the length of signal which is the essential function needed if a more complex signal is to be transmitted.
CHDK LUA script to test complex functionality process using button aproach from above

Show »

@title test remote

a = get_usb_power
until a>0
if a>0 then print a
if a < 100 then gosub “shootpic” else gosub “dozooms”
until is_key “set”
sleep 1500
for n=1 to 3
sleep 800
next n
for n=1 to 3
click “zoom_out”
sleep 800
next n

Of course an arduino could also generate such pulses and i implemented a small program to do just that. In all 8 different codes can be sent and you can take different actions when these codes are received on the IXUS side. At this moment the script simply prints out the length of each bit as it is received. This way we can check if the data is getting across successfully.

The arduino program is below.  All this program does at the moment is give three commands in succession. Zoom in Zoom out and take picture. You could connect these instructions to buttons on the arduino but better would be to read a IRremote control signal and translate that into the appropriate command. We already can read IRremotes as you can read here. These give accurate outputs on any remotes. Allocating each buttons code to an instruction will give you the possibility to give the IXUS instructions under remote control. How cool is that.

Show »

 *  Remote control for canon cameras, using CHDK on camera.

#include <Arduino.h>

// LED signals

#define SIG_STARTED "...-"  		// started, all initialisations done
#define SIG_ERROR "...---..." 		// heavy error not used
#define SIG_SHOOT "."			// take image

#define  VERSION  "0.1"

// misc
#define SERIAL_COM_SPEED 9600

// output pins
#define  CAMPIN       2
#define  LEDPIN	     13

#define CHDK_ZOOM_IN		"S.1.0.0"
#define CHDK_ZOOM_OUT		"S.0.1.0"
#define CHDK_SHOOT		"S.1.1.0"
#define CHDK_EXP_MINUS		"S.0.0.1"
#define CHDK_EXP_ZERO		"S.1.0.1"
#define CHDK_EXP_PLUS		"S.0.1.1"
#define CHDK_EMERGENCY		"S.1.1.1"
#define CHDK_NULL		"S.0.0.0"

#define S_PAUSE 30
#define S_START 70
#define S_LBIT 10
#define S_HBIT 40
#define DEADTIME	250  // min. time between to commands
void setup()
	// setup serial communication for debugging
	// output some informations on serial
	Serial.println("CHDK - remote control");
ttversion "); Serial.println(VERSION); pinMode(CAMPIN, OUTPUT); pinMode(LEDPIN, OUTPUT); signalLed(SIG_STARTED); Serial.println("[status]tstarted"); Serial.println(); } void loop() {        for(int i=0;i<3;i++){ // Zoom if (i == 0) { chdkSend(CHDK_ZOOM_OUT); Serial.println("[chdk]ttzoom out");                         delay(3000); } if (i == 1) { chdkSend(CHDK_ZOOM_IN); Serial.println("[chdk]ttzoom in");                         delay(3000); } // Shoot if (i == 2) { chdkSend(CHDK_SHOOT); Serial.println("[chdk]ttshoot"); signalLed(SIG_SHOOT);                         delay(3000); } } } void signalLed(const char chrMorse[]) { for (unsigned int i = 0; i < strlen(chrMorse); i++) { digitalWrite(LEDPIN, HIGH); if (chrMorse[i] == '.') { delay(200); } else { delay(600); } digitalWrite(LEDPIN, LOW); delay(200); } }   void chdkSend(const char command[]) { for (int unsigned i=0; i<strlen(command); i++) {    switch (command[i])    {    case 'S':                                   digitalWrite(CAMPIN,HIGH);                                   delay(S_START);             break;    case '.':                                   digitalWrite(CAMPIN,LOW);                                   delay(S_PAUSE);     break;    case '1':                                   digitalWrite(CAMPIN,HIGH);                                   delay(S_HBIT);     break;    case '0':                                   digitalWrite(CAMPIN,HIGH);                                   delay(S_LBIT);     break;    } }                 delay(DEADTIME); }

Of course the IXUS script should be adapted to that so that the commands do what they are supposed to. This could be anything from zooming in or out to changing the focus etc.
When this is all working i will make a small circuit board with an Attiny85 processor under the arduino IDE which will do the job.
Its a bit tricky because of the lack of Timer2 which is used on the arduino program. Watch this space.


If you want to use the zoombrowser program from canon you need to switch off CHDK so that the driver recognises the camera. This can easily be done by switching the write protect switch on the camera SD card. You can now also try ptpcamgui which you can find https://www.box.com/shared/sv6u44gnph. This gives access to  the canons internal ptp functionality. The gui does all the work and you get a nice interface possibility. The german site http://forum.chdk-treff.de/viewtopic.php?f=7&t=2207 gives a good description of how this all can be used. The english version can be found here http://chdk.wikia.com/wiki/PTP_Extension You need to install an additional driver. The instructions for this can be found in the above links. I found some difficulties in  this as the zoombrowser driver needs to be active in order for the driver program to install correctly. Above you can see how this is done with the SD card write protect switch. After this run  the inf-wizard.exe program from the driver directory. You can then select the appropriate Canon camera from the list. After this the driver can be installed.


There are a whole series of other cool things you can do with the CHDK firmware. Here follow some ideas.


In photography, bracketing is the general technique of taking several shots of the same subject using different camera settings. Bracketing is useful and often recommended in situations that make it difficult to obtain a satisfactory image with a single shot, especially when a small variation in exposure parameters has a comparatively large effect on the resulting image. Autobracketing is automatic bracketing by using a setting on the camera to take several bracketed shots (in contrast to the photographer altering the settings by hand between each shot). Given the time it takes to accomplish multiple shots, it is typically, but not always, used for static subjects.

Exposure bracketing

Without further qualifications, the term bracketing usually refers to exposure bracketing: the photographer chooses to take one picture at a given exposure, one or more brighter, and one or more darker, in order to select the most satisfactory image. Technically, this can be accomplished by changing either the shutter speed or the aperture, or, with digital cameras, the ISO speed, or combinations thereof. Exposure can also be changed by altering the light level, for example using neutral-gray filters or changing the degree of illumination of the subject (e.g. artificial light, flash). Since the aim here is to alter the amount of exposure, but not otherwise the visual effect, exposure compensation for static subjects is typically performed by altering the shutter speed, for as long as this is feasible.

Many professional and advanced amateur cameras, including digital cameras, can automatically shoot a bracketed series of pictures, while even the cheaper ones have a less convenient but still effective manual exposure compensation control.
Exposure bracketing is indicated when dealing with high-contrast subjects and/or media with limited dynamic range, such as transparency film or CCD sensors in many digital cameras.
Exposure bracketing is also used to create fade-in or fade-out effects, for example in conjunction with multi-vision slide shows, or in combination with multiple exposure or flash.
When shooting using negative film, the person printing the pictures to paper must not compensate for the deliberately underexposed and overexposed pictures. If a set of photos are bracketed but are then printed using automated equipment, the equipment may assume that the camera or photographer made an error and automatically “correct” the shots it determines are “improperly” done.
Images produced using exposure bracketing are often combined in postprocessing to create a high dynamic range image that exposes different portions of the image by different amounts.
See also: Automatic Exposure Bracketing

Flash bracketing

Flash bracketing is a technique of working with electronic flash, especially when used as fill flash in combination with existing light, maintaining the overall amount of exposure. The amount of light provided by the flash is varied in a bracketed series in order to find the most pleasing combination of ambient light and fill flash. If used for this purpose, flash bracketing can be differentiated from normal exposure bracketing via flash, although the usage of the term is not strict.
Alternatively, if the amount of flash light cannot be altered easily (for example with studio flashes), it is also possible to alter the aperture instead, however, this will also affect the depth of field and ambient light exposure. If the flash to ambient light ratio is to be changed in flash bracketing using this technique, it is necessary to counter-shift the shutter speed as well in order to maintain the level of ambient light exposure, however, with focal plane shutters, this is often difficult to achieve given their limited X-sync speed – and flash techniques such as high-speed synchronizationare not available with studio flashes.

Depth-of-field bracketing

DOF (Depth-of-field) bracketing comprises taking a series of pictures in stepped apertures (f-stops), while maintaining the exposure, either by counter-shifting the shutter speed or, with digital cameras, adapting the ISO speed accordingly. In the first case, it will also change the amount of motion blur in the picture. In the second case, it may visibly affect image noise and contrast.
Combining DOF bracketing with multiple exposure, the so called STF effect (for Smooth Trans Focus) can be achieved.
You can use focus bracketing to increase the DOF (depth of field) of a photo. This is especially useful for macros, because often the DOF is so shallow that large parts of the picture will be blurred. Just load your pictures into CombineZM (freeware), click “Macro>Do Stack” and they will be combined into one photo with large depth of field.

Focus bracketing

Focus bracketing is useful in situations with limited depth of field, such as macro photography, where one may want to make a series of exposures with different positions of the focal plane and then choose the one in which the largest portion of the subject is in focus, or combine the in-focus portions of multiple exposures digitally (focus stacking). Usually this involves the use of software with unsharp masking, a filtering algorithm that removes out-of-focus portions of each exposure. The in-focus portions are then “stacked”; combined into a single image. Focus stacking is challenging, in that the subject (as in all brackets) must stay still and that as the focal point changes, the magnification (and position) of the images change. This must then be corrected in a suitable application by transforming the image.

White balance bracketing

White balance bracketing, which is specific to digital photography, provides a way of dealing with mixed lighting by shooting several images with different white point settings, often ranging from bluish images to reddish images. When shooting in a camera’s RAW format (if supported), white balance can be arbitrarily changed in postprocessing as well, so white balance bracketing is particularly useful for reviewing different white balance settings in the field. In contrast to manual white balance bracketing, which requires the photographer to take multiple shots, automatic white-balance bracketing, as it is implemented in many digital cameras, requires a single exposure only.

ISO bracketing

ISO bracketing is a form of simulated exposure bracketing in which aperture and shutter speed (thus depth of field and motion blur) remain constant. The brightness levels in this case are only altered by increasing or decreasing gain, or amplification of the digital signal prior to the conversion to an image file such as a JPEG or Tagged Image File Format. This type of bracketing must be performed with the camera in Manual mode but is easy to implement simply by shooting a single properly exposed image in RAW and applying exposure compensation in post processing. This is analogous to “pushing” or “pulling” in film processing, and as in film processing, will affect the amount of “grain” or image noise.
It is also possible to apply a type of ISO bracketing which brackets the signal gain while maintaining a constant level of brightness in the finished photograph. In this case the exposure compensation (EV value) setting remains constant while bracketing the ISO value in Av, Tv, or P mode, which will have a corresponding effect on the shutter speed, aperture value, or both. This form of ISO bracketing could potentially affect not only image noise, but also depth of field and motion blur.
In-camera Automatic ISO Bracketing is uncommon and therefore must usually be performed manually.


Stereo Photography


KAP (Kite Aerial Photography)



links to other pages dealing with photography.

http://www.diy-streetview.com/ A DIY Google streetview machine
http://www.canoremote.de/ Remote control of the Ixus using an apple remote control
http://www.achillies.com/CHDK_Files/USB_Splitter.htm Split the USB signal to get video out
https://www.box.com/shared/sv6u44gnph This is ptpcam repository
http://forum.chdk-treff.de/viewtopic.php?f=7&t=2207 German ptp forum
http://www.instructables.com/id/Remote-for-Canon-Compact-Cameras/ remote control using an ir receiver

Leave a Reply