ArduCAM no such file message

How do I stop this message " No such file"

https://create.arduino.cc/editor/Colin43/4f4bbede-cdeb-4cb8-8e8c-f07d975e5e31/preview

arduini 1.JPG

You are missing the library or made a mistake adding the library to IDE. Can you see your library under your Arduino Libraries folder?

RabbitTheDevil is correct. The error is because you haven't installed the ArduCAM library.

Unfortunately this library is a bit challenging to install in the Arduino Web Editor, but you can do it by following these instructions:

Download the library: https://github.com/ArduCAM/Arduino/archive/master.zip

Unzip the downloaded file.

Unlike the Arduino IDE, Arduino Web Editor requires that all libraries have a library.properties file, but the ArduCAM library does not have this file, so you'll need to create one:

Create a file named library.properties in the Arduino-master/ArduCAM folder.

Open the file in a text editor and add the following lines:

name=ArduCAM
version=0.1.0-beta
author=ArduCAM.com
maintainer=ArduCAM.com
sentence=Take high resolution still images and short video clips on Arduino based platforms using ArduCAM's camera modules.
paragraph=
category=Device Control
url=https://github.com/ArduCAM/Arduino
architectures=*
includes=ArduCAM.h,memorysaver.h

Save the file.

The Arduino Web Editor only allows you a limited amount of disk space. It is also very slow to import large libraries. As it is when you download it, the ArduCAM library is >88 MB! But that's all from a bunch of files that will not have any use when the library is imported to Arduino Web Editor. So you need to delete those files:

Delete the Arduino-master/ArduCAM/examples/ESP8266 folder. ESP8266 is not currently supported on Arduino Web Editor so you don't need those.

Delete the Arduino-master/ArduCAM/examples/host_app folder.

Delete the Arduino-master/ArduCAM/examples/RaspberryPi folder.

Delete Arduino-master/ArduCAM/examples/mini/ArduCAM_Mini_PIR_Trig_Capture2SD.ino/pirHardwareConnection.png

Rename Arduino-master/ArduCAM/examples/mini/ArduCAM_Mini_PIR_Trig_Capture2SD.ino to Arduino-master/ArduCAM/examples/mini/ArduCAM_Mini_PIR_Trig_Capture2SD

Note that the library documentation says this: https://github.com/ArduCAM/Arduino#1-edit-memorysaverh-file

Open the memorysaver.h file in the ArduCAM folder and enable the hardware platform and camera module which matches to your hardware by comment or uncomment the macro definition in the file. For example, if you got a ArduCAM-Mini-2MP you should uncomment the line #define OV2640_MINI_2MP and comment all the other lines. And if you got a ArduCAM-Shield-V2 and a OV5642 camera module, you should uncomment the line #define ARDUCAM_SHIELD_V2 and the line #define OV5642_CAM then comment other lines.

You won't be able to edit memorysaver.h after the library has been imported into Arduino Web Editor so you need to do it now.

Zip the Arduino-master/ArduCAM folder.

In the Arduino Web Editor, click the "Sketchbook" tab.

Click the upward pointing arrow button (Import).

If you get a pop up about importing your sketchbook, click the "Import" button.

Select the ArduCAM.zip file you created.

Click the "Open" button.

Wait until you get a pop up that tell you the library was successfully imported.

You also have a bug in your code. You need to change line 19 from:

#include "memorysaver.h

to:

#include "memorysaver.h"

Many thanks for all the info I will print it out and go through step by step, wish me luck Colin

PS if I don't use the web editor but use the one I have downloaded on my laptop I guess it's still the same procedure

Colin43:
Many thanks for all the info

You’re very welcome. Please let me know if you have any questions or run into any problems.

Colin43:
PS if I don’t use the web editor but use the one I have downloaded on my laptop I guess it’s still the same procedure

With the Arduino IDE, it’s much more simple to install the ArduCAM library:

  • Download the library: https://github.com/ArduCAM/Arduino/archive/master.zip
  • Unzip the downloaded file.
  • Edit Arduino-master/ArduCAM/memorysaver.h to configure it for the camera hardware you own. Since you’re only installing the ArduCAM library on your computer, you can always edit that file later, but it’s convenient to do it now.
  • (In the Arduino IDE) Sketch > Include Library > Add .ZIP library
  • Select the folder Arduino-master/ArduCAM
  • Click the “Open” button.

