Sunday, March 22, 2009

Trigger Time

Now I've got the human interface sorted, its time to sort the most important interface: The camera interface!

The interface to the Canon EOS 450D is a 2.5mm stereo jack (Slightly smaller version of a normal headphone jack). The tip of the jack provides the shoot trigger, the centre of the jack is the focus trigger and shield (bottom) of the jack is a common ground for both shoot & focus. Power is supplied by the camera itself, so all you have to do is close the connection between focus and ground to focus the camera, then shoot and ground to take the picture.

Because the camera supplies the power, we just need a pair of electronic controlled switches to perform the required focus and shoot function. The obvious solution would be to use a transistor to perform the switch function, however we don't really want to cross connect the camera to the Arduino power supplies, so we really need an isolating switch.

For this there are two choices: A relay would be the first choice, but relays are quite slow to switch, so in a project where the point is to react as quick as possible to a sound trigger, a relay would introduce too much of a delay. The alternative then is to use an opto-coupler. This is basically a LED and a photo-transistor mounted in an IC type package, thus creating an isolated switch. The device I am using is a KB827 dual opto-isolator, which gives me the two switches I require in a single 8 pin DIP package.

I also decided at add a couple of LED's to the focus and trigger outputs to give a visual indication of the camera triggering. Also, there is a 550 Ohm in series with the LED and opto-isolator to make sure we don't overdrive the Arduino pin output. During development, rather than connect to the actual camera and risk damaging it, I thought it would be a better idea to connect the photo-transistor side of the opto-isolator with another pair of LED's to give a visual indication that everything is working before connecting to the real thing!

I've also updated the software a bit to actually show the hot-keys as they are intended to be. The other thing I decided to do was to mount the display into a box becuase I the I2C daughter board on the back of the display was bending a bit and I was also getting a occasional missed characters when writing to the display. The ultra-observant will also notice that I finally added the 4.7K Ohm pull-up resistors to the I2C SDA/SCL lines.

The next updates will be mostly software to get the camera trigger control sorted. When complete, I should be able to trigger the camera with optional parameters for exposure time and also perform time-lapse functions.

....OK, so really the next step is to trigger the real camera ;-)

Saturday, March 21, 2009

Debouncing Switches

Well, now I'm properly under way with the project :-)

The first job was to get the input sorted. The plan is to use a bank of four push switches which will align with hot-key style control's on the display. The first job here of course is to connect the buttons to the Arduino and recognising in software when a button is pressed.

The circuit for this is really quite simple. Firstly, we take the power supply from the Arduino via the power connector (J1) simply using the +5V (pin3) and Ground (pin4). The display (CLCD420-B/J4) is connected via the I2C bus provided via the Arduino analogue input (J3); The SCL signal is provided by analogue pin 5 and SDA is analogue pin 4. Both SCL and SDA lines are connected to +5V via 4K7 ohm pullup resistors.

The switches (J5) share a common +5V supply, then each switch is fed to the Arduino Digital (J2) pins 9 through 12 and to ground via 220K Ohm resistors. When a switch is open, the resistor is effectively disconnected and the Arduino pin is held low. Whent the switch is closed, the resistor ensures that the input pin is held high, while also restricting the current flow.

So the software should also be quite simple... only there's a problem... when you press a push button, the electrical connection is not simply on/off, but rather toggles rapidly during the on/off transitions. To get round this we need to wait for the input to settle at a constant level. So rather than saying the button is pressed the instant the input goes high, we say the button is pressed once the input has remained constantly high for a given time. This process is called "Debouncing".

In the test program, I simply read the button presses and toggle a state value with each button press and output the state (on/off) to the display. The debounce time used is 50ms, that is, the button must be held for 50ms in order to count as a press and toggle the respective state. I created a class for handling the debounce function, so the code need only instatiate the class for each required button/input pin; the constructor handles the pin initialisation, so no other initialisation is required in the setup() function. Software then only needs to call the respective Read() function for each pin.

Friday, March 20, 2009

Getting there

Well, not much progress lately. Its hard to start an electronics project when you don't have any electronic components! That has all changed today, since I just got a nice package in the post containing all the bits I need to get started. :-) How convenient its also the weekend, so maybe I'll also have a bit of quality free time to make a real start!!!

Watch this space!

Wednesday, March 4, 2009

Well, the first parts arrived the other day, so I can finally start playing - How exciting :-P

First up, I got my first Arduino Duemilanove board (I actually got 2 boards, one to play with and one for the actual project!). It really is a very impressive piece of kit and incredibly easy to set up.

Within minutes I'd got the IDE downloaded and installed (that is to say, the USB drivers installed, the IDE is a standalone app that requires no installation!) and was running my first program to make the on-board LED blink! WOW! ;-)

Yeah, a very basic program but it does test that the board is working OK and is also a good demostration of how quickly you can get to work!



The next 'big' part of the project was the dispay device. This is a 4x20 character LCD display with I2C controller from Comfile Technology (CLCD420-B).

The display itself is actually a Palm Tech PMC2004E-SBLW display. The controller seems to be a custom built controller which actually uses an Atmel ATMega48 micro-controller (The 4KB version of the micro-controller on the Arduino board!).

