├── example_wiring.png ├── examples └── click │ └── click.ino ├── NikonRemote.h ├── NikonRemote.cpp └── README.md /example_wiring.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/outofjungle/NikonRemote/HEAD/example_wiring.png -------------------------------------------------------------------------------- /examples/click/click.ino: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int IR_PIN = 12; 4 | 5 | NikonRemote remote( IR_PIN ); 6 | 7 | void setup() { 8 | remote.click(); 9 | } 10 | void loop() {} 11 | -------------------------------------------------------------------------------- /NikonRemote.h: -------------------------------------------------------------------------------- 1 | // NikonRemote.h - Arduino library to remotely trigger Nikon camera 2 | // Thanks to Michele Bighignoli for timing information (http://www.bigmike.it/ircontrol/) 3 | // and BENMCTEE for poor man's PWM logic (http://fritzing.org/projects/lightning-trigger-for-nikon-dslr-camera/) 4 | 5 | #ifndef NIKONREMOTE_H 6 | #define NIKONREMOTE_H 7 | 8 | #include 9 | 10 | class NikonRemote { 11 | private: 12 | unsigned int ir_pin; 13 | void pulse_on( unsigned long ); 14 | void pulse_off( unsigned long ); 15 | 16 | public: 17 | NikonRemote( unsigned int ); 18 | void click(); 19 | }; 20 | 21 | #endif 22 | -------------------------------------------------------------------------------- /NikonRemote.cpp: -------------------------------------------------------------------------------- 1 | #include "NikonRemote.h" 2 | 3 | NikonRemote::NikonRemote( unsigned int ir_pin ) { 4 | this->ir_pin = ir_pin; 5 | pinMode( this->ir_pin, OUTPUT); 6 | } 7 | 8 | void 9 | NikonRemote::pulse_on( unsigned long duration ) { 10 | unsigned long stop = micros() + duration; 11 | while( micros() < stop ) { 12 | digitalWrite( this->ir_pin, HIGH ); 13 | delayMicroseconds( 13 ); 14 | digitalWrite( this->ir_pin, LOW ); 15 | delayMicroseconds( 13 ); 16 | } 17 | } 18 | 19 | void 20 | NikonRemote::pulse_off( unsigned long duration ) { 21 | unsigned long stop = micros() + duration; 22 | while( micros() < stop ); 23 | } 24 | 25 | void 26 | NikonRemote::click() { 27 | for (int i=0; i < 2; i++) { 28 | pulse_on(2000); 29 | pulse_off(27850); 30 | pulse_on(390); 31 | pulse_off(1580); 32 | pulse_on(410); 33 | pulse_off(3580); 34 | pulse_on(400); 35 | pulse_off(63200); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Arduino Nikon IR Remote Library 2 | =============================== 3 | 4 | Arduino library to remotely trigger Nikon camera. 5 | 6 | - Thanks to Michele Bighignoli for timing information (http://www.bigmike.it/ircontrol/) 7 | - BENMCTEE for poor man's PWM logic (http://fritzing.org/projects/lightning-trigger-for-nikon-dslr-camera/) 8 | 9 | Installation 10 | ------------ 11 | 12 | Clone this repository into Arduino libraries folder and re-start the Arduino IDE. 13 | 14 | $ cd $ARDUINO_LIBS 15 | $ git clone git://github.com/outofjungle/NikonRemote.git 16 | 17 | Use 18 | --- 19 | Library comes with a simple example `click` that gets added to the Arduino Example menu upon installation. 20 | 21 | To run the code, wire an IR LED to the arduino as shown in the wiring diagram and upload the sketch to the Arduino. To activate the remote, press and release the Arduino reset button. 22 | 23 | ### Wiring diagram 24 | 25 | 26 | ![Screenshot 1](https://github.com/outofjungle/NikonRemote/raw/master/example_wiring.png) 27 | --------------------------------------------------------------------------------