Introduction: Tiny Timer (T^2 for Short)
T^2 is a small and simple camera timer. Based on the ever popular ATTINY85, this design only uses 5 components. It is designed with a 2.5 mm male stereo plug to connect to a compatible camera. I am using a Canon T1i Rebel to attach the timer to.
I originally bought a camera timer off Amazon that was pretty cheap, about 15$. I decided it had a lot of features I didn't want such as photo count, delay start, ect...
So why not make a much simpler device that is smaller, more efficient, open source and made by myself!
With the amazing technology as employed here, this device can run for up to 200 hours (with an average current draw of 2 mAh).
I originally bought a camera timer off Amazon that was pretty cheap, about 15$. I decided it had a lot of features I didn't want such as photo count, delay start, ect...
So why not make a much simpler device that is smaller, more efficient, open source and made by myself!
With the amazing technology as employed here, this device can run for up to 200 hours (with an average current draw of 2 mAh).
Step 1: Components
For this projects most of the components can be found at RadioShack or Sparkfun.
1. ATTINY85 microcontroller
2. DIP Sockets Solder Tail - 8-Pin
3. Reed Switch 5V/1A
4. Polymer Lithium Ion Battery - 400mAh
5. 4 Position DIP switch
6. 2.5 mm Male Stereo Cable (can be found on ebay and spliced)
7. Universal Component PC Board
8. Soldering Equipment
9. Arduino for programming
I was able to find everything for less than $20 and some were even reused parts!
1. ATTINY85 microcontroller
2. DIP Sockets Solder Tail - 8-Pin
3. Reed Switch 5V/1A
4. Polymer Lithium Ion Battery - 400mAh
5. 4 Position DIP switch
6. 2.5 mm Male Stereo Cable (can be found on ebay and spliced)
7. Universal Component PC Board
8. Soldering Equipment
9. Arduino for programming
I was able to find everything for less than $20 and some were even reused parts!
Step 2: Layout
The main component is the ATTINY85 by ATMEL. To learn more about it click here or here for the data sheet.
It is a fairly simple layout as seen on my original design. 3 pins of the DIP switch will act as a binary counter (giving 8 different combinations) while the extra switch will be an I/O switch. The ATTINY85 and Arduino have pullup resistors on their digital output pins that can tell the state of a switch when connected to ground. That will help us out. Another digital output is connected to a 5 volt reed relay switch that uses a magnetic field created by the current from the microcontroller to close an internal switch that will activate the shutter on the camera.
It is a fairly simple layout as seen on my original design. 3 pins of the DIP switch will act as a binary counter (giving 8 different combinations) while the extra switch will be an I/O switch. The ATTINY85 and Arduino have pullup resistors on their digital output pins that can tell the state of a switch when connected to ground. That will help us out. Another digital output is connected to a 5 volt reed relay switch that uses a magnetic field created by the current from the microcontroller to close an internal switch that will activate the shutter on the camera.
Step 3: Moving Code to ATTINY85
For the coding you will need an Arduino and a computer running the Arduino IDE. Actually moving the code is a simple process but can be confusing to explain. So I will lead you to MIT, obviously they would be the ones to know about it! This is the same process I use and works well.
Programming an ATTINY w/ an Arduino and another one for the updated software. It may help to look at both of them.
This does require a 10 uF capacitor.
Programming an ATTINY w/ an Arduino and another one for the updated software. It may help to look at both of them.
This does require a 10 uF capacitor.
Step 4: The Code
I love open source and this is why...
My code for everyone to see and use!
//T^2 Camera Timer
//By Carl Smith
//Create and Define Global Variables
int dipPins[] = {0, 1, 2};//, 5}; //DIP Switch Pins
//pin 5 is on/off for battery power
int transAddress;
int num;
int pause = 0;
#define cameraPin 3
void setup()
{
//Serial.begin(9600);
int i;
for(i = 0; i<=2; i++){
pinMode(dipPins[i], INPUT); // sets the digital pin 2-5 as input
digitalWrite(dipPins[i], HIGH); //Set pullup resistor on
}
transAddress = address();
pinMode(cameraPin,OUTPUT);
delay(100);
}
void loop()
{
num = address();
switch(num) {
case 0 : pause = 500;break;
case 1 : pause = 1000;break;
case 2 : pause = 2000; break;
case 3 : pause = 4000; break;
case 4 :pause = 7000;break;
case 5 :pause = 10000;break;
case 6 : pause = 15000; break;
case 7 : pause = 30000;break;
}
//Serial.println(pause + " seconds");
//Serial.println(pause/1000);
camera();
//pause = 100;
delay(pause);
//Serial.println(address());
}
//Create Address from DIP Switch (4 positions used)
byte address(){
int i,j=0;
//Get the switches state
for(i=0; i<=2; i++){
j = (j << 1) | digitalRead(dipPins[i]); // read the input pin
}
return j; //return address
delay(100);
}
void camera()
{
digitalWrite(cameraPin,HIGH);
delay(45);
digitalWrite(cameraPin,LOW);
}
My code for everyone to see and use!
//T^2 Camera Timer
//By Carl Smith
//Create and Define Global Variables
int dipPins[] = {0, 1, 2};//, 5}; //DIP Switch Pins
//pin 5 is on/off for battery power
int transAddress;
int num;
int pause = 0;
#define cameraPin 3
void setup()
{
//Serial.begin(9600);
int i;
for(i = 0; i<=2; i++){
pinMode(dipPins[i], INPUT); // sets the digital pin 2-5 as input
digitalWrite(dipPins[i], HIGH); //Set pullup resistor on
}
transAddress = address();
pinMode(cameraPin,OUTPUT);
delay(100);
}
void loop()
{
num = address();
switch(num) {
case 0 : pause = 500;break;
case 1 : pause = 1000;break;
case 2 : pause = 2000; break;
case 3 : pause = 4000; break;
case 4 :pause = 7000;break;
case 5 :pause = 10000;break;
case 6 : pause = 15000; break;
case 7 : pause = 30000;break;
}
//Serial.println(pause + " seconds");
//Serial.println(pause/1000);
camera();
//pause = 100;
delay(pause);
//Serial.println(address());
}
//Create Address from DIP Switch (4 positions used)
byte address(){
int i,j=0;
//Get the switches state
for(i=0; i<=2; i++){
j = (j << 1) | digitalRead(dipPins[i]); // read the input pin
}
return j; //return address
delay(100);
}
void camera()
{
digitalWrite(cameraPin,HIGH);
delay(45);
digitalWrite(cameraPin,LOW);
}
Step 5: Analyzing the Code
If you look into the actual code you can see several important part. You are able to adjust the timing to whatever you feel is right for you as well as pin outs and ect...
This section sets the inputs as pullup resistors so the ATTINY85 can detect if the switches are on/off.
for(i = 0; i<=2; i++){
pinMode(dipPins[i], INPUT); // sets the digital pin 2-5 as input
digitalWrite(dipPins[i], HIGH); //Set pullup resistor on
}
Here, the position of the switches are combined to result in a single value for later use.
//Create Address from DIP Switch (4 positions used)
byte address(){
int i,j=0;
//Get the switches state
for(i=0; i<=2; i++){
j = (j << 1) | digitalRead(dipPins[i]); // read the input pin
}
return j; //return address
delay(100);
}
The single value as previously stated is used here to determine what value the shutter delay should be (0.5, 1, 2, 4, 7, 10, 15, 30 seconds)
void loop()
{
num = address();
switch(num) {
case 0 : pause = 500;break;
case 1 : pause = 1000;break;
case 2 : pause = 2000; break;
case 3 : pause = 4000; break;
case 4 :pause = 7000;break;
case 5 :pause = 10000;break;
case 6 : pause = 15000; break;
case 7 : pause = 30000;break;
}
This section sets the inputs as pullup resistors so the ATTINY85 can detect if the switches are on/off.
for(i = 0; i<=2; i++){
pinMode(dipPins[i], INPUT); // sets the digital pin 2-5 as input
digitalWrite(dipPins[i], HIGH); //Set pullup resistor on
}
Here, the position of the switches are combined to result in a single value for later use.
//Create Address from DIP Switch (4 positions used)
byte address(){
int i,j=0;
//Get the switches state
for(i=0; i<=2; i++){
j = (j << 1) | digitalRead(dipPins[i]); // read the input pin
}
return j; //return address
delay(100);
}
The single value as previously stated is used here to determine what value the shutter delay should be (0.5, 1, 2, 4, 7, 10, 15, 30 seconds)
void loop()
{
num = address();
switch(num) {
case 0 : pause = 500;break;
case 1 : pause = 1000;break;
case 2 : pause = 2000; break;
case 3 : pause = 4000; break;
case 4 :pause = 7000;break;
case 5 :pause = 10000;break;
case 6 : pause = 15000; break;
case 7 : pause = 30000;break;
}
Step 6: Board Layout
The board design is fairly simple, just a little tricky to fit into a small space if it is not well planned out. Using Fritzing I have drawn up the design to make it simpler to view.
As you can see, the #1 switch is used as a power connector to turn the device on/off. The 3 other switches use the pull up resistors built into the ATTINY 85 to detect whether the switch is opened or closed an then use a binary method to determine what the delay for the shutter should be as defined by the user.
It may take a little work to determine which connector your camera uses to sense a short circuit for the remote capture.
*Fritzing doesn't have a 4 channel DIP switch so I used 2 - 2 channel switches
**The relay switch on fritzing is slightly different than the 5 V DC Relay used in the project
As you can see, the #1 switch is used as a power connector to turn the device on/off. The 3 other switches use the pull up resistors built into the ATTINY 85 to detect whether the switch is opened or closed an then use a binary method to determine what the delay for the shutter should be as defined by the user.
It may take a little work to determine which connector your camera uses to sense a short circuit for the remote capture.
*Fritzing doesn't have a 4 channel DIP switch so I used 2 - 2 channel switches
**The relay switch on fritzing is slightly different than the 5 V DC Relay used in the project
Step 7: Soldering
The way you set up the board is up to you. I tried to make my form factor as small as possible so I could mount it inside an Altoids tin and that on top of the camera. As long as you make sure the connections are correct, the possible options of laying out the board are endless.
*Be safe while soldering, no one likes burnt finger tips!
*Be safe while soldering, no one likes burnt finger tips!
Step 8: Finishing Up
Well it is almost done! Find a nice enclosure for your timer and a way to mount it to your camera! Thanks for viewing and don't forget to vote for me!