I had originally intended to do some more example programs with the Arduino, but curiosity got the better of me, so immediately after the LED test program, I decided to hook up the display to the Arduino's I2C bus and set about that old favourite "Hello World" program. :-P

Again, simplicity in itself! Simply connect up the two I2C lines and the +5v and GND connections. Link in the Wire libraray provided by the Arduino IDE, then simply call the various wire functions to start sending strings. All in, probably only about 20 minutes to work everything out and get Hello World going!

Monday, March 2, 2009

The Idea

OK, so the blog title already kind of gives away what my idea is, but a little more info would be useful!

The idea is to trigger my Digital SLR camera from a selection of trigger sources:
  • Audio trigger - Make a noise and a photo is taken
  • Light trigger - Break a light beam and a photo is taken
  • Manual trigger - Press a button and a photo is taken
In each case, it should be possible to set various parameters, such as the trigger level, delay between the trigger and the actual photo and the length of the trigger, to allow for multiple shots to be taken or for bulb exposure.

An LCD display will be connected via the I2C bus and four push button switches will be used to control and setup the trigger. In addition to the external trigger mechanisms, it would also be nice to add a timer function to perform time-lapse photography i.e. take 1 shot per minute for 10 minutes, or more precise control of bulb exposures, i.e. 7.3s exposure time.

The camera to be controlled is primarily a Canon EOS 450D, however, the output will be more generic so that the system can be used to control other camera brands/models as well as external flash guns by using different cables.

Wednesday, February 25, 2009

Inspiration

As I said in my previous post, I wanted to keep electronics as a hobby, but somehow I never managed to do anything.

Part of the reason for this was due to a lack of time - work takes up far to much time and partying is also quite time consuming! Probably the biggest problem though was the lack of a great idea that really inspired me to start a project.

I have toyed with the idea of starting a Microchip PIC project many times. The PIC always looked like a decent platform for cheap home development projects, but somehow the PIC processor didn't really inspire me - I'm very much used to programming Motorola based CPU's and the PIC seems to be more in line with the Intel way of doing things, which for a Motorola fan is not a good thing ;-)

If I had a great idea for a project, then I would have had the inspiration to start a PIC project, but the hardware itself wasn't enough to inspire me into thinking of a project that I wanted to do!

Last weekend, I was visiting a friend in Zurich and he was playing around with an Arduino board. This little thing looked really nice. It features an Atmel ATmega168 processor - I'm familiar with Atmel from my day to day job, but the ATmega168 was a new platform to me. After a brief look at the spec sheet for this processor, it was clear that this little 8-bit processor is quite similar in its architecture and way of doing things to the Motorola processors that I'm more familiar with.

Suddenly I'd found a piece of kit that I really wanted to play with. With the inspiration for the hardware, coming up with an idea for a project was just a matter of time....

Tuesday, February 24, 2009

A little bit about me, electronics and software

Going back a long way, when I was about 9 years old, I got my very first computer, a Commodore 64! Unfortunately for me (or so I thought at the time), my Dad was prepared to pay for the computer but not prepared to pay for the games! His solution was to buy me a book of game program listings and let me type them in myself! Although I didn't understand what it was all doing at the time, it did give me my first introduction to computer programming :-)

...oh, and the games were really bad too!

So, roll on a few years to late high school and I was actually starting to understand this whole computer programming thing and starting to like it. I also had a passing interest in electronics building basic circuits to do pretty much nothing, but generally playing and learning! By the time it came to leaving school and deciding a future career, I was a little bit torn between electronics or software. My choice at the time was that I would pursue a career in electronics and keep software for a hobby!

So off I went to study electronics, while in the evenings (when I wasn't getting drunk down the pub!), I was teaching myself a little more about software. By this time I had progressed from BASIC programming on the C64 and was now getting into Machine Code (Assembler) programming on the Commodore Amiga - both programming the Motorola 68K (first 68000, later 68020) and the Amiga custom chip set. At this point I already started to realise the advantages of studying electronics when it comes to programming hardware related software!

By the end of my studying, I'd had a bit of a change of heart about my career choice. Rather than have a software hobby, I decided that software was what I really wanted to do and that electronics would be better suited as a hobby!

So for the last 13 years or so, I've been working as an embedded systems software engineer. Initially working on Motorolla 68K based systems and more recently on Motorola/IBM based PowerPC system. The majority of my work over the years has been for developing boot firmware and board support drivers, so plenty of assembly coding, system initialisation etc.

As for the electronics hobby, despite my good intentions, I've done absolutely nothing with electronics since finishing my studies, so I'm a little rusty with my resistor codes ;-) The project I'm planning will be largely software based, but I have no fears or worries about this, however the is a small amout of electronics design required, which is the real challenge for me on this project!


...lets see how it goes.....

:-P

What's this all about then?

Well, for many years I've been pondering about doing some sort of micro-controller project and finally I've decided what to do! Its all very exciting :-)

This will be my first such project and, as it seems customary these days, I thought I'd create my first blog to detail what I'm doing as I go along with the project so that other people out there in the interweb can follow my progress, offer me advice or criticism, or gain from my experiences should they want to build a similar project!

So...
WELCOME TO MY PROJECT BLOG