Sunday, November 27, 2011

DIY: Photo Booth - Teensy


The Teensy USB Development Board was used in my DIY Photo Booth Project to add arcade style buttons to the enclosure to enable the user to switch between Photo and Video Modes, Start the image/video capture, and enable/disable the camera's live view. I originally had one button to activate Photo Mode, and a different button to activate Video mode. However, I found that dSLR Remote Pro had a simpler keyboard shortcut that could alternate between both photo and video modes. Here is my original sketch planning on how I would use Teensy.


The big Green button is LED backlit, and will be used to initiate either the Photo or Video countdown. Wiring was simple and straight forward. Power to the Teensy is provided by the USB Cable going to the PC. I found other teensy projects that were similar and used online documentation to figure out how to wire up the board properly. Some people used resistors and power from the teensy, but I kept it as simple as possible.



You can used compiled C programming code, or Arduino to configure the Teensy. I used Arduino, and here is my script that was uploaded to the Teensy. The final version had the big green button simulating a left click of the mouse, the black button to toggle live view (F6 button), and the yellow button to toggle back and forth between Photo and Video modes. (CTRL-S)


/*
Photobooth LED Buttons
*/
// Setting variables that correspond to the PIN numbers that
const int boothStart = 8; // Green Start Button - 8
const int liveViewMode = 4; // Live View Mode Toggle - 6
const int videoPhotoMode = 6; // Photo / Video Mode Toggle Button - 4
int startButtonStatus = 0;
int liveViewButtonStatus = 0;
int cameraButtonStatus = 0;
void setup() {
pinMode(boothStart, INPUT);
pinMode(liveViewMode, INPUT);
pinMode(videoPhotoMode, INPUT);
}
void loop(){

// Check Button Status
startButtonStatus = digitalRead(boothStart);
liveViewButtonStatus = digitalRead(liveViewMode);
cameraButtonStatus = digitalRead(videoPhotoMode);

// If boothStart button is pressed
if (startButtonStatus == HIGH) {
Mouse.set_buttons(1, 0, 0); // click left button
// delay(100);
Mouse.set_buttons(0, 0, 0); // release buttons
delay(500);
}
// If liveViewButton button is pressed
if (liveViewButtonStatus == HIGH) {
Keyboard.set_key1(KEY_F6);
Keyboard.send_now();
Keyboard.set_modifier(0);
Keyboard.set_key1(0);
Keyboard.send_now();
delay(500);
}

// If cameraMode button is pressed
if (cameraButtonStatus == HIGH) {
Keyboard.set_modifier(MODIFIERKEY_CTRL);
Keyboard.set_key1(KEY_S);
Keyboard.send_now();
Keyboard.set_modifier(0);
Keyboard.set_key1(0);
Keyboard.send_now();
delay(500);
}
}


5 comments:

  1. I tried verifying the code in Arduino 1.0.1 and it claims that 'Mouse' is only supported in Arduino Leonardo, am I missing something?

    ReplyDelete
  2. There is only something about getting shoulder-to-bear behind a window ornament which makes a feeling of fellowship and fun, where individuals feel they can give up a little and appreciate a mutual affair. Metroclick.com

    ReplyDelete
  3. Its a great pleasure reading your post.Its full of information about Photobooth, thanks for sharing with us

    ReplyDelete
  4. You have shared some great post about photo booth which contains some best knowledge which could not easily to find so. Keep it up. corporate photo booth Chicago.

    ReplyDelete
  5. I came to this blog and it helped me to add few new points to my knowledge. we provide Professional Photo Editing Service in Netherlands at affordable charges. to know more visit our website.

    ReplyDelete