Openlog SD card - Simple help

So i’ve managed to get the camera to work by modifying and using this code(I modified baud rate to 38400 instead of the original, 9600. I’m also not using VC0706 cam. I’m using LSY-201 camera:

#include <camera_VC0706.h>
#include <SD.h>
#include <SoftwareSerial.h>         
#if ARDUINO >= 100

SoftwareSerial cameraconnection = SoftwareSerial(5, 6);

#else
NewSoftSerial cameraconnection = NewSoftSerial(5, 6);
#endif
camera_VC0706 cam = camera_VC0706(&cameraconnection);

void setup() {

  Serial.begin(38400);
  Serial.println("VC0706 Camera snapshot test");
  
  // Try to locate the camera
  if (cam.begin()) {
    Serial.println("Camera Found:");
  } else {
    Serial.println("No camera found?");
    return;
  }
  // Print out the camera version information (optional)
  char *reply = cam.getVersion();
  if (reply == 0) {
    Serial.print("Failed to get version");
  } else {
    Serial.println("-----------------");
    Serial.print(reply);
    Serial.println("-----------------");
  }


  
  cam.setImageSize(VC0706_640x480);        // biggest
  //cam.setImageSize(VC0706_320x240);        // medium
  //cam.setImageSize(VC0706_160x120);          // small

  // You can read the size back from the camera (optional, but maybe useful?)
  uint8_t imgsize = cam.getImageSize();
  Serial.print("Image size: ");
  if (imgsize == VC0706_640x480) Serial.println("640x480");
  if (imgsize == VC0706_320x240) Serial.println("320x240");
  if (imgsize == VC0706_160x120) Serial.println("160x120");

  Serial.println("Snap in 3 secs...");
  delay(3000);

  if (! cam.takePicture()) 
    Serial.println("Failed to snap!");
  else 
    Serial.println("Picture taken!");
  
  // Create an image with the name IMAGExx.JPG
  char filename[13];
  strcpy(filename, "IMAGE00.JPG");
  for (int i = 0; i < 100; i++) {
    filename[5] = '0' + i/10;
    filename[6] = '0' + i%10;
    // create if does not exist, do not open existing, write, sync after write
    if (! SD.exists(filename)) {
      break;
    }
  }
  
  // Open the file for writing
  File imgFile = SD.open(filename, FILE_WRITE);

  // Get the size of the image (frame) taken  
  uint16_t jpglen = cam.frameLength();
  Serial.print("Storing ");
  Serial.print(jpglen, DEC);
  Serial.print(" byte image.");

  int32_t time = millis();
  pinMode(8, OUTPUT);
  // Read all the data up to # bytes!
  byte wCount = 0; // For counting # of writes
  while (jpglen > 0) {
    // read 32 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);
    if(++wCount >= 64) { // Every 2K, give a little feedback so it doesn't appear locked up
      Serial.print('.');
      wCount = 0;
    }
    //Serial.print("Read ");  Serial.print(bytesToRead, DEC); Serial.println(" bytes");
    jpglen -= bytesToRead;
  }
  imgFile.close();

  time = millis() - time;
  Serial.println("done!");
  Serial.print(time); Serial.println(" ms elapsed");
}

void loop() {
}

My console reads as following:

VC0706 Camera snapshot test
Camera Found:
-----------------
VC0703 1.00
No ctrl infr
MI360
625
Init end
-----------------
Image size: 640x480
Snap in 3 secs...
Picture taken!
Storing 45808 byte image.......................done!
15229 ms elapsed

The SD card saves using SERIAL so it means that everything in the console gets saved to the SD card i believe. My question is, how can i loop this code to take screenshots every 5 seconds? And also, is there anything i can remove and shorten in the code to make it a lot more simple?
Something else i noticed is that it takes about 5 to 10 seconds for the image to save into the SD card… is there anything i can do to fasten the proccess and save the image very quickly? “…done!” takes about 5-10 secs.

Thanks!

Hello, i’m really new to arduino but i’m trying to capture photos with a camera connected to the arduino. First of all i have to get the SD card to work, which i’m not sure it is. It’s the openlog module and it’s connected with RX directly to TX in the uno board, and TX directly to the RX. If i understood correctly it’s supposed to log everything with “printIn” command. But i’m trying to test if the SD Card works by using the SD Card Test, however it seems to fail connection with te SD Card.
Is this perhaps because i need to edit the default “const int chipSelect = 4;” to something else than 4? I’m not sure what ChipSelect means, or where i can figure out where this chip is connected to, on the board?
Thanks.

Chip Select (actually Slave Select) is how the SPI bus tells a device that it's that devices turn to listen and respond. It has nothing to do with Serial and is only used for SPI devices. Sounds like your "openlog module" is serial device so you can't use it to directly connect to the SD card.

Oh wow i didn't know! I really really really appreciate your reply. If that's the case, what do i do in order to capture images with a camera and store them into the SD card? Do you know any code i could use for this?

Thanks!!

Knuts:
what do i do in order to capture images with a camera and store them into the SD card?

Well, since your "openlog module" accepts data via serial you could write your images to the serial port. You will need a way to scan the log for image data and reproduce the images from that. Or you could use an SD card module or shield and write the image data as data files. What, exactly, are you trying to achieve?

I have an SD card in the openlog module. What i'm trying to achieve is to get the camera to take photos every five seconds, and store them in the SD card. The only problem seems to be that i don't have a code that seems to work for openlog (SD card) module via serial. I only find codes online that capture images and save them to an SD card that uses CS, (SPI), etc. And since i'm using openlog - serial, there is no CS pin.