Arduino Time-Lapse Controller
by hacker3455 in Circuits > Arduino
79653 Views, 389 Favorites, 0 Comments
Arduino Time-Lapse Controller
After adding in a display, a couple of buttons, and a more complex program, the self contained Arduino powered Time-Lapse Controller was born!
I have tried to make the instructions as clear and user-friendly as possible, but if any questions arise, feel free to ask!
Parts
Parts:
- Arduino
- 7 Segment Display
- 220 Ohm Resistor x2
- 10K Ohm Resistor x2
- 470 Ohm Resistor
- Hookup wire
- NPN Transistor
- 3/32 Phone-jack
- hookup wire
- mounting surface (i.e. perfboard, breadboard, PCB)
Wiring Up the 7 Segment Display
After a bit of research, I found some sample code for a 7 segment display here. Taking a closer look at the first example, I noticed that each segment of the display need to be wired to a sequential pin on the Arduino. In the case of the example, pins 2-9 with pin 2 being the "dot" on the display.
Keep in mind that each display's pinout is different and may differ from the display I used (from Radioshack), make sure to pay attention to its datasheet.
Instructions:
- Wire both GND pins of the display to GND on the Arduino with a 220 Ohm resistors
- Wire the display pins to sequential Arduino pins. In my case I used pins 3-9
- Wire the "dot" pin to the Arduino. For me, pin 2
Wiring Up the Buttons
Using this as a reference, I wired up the two buttons
Instructions:
Follow the pictures in the above link and the one enclosed and it should be pretty easy to figure out.
- using 10K Ohm resistors and hookup wire I connected the buttons to pins 11 and 12.
Wiring Up Shutter Control
Info:
After reading through rickadam's instructable on time lapse, I based my circuit off of his design.
A DSLR camera uses a 3/32 phono-jack to interface with this circuit, but this could easily be adapted to just about any camera
Instructions:
- Wire pin 1 of the phono-jack to Ardunio GND
- Wire the NPN transistor pin 1 to Arduino GND
- Wire 470 Ohm resistor from an open Arduino pin (in my case 13) to NPN transistor pin 2
- Wire pin 3 of phono-jack to pin 3 of the NPN transistor
(NOTE: the pin values given in this step are only used as identifiers and my not directly correspond with the values given on datasheets)
Upload Blink and Create a Reference Sheet
My assumption is that the display I used and how it is wired up is different in comparison to your project. To make sure the final code runs properly, we need to change a few values within the program. To make that process easier, a reference sheet will be made.
Instructions:
- Open up Arduino's Blink example and change the value of "led" to one of your segment pins. Download and run the sketch to the Arduino.
- Change the value of "led" again to another pin, download and run
- Continue this process while documenting the location on the display each pin lights up. Reference the picture as an example.
Modifying the Display Code to Fit Your Circuit
Open up the segment testing code and change "PIN" to the value of your lowest pin.
After uploading and running the code, the display should count down from 9 to 0. But instead your display will be showing a random collection of symbols
Using your reference sheet, we will modify the existing code to be customized to your circuit.
- At the top of the program, locate this section of the code:
byte seven_seg_digits[10][7] = { { 1,1,1,1,1,1,0 }, // = 0
{ 0,1,1,0,0,0,0 }, // = 1
{ 1,1,0,1,1,0,1 }, // = 2
{ 1,1,1,1,0,0,1 }, // = 3
{ 0,1,1,0,0,1,1 }, // = 4
{ 1,0,1,1,0,1,1 }, // = 5
{ 1,0,1,1,1,1,1 }, // = 6
{ 1,1,1,0,0,0,0 }, // = 7
{ 1,1,1,1,1,1,1 }, // = 8
{ 1,1,1,0,0,1,1 } // = 9
};
We will be modifying the 1s and 0s in this section.
- Each row corresponds to the digit that will be displayed and set of data to properly display that digit. The data will be sent as 1s (on) and 0s (off)
- Each column correspond to the pin which the data will be written to. The left most number correlates the the lowest pin defined by "PIN" (in my case pin 3). Moving across the row to the right, the next value corresponds to the next pin value and so on and so on.
For example, in the case of my circuit:
- I would like to modify the code so that my circuit will properly display "4"
- Looking at my reference sheet, the following pins should be lit: 3,4,7,6
- Turning to the code, I will change the appropriate values:
//Arduino pins: 3,4,5,6,7,8,9
byte seven_seg_digits[10][7] = { { 1,1,1,1,1,1,0 }, // = 0
{ 0,1,1,0,0,0,0 }, // = 1
{ 1,1,0,1,1,0,1 }, // = 2
{ 1,1,1,1,0,0,1 }, // = 3
{ 1,1,0,1,1,0,0 }, // = 4
{ 1,0,1,1,0,1,1 }, // = 5
{ 1,0,1,1,1,1,1 }, // = 6
{ 1,1,1,0,0,0,0 }, // = 7
{ 1,1,1,1,1,1,1 }, // = 8
{ 1,1,1,0,0,1,1 } // = 9
};
- Continue this process until all of the values have been changed. After downloading and running the program, the display should count down from 9 to 0. If not, change the appropriate values.
NOTE: If the "dot" is lighting up during any step of this process make sure the following things are true:
- "PIN" has been properly defined as the lowest value of your display pins, if the "dot" pin is the lowest make sure to use the next highest
- Make sure when wiring the display, the "dot" does not interrupt the sequential wiring of the display segment pins
Downloads
Modifying and Uploading the Final Code
We are now in the homestretch. Using the modifications made in the segment testing code, we will modify the final code so that your circuit will display the correct numbers.
Instructions:
- Copy the edited code from the previous step and replace it within the final code
- Change the pin value of "Bc" (cycle button)
- Change the pin value of "Ba" (accept button)
- Change the value "PIN" to the lowest display pin
- If you see fit, modify the function "lad" to your own custom animation to signify the accepting of the chosen value
After all of these changes are made, the final code should download and run smoothly.
Downloads
How to Use the Rig
- Upon first powering up the circuit, the display should eventually come on and display "0"
- Pressing the cycle button will increase the value by one and display a "1"
- Continuing to press the cycle button will increase the displayed value by one until the value of "9" is reached
- Once "9" is reached and the cycle button is pressed again, the next value will loop back to "0"
- Pressing the accept button will store that value in the Arduino's memory and a accept animation will be displayed
- This process will repeat for a total of 3 times, each digit corresponding to a value within the wanted time delay
- After the final digit is stored, a count down will start, after the countdown the camera will then take pictures at the interval you specified in the input process
(NOTE: If a mistake is made while inputting the digits, the reset button can be pressed and the program will restart)
For example:
say you wanted the interval between shots to be 1 minute and 35 seconds
- Plug in the camera via the phono-jack
- Power up the circuit
- Press the cycle button until the number 1 is displayed
- Press the accept button
- Press the cycle button until the number 3 is displayed
- Press the accept button
- Press the cycle button until the number 5 is displayed
- Press the accept button
- After the process is complete, a countdown will start, and then the camera will take pictures with an interval of 1 minute and 35 seconds
Final Thoughts
I still have some more ideas for the design, mainly on the programming side, such as displaying the number of pictures taken since the start of the session. Who knows what else may pop into my head.
To close, here is a small test done in my backyard.
Stay tuned for possible updates!
Thanks.
UPDATE (12-12-13):
I have updated the code and now the intervalometer can count the number of pictures taken. It is attached below. Also included is a full time-lapse video of myself and a friend building a computer.