Ever fancied building your own camera controller?
IMPORTANT NOTE: Capacitors for the MAX619 are 470n or 0.47u. The schematic is correct, but the component list was wrong - updated.
This is an entry into the Digital Days competition so if you find it useful, please rate/vote/comment favourably! If you reallly like it and are a stumbler, hit "i like it!" :)
Update: featured on hackaday! hackaday.com/2009/10/13/a-different-breed-of-camera-controllers/
Update: new photos of the laser trigger in action!
Update: First Prize =D, thanks for voting and/or rating!
This instructable is mainly for the benefit of SLR users looking to get a bit more mileage out of their cameras, however if there are any point and shoots with IR interfaces, you might find this interesting. Certainly this will also work (with a bit of modification) with camera hacks where you can wire up logical outputs to camera trigger terminals.
This started off as a full blown tutorial, but due to some unexpected constraints i encountered later on, it may be more of a guide as to how to accomplish various things - i'll often leave you the choice on how you could do things which i think is a better way of doing things than just blindly saying "you must do this". Think of this as a lesson in camera controller design.
I've provided schematics and full code so you can always just copy it. It will be a simple case of transferring the design to a stripboard and adding the LCD for most people. I've gone through how to breadboard it since the process is very similar and allows for correcting mistakes before you make the design permanent!
Features:
Single shot mode
Interval (time lapse) mode
Triggered shot (trigger from external sensor) mode with variable conditions
Included sensor designs - light, sound (many more possible!)
Total cost - under £25 (excluding tools)
LCD Display for easy change of settings
Compatible with Nikon/Canon (coded), potential support (untested) for Olympus/Pentax
No firmware modification needed
Uses IR so is both wireless and doesn't damage your camera
I had the idea for this after sitting outside in the cold clicking my remote control for hours. I was doing an 8 second interval for around 1000 shots. I thought, hey, it's just an IR LED isn't it? Why can't i replicate it and make my own remote with a built in delay?
I then found out (somewhat embarrassedly, because i thought i'd had a massive brain wave) that this has been done and there are even a couple of instructables on the topic.
Where my implementation differs from most intervalometers and diy remotes is that it allows for a lot of customisation and modularity, is compatible with both Nikon/Canon (and likely others later) and combines the ability to take a picture on a particular trigger.
The idea is simple. You want to take a picture of something quite fast (limited currently by the lag on your shutter, for me 6ms). There are a variety of methods for doing this:
1. Trial and error you try to take the picture at the right moment
2. Improved trial and error you black out the room, put your camera on bulb (open shutter) and fire a flash at the right time
3. Buy a dedicated trigger controller that has some kind of audio/light sensor to take the picture at your command
4. Build one yourself!
Ok, 1 and 2 are fine for messing around and can yield some very good pictures. But what im going to show you is that its possible to construct a circuit that will give you consistent results time and time again. Most importantly, in these tight times, the cost is lower than alternative models (some people have produced kits doing this kind of thing, but they cost a fortune see links).
The versatility of the design is this:
If your sensor generates an output voltage between 0 and 5V, you can use it to trigger your camera!
On the face of it this is a boring statement, but once you begin to understand the implications it becomes very powerful. By simply monitoring a voltage level, your trigger could be light based (LDR), sound based (microphone or ultrasound), temperature based (thermistor) or even a simple potentiometer. In fact, just about anything. You could even link the circuit up to another controller and provided it can give you a logical output, thus you can trigger from it.
The only major limitation of the design currently is that it works only with IR interfaces, it would be fairly simple to modify the software and hardware to output via mini-USB or whatever sort of interface is required.
Note: Source Code:
I have provided some applications in step 13. The code i run on my controller as of now is up there in a hex file along with the main c file and its dependencies. You can simply run my code if you are unsure about compiling. I've also included some sample code that you can use in various steps (they're named obviously like remote_test, intervalometer test and adc test. If i refer to code in a step, odds are it's in there.
EDIT: An update about balloons popping - it seems i was a bit short sighted when i said you could easily shoot photos of popping balloons. Turns out that the skin on the average balloon travels so fast that it'll have popped completely by the time your camera fires. This is an issue with most cameras, NOT the controller (which senses the ADC at a rate of around 120kHz). The way round this is to use a triggered flash, which is doable if you add an extra wire out and another small circuit. That said, you could in theory use something else to pop it and play with the delay (or even change the delay code to include microseconds). A air pellet travelling 1m at 150ms-1 takes about 6-7ms, enough time to trigger and shoot. Just moving the gun would provide a rudimentary delay of a few microseconds. Again, apologies about this, i'm going to play about tonight if i can get hold of some balloons, but there are still many uses for an audio trigger, like fireworks!
I've put a quick and dirty time lapse below to show that it works however :)
Don't forget to read, rate and/or vote!
Cheers, Josh
Disclaimer
In the unlikely event that something goes horrifically wrong or you somehow brick your camera/dremel your cat, i am not liable for anything. By starting a project based on this instructable, you accept that and continue at your own risk.
If you make one of these, or use my instructable to help you - please send me a link/photo so i can include it here! The response has been overwhelming so far (at least by my standards) so it'd be awesome to see how people are interpreting it. I'm working on revision 2 as i type ;)
Remove these ads by
Signing UpStep 1: Some initial thoughts...
Microcontroller
The heart and soul of this project is an AVR ATMega8. It is essentially a slightly trimmed version of the ATMega168 chip that Arduino use. It is programmable in C or Assembly and has a variety of really useful features that we can use to our advantage.
" 28 pins, the majority of which are input/output (i/o)
" Onboard analog to digital converter
" Low power consumption
" 3 onboard timers
" Internal or external clock source
" Lots of code libraries and samples online
Having lots of pins is good. We can interface with an LCD screen, have 6 button inputs and still have enough left over for an IR LED to shoot with and some status LEDs.
The Atmel AVR series of processors has a lot of support online and there are plenty of tutorials in getting started (i will go over this briefly, but there are better dedicated tutorials) and heaps and heaps of code to mull over. For reference ill be coding this project in C using the AVR-LibC library.
I could have easily gone with PIC to do this, but AVR is well supported and all the examples i've found for remotes have been AVR based!
LCD Display
There are two main types of display, graphical and alphanumeric. Graphical displays have a resolution and you can put pixels wherever you like. The downside is that theyre harder to code for (although libraries exist). Alphanumeric displays are simply one or more rows of characters, the LCD has an onboard store of basic characters (i.e. the alphabet, some numbers and symbols) and its relatively easy to output strings and so on. The downside is theyre not as flexible and displaying graphics is virtually impossible, but it suits our purpose. Theyre also cheaper!
Alphanumerics are categorised by their row and column count. The 2x16 is pretty common, with two rows of 16 characters, each character being a 5x8 matrix. You can get 2x20s too, but i dont see the need. Buy whatever you feel comfortable with.
I chose to use a red backlit LCD (i want to use this for astrophotography and red light is better for night vision). You can go without a backlight - its entirely your choice. If you choose a non backlit route you will save power and money, but you might need a torch in the dark.
When looking for an LCD, you should ensure that it is controlled by the HD44780. It is an industry standard protocol developed by Hitachi and there are a lot of good libraries that we can use to output data. The model i bought was a JHD162A from eBay.
Input
Input will be done by buttons (simple!). I chose 6 - mode select, ok/shoot and 4 directions. Its also worth getting another small button for resetting the micro in case of a crash.
As for the trigger input, some basic ideas are a light dependent resistor or an electret microphone. This is where you can get creative or stingy depending on your budget. Ultrasound sensors will cost a bit more and require some extra programming but you can do some really neat stuff with them.
Most people will be happy with a microphone (probably the most useful general sensor) and electrets are very cheap. Be aware that itll need to be amplified too (but ill go over this later).
Output - Status
The only real output we need is status (besides the display), so a couple of LEDs will work fine here.
Output - Shooting
For taking pictures, we need to interface with the camera and for that we need a light source that can produce infra-red radiation. Thankfully there are a multitude of LEDs that do this and you should try to pick up a reasonably high power one. The unit i chose has a current rating of 100mA max (most LEDs are around 30mA).
You should also take care to note the wavelength output. Infrared light is in the longer wavelength part of the EM spectrum and you should be looking for a value of around 850-950nm. Most IR LEDs tend towards the 950 end and you may see a bit of red light when it's turned on, this isn't a problem, but it's wasted spectrum so try to go closer to 850 if possible.
Power
How are we going to power all this? Well, it's going to be portable so batteries! I chose to use 2 AA batteries which are then stepped up to 5V. I'll go over the reasoning behind this in the next few sections.
'Casing and Construction'
How you do this bit is entirely up to you. I decided to use stripboard for the circuit after prototyping because it's cheap and flexible and saves designing a custom PCB. I have provided the schematics so you are free to make your own PCB layout - although if you do, i would be grateful to have a copy!
Again the case is entirely your choice, it needs to be able to fit the screen, buttons (in a fairly intuitive layout if possible) and the batteries. As circuit boards go, this one isn't that complicated, a lot of the connections are simply to things like the buttons/LCD.




















































