Time Lapse Camera
Arduino based time lapse camera
Time-lapse photography is a technique whereby the frequency at which film frames are captured is much lower than that used to view the sequence. Using time-lapse photography technique as a documentation method can facilitate documentation and demonstration of a project, the meeting minutes, the recording of class activities or studio work sessions.
I designed and implemented an arduino based time lapse camera prototype. The camera has the following functions:
1) Capture Time Lapse Photos (Switching between 30s/photo or 1min/photo)
2) Automatically upload photos captured to a web server
3) Provide a RGB light feedback system suggesting current camera status.
I will show you how to create this camera system in detail.
The project is based on Arduino platform, so an Arduino board is necessary for the project. Arduino is an open-source electronics prototyping platform providing both hardware and software. There are a number of boards available currently, such as Arduino Uno, Arduino Leonardo, Arduino Mega, etc. In this project, I used Arduino Uno R3. But you can choose the model you like with slightly changing the pins.
In addition to Arduino board, you’ll need some other components. Figure 3 shows the components required in this project. All components could be purchased at Adafruit.com. The VC0706 TTL Serial Camera is used to perform the task of photo capture module. Adafruit CC3000 Wi-Fi breakout board is used to send photos to a web server. It has voltage regulators onboard, as well as an onboard antenna. The Micro SD card breakout board saves photo to the SD card. The RGB LED contains three LEDs-a red, a blue and a green. It could technically mix any colors, but actually only a couple colors could be easily differentiated from each other. The RGB LED signals users the current status of the camera system. The button is used to switch between two photo capture rates: 30s/photo or 1min/photo. Finally, you need some jumper wires and resistors to make the connections between the different parts.
This project uses Arduino IDE, which could be found at Arduino.cc. Adafruit’s CC3000 library and VC0706 library are required for this project. To install a library, download the required folder, and put it into your /Arduino/libraries/ folder. To use this IDE, you simple input code into a new sketch, compile it and upload it to the Arduino board. The sketch tells Arduino—the microcontroller to drive other components to perform tasks.
Since Arduino has a small memory, it couldn’t cache a 12 kilobytes photo (The average photo size of photos captured by VC0706 TTL Serial Camera). Arduino only supports read photos with binary stream, and sends the binary data to Wi-Fi breakout board or Micro-SD card breakout board. The small memory issue complicates the photo saving task since a complete photo file couldn’t generate first in Arduino. If you choose to save photos to the Micro-SD card, you’ll need to open a new image file on the SD card, and then write the binary data of pixels into the file. If you choose to upload photos to a web server wirelessly, you’ll need to configure the server first due to that the internet communication protocols have specific standards to be met. The only binary stream data transfer supported by Arduino excludes most protocols supporting file uploading.
If you choose to upload photos captured to a web server via Wi-Fi, one feasible solution is to upload photos via HTTP request. The CC3000 breakout board would set up a TCP connection with your web server and then send binary data stream with HTTP request. To send data with binary stream, a web server with Apache configuration to support “multipart/form-data” form file uploading is required for this project. You need to get a web server, a first-level domain name with independent IP address is suggested, and configure the Apache application.
The hardware configuration is straightforward for this project. Adafruit provide detailed introduction of the VC0706 camera and CC3000 Wi-Fi breakout board configuration.
VC0706 TTL Serial Camera: There are six pins on the board; four of them are used in this project. Connect VCC to the 3.3V pin of the CC3000 board, and GND to the Arduino ground. The TX pin and RX pin could connect to any two digital pins of Arduino. In the sample code in Appendix, I connect the TX pin to the Arduino pin 7 using a voltage divider with the two 10K ohms resistors, following the picture below. Then, connect RX directly to the Arduino pin number 4.
CC3000 Wi-Fi breakout board: There are 8 pins on board. IRQ pin must connect to an interrupt pin of Arduino, so I connect the IRQ pin to Arduino pin 3. CC3000 uses Serial Peripheral Interface (SPI) to communicate with Arduino, so the MOSI, MISO, and CLK pins go to pins 11, 12, and 13 of Arduino, respectively. The power pins: Vin goes to the Arduino 5V, and GND to GND. The 3.3V pin has already connected to VC0706 camera. The remaining two pins could be chosen randomly. I connected VBAT to pin 5, and CS to pin 6.
Pushbutton: Pushbuttons or switches connect two points in a circuit when you press them. A 10k Ohms resistor is used. The button must connect to a interrupt pin of Arduino, so I connected one point with Arduino pin 2. If the button is pressed, there will be current in the circuit when two points are connected.
RGB LED: A RGB LED contains three LEDs pins: a red, a blue and a green. Connect these pins to Arduino pin 10, 9, 8, respectively with three 560 Ohms resistors.
The assembled camera prototype is:
After the hardware configuration, you need to write the program to drive the components.
Open the Arduino software and copy the program code. Compile the code and upload the sketch to your arduino board.
My program code is available here. (The file type is limited to common document types. I cannot directly upload the sketch here.)
Change the WiFi SSID and password to your own Wi-Fi parameters, then you can connect to WiFi.
I tested the camera system with my personal web server.