The library is now installed in the Arduino IDE. Despite the menu name, “Add .ZIP library” can be used to install libraries from folders as well as from .zip files. You can access the library’s example sketches from the File > Examples > ArduCAM menu.

Now that sounds a lot more user-friendly.

When I purchased the camera and shield the big selling point was it could be used without writing any programs just plug it in MISLEADING ADVERTISING I reckon.

so far so good.

How do I now solve "myCAM was not declared in scope"?

Declare the myCAM object before your setup(). You are most likely declaring it in your setup like Cam myCam = new Cam() or something similar, but your loop can't see what you declared in setup part. So do your declarations before setup, but set the values to those in your setup. You should be able to do Cam myCam; before your setup and do myCam = new Cam() in your setup. The declarations I did here are not correct, change them accordingly.

Thanks, Rabbit I think I’m really out of my depth with programming this camera. If I can ask one last question before I give it all away. Could you take a look at the screenshot, could I be on the correct track?

Can you please post your whole code between code tags so we can read it and help you efficiently? The link above is dead now. A screenshot of your code really doesn't help me much.

First part of the code

#include <HW_AVR_SPI_defines.h>
#include <UTFT_SPI.h>

#include <ArduCAM_Touch.h>

#include <ArduCAM.h>
#include <memorysaver.h>
#include <mt9d111_regs.h>
#include <mt9d112_regs.h>
#include <mt9m001_regs.h>
#include <mt9m034_regs.h>
#include <mt9m112_regs.h>
#include <mt9t112_regs.h>
#include <mt9v111_regs.h>
#include <ov2640_regs.h>
#include <ov3640_regs.h>
#include <ov5640_regs.h>
#include <ov5642_regs.h>
#include <ov7660_regs.h>
#include <ov7670_regs.h>
#include <ov7675_regs.h>
#include <ov7725_regs.h>

// ArduCAM demo (C)2017 Lee
// Web: http://www.ArduCAM.com
// This program is a demo of how to use most of the functions
// of the library with a supported camera modules//This demo can only work on ARDUCAM_SHIELD_V2 platform.
//This demo is compatible with ESP8266
// It will run the ArduCAM as a real 2MP/3MP/5MP digital camera, provide both preview and JPEG capture.
// The demo sketch will do the following tasks:
// 1. Set the sensor to BMP preview output mode.
// 2. Switch to JPEG mode when shutter buttom pressed.
// 3. Capture and buffer the image to FIFO.
// 4. Store the image to Micro SD/TF card with JPEG format.
// 5. Resolution can be changed by myCAM.OV5642_set_JPEG_size() function.
// This program requires the ArduCAM V4.0.0 (or later) library and ArduCAM shield V2
// and use Arduino IDE 1.6.8 compiler or above

#include <UTFT_SPI.h>
#include <SD.h>
#include <Wire.h>
#include <ArduCAM.h>
#include <SPI.h>
#include "memorysaver.h"
//This demo was made for Omnivision MT9D111A/MT9D111B/MT9M112/MT9V111_CAM/
//                                  MT9M001/MT9T112/MT9D112/OV7670/OV7675/
//                                  OV7725/OV2640/OV5640/OV5642 sensor.
#if !(defined ARDUCAM_SHIELD_V2 && (defined MT9D111A_CAM|| defined MT9D111B_CAM || defined MT9M112_CAM \
                                 || defined MT9V111_CAM || defined MT9M001_CAM || defined MT9T112_CAM \
                                 || defined MT9D112_CAM || defined OV7670_CAM  || defined OV7675_CAM \
                                 || defined OV7725_CAM  || defined OV2640_CAM  || defined OV5640_CAM \
                                 || defined OV5642_CAM  || defined OV3640_CAM))
#ifndef _MEMORYSAVER_
#define _MEMORYSAVER_

//Only when using raspberry,enable it
//#define RASPBERRY_PI

//There are two steps you need to modify in this file before normal compilation
//Only ArduCAM Shield series platform need to select camera module, ArduCAM-Mini series platform doesn't

//Step 1: select the hardware platform, only one at a time
#define OV2640_MINI_2MP
//#define OV3640_MINI_3MP
//#define OV5642_MINI_5MP
//#define OV5642_MINI_5MP_BIT_ROTATION_FIXED
//#define OV2640_MINI_2MP_PLUS
//#define OV5642_MINI_5MP_PLUS
//#define OV5640_MINI_5MP_PLUS


