Ameba Arduino: [RTL8195AM] ArduCam - Use ArduCAM-Mini-2MP to transfer photos

Preparation

  • Ameba x 1
  • ArduCAM-Mini-2MPx 1
  • AccessPort V.137 Terminal connection software

Example

In this example, ArduCAM-Mini-2MP module is used to generate JEPG and output raw data to console. The libraries we need are
https://github.com/Ameba8195/Arduino/blob/master/libraries/AmebaArduCAM.zip
To install the library, please refer to the teaching article on the official Arduino website. Add the library in the zip file to Ameba RTL8195:
https://www.arduino.cc/en/Guide/Libraries#toc4
Please refer to AMEBA_ArduCAM_Mini_OV2640_JPEG example for instructions on using ArduCAM-Mini-2MP
The wiring diagram is as follows:
1Open the example “File” -> “Examples” -> “AmebaArducam” -> “AMEBA_ArduCAM_Mini_OV2640_JPEG”,After compiling and uploading to Ameba RTL8195, press the Reset button to reboot。

Instructions

This example uses Serial communication to interact with the user, and we use the terminal software as AccessPort, and the connection baudrate is 115200 after connecting to Ameba RTL8195 as shown below:
2
At the beginning, the program will wait for the user to input the hexadecimal command from the Serial transmission interface. First, set the setting of the AccessPort sending field from string to hexadecimal, and set the picture resolution (default is 320×240). Enter 0 ~ 8 in the sending field, the maximum resolution that OV2640 can support is as follows:
      case 0:
        myCAM.OV2640_set_JPEG_size(OV2640_160x120);
        break;
      case 1:
        myCAM.OV2640_set_JPEG_size(OV2640_176x144);
        break;
      case 2:
        myCAM.OV2640_set_JPEG_size(OV2640_320x240);
        break;
      case 3:
        myCAM.OV2640_set_JPEG_size(OV2640_352x288);
        break;
      case 4:
        myCAM.OV2640_set_JPEG_size(OV2640_640x480);
        break;
      case 5:
        myCAM.OV2640_set_JPEG_size(OV2640_800x600);
        break;
      case 6:
        myCAM.OV2640_set_JPEG_size(OV2640_1024x768);
        break;
      case 7:
        myCAM.OV2640_set_JPEG_size(OV2640_1280x1024);
        break;
      case 8:
        myCAM.OV2640_set_JPEG_size(OV2640_1600x1200);
        break;

Then enter 0x11 value in the AccessPort sending field. In the code, 0x11 represents setting the output image format to JPEG (the default is JPEG format), and then re-enter 0x10, OV2640 will start printing a jpeg raw to the terminal data

      case 0x10:
        mode = 1;
        start_capture = 1;
        //Serial.println("CAM start single shoot.");
        break;
      case 0x11:
        myCAM.set_format(JPEG);
        myCAM.InitCAM();
        break;

At this time, the Terminal page of AccessPort can be set to HEX display, you can see the raw data from OV2640, as shown below:
3

After the raw data is printed on the Terminal page, click on the icon of the archive above. During the archive process, select All Files (*. *) as the type of archive, and then you can watch the pictures
4

In addition, it provides a continuous image output method. As long as you return to the AccessPort sending field and enter a value of 0x20, the OV2640 will continuously output jpeg raw data

case 0x20:
        mode = 2;
        start_capture = 2;
        //Serial.println("CAM start contrues shoots.");
        break;     

Until Ameba RTL8195 receives 0x21 value command from AccessPort, it will end printing jpeg raw data

temp = Serial.read();
if (temp == 0x21)
{
     start_capture = 0;
     mode = 0;
     break;
}
Please confirm that QQ communication software is installed