First Post Project Time Lapse Camera Help

Time Lapse Camera Hardware Arduino UNO R3 Data Logging Shield with RTC by deek-robot from HiLetGo ArduCam 5MP mini OV5642 PLUS from robotshop sandisk 16gb micro with adapter cr1220
I started with sketch from elithecomputerguy

[code]
#include <Wire.h>
#include <ArduCAM.h>
#include <SPI.h>
#include <SD.h>
#include "memorysaver.h"
#if !(defined (OV5640_MINI_5MP_PLUS)||defined (OV5642_MINI_5MP_PLUS))
#error Please select the hardware platform and camera module in the ../libraries/ArduCAM/memorysaver.h file
#endif
#define   FRAMES_NUM    0x00
// set pin 7 as the slave select for the digital port for ArduCam:
const int CS = 7;
//ETCG Notes -- Change Digital Pin for SD Module/ Shield
#define SD_CS 10
//ETCG Note -- RTC/ Real Time Clock Code
#include <DS3231.h>
DS3231 rtc(SDA, SCL);
int timeLapseLength = 60;
long lapseTimeStamp;
//ETCG Note -- Variable for Filename
String fileName;
bool is_header = false;
int total_time = 0;
#if defined (OV5640_MINI_5MP_PLUS)
ArduCAM myCAM(OV5640, CS);
#else
ArduCAM myCAM(OV5642, CS);
#endif
uint8_t read_fifo_burst(ArduCAM myCAM);
void setup() {
  // put your setup code here, to run once:
  uint8_t vid, pid;
  uint8_t temp;
#if defined(__SAM3X8E__)
  Wire1.begin();
#else
  Wire.begin();
#endif
  Serial.begin(115200);
  Serial.println(F("ArduCAM Start!"));
  pinMode(CS, OUTPUT);
  digitalWrite(CS, HIGH);
  SPI.begin();
  myCAM.write_reg(0x07, 0x80);
  delay(100);
  myCAM.write_reg(0x07, 0x00);
  delay(100);

  while (1) {
    //Check if the ArduCAM SPI bus is OK
    myCAM.write_reg(ARDUCHIP_TEST1, 0x55);
    temp = myCAM.read_reg(ARDUCHIP_TEST1);
    if (temp != 0x55)
    {
      Serial.println(F("SPI interface Error!"));
      delay(1000); continue;
    } else {
      Serial.println(F("SPI interface OK.")); break;
    }
  }
#if defined (OV5640_MINI_5MP_PLUS)
  while (1) {
    //Check if the camera module type is OV5640
    myCAM.rdSensorReg16_8(OV5640_CHIPID_HIGH, &vid);
    myCAM.rdSensorReg16_8(OV5640_CHIPID_LOW, &pid);
    if ((vid != 0x56) || (pid != 0x40)) {
      Serial.println(F("Can't find OV5640 module!"));
      delay(1000); continue;
    } else {
      Serial.println(F("OV5640 detected.")); break;
    }
  }
#else
  while (1) {
    //Check if the camera module type is OV5642
    myCAM.rdSensorReg16_8(OV5642_CHIPID_HIGH, &vid);
    myCAM.rdSensorReg16_8(OV5642_CHIPID_LOW, &pid);
    if ((vid != 0x56) || (pid != 0x42)) {
      Serial.println(F("Can't find OV5642 module!"));
      delay(1000); continue;
    } else {
      Serial.println(F("OV5642 detected.")); break;
    }
  }
#endif
  //Initialize SD Card
  while (!SD.begin(SD_CS))
  {
    Serial.println(F("SD Card Error!")); delay(1000);
  }
  Serial.println(F("SD Card detected."));
  //Change to JPEG capture mode and initialize the OV5640 module
  myCAM.set_format(JPEG);
  myCAM.InitCAM();
  myCAM.set_bit(ARDUCHIP_TIM, VSYNC_LEVEL_MASK);
  myCAM.clear_fifo_flag();
  myCAM.write_reg(ARDUCHIP_FRAMES, FRAMES_NUM);
}
void loop() {

  //ETCG Note -- RTC/ Real Time Clock Code
  rtc.begin();

  // put your main code here, to run repeatedly:
  myCAM.flush_fifo();
  myCAM.clear_fifo_flag();
#if defined (OV5640_MINI_5MP_PLUS)
  myCAM.OV5640_set_JPEG_size(OV5640_2592x1944); delay(1000);
#else
  myCAM.OV5642_set_JPEG_size(OV5642_2592x1944); delay(1000);
#endif
  if (rtc.getUnixTime(rtc.getUnixTime()) - lapseTimeStamp > timeLapseLength) {
    lapseTimeStamp = rtc.getUnixTime(rtc.getTime());

    //Start capture
    myCAM.start_capture();
    Serial.println(F("start capture."));
    total_time = millis();
    while ( !myCAM.get_bit(ARDUCHIP_TRIG, CAP_DONE_MASK));
    Serial.println(F("CAM Capture Done."));
    total_time = millis() - total_time;
    Serial.print(F("capture total_time used (in miliseconds):"));
    Serial.println(total_time, DEC);
    total_time = millis();
    read_fifo_burst(myCAM);
    total_time = millis() - total_time;
    Serial.print(F("save capture total_time used (in miliseconds):"));
    Serial.println(total_time, DEC);
    //Clear the capture done flag
    myCAM.clear_fifo_flag();
    delay(5000);
  } else {
    Serial.print("Waiting: ");
    Serial.println(timeLapseLength - (rtc.getUnixTime(rtc.getTime()) - lapseTimeStamp));
  }

}
uint8_t read_fifo_burst(ArduCAM myCAM)
{
  uint8_t temp = 0, temp_last = 0;
  uint32_t length = 0;
  static int i = 0;
  static int k = 0;
  char str[8];
  File outFile;
  byte buf[256];
  length = myCAM.read_fifo_length();
  Serial.print(F("The fifo length is :"));
  Serial.println(length, DEC);
  if (length >= MAX_FIFO_SIZE) //8M
  {
    Serial.println("Over size.");
    return 0;
  }
  if (length == 0 ) //0 kb
  {
    Serial.println(F("Size is 0."));
    return 0;
  }
  myCAM.CS_LOW();
  myCAM.set_fifo_burst();//Set fifo burst mode
  i = 0;
  while ( length-- )
  {
    temp_last = temp;
    temp =  SPI.transfer(0x00);
    //Read JPEG data from FIFO
    if ( (temp == 0xD9) && (temp_last == 0xFF) ) //If find the end ,break while,
    {
      buf[i++] = temp;  //save the last  0XD9
      //Write the remain bytes in the buffer
      myCAM.CS_HIGH();
      outFile.write(buf, i);
      //Close the file
      outFile.close();
      Serial.println(F("OK"));
      is_header = false;
      myCAM.CS_LOW();
      myCAM.set_fifo_burst();
      i = 0;
    }
    if (is_header == true)
    {
      //Write image data to buffer if not full
      if (i < 256)
        buf[i++] = temp;
      else
      {
        //Write 256 bytes image data to file
        myCAM.CS_HIGH();
        outFile.write(buf, 256);
        i = 0;
        buf[i++] = temp;
        myCAM.CS_LOW();
        myCAM.set_fifo_burst();
      }
    }
    else if ((temp == 0xD8) & (temp_last == 0xFF))
    {
      is_header = true;
      myCAM.CS_HIGH();

      //ETCG Note -- Create Filename for Image
      long timeStamp = rtc.getUnixTime(rtc.getTime());
      timeStamp = timeStamp - 1500000000;
      fileName = String(timeStamp) + ".jpg";

      outFile = SD.open(fileName, O_WRITE | O_CREAT | O_TRUNC);

      if (! outFile)
      {
        Serial.println(F("File open failed"));
        while (1);
      }
      myCAM.CS_LOW();
      myCAM.set_fifo_burst();
      buf[i++] = temp_last;
      buf[i++] = temp;
    }
  }
  myCAM.CS_HIGH();
  return 1;

}

