Go Down

Topic: CHDK Camera remote shutter (IR/bluetooth/shutter) (Read 7376 times) previous topic - next topic

AlxDroidDev

Jan 26, 2015, 06:03 pm Last Edit: Mar 09, 2015, 03:59 pm by AlxDroidDev
I just completed a project that is a CHDK Remote trigger.

CHDK (http://chdk.wikia.com/wiki/CHDK) is an extensible, non-permanent firmware add-on for several Canon cameras. It runs from the SD card, and can be easily enabled or disabled. It improves the original firmware with several new features. One of them, and the base for this project, is the ability to add remote shutter capabilities through the USB. This remote shooting feature has several modes. One of them ("Quick") will make the camera shoot with just a short pulse on the +5V pin of the USB connector.

More info about this here: http://chdk.wikia.com/wiki/USB_Remote

So, my project was to create a "device" that would connect to a CHDK-enabled Canon camera and allow me to shoot it through an infra-red remote control, bluetooth (an Android app was created for that), or simply with the shutter button on the device.

The device is connected to the camera through USB.

This is the final device:






Hardware:
- Internally it features an Atmega328P (the bootloader was kept, and you'll know why).
- The voltage regulator is a MAX603 LDO, low quiescent, 5V
- It is operated by a 9V battery or through a FDTI
- The bluetooth adapter is a JY-MCU v1.02 (from DealExtreme)
- The IR receiver is a Vishay TSOP1738
- a small buzzer for signaling the command has been received
- The 3-position DIP switch enables/disables the following features: all LEDs, buzzer, bluetooth
- there is a USB connector, where the camera is plugged
- the DTR (= RST + 100nF cap), TX, RX, VCC and GND pins are exposed, to easily connect a FDTI adapter and make updates to the Arduino code. This is why I kept the bootloader
- the "box" features a standard 1/4 screw, to where the camera can be attached
- Red LED: power status
- Green LED: shutter
- Blue LED: bluetooth status. blinking = not paired; solid = paired
- the button on the picture works as a shutter, just like the one on the camera. This is specially useful for long exposures, where even pressing the shutter on the camera maves it vibrate a little.


Software
- Arduino: using Ken Shirriff's  IRremote library to decode the TSOP 1738 codes and also the SoftwareSerial to connect to the bluetooth device.
- I have decoded both the Nikon and Canon IR remote controls, and my "box" will work with both.
- All LEDs are PWM'd (10/255 duty cycle), in order to save power
- ADC, SPI, TWI and brown-out detection are disabled in order to save power
- Holding the shutter button for 2 seconds, the device will enter "continous" shooting mode, and a picture will be taken every 0.5 second for as long as the button is pressed.

- Android: an Android app was developed to work the camera in "Zoom" mode. This way I can not only shoot the camera, but also control its zoom.




Initially the entire project was built on a breadboard:


Then I decided it was good enough to be made into a box, and I started building on a protoboard. Using a protoboard was my worse decision in this project: I wish I had followed my instincts and designed and etched my own board. I believe I lost much more time soldering all the wires in the protoboard than I would have designing and etching my own PCB, as I had done in the past.



Other features:
  • through the Android app I can control several modes of the device, including intensity of the LEDs (they are all PWM'd), buzzer on/off, and the app may or may not override the DIP switches
  • the Android app also configures the interval of pictures when the device is in continuous modes (from 200ms to 2 secs)
  • the reason I kept the bootloader is because I also exposed a serial port, to which I can connect a FTDI USB-to-UART bridge and quick reprogram/update the firmware on the Atmega328. This way I don´t have to open the device and remove the Atmega328 everytime I make changes to the code. This serial port is visible in one of the pics, on the left side of the device.
  • Ironically I used a Nikon IR remote control to test and develop this, but any remote control can be used


More photos of the done device and the "making of":  Picasa web album


Some of my projects:
Shield for DS1337+, DS1624 and AT24C1024B (RTC, temp & mem): http://forum.arduino.cc/index.php/topic,126197.0.html
CHDK Camera remote shutter (BT, IR, USB): http://forum.arduino.cc/index.php?topic=295377.0

almamater


AnalysIR


AlxDroidDev

Some of my projects:
Shield for DS1337+, DS1624 and AT24C1024B (RTC, temp & mem): http://forum.arduino.cc/index.php/topic,126197.0.html
CHDK Camera remote shutter (BT, IR, USB): http://forum.arduino.cc/index.php?topic=295377.0

shuggy99

#4
Mar 09, 2015, 02:29 pm Last Edit: Mar 09, 2015, 02:30 pm by shuggy99
Hi there.  Maybe you can help me with the zoom functionality?  Don't need anything as complex as you're set up.

This is for a disabled person to be able to use big external buttons to control the zoom in, out, and shoot.

Is there a particular shape to the pulse for zoom?  I know the wiki say "pulses needs to be "on" for longer than 100 mSec, "off" for longer than 50 mSec and a 500mSec gap indicates the end of the counting period."  but not sure how to go about this.

Any chance I can have a look at your code for the ZOOM functionality to get an idea of what I'm doing?

Cheers

 

AlxDroidDev

#5
Mar 09, 2015, 03:37 pm Last Edit: Mar 09, 2015, 04:00 pm by AlxDroidDev
Hey shuggy99,

It is a square wave with a duty cycle of about 66% (2/3 HIGH, 1/3 LOW), and in my case the period of the wave is 180ms.

Keep in mind that for the Zoom function to work, CHDK in the camera has to be configured for remote shooting, and "Control Mode" has to be "zoom mode".


here is my "zoomShoot()" function:
Code: [Select]
const byte SHTR_LED_PIN = 6;   // Uses PWM
const byte USB_PIN = 4;
uint8_t  CONF_INTENSITY = 40;

void zoomShoot(byte pulses) {
  analogWrite(SHTR_LED_PIN, CONF_INTENSITY); //

  for (byte i=1; i<=pulses;i++) {
    digitalWrite(USB_PIN, HIGH);   
    delay(120);
    digitalWrite(USB_PIN, LOW);
    delay(60);
  }
 
  delay(440);
 
  digitalWrite(SHTR_LED_PIN, LOW);
}


To use the function, you just call zoomShoot() with the number of pulses (or cycles), for the desired actions:

  • 1 pulse   = zoom in one step
  • 2 pulses  = zoom out one step
  • 3 pulses  = shoot
  • 4 pulses  = zoom completely in
  • 5 pulses  = zoom completely out
Some of my projects:
Shield for DS1337+, DS1624 and AT24C1024B (RTC, temp & mem): http://forum.arduino.cc/index.php/topic,126197.0.html
CHDK Camera remote shutter (BT, IR, USB): http://forum.arduino.cc/index.php?topic=295377.0

AnalysIR

@shuggy99 - If the last post doesnt work out for you.....

What model of camera do you have? Is it CHDK already?
Do you have the original IR remote? model #?
Do you have an IR Receiver (other than in the camera)?  model #?
Do you have an Arduino? type?

If you have all of the above & an Arduino , just try out the examples provided with IRLib or IRremote libraries.


A good place to learn about IR remote control is:
http://www.sbprojects.com/knowledge/ir/


shuggy99

#7
Mar 09, 2015, 04:18 pm Last Edit: Mar 09, 2015, 04:38 pm by shuggy99
Now THATS quick replies :)  Many thanks.

Testing using an A810 but will be using an SX260.  Just not seeing anything happening with the timings I've tried.

I've used CHDK in the past with APM - quadcopter - for aerial surveying so 'familiar' with it but nothing in depth…


With my limited knowledge I think I've been trying the wrong method.  Been using digitalwrite and delay but probably the wrong way


Every day is a school day...

AlxDroidDev

#8
Mar 09, 2015, 04:56 pm Last Edit: Mar 09, 2015, 04:58 pm by AlxDroidDev
Regarding electrical connections, for the above sample code to work you have to connect the camera's USB GND to the Arduino's GND. Connect the camera's USB +5V to what I defined as USB_PIN (digital 4). There are no resistors or anything else required for this to work.

You, however, have to make sure that CHDK in the camera is properly configured (Remote Shooting is enabled and Control mode = Zoom), like this:



Oh, and for the above code to work, your setup() function has to include these lines:


Code: [Select]
pinMode(USB_PIN, OUTPUT);
digitalWrite(USB_PIN, LOW);
Some of my projects:
Shield for DS1337+, DS1624 and AT24C1024B (RTC, temp & mem): http://forum.arduino.cc/index.php/topic,126197.0.html
CHDK Camera remote shutter (BT, IR, USB): http://forum.arduino.cc/index.php?topic=295377.0

shuggy99

#9
Mar 09, 2015, 05:33 pm Last Edit: Mar 09, 2015, 09:24 pm by shuggy99
I don't want to Hijack your post with my newbie stuff - will start a new thread. 


http://forum.arduino.cc/index.php?topic=307057.0

Go Up