Arduino is a little gem of a device. Here’s what Wikipedia has to say of it:
Arduino is an open-source computer hardware and software company, project and user community that designs and manufactures microcontroller-based kits for building digital devices and interactive objects that can sense and control objects in the physical world.
The project is based on microcontroller board designs, manufactured by several vendors, using various microcontrollers. These systems provide sets of digital and analog I/O pins that can be interfaced to various expansion boards (“shields”) and other circuits. The boards feature serial communications interfaces, including USB on some models, for loading programs from personal computers. For programming the microcontrollers, the Arduino project provides an integrated development environment (IDE) based on the Processing project, which includes support for the C and C++ programming languages.
The first Arduino was introduced in 2005, aiming to provide an inexpensive and easy way for novices and professionals to create devices that interact with their environment using sensors and actuators. Common examples of such devices intended for beginner hobbyists include simple robots, thermostats, and motion detectors.
Arduino boards are available commercially in preassembled form, or as do-it-yourself kits. The hardware design specifications are openly available, allowing the Arduino boards to be manufactured by anyone. Adafruit Industries estimated in mid-2011 that over 300,000 official Arduinos had been commercially produced, and in 2013 that 700,000 official boards were in users’ hands.
From the start it was clear I would need something to run the scanner. It simply is not viable to grab thousands of tiny images without some automated system. Even with CHDK (Canon Hack Development Kit) installed, the camera should be told when to grab the images, and it’d be a real pain to move the film if it was to be done by hand. I had heard of the Arduino, but not used it for anything – therefore I went directly into the deep end without thinking too much. I’d settle the issues one by one when I got there.
Before I started doing anything physical, I thought of how the system should run. All I had at this point was the film gate which would need a rotating motor to run. The film gate is a piston-like device, which first pushes the film down, then retracts and pushes the next frame down. When the frame is in place, the camera should grab a picture of it. The film, when it has passed the gate, needs to be taken up in another spool, lest it flow off the table.
So, I acquired an Arduino and a servo shield. Shields are little add-ons that make it easier to wire the Arduino. I also bought two full-rotation servos (most servos rotate 180 degrees only) and a bunch of wirings. When I got the package, I started some tests.
At first I thought I could use the CHKD feature of movement detection. I could perhaps have the camera trigger itself a set time after the motion detection had noticed the film moving. This turned out to be too imprecise. Then, I thought I could maybe run the servo for a period of time, and use the timed shot feature of CHDK to grab the pictures. This seemed like a good idea, but then I ran this test.
The arm, which I pasted onto the servo horn for the test, shows that the servo rotation cannot be controlled to the required degree of accuracy. At this point I was still thinking I would need to interrupt the rotation of the film gate for taking the pictures, which wasn’t true, as I soon realized. The film gate would take care of the positioning the frame in place.
So, I printed a little piece to attach the film gate to, and another piece to keep the film in place. When I ran the servo this time, I could see much better action:
The film is now moved in precise movements across the hole through which the camera will shoot. The speed of the servo can be adjusted very precisely, so at this time I let it run at 30 frames per minute, but in the final device, I get 22 frames per minute (just over a second of film every minute). This was very promising.
So next I thought, maybe I could use the film gate itself to synchronize the camera operation. Arduino is able to take in analog and digital input, and give analog and digital output. The final setup I figured I should use had one servo turning the film gate, another servo turning the takeup spool, a switch to tell Arduino when to take the picture, and one switch to tell if the takeup servo was being zealous and had rolled the film too tight. Positioning the switch for the camera so close to the film gate piston turned out to be impossible, so I attached an extra arm to the piston, and printed a little mounting part for the switch.
The switch was then wired to the Arduino; the ground connector goes into Arduino’s ground pin, and the other connector was attached to the signal pin. Thus when the switch is closed, Arduino knows of this, and that little bit of information can be used for action.
I took an old USB cable that works with the Canon Ixus camera, cut the power wire, and soldered two wires to it. One goes to the ground pin on the Arduino, and another to the signal wire. In CHDK, I turned on the Remote Trigger feature, so every time the camera senses +5 volts coming in via the USB, it takes a picture. In the Arduino, I programmed this to happen whenever the film gate switch closes. I tested it first without the servo, just by closing the switch by hand, and it worked. When I hooked it up with the servo, I could test the most demanding part of the operation:
This was promising in the extreme. As you see, the camera grabs a pic and waits for the next keypress.
So the wiring is as follows:
- input lead from film gate switch to input pin 2
- input lead from film transport switch to input pin 4
- output lead from pin 6 to film gate servo
- output lead from pin 8 to film transport servo
- output lead from pin 10 to the modified USB cable that leads to the camera.
Note that the 11 pins are all equal in the Arduino, and it is the code that runs the Arduino where you define which pin does what.
Now I had more or less every part in place, and the remaining task was to put the entire orchestra together and make it play. The next episode will describe the Arduino coding and how I made it work together with the CHDK.