//#define ARDUCAM_SHIELD_REVC
#define ARDUCAM_SHIELD_V2


//Step 2: Select one of the camera module, only one at a time
#if (defined(ARDUCAM_SHIELD_REVC) || defined(ARDUCAM_SHIELD_V2))
//#define OV7660_CAM
//#define OV7725_CAM
//#define OV7670_CAM
//#define OV7675_CAM
#define OV2640_CAM
//#define OV3640_CAM
//#define OV5642_CAM
//#define OV5640_CAM

//#define MT9D111A_CAM
//#define MT9D111B_CAM
//#define MT9M112_CAM
//#define MT9V111_CAM
//#define MT9M001_CAM
//#define MT9V034_CAM
//#define MT9M034_CAM
//#define MT9T112_CAM
//#define MT9D112_CAM
#endif

#endif  //_MEMORYSAVER_
#endif
#if defined(__arm__)
#include <itoa.h>
#endif

#if defined(ESP8266)
#define SD_CS 0
const int SPI_CS = 16;
#else
#define SD_CS 9
const int SPI_CS = 10;
#endif

#if defined (MT9D111A_CAM)
ArduCAM myCAM(MT9D111_A, SPI_CS);
#elif defined (MT9D111B_CAM)
ArduCAM myCAM(MT9D111_B, SPI_CS);
#elif defined (MT9M112_CAM)
ArduCAM myCAM(MT9M112, SPI_CS);
#elif defined (MT9V111_CAM)
ArduCAM myCAM(MT9V111, SPI_CS);
#elif defined (MT9M001_CAM)
ArduCAM myCAM(MT9M001, SPI_CS);
#elif defined (MT9T112_CAM)
ArduCAM myCAM(MT9T112, SPI_CS);
#elif defined (MT9D112_CAM)
ArduCAM myCAM(MT9D112, SPI_CS);
#elif defined (OV7670_CAM)
ArduCAM myCAM(OV7670, SPI_CS);
#elif defined (OV7675_CAM)
ArduCAM myCAM(OV7675, SPI_CS);
#elif defined (OV7725_CAM)
ArduCAM myCAM(OV7725, SPI_CS);
#elif defined (OV2640_CAM)
ArduCAM myCAM(OV2640, SPI_CS);
#elif defined (OV3640_CAM)
ArduCAM myCAM(OV3640, SPI_CS);
#elif defined (OV5640_CAM)
ArduCAM myCAM(OV5640, SPI_CS);
#elif defined (OV5642_CAM)
ArduCAM myCAM(OV5642, SPI_CS);
#endif
UTFT myGLCD(SPI_CS);
boolean isShowFlag = true;
bool is_header = false;

2nd part of the code

void setup()
{
  uint8_t vid, pid;
  uint8_t temp;
#if defined(__SAM3X8E__)
  Wire1.begin();
#else
  Wire.begin();
#endif
  Serial.begin(115200);
  Serial.println(F("ArduCAM Start!"));
  // set the SPI_CS as an output:
  pinMode(SPI_CS, OUTPUT);
  digitalWrite(SPI_CS, HIGH);
  // initialize SPI:
  SPI.begin();

  //Reset the CPLD
  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;
    }
  }
  //Change MCU mode
  myCAM.set_mode(MCU2LCD_MODE);
  myGLCD.InitLCD();
#if defined (OV2640_CAM)
  while (1) {
    //Check if the camera module type is OV2640
    myCAM.wrSensorReg8_8(0xff, 0x01);
    myCAM.rdSensorReg8_8(OV2640_CHIPID_HIGH, &vid);
    myCAM.rdSensorReg8_8(OV2640_CHIPID_LOW, &pid);
    if ((vid != 0x26 ) && (( pid != 0x41 ) || ( pid != 0x42 ))) {
      Serial.println(F("Can't find OV2640 module!"));
      delay(1000); continue;
    } else {
      Serial.println(F("OV2640 detected.")); break;
    }
  }
#elif defined (OV3640_CAM)
  while (1) {
    //Check if the camera module type is OV3640
    myCAM.wrSensorReg16_8(0xff, 0x01);
    myCAM.rdSensorReg16_8(OV3640_CHIPID_HIGH, &vid);
    myCAM.rdSensorReg16_8(OV3640_CHIPID_LOW, &pid);
    if ((vid != 0x36) || (pid != 0x4C)) {
      Serial.println(F("Can't find OV3640 module!"));
      delay(1000); continue;
    } else {
      Serial.println(F("OV3640 detected.")); break;
    }
  }
