/* Timelapse Remote control For attiny 85 / 45 / 25 Pin-Connections: 1 Reset, not connected, maybe pullup high. 2 PB 3 , pushbutton to GND, internal pullup active (0 = pressed, 1 = open) 3 PB 2 , pushbutton to GND, internal pullup active 4 VCC 5 PB0 , statusled, via 300 Ohm to GND, (active high) 6 PB1 , 1-Wire bootloader. 7 PB2 , IR-LED, via 1k to BC547, VCC-IR-CE-30_Ohm-GND 8 GND 20120710 andyk75 for instructables */ #include #include #include #include #include /* Uncomment the following statements for your Camera Type You could also use multiple defines to execute more than one code. if you have two cameras, say Fuji and Nikon, define both in the beginning and both cameras will be triggered. It takes some milliseconds more time and uses a bit more energy from the battery, but hey, what the heck? It works for both! IMPORTANT: The code for Canon, Minolta and Sony has to be checked! Because in the control sequence there are statements to control more than the trigger of these cameras. But the other button is in my design used for something different and I don't have one of these cameras to test it. So please check it for yourself! */ //#define CANON // please check code ! //#define PENTAX #define NIKON //#define OLYMPUS //#define SONY // please check code ! //#define MINOLTA // please check code ! //#define FUJI void triggerrelease( void ); void flash( uint8_t counter ); void fastflash( uint8_t counter ); ISR(PCINT0_vect); ISR(TIMER0_OVF_vect); #define programmingport PB1 #define startbutton PB4 #define adjusttimelapse PB3 #define statusled PB0 #define irleds PB2 // defines for RC-1 IR Protocoll #define NR_PULSES 16 #define DELAY_SHOT 7.33 #define DELAY_DSHOT 5.36 // Macros for IR LED #define LED_ON() PORTB |= (1< 0 ) TIMSK = (1<6)lapsetime=0; // this prevents long timelapses of several minutes, as the camera will shut itself down before the next picture would be taken flash(1); // give a feedback that the press was counted. } } sei(); // reenable interrupts } /* Timer Overflow, wake up and counter for timelapse * - count the wakeups * - trigger the release if the time is right * */ ISR(TIMER0_OVF_vect) { secondcounter++; // a second means 30 overflows and 132.5 ticks. if(secondcounter > 30) { // now a second has passed secondcounter = 0; // Reset the second-counter lapsecounter++; // count the second in lapse-counter if(lapsecounter == lapsetime) // if the time is right, trigger the camera to take a picture { triggerrelease(); lapsecounter = 0; // reset lapse-counter } } } /*! * \brief function to let the statusled flash as many times as counter indicates */ void flash( uint8_t counter ) { uint8_t i; for( i= 0; i< counter; i++ ) { PORTB |= (1<>= 1; } } #elif defined SONY uint8_t i,j=0,k; uint8_t cmd = 0; uint16_t mask = 1; uint16_t address = 0x1E3A; if((PINB & 1<