[/code]
Error

Arduino: 1.8.13 (Linux), Board: "Arduino Uno"
ETCG_time_lapsecode:23:20: error: no matching function for call to 'DS3231::DS3231(const uint8_t&, const uint8_t&)'
 DS3231 rtc(SDA, SCL);
In file included from /home/threewheeler/Arduino/ETCG_time_lapsecode/ETCG_time_lapsecode.ino:22:0:
/home/threewheeler/arduino/libraries/DS3231/DS3231.h:64:3: note: candidate: DS3231::DS3231()
   DS3231();
In function 'void loop()':
ETCG_time_lapsecode:116:7: error: 'class DS3231' has no member named 'begin'
   rtc.begin();
ETCG_time_lapsecode:131:11: error: 'class DS3231' has no member named 'getUnixTime'; did you mean 'getA1Time'?
   if (rtc.getUnixTime(rtc.getUnixTime()) - lapseTimeStamp > timeLapseLength) {
ETCG_time_lapsecode:131:27: error: 'class DS3231' has no member named 'getUnixTime'; did you mean 'getA1Time'?
   if (rtc.getUnixTime(rtc.getUnixTime()) - lapseTimeStamp > timeLapseLength) {
ETCG_time_lapsecode:132:26: error: 'class DS3231' has no member named 'getUnixTime'; did you mean 'getA1Time'?
     lapseTimeStamp = rtc.getUnixTime(rtc.getTime());
ETCG_time_lapsecode:132:42: error: 'class DS3231' has no member named 'getTime'; did you mean 'getA1Time'?
     lapseTimeStamp = rtc.getUnixTime(rtc.getTime());
ETCG_time_lapsecode:153:43: error: 'class DS3231' has no member named 'getUnixTime'; did you mean 'getA1Time'?
     Serial.println(timeLapseLength - (rtc.getUnixTime(rtc.getTime()) - lapseTimeStamp));
ETCG_time_lapsecode:153:59: error: 'class DS3231' has no member named 'getTime'; did you mean 'getA1Time'?
     Serial.println(timeLapseLength - (rtc.getUnixTime(rtc.getTime()) - lapseTimeStamp));
/home/threewheeler/Arduino/ETCG_time_lapsecode/ETCG_time_lapsecode.ino: In function 'uint8_t read_fifo_burst(ArduCAM)':
ETCG_time_lapsecode:224:28: error: 'class DS3231' has no member named 'getUnixTime'; did you mean 'getA1Time'?
       long timeStamp = rtc.getUnixTime(rtc.getTime());
ETCG_time_lapsecode:224:44: error: 'class DS3231' has no member named 'getTime'; did you mean 'getA1Time'?
       long timeStamp = rtc.getUnixTime(rtc.getTime());
Multiple libraries were found for "SD.h"
 Used: /home/threewheeler/arduino/libraries/SD
 Not used: /home/threewheeler/arduino/libraries/SD-master
exit status 1
no matching function for call to 'DS3231::DS3231(const uint8_t&, const uint8_t&)'

Looks like you didn't install the RTC library properly, or it's the wrong RTC library for the sketch code.

Yes I have been learning about the error message and it appears I have some library issues. I have seen many DS3231 libraries. I am going to start simple basic with this project... I would be happy w/o the RTC, for now. I will try to use the ArduCam and the datalogging shield together then go from there, I guess.

aarg:
Looks like you didn't install the RTC library properly, or it's the wrong RTC library for the sketch code.

Functions and members should be in the keywords txt file for the library?

ETCG_time_lapsecode:23:20: error: no matching function for call to 'DS3231::DS3231(const uint8_t&, const uint8_t&)'
 DS3231 rtc(SDA, SCL);

ETCG_time_lapsecode:116:7: error: 'class DS3231' has no member named 'begin'
   rtc.begin();

threewheeler80:
Functions and members should be in the keywords txt file for the library?
]

No, in the .h file

Learned much in 48 hours... Several companies make data logging shields that look similar but may work better with different versions of code. The data logging shield I am using utilizes a RTC DS1307 which I think is the older one but will work somehow. The newer one is DS3132 and adafruit new one pcf8523 which is better in someway. I tested the the RTC set the time using a DS1307 library. I have also included a picture which clearly but very small says what chip I have :slight_smile: . Now I know that DS1307 should work, I am thinking of including that library in my sketch? Oh and the SD card was recognized... BONUS! I am using RinkyDink DS3132 rtc but the directories where the examples are saved is weird.. I have learned the new version uses .pde, in the second DS3132 file folder (directory - Arduino and chipKit) the ds3131_unixtime folder is empty? IDK...

IMG_0303.jpg

IMG_0303.jpg

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.