# Timelapse Spy Camera

## Overview

![](https://cdn-learn.adafruit.com/assets/assets/000/037/594/medium800/camera_DSC_3440.jpg?1480351638)

Here's a quick guide on how to use the Mini Spy Camera to make timelapses and control from a microcontroller like a Trinket.

# Camera modes

The Spycam can work in two different modes- video and snapshot.

In general, the white trigger line is pulled high.

If trigger is pulsed low for a short amount of time (less than half a second) it will take a photo.

If trigger is pulsed low for a long amount of time (a second or longer) it will start/stops video recording.

Follow these instructions to make your own timelapse camera!

# Wiring

- Spycam BLACK&nbsp;-\> Trinket GND
- Spycam RED&nbsp;-\> Trinket&nbsp;BAT+
- Spycam WHITE&nbsp;-\> Trinket PIN 0 (Trigger)

# Solder

&nbsp;Solder the connections listed above between the Trinket & the Spycam.&nbsp;

&nbsp;

Also solder a JST connector to the back of the Trinket so you can plug in a Lipo battery.

&nbsp;

The larger the battery, the longer it will run, but note that the Spycam is limited to storing 1000 photos maximum.

![camera_DSC_3442.jpg](https://cdn-learn.adafruit.com/assets/assets/000/037/595/medium640/camera_DSC_3442.jpg?1480352327)

Below is the code to take a photo every 10 seconds on a Trinket! [Follow our Trinket starter guide to learn how to upload code to your Trinket](../../../../introducing-trinket/)

# Code
```auto
int trig = 0;
int led = 1;

void setup() {                
  // initialize the digital pins as output.
  pinMode(led, OUTPUT);
  pinMode(trig, OUTPUT);         

  digitalWrite(led, HIGH);  
  digitalWrite(trig, HIGH); 
}

// Hold HIGH and trigger quick (<250ms) LOW to take a photo. Holding LOW and trigger HIGH starts/stops video recording

void loop() {
  digitalWrite(trig, LOW);   
  digitalWrite(led, LOW);
  
  delay(50);               

  digitalWrite(trig, HIGH);    
  digitalWrite(led, HIGH);   

  //Delay between pictures
  delay(10000);               
  
}
```


## Related Guides

- [Bubble Table with LED Animations and IR Remote Control](https://learn.adafruit.com/bubble-table-with-led-animations-and-ir-remote-control.md)
- [Wireless Control Button for WLED Projects](https://learn.adafruit.com/wireless-control-button-for-wled-projects.md)
- [Magic Light Bag of Holding](https://learn.adafruit.com/magic-light-bag-of-holding.md)
- [Desktop Dumpster Fire](https://learn.adafruit.com/desktop-dumpster-fire.md)
- [Sound Reactive Sunflower Baby Crib Mobile with Bluetooth Control](https://learn.adafruit.com/sound-reactive-sunflower-baby-crib-mobile-with-bluetooth-control.md)
- [Glowing Beehive Hairdo Wig](https://learn.adafruit.com/glowing-beehive-hairdo-wig.md)
- [Coffee Rater](https://learn.adafruit.com/coffee-rater.md)
- [Twin Peaks Light Reactive Picture Frame](https://learn.adafruit.com/twin-peaks-light-reactive-pyportal-picture-frame.md)
- [Pico Bootloader Retro Console](https://learn.adafruit.com/pico-bootloader-retro-console.md)
- [Fruit Jam Sega Genesis](https://learn.adafruit.com/fruit-jam-sega-genesis.md)
- [Guardian Robot – Zelda BOTW](https://learn.adafruit.com/guardian-robot-zelda-botw.md)
- [Boomy The Boombox](https://learn.adafruit.com/boomy-the-boombox.md)
- [Busy Box Interruption Sign](https://learn.adafruit.com/busy-box-interruption-sign.md)
- [Adafruit Metro ESP32-S3](https://learn.adafruit.com/adafruit-metro-esp32-s3.md)
- [PyLeap App](https://learn.adafruit.com/pyleap-app.md)