#elif defined (OV5640_CAM)
  while (1) {
    //Check if the camera module type is OV5640
    myCAM.wrSensorReg16_8(0xff, 0x01);
    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;
    }
  }
#elif defined (OV5642_CAM)
  while (1) {
    //Check if the camera module type is OV5642
    myCAM.wrSensorReg16_8(0xff, 0x01);
    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 BMP capture mode and initialize the OV5642 module
  myCAM.set_format(BMP);
  myCAM.InitCAM();
}
void loop()
{
  char str[8];
  File outFile;
  byte buf[256];
  static int i = 0;
  static int k = 0;
  uint8_t temp = 0, temp_last = 0;
  uint32_t length = 0;
  uint8_t start_capture = 0;
  int total_time = 0;
  //Wait trigger from shutter buttom
  if (myCAM.get_bit(ARDUCHIP_TRIG , SHUTTER_MASK))
  {
    isShowFlag = false;
    myCAM.set_mode(MCU2LCD_MODE);
    myCAM.set_format(JPEG);
    myCAM.InitCAM();
#if defined (OV2640_CAM)
    myCAM.OV2640_set_JPEG_size(OV2640_640x480); delay(1000);
#elif defined (OV3640_CAM)
    myCAM.OV3640_set_JPEG_size(OV3640_320x240); delay(1000);
#elif defined (OV5640_CAM)
    myCAM.OV5640_set_JPEG_size(OV5640_320x240); delay(1000);
    myCAM.write_reg(ARDUCHIP_TIM, VSYNC_LEVEL_MASK);    //VSYNC is active HIGH
#elif defined (OV5642_CAM)
    myCAM.OV5642_set_JPEG_size(OV5642_320x240); delay(1000);
    myCAM.write_reg(ARDUCHIP_TIM, VSYNC_LEVEL_MASK); //VSYNC is active HIGH
#endif
    //Wait until buttom released
    while (myCAM.get_bit(ARDUCHIP_TRIG, SHUTTER_MASK));
    delay(1000);
    start_capture = 1;
  }
  else
  {
    if (isShowFlag )
    {
      if (!myCAM.get_bit(ARDUCHIP_TRIG, VSYNC_MASK)) //New Frame is coming
      {
        myCAM.set_mode(MCU2LCD_MODE);   //Switch to MCU
        myGLCD.resetXY();
        myCAM.set_mode(CAM2LCD_MODE);     //Switch to CAM
        while (!myCAM.get_bit(ARDUCHIP_TRIG, VSYNC_MASK)); //Wait for VSYNC is gone
      }
    }
  }
  if (start_capture)
  {
    //Flush the FIFO
    myCAM.flush_fifo();
    //Clear the capture done flag
    myCAM.clear_fifo_flag();
    //Start capture
    myCAM.start_capture();
    Serial.println(F("Start Capture"));
  }
  if (myCAM.get_bit(ARDUCHIP_TRIG , CAP_DONE_MASK))
  {
    Serial.println(F("Capture Done."));
    length = myCAM.read_fifo_length();
    Serial.print(F("The fifo length is :"));
    Serial.println(length, DEC);
    if (length >= MAX_FIFO_SIZE) //8M
    {
      Serial.println(F("Over size."));
      return ;
    }
    if (length == 0 ) //0 kb
    {
      Serial.println(F("Size is 0."));
      return;
    }
    //Construct a file name
    k = k + 1;
    itoa(k, str, 10);
    strcat(str, ".jpg");
    //Open the new file
    outFile = SD.open(str, O_WRITE | O_CREAT | O_TRUNC);
    if (! outFile)
    {
      Serial.println(F("File open failed"));
      return;
    }
    i = 0;
    myCAM.CS_LOW();
    myCAM.set_fifo_burst();
    while ( length-- )
    {
#if defined (ESP8266)
      yield();
#endif
      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("Image save OK."));
        is_header = false;
        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;
        buf[i++] = temp_last;
        buf[i++] = temp;
      }
    }
    //Clear the capture done flag
    myCAM.clear_fifo_flag();
    //Clear the start capture flag
    start_capture = 0;
    myCAM.set_format(BMP);
    myCAM.InitCAM();
    isShowFlag = true;
  }
}

[/code]

Your original code compiled without any problems but then you really went off the rails after that. You need to take a methodical approach to writing code: test, make a single change, test again, repeat. Don’t ever move on to the next change until the current one is working correctly. It might seem slow at first, but in the end it’s faster and much less frustrating.

Colin43:

#include <ArduCAM.h>

#include <memorysaver.h>
#include <mt9d111_regs.h>
#include <mt9d112_regs.h>
#include <mt9m001_regs.h>
#include <mt9m034_regs.h>
#include <mt9m112_regs.h>
#include <mt9t112_regs.h>
#include <mt9v111_regs.h>
#include <ov2640_regs.h>
#include <ov3640_regs.h>
#include <ov5640_regs.h>
#include <ov5642_regs.h>
#include <ov7660_regs.h>
#include <ov7670_regs.h>
#include <ov7675_regs.h>
#include <ov7725_regs.h>

Delete all these lines. Apparently you did a Sketch > Include Library > ArduCAM. The only thing that does is to automatically add an #include directive for the files listed in the includes field of library.properties. Since the library doesn’t have a library.properties, it added #include directives for all the .h files in the library. But that is bad because these files are for specific hardware and it makes no sense to add #include directives for all of them. You already had the correct include directives for the ArduCAM library in your original code, which are still there at lines 42 and 44. So your pointless use of Sketch > Include Library > ArduCAM only broke your code.

After that, the code compiles for me but there is something else very perplexing to me:

Colin43:

#ifndef _MEMORYSAVER_

#define MEMORYSAVER

//Only when using raspberry,enable it
//#define RASPBERRY_PI

//There are two steps you need to modify in this file before normal compilation
//Only ArduCAM Shield series platform need to select camera module, ArduCAM-Mini series platform doesn’t

//Step 1: select the hardware platform, only one at a time
#define OV2640_MINI_2MP
//#define OV3640_MINI_3MP
//#define OV5642_MINI_5MP
//#define OV5642_MINI_5MP_BIT_ROTATION_FIXED
//#define OV2640_MINI_2MP_PLUS
//#define OV5642_MINI_5MP_PLUS
//#define OV5640_MINI_5MP_PLUS

//#define ARDUCAM_SHIELD_REVC
#define ARDUCAM_SHIELD_V2

//Step 2: Select one of the camera module, only one at a time
#if (defined(ARDUCAM_SHIELD_REVC) || defined(ARDUCAM_SHIELD_V2))
//#define OV7660_CAM
//#define OV7725_CAM
//#define OV7670_CAM
//#define OV7675_CAM
#define OV2640_CAM
//#define OV3640_CAM
//#define OV5642_CAM
//#define OV5640_CAM

//#define MT9D111A_CAM
//#define MT9D111B_CAM
//#define MT9M112_CAM
//#define MT9V111_CAM
//#define MT9M001_CAM
//#define MT9V034_CAM
//#define MT9M034_CAM
//#define MT9T112_CAM
//#define MT9D112_CAM
#endif

#endif  //MEMORYSAVER

You copy pasted the contents of memorysaver.h into your sketch. That is completely pointless because the MEMORYSAVER macro was defined in memorysaver.h, which was already included in your code, so the compiler will just skip all that code in your sketch. Therefore it only clutters up your code, and is bound to cause confusion. Delete all those lines. Make sure you have properly configured the memorysaver.h file in the library for your hardware.

Many thanks " really went off the rails" you can say that again .I will have another go

We can now use light and the end of the tunnel in the same sentence. I have a program loaded without any errors. That's loading the Arduino, the only problem is I can't ( as yet) capture any pictures.

Camera program info: AdruCAM 2mp OV 2640 camera plugged into the V2 shield

The program used in V2 shield examples ' Mini Capture 2SD'

I have loaded the host programs from what I can make out one is the set-up the other for image viewing.

The first loaded a treat no problems The second when it's opened SPI interface error message followed by umteen ?????

I have the camera working, okay it still has a few problems like the image quality, so far I'm very happy.

Congratulations! I'm so glad to hear it's working now. Enjoy! Per

Thanks for all your help.

You're welcome. I'm glad if I was able to be of assistance.

I don't wanna push my luck LOL ....but ....would it be okay if I ask another question about this project Col