Visit Our Store »
Go Pro Today »




Provided the controller works to trigger the D3000, all you'd need to do is put your camera in bulb mode. You'd then send one shoot command at the start of the exposure and one at the end. I'm afraid I'm developing the next version of the controller so I'm not sure this code will get updated (the new one will have this functionality), but you could do it by setting the mode to time lapse with the interval set to your bulb duration. That way you get:
1) shot - bulb mode entered
2) interval
3) shot - bulb mode exited
4) interval etc
Not much use if you need shorter times between shots, but potentially doable. It would mean you get half as many pictures as you normally would in any given space of time.
I did have an idea to do something like this but instead of an IR i could connect it to the mini USB port on my camera and somehow program an Atmel chip to send WIA commands.
And also dosent bulb mode need to have its shutter button pressed so it would take bulb? Dosent that mean that the IR has to continually send the shutter open command?
For bulb mode on Nikon cameras, if you are in remote mode (as you should be using IR), the camera takes one shot command to open the shutter and another to close it. The reason I originally bought a proper remote was because you can't use bulb on the camera by itself because of the stupid "hold down the button" functionality.
I looked into commands over USB, but while Nikon provides an SDK for all the fun stuff like shutter speed/aperture control, most of it is wrapped in proprietary DLLs which I'm not happy about using.
It's always a good idea to put a current limiting resistor in series with the leds - I generally run them well under the recommended current rating to extend battery life anyway. The exception is the IR led which should be at maximum (something like 50-100mA depending on your precise led) to get the best range.
You can power the status LEDs straight from the AVR through a resistor to ground.
http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail&name=ATMEGA8A-PU-ND
Thanks for the help, and AMAZING guide!
Atmel lists the 8A as being compatible between 2.7 and 5.5V, so I wouldn't worry too much there if you still want to go with a 5V supply.
http://www.atmel.com/dyn/products/product_card.asp?part_id=4585
I believe I used a 5V converter because the LCD display required a 5V supply (JHD162A), but you may be able to find a pin-compatible one that requires a 3V input.
It would be convenient if you did, since the rest of the circuit would probably function fine with 3V.
Josh
|Csa |
|O + |
|-------------|
This does not help to build it.
I'm not sure what your problem is? This step deals purely with a discussion of the power supply. The later steps show you what should be connected to what.
Buggerit, why has the text gone!
Nice Project!
I build that, but not working (nothing write to LCD & no LED light up)
How set the fusebit in ponyprog?
What light LED1&2?
What doing the S1-S6?
Can u help me?
Have a nice day!
Low: 0xFD
High: 0xD5
(Avrdude command: -U lfuse:w:0xfd:m -U hfuse:w:0xd5:m)
What lights LED 1 and 2? Well, they're attached to two pins (PC1 and PC2) which are controlled by the C code provided. What are S1 to S6? They are the switches discussed in the instructable.
Apologies if it's not clear, but S6 is the "shoot" button. S5 is "mode" and S1-4 are the directional buttons. Looking at the code we see: S1 = Left, S2 = Right, S3 = Up, S4 = Down.
It's all in the definitions at the start of the C file so refer to that if you get stuck.
Nothing writes to the LCD? Do you get any output at all? What do you have connected to what? You're going to need to give me a bit more information!
Cheers, Josh
For instance, no use you trying to get the LCD working if you don't know how the LEDs are controlled.
I write the Code\Cannon\main_canon.hex with pony-prog.
Fusebit : Spien,EEsave,BOOTSZO0 CKSEL1
Wiring the circuit! When connect the power than display 1 line all pixel is on.
Resonator is working when powered (See with scope)
When touch Osc1 Pin9 than scrolling random characters and random flashing the led1-2.
What maybe wrong.
Thanks for help!
Make sure that you've connected up the LCD to the correct pins on the AVR.
I suggest you try building a test file from here: http://homepage.hispeed.ch/peterfleury/lcdlibrary.zip A makefile is included.
And then running it - don't use the lcd.c and lcd.h from that folder though, use the ones i supply because i mapped the screen to different pins from default.
Which leads me to a question:
Since you are obviously electronically adept, Maybe you could helpme. I have been trying to make a large trash can that willdispense a treat when trash is thrown in. I have a cereal dispenser,small electric motor and gears, but have not been able to find a sensingsystem that will trigger the motor for a variable 1-4 seconds, cover alarge area, and sense a thrown object.
Is this something that I could put together with my limited skills? Andwhere would I look for help and supplies?
Well i'm afraid i've not had that much experience with servos/motors soyou'll need someone else for that.
As for the sensing, well you have a variety of ways. Anaccelerometer could be used to detect when something lands in it (i.e.vibrates). You could put it on a spring loaded lid so that whentrash lands on it, the lid goes down, accelerometer detects movement andyou fire your motor for however long you want.
Simpler solution would be to use an optical or proximity sensor (thoughproximity would be easier if you just shell out for a module than buildit yourself out of two ultrasonic transducers). You put the moduleon the inside of the bin and set it so that it doesn't do anything ifthe distance read back is equal to the opposite side of the bin. When something falls in, the ultrasound signal is bounced back soonerthan expected and the microcontroller (or whatever) can deal with it.
Best bet would be to look on a robotics forum :)
Break your project into chunks. With the controller, i lookedfirst at how the IR signal worked, then how i would go about making abasic remote, then buttons, LCD, triggering and so on. Build it upgradually and it'll go a LOT easier than blindly stumbling into acomplicated design.
Supplies, depends where you live. In the US, plenty of onlineshops - Farnell, digikey, radioshack catalogue, etc. In the UK,Rapidonline and Farnell are best bets. Google is your friend!
And I'm sure breaking it into chunks will be the best advise yet for helping me work this out.
Thanks again.
Lynne123
and by the way, Whiternoise, i LOVE this instructable and i LOVE your camera controller... i will definitely be trying this as soon as i can!
Thanks for the great idea for the motion detector and timer. I will be sure to make it an "instructible" if I ever get it done.
If you enjoyed it that much, consider rating/voting for me in thecompetiton!
</ blatant pandering>
what are these pins?
#defineLCD_PORT PORTD /**< port for the LCDlines */
#defineLCD_DATA0_PORT PORTB /**< port for 4bitdata bit 0 */
#define LCD_DATA1_PORT LCD_PORT /**< port for 4bit data bit 1 */
#define LCD_DATA2_PORT LCD_PORT /**< port for 4bit data bit 2 */
#define LCD_DATA3_PORT LCD_PORT /**< port for 4bit data bit 3 */
#defineLCD_DATA0_PIN 0 /**<pin for 4bit data bit 0 */
#defineLCD_DATA1_PIN 2 /**<pin for 4bit data bit 1 */
#defineLCD_DATA2_PIN 1 /**<pin for 4bit data bit 2 */
#defineLCD_DATA3_PIN 0 /**<pin for 4bit data bit 3 */
#defineLCD_RS_PORT LCD_PORT /**< port for RSline */
#defineLCD_RS_PIN 6 /**<pin for RSline */
#defineLCD_RW_PORT LCD_PORT /**< port forRWline */
#defineLCD_RW_PIN 5 /**<pin for RWline */
#defineLCD_E_PORT LCD_PORT /**< port for Enableline */
#defineLCD_E_PIN 4 /**<pin for Enable line */
This is from lcd.h.
The pins are correct on the schematic to my knowledge (check onabreadboard before you build to be sure): http://img8.imageshack.us/img8/8904/cameracontrollerschemat.png/4743/cameracontrollerschematm.png<br />
From the above, LCD_PORT is PortD.
RS - PD6, pin 12
RW - PD5, pin 11
E - PD4, pin 6
too bad I probably couldn't build something like this :( :)
James
I'm going to start ordering the components this weekend.
Cheers,
Joe
If you're in the UK, irecommend:http://cgi.ebay.co.uk/16x2-Blue-LCD-display-module-HD44780-LED-Backlight_W0QQitemZ270143465646QQcmdZViewItemQQptZUK_BOI_Electrical_Components_Supplies_ET?hash=item3ee5ce28ae&_trksid=p3286.c0.m14for a cheap backlit screen
Otherwise these guys do good deals on multicoloured models (and ifthey're in China they probably ship everywhere):
http://cgi.ebay.co.uk/Character-LCD-Module-Display-16X2-1602-HD44780_W0QQitemZ190336901323QQcmdZViewItemQQptZUK_BOI_Electrical_Components_Supplies_ET?hash=item2c50f6a0cb&_trksid=p3286.c0.m14
Double check the components against datasheets though, i'm pretty surethe list is right but worth making doubly sure - especially if you gowith a different power IC.
Remember you can go with an ATMega8 or anything that's pincompatible, but it needs at least 8k memory! If you need to changepins, there are defines in LCD.h and my source file for doing so.
Cheers, Josh
I like the simplicity of your solution though!
Your FIRST project involves circuit design, interfacing, programming, - wow!
If this is the standard of your first project, I predict that you will be the guy to invent nuclear fusion within 12 months!
Incredible job!
I am a physicist ;)