This PCB controls a camera and an SD card so you can make automatic time lapse videos.
time_lapse(99, 5000);will take 99 pictures waiting about ten seconds (5 seconds of delay + 5 seconds of saving) between each shot. The function definition looks like this:
void time_lapse(int num_pics, unsigned int wait){ // Create an image with the name IMAGExx.JPG char filename[13]; strcpy(filename, "lapse00.jpg"); for (int i = 0; i < num_pics; i++) { filename[5] = '0' + i/10; filename[6] = '0' + i%10; take_picture(filename); delay(wait); }}
Please note:
if you want more than a hundred images this function needs to be tweaked so that the images are saved as lapseXXX.jpg rather than lapseXX.jpg.
/* LucidTronix Time Lapse Camera. * For instructions details and schematic, See: * http://www.lucidtronix.com/tutorials/14 * Connect the camera RX to pin 10 * and camera TX to pin 11 */#include#include #include #include SoftwareSerial cameraconnection = SoftwareSerial(10, 11);// pass the serial connection to the camera objectVC0706 cam = VC0706(&cameraconnection);#define SD_CS 4 // Set the chip select line to whatever you use (4 doesnt conflict with the library)int pin_pan = 6;int pan = 0;unsigned int cur_wait = 2000;void setup() { delay(1400); while (!cam.begin()) { delay(10000); } pinMode(SD_CS, OUTPUT); digitalWrite(SD_CS, HIGH); while (!SD.begin(SD_CS)) { delay(10000); } cam.setImageSize(VC0706_320x240); // medium time_lapse(99, 5000);}void loop(){}void take_picture(char * filename){ if ( cam.takePicture()){ // Create an image with the name filename // Open the file for writing // delete it if it exists SD.remove(filename) ; delay(200); File imgFile = SD.open(filename, FILE_WRITE); // Get the size of the image (frame) taken uint16_t jpglen = cam.frameLength(); // Read all the data up to # bytes! while (jpglen >= 1) { // read 64 bytes at a time; uint8_t *buffer; uint8_t bytesToRead = min(32, jpglen); // change 32 to 64 for a speedup but may not work with all setups! buffer = cam.readPicture(bytesToRead); imgFile.write(buffer, bytesToRead); jpglen -= bytesToRead; } imgFile.close(); cam.reset(); }}void time_lapse(int num_pics, unsigned int wait){ // Create an image with the name IMAGExx.JPG char filename[13]; strcpy(filename, "lapse00.jpg"); for (int i = 0; i < num_pics; i++) { filename[5] = '0' + i/10; filename[6] = '0' + i%10; take_picture(filename); delay(wait); }}
| Title | Description | # | Cost | Link | Picture |
| TTL Serial JPEG Camera with NTSC Video | Camera from adafruit | 1 | $39.95 | Link |
|
| Servo Motor | Continuous rotation servo motor. | 1 | $13.95 | Link |
|
| PCB for SD Card and Camera | PCB supports camera and SD card atmge32u4 and USB. | 1 | $7.0 | Link |
|
| ATMEGA32U4-MU | Integrated Circuits MCU AVR 32K FLASH 16MHZ 44-QFNValue:2.7 V ~ 5.5 V 16MHz | 1 | $6.04 | Link |
|
| microSD Card Connector | Secure Digital - microSD™ Push In, Push OutValue: microSD | 1 | $3.44 | Link |
|
| USB connector | USB Mini type BValue:female | 1 | $0.68 | Link |
|
| Crystal | CRYSTAL 16.00000 MHZ 20PF SMDValue:16MHz | 1 | $0.53 | Link |
|
| Switch | SWITCH SLIDE DPDT 6VDC 0.3A SMTValue:DPDT | 1 | $0.44 | Link |
|
| Button 6mm Through Hole | Tactile Switch Through Hole SPST-NO 0.05A 12VValue:0.05A @ 12VDC | 3 | $0.1 | Link |
|
Comments: