Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OV7670 #77

Closed
jjsch-dev opened this issue Sep 23, 2019 · 87 comments
Closed

OV7670 #77

jjsch-dev opened this issue Sep 23, 2019 · 87 comments

Comments

@jjsch-dev
Copy link
Contributor

Hi, I writed the driver for the OV7670, if some need it please contact me.

@jjsch-dev
Copy link
Contributor Author

jjsch-dev commented Oct 23, 2019 via email

@jjsch-dev
Copy link
Contributor Author

jjsch-dev commented Oct 24, 2019 via email

@jjsch-dev
Copy link
Contributor Author

thanks for the information, I made a fork of the esp32-camera and the pull request for adding the ov7670 driver. Please tell me if you can get the changes.

@jjsch-dev
Copy link
Contributor Author

The esp32-camera-master is part of the idf component, you need to copy it to the folder idf/componnets. I use a fork of the igrr/esp32-cam-demo, if you need it please let me know.

@jjsch-dev
Copy link
Contributor Author

ok, I will made the fork tomorrow.

@jjsch-dev
Copy link
Contributor Author

I made the pull request to the igrr/esp32-cam-demo. Please use this project and compile.

@jjsch-dev
Copy link
Contributor Author

Checking the rep for the es32-camera, by mistake I forgot to add the drivers files:
sensors/ov7670.c
sensors/private_include/ov7670.h
sensors/private_include/ov7670_regs.h
please check now.

@jjsch-dev
Copy link
Contributor Author

Now I merge the igrr/esp32-cam-demo in my repository. Please use this project and compile.

@jjsch-dev
Copy link
Contributor Author

The esp32_camera driver need to be inside the components folder of esp-idf, please check if you have a similar list.
folder_esp32_camera

@jjsch-dev
Copy link
Contributor Author

ok, please try to move the folder esp32-camera to the folder esp-idf/components.

@jjsch-dev
Copy link
Contributor Author

you need to obtain two source code, one is the esp32-cam-demo-master (the application), please leave it in the example folder, but the driver code esp32-camera need to be in the folder esp-idf/components.

@jjsch-dev
Copy link
Contributor Author

the camera driver: https://github.com/jjsch-dev/esp32-camera
the camera demo: https://github.com/jjsch-dev/esp32-cam-demo
camera_demo
camera_driver

@jjsch-dev
Copy link
Contributor Author

please copy all files.
http_folder

@amirjak
Copy link

amirjak commented Oct 29, 2019

Thank you for your work .
It works .
715vwvP5ZEL

I have a problem with the color of the photo ?

http://192.168.1.132/bmp

capture.bmp

capture

@amirjak
Copy link

amirjak commented Oct 29, 2019

Pin Configuration

PWDN ______Not connected
RESET _____2
XCLK _____21
SIOD _____ 26
SIOC _____27

D7 ___35
D6 ___34
D5 ___ 39
D4 ___36
D3 ___19
D2 ___ 18
D1 ___5
D0 ___ 4

VSYNC ___25
HREF ___23
PCLK ___22
IMG_20191029_173016

@jjsch-dev
Copy link
Contributor Author

Good job!!

My Pin Configuration
CONFIG_D0=16
CONFIG_D1=25
CONFIG_D2=17
CONFIG_D3=33
CONFIG_D4=18
CONFIG_D5=32
CONFIG_D6=19
CONFIG_D7=35
CONFIG_XCLK=5
CONFIG_PCLK=14
CONFIG_VSYNC=27
CONFIG_HREF=23
CONFIG_SDA=21
CONFIG_SCL=22
CONFIG_RESET=26

The prototype
esp32_capture_ov7670

Captured picture
esp32_ov7670_capture

Please enable the color pattern
CONFIG_ENABLE_TEST_PATTERN=y
verify the camera clock
CONFIG_XCLK_FREQ=12000000

esp32_ov7670_color

@amirjak
Copy link

amirjak commented Oct 30, 2019

I made the changes in these two file

Annotation 2019-10-30 124811

sdkconfig.defaults

CONFIG_ENABLE_TEST_PATTERN=y

CONFIG_OV2640_SUPPORT=n
CONFIG_OV7725_SUPPORT=n
CONFIG_OV7670_SUPPORT=y
CONFIG_ESP32_DEFAULT_CPU_FREQ_240=y
CONFIG_ESP32_DEFAULT_CPU_FREQ_MHZ=240
CONFIG_MEMMAP_SMP=y
CONFIG_TASK_WDT=n
CONFIG_FREERTOS_UNICORE=n
CONFIG_FREERTOS_HZ=100
CONFIG_LOG_DEFAULT_LEVEL_INFO=y
CONFIG_LOG_DEFAULT_LEVEL=3

sdkconfig.File

CONFIG_BT_RESERVE_DRAM=0
CONFIG_BLE_MESH is not set

CONFIG_ENABLE_TEST_PATTERN=y

CONFIG_OV2640_SUPPORT is not set
CONFIG_OV7725_SUPPORT is not set
CONFIG_OV7670_SUPPORT=y

But it didn't work

capture

@jjsch-dev
Copy link
Contributor Author

The file is the sdkconfig, but you can change the configuration using the utility menuconfig. Some times you will need to clean project to update the configuration, use: make clean.

sdkconfig

Launch the menuconfig
menuconfig_cmd

Change the clock frequency
menuconfig_demo
menuconfig_clk

Enable test pattern
menuconfig_camera
menuconfig_testpattern

@amirjak
Copy link

amirjak commented Oct 31, 2019

I think I missed something

So I deleted everything and started from the beginning

I have downloaded these files again
01
05

And put them in these folders


jjsch-dev/esp32-camera

esp\esp-idf\components\esp32-camera


jjsch-dev/esp32-cam-demo

esp\esp-idf\examples\esp32-cam-demo


igrr/esp32-http-server

esp\esp-idf\examples\esp32-cam-demo\components\http_server


And then at mingw32.exe

14
16

20

23
29
30

And then it happened

31

It does not work

@jjsch-dev
Copy link
Contributor Author

I reproduce the problem by increasing the frequency of the camera clock by 120 Mhz, please use 12 Mhz.

menuconfig_clk

@amirjak
Copy link

amirjak commented Nov 1, 2019

frequency 12000000 not working

@jjsch-dev
Copy link
Contributor Author

I do some test with my board, and found the camera clock limit is 24 Mhz, but work fine from 12 to 20 Mhz, and present the problems that you first reported with 10 Mhz. All test was made it with 240 Mhz for the cpu clock.

Camera clock = 10 Mhz
esp32_ov7670_testpattern_10mhz

Camera clock = 15 Mhz
esp32_ov7670_testpattern_15mhz

Camera clock = 20 Mhz
esp32_ov7670_testpattern_20mhz

Camera clock = 24 Mhz
esp32_camera_error_xclk_24Mhz

CPU clock = 240 Mhz
esp32_clk_240Mhz

@amirjak
Copy link

amirjak commented Nov 2, 2019

After the camera color had a problem
capture

I deleted the msys32 program with its folder

After that, when I reinstalled the program, I had a this problem

I made these changes

001

And then it happened

01

02

If you can send your cpu_start.c file to me

@jjsch-dev
Copy link
Contributor Author

ok
cpu_start.zip

@jjsch-dev
Copy link
Contributor Author

It is possible that you use are using a newer version of module ledc than me. I found in the esp32_camera a similar report:
LEDc configuration error and camera_probe failed #66 of https://github.com/masterd89

https://github.com/mirronelli suggest add the following sentence to fix the problem.

there was a change in ledc driver that is used to drive the clock

to work with the current version a one line of code needs to be added into xclk.c
the line is:

timer_conf.clk_cfg = LEDC_USE_APB_CLK;
put in in the block bellow

    ledc_timer_config_t timer_conf;
    timer_conf.duty_resolution = 2;
    timer_conf.freq_hz = config->xclk_freq_hz;

timer_conf.speed_mode = LEDC_HIGH_SPEED_MODE;
timer_conf.timer_num = config->ledc_timer;
timer_conf.clk_cfg = LEDC_USE_APB_CLK;
esp_err_t err = ledc_timer_config(&timer_conf);
if (err != ESP_OK) {
ESP_LOGE(TAG, "ledc_timer_config failed, rc=%x", err);
return err;
}
you will find the the file in yourproject/components/esp32-camera/driver/xclk.c

use of the APB clock was assumed in previous commit to ledc.c and now it needs to be explicitly set

@amirjak
Copy link

amirjak commented Nov 3, 2019

Thank you for your work .

715vwvP5ZELcapturecapture (1)456

It works .

@jjsch-dev
Copy link
Contributor Author

Glad to hear that!

@billyrudi
Copy link

Hi, how i can use camera with arduino ide?
i have esp32-cam board and ov7670 camera module.
regards Paolo

@amirjak
Copy link

amirjak commented Nov 5, 2019

@jjsch-dev
Copy link
Contributor Author

jjsch-dev commented Mar 21, 2020

you need both, xclk is the sensor input, and pclk is the reference output for capturing from esp32.
OV7670_FIFO_SCH_V2_reform

@ecallens
Copy link

Hi,

Thank you for the driver and the demo code. It works fine using the standard ESP32-WROVER-KIT Camera Pinout. I tried using it on the Wrover kit V3 with a custom pinout for a project and I have a color issue.

Capture6

Capture1

Here is my menuconfig relevant configuration :
Capture
Capture2
Capture4
Capture5

Any idea why I could have this color problem with this specific pinout on the Wrover kit v3 ?
Thanks

@jjsch-dev
Copy link
Contributor Author

Hi @TheEdwood , I'm glad that you were able to make the camera work, regarding the problem, verify that the camera clock is higher than 10 Mhz. CONFIG_XCLK_FREQ = 12000000

@ecallens
Copy link

HI @jjsch-dev, The frequency is already set to 12000000 as you said, I checked on the sdkconfig.h generated file. I also have the problem with 20 MHz clock

What I find weird is that I have this problem only with this specific pinout (as showed in the pictures above). Is there any pin that can't be used with the camera interface ?

Thanks

@ecallens
Copy link

Hi @jjsch-dev,

I found the issue.
I was using the IO32 and IO33 pins for D3 et D2 signals. In the ESP32-WROVER KIT V3, these pins are used for a 33 kHz crystal peripheral, and are therefore not wired to the main connector. A resistor combination can be changed to switch the configuration and use the pins.

From the espressif kit description page (https://docs.espressif.com/projects/esp-idf/en/latest/esp32/hw-reference/esp32/get-started-wrover-kit-v3.html) :

"Since GPIO32 and GPIO33 are connected to the oscillator by default, they are not connected to the JP1 I/O connector to maintain signal integrity. This allocation may be changed from the oscillator to JP1 by desoldering the zero-ohm resistors from positions R11 / R23 and re-soldering them to positions R12 / R24."

With this taken care of, the camera works.
Thanks !

@jjsch-dev
Copy link
Contributor Author

@TheEdwood I'm glad you found the problem.

@Rajssss
Copy link

Rajssss commented Oct 1, 2020

@jjsch-dev I am getting these two errors:
connect.c: undefined reference to start' connect.c: undefined reference to stop'
Any idea?
I am trying to build your example esp32-camera-demo.
I see void start(void) and void stop(void) is declared in connect.c but they are not defined?

@jjsch-dev
Copy link
Contributor Author

@Rajssss I can't find references to stop or start in app_main.c. Could you tell me which line of the code they are in?

@Rajssss
Copy link

Rajssss commented Oct 1, 2020

@jjsch-dev its in connect.c, actually its part of protocol_examples_common example.
Line 50 and 53 has the deceleration and line 87 has a call to start().
I have another question is that demo (https://github.com/jjsch-dev/esp32-cam-demo) really meant to be work with your driver?

@jjsch-dev
Copy link
Contributor Author

@Rajssss Sorry for the delay in responding, I checked the repository and I saw that there are changes in the camera driver, so I'm not sure that the demo application works with the latest version.
This weekend I will try to compile the camera demo with the new driver version.

@Rajssss
Copy link

Rajssss commented Oct 2, 2020

@jjsch-dev thanks :) It will be fine for me if you can share the same version (If you have it still now) which was working earlier for you.

@jjsch-dev
Copy link
Contributor Author

esp3_camera-jjsch-dev

@Rajssss
Copy link

Rajssss commented Oct 2, 2020

@jjsch-dev thanks again. but that link point to same driver right? I am not sure what you wanted to point out here.

@kshitijgarg2609
Copy link

image
I have found this pins_camera.h in the examples given in esp32 arduino, I try to use these pin sets with OV7670 by defining Wrover kit

image
I also tried to change frequency from 20mhz to 12mhz. but the camera is never detected. As mentioned in library that it will support OV7670, so is there anyway to interface this ov7670 fifo camera with esp32 and using esp_camera.h?

@jjsch-dev
Copy link
Contributor Author

@kshitijgarg2609 Hi, I have not tested the controller on arduino, could you please pass me the imo file you are using so that I can perform tests?

@kshitijgarg2609
Copy link

@jjsch-dev ,I am sharing the codes here, Please check.

camera_pins.h ////////////////////////////////////////////////////////////////////

#if defined(CAMERA_MODEL_WROVER_KIT)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 21
#define SIOD_GPIO_NUM 26
#define SIOC_GPIO_NUM 27

#define Y9_GPIO_NUM 35
#define Y8_GPIO_NUM 34
#define Y7_GPIO_NUM 39
#define Y6_GPIO_NUM 36
#define Y5_GPIO_NUM 19
#define Y4_GPIO_NUM 18
#define Y3_GPIO_NUM 5
#define Y2_GPIO_NUM 4
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 23
#define PCLK_GPIO_NUM 22

#elif defined(CAMERA_MODEL_ESP_EYE)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 4
#define SIOD_GPIO_NUM 18
#define SIOC_GPIO_NUM 23

#define Y9_GPIO_NUM 36
#define Y8_GPIO_NUM 37
#define Y7_GPIO_NUM 38
#define Y6_GPIO_NUM 39
#define Y5_GPIO_NUM 35
#define Y4_GPIO_NUM 14
#define Y3_GPIO_NUM 13
#define Y2_GPIO_NUM 34
#define VSYNC_GPIO_NUM 5
#define HREF_GPIO_NUM 27
#define PCLK_GPIO_NUM 25

#elif defined(CAMERA_MODEL_M5STACK_PSRAM)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM 15
#define XCLK_GPIO_NUM 27
#define SIOD_GPIO_NUM 25
#define SIOC_GPIO_NUM 23

#define Y9_GPIO_NUM 19
#define Y8_GPIO_NUM 36
#define Y7_GPIO_NUM 18
#define Y6_GPIO_NUM 39
#define Y5_GPIO_NUM 5
#define Y4_GPIO_NUM 34
#define Y3_GPIO_NUM 35
#define Y2_GPIO_NUM 32
#define VSYNC_GPIO_NUM 22
#define HREF_GPIO_NUM 26
#define PCLK_GPIO_NUM 21

#elif defined(CAMERA_MODEL_M5STACK_WIDE)
#define PWDN_GPIO_NUM -1
#define RESET_GPIO_NUM 15
#define XCLK_GPIO_NUM 27
#define SIOD_GPIO_NUM 22
#define SIOC_GPIO_NUM 23

#define Y9_GPIO_NUM 19
#define Y8_GPIO_NUM 36
#define Y7_GPIO_NUM 18
#define Y6_GPIO_NUM 39
#define Y5_GPIO_NUM 5
#define Y4_GPIO_NUM 34
#define Y3_GPIO_NUM 35
#define Y2_GPIO_NUM 32
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 26
#define PCLK_GPIO_NUM 21

#elif defined(CAMERA_MODEL_AI_THINKER)
#define PWDN_GPIO_NUM 32
#define RESET_GPIO_NUM -1
#define XCLK_GPIO_NUM 0
#define SIOD_GPIO_NUM 26
#define SIOC_GPIO_NUM 27

#define Y9_GPIO_NUM 35
#define Y8_GPIO_NUM 34
#define Y7_GPIO_NUM 39
#define Y6_GPIO_NUM 36
#define Y5_GPIO_NUM 21
#define Y4_GPIO_NUM 19
#define Y3_GPIO_NUM 18
#define Y2_GPIO_NUM 5
#define VSYNC_GPIO_NUM 25
#define HREF_GPIO_NUM 23
#define PCLK_GPIO_NUM 22

#else
#error "Camera model not selected"
#endif

camera_frame_data.h ////////////////////////////////////////////////////////////////////

#include <esp_camera.h>
#define CAMERA_MODEL_WROVER_KIT
#include "camera_pins.h"

void initCam();
int getFrame();

void initCameracam_confuration();

static camera_config_t cam_conf;
boolean cam_start=false;
camera_fb_t *frame;
uint8_t frame_flg='E';

void initCam()
{
initCameracam_confuration();
if(esp_camera_init(&cam_conf)==ESP_OK)
{
sensor_t *sensor_conf = esp_camera_sensor_get();
sensor_conf->set_hmirror(sensor_conf,1);
cam_start=true;
}
else
{
cam_start=false;
}
}

int getFrame()
{
frame_flg='E';
if(cam_start)
{
frame=esp_camera_fb_get();
if(frame)
{
frame_flg='F';
}
}
return (frame_flg=='F')?1:0;
}

void initCameracam_confuration()
{
cam_conf.pin_pwdn = PWDN_GPIO_NUM;
cam_conf.pin_reset = RESET_GPIO_NUM;
cam_conf.pin_xclk = XCLK_GPIO_NUM;
cam_conf.pin_sscb_sda = SIOD_GPIO_NUM;
cam_conf.pin_sscb_scl = SIOC_GPIO_NUM;

cam_conf.pin_d7 = Y9_GPIO_NUM;
cam_conf.pin_d6 = Y8_GPIO_NUM;
cam_conf.pin_d6 = Y8_GPIO_NUM;
cam_conf.pin_d5 = Y7_GPIO_NUM;
cam_conf.pin_d4 = Y6_GPIO_NUM;
cam_conf.pin_d3 = Y5_GPIO_NUM;
cam_conf.pin_d2 = Y4_GPIO_NUM;
cam_conf.pin_d1 = Y3_GPIO_NUM;
cam_conf.pin_d0 = Y2_GPIO_NUM;
cam_conf.pin_vsync = VSYNC_GPIO_NUM;
cam_conf.pin_href = HREF_GPIO_NUM;
cam_conf.pin_pclk = PCLK_GPIO_NUM;

cam_conf.ledc_channel = LEDC_CHANNEL_0;
cam_conf.ledc_timer = LEDC_TIMER_0;
cam_conf.xclk_freq_hz = 12000000;
cam_conf.pixel_format = PIXFORMAT_JPEG;

cam_conf.frame_size = FRAMESIZE_QVGA;
cam_conf.jpeg_quality = 10;
cam_conf.fb_count = 1;
}

esp32_cam_test.ino ////////////////////////////////////////////////////////////////////

void setup()
{
Serial.begin(115200);
initCam();
}

void loop()
{
if(getFrame())
{
Serial.println("FRAME CAPTURED !!!");
}
else
{
Serial.println("FRAME ERROR !!!");
}
}

1621906011503

@jjsch-dev
Copy link
Contributor Author

@kshitijgarg2609 , Thanks for the code, I'll check it out in the next few days.

@kshitijgarg2609
Copy link

@jjsch-dev tested?

@jjsch-dev
Copy link
Contributor Author

@kshitijgarg2609 sorry for the delay in responding, these days I was busy, today I started to test the example you gave me on Arduino, I keep in touch.

@jjsch-dev
Copy link
Contributor Author

@kshitijgarg2609 Hello, the code you sent me is fine, the problem, (if the pins are configured correctly), in my case was that the OV7670 does not support JPG as a format, and if you do not have PSRAM the size of the frame has to be QQVGA.

I modified the code a bit (attached to the 3 files in zip format), so that at first it reports the PID of the detected camera, for the OV7670 it is 0x76.

esp32_cam_test.zip

esp32_camera_arduino

@kshitijgarg2609
Copy link

@jjsch-dev Thank you very much for considering such issues. I have downloaded the code and tested it again, please can you share the circuit diagram or please tell me which other components like resistance to be used. Unfortunately, I am getting frame error again.

@jjsch-dev
Copy link
Contributor Author

@kshitijgarg2609 Hello, my circuit diagram with an OV7670 sensor and an ESP-32 MCU node is as follows. Can you share the initialization that Arduino sends through the serial monitor?

Schematic_ESP-32-nodeMCU-OV7670_2021-06-06

@github-actions
Copy link

github-actions bot commented Sep 9, 2021

This issue appears to be stale. Please close it if its no longer valid.

@tcpipchip
Copy link

tcpipchip commented May 25, 2022

hi, the Arduino example that you sent (zip) is capturing image ?
esp32_cam_test.zip
To me is returning null

`//esp32_cam_test.ino ////////////////////////////////////////////////////////////////////
#include "secrets.h"
#include "esp_camera.h"
#include <WiFiClientSecure.h>
#include <MQTTClient.h>
#include <ArduinoJson.h>
#include "WiFi.h"
#include <base64.h>
#include <EEPROM.h>
#include "camera_frame_data.h"

#define EEPROM_SIZE 1

// The MQTT topics that this device should publish/subscribe
#define AWS_IOT_PUBLISH_TOPIC "$aws/things/lamp/image"
#define AWS_IOT_SUBSCRIBE_TOPIC "$aws/things/lamp/image_txt"

WiFiClientSecure net = WiFiClientSecure();
MQTTClient client = MQTTClient(15000);

void connectAWS()
{
WiFi.mode(WIFI_STA);
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);

Serial.println("Connecting to Wi-Fi");

while (WiFi.status() != WL_CONNECTED){
delay(500);
Serial.print(".");
}

// Configure WiFiClientSecure to use the AWS IoT device credentials
net.setCACert(AWS_CERT_CA);
net.setCertificate(AWS_CERT_CRT);
net.setPrivateKey(AWS_CERT_PRIVATE);

// Connect to the MQTT broker on the AWS endpoint we defined earlier
client.begin(AWS_IOT_ENDPOINT, 8883, net);

// Create a message handler
client.onMessage(messageHandler);

Serial.print("Connecting to AWS IOT");

while (!client.connect(THINGNAME)) {
Serial.print(".");
delay(100);
}

if(!client.connected()){
Serial.println("AWS IoT Timeout!");
return;
}

// Subscribe to a topic
client.subscribe(AWS_IOT_SUBSCRIBE_TOPIC);

Serial.println("AWS IoT Connected!");
}

void messageHandler(String &topic, String &payload) {
Serial.println("incoming: " + topic + " - " + payload);

// StaticJsonDocument<200> doc;
// deserializeJson(doc, payload);
// const char* message = doc["message"];
}

void getFrame()
{
// capture camera frame
camera_fb_t *fb = esp_camera_fb_get();
if(!fb) {
Serial.println("Camera capture failed");
return;
} else {
Serial.println("Camera capture successful!");
}

const char *data = (const char *)fb->buf;

Serial.println(data);

// Image metadata. Yes it should be cleaned up to use printf if the function is available
Serial.print("Size of image:");
Serial.println(fb->len);
Serial.print("Shape->width:");
Serial.print(fb->width);
Serial.print("height:");
Serial.println(fb->height);

String encoded = base64::encode(fb->buf, fb->len);

Serial.println(encoded);

// formating json
DynamicJsonDocument doc(38401);
doc["picture"] = encoded;
String jsonBuffer;

serializeJson(doc, jsonBuffer);

Serial.println(jsonBuffer);

// publishing topic 
if (!client.publish(AWS_IOT_PUBLISH_TOPIC, jsonBuffer)) {
  lwMQTTErr(client.lastError());
}
else
  Serial.println("Published");

// Killing cam resource

esp_camera_fb_return(fb);
}

void lwMQTTErr(lwmqtt_err_t reason)
{
if (reason == lwmqtt_err_t::LWMQTT_SUCCESS)
Serial.print("Success");
else if (reason == lwmqtt_err_t::LWMQTT_BUFFER_TOO_SHORT)
Serial.print("Buffer too short");
else if (reason == lwmqtt_err_t::LWMQTT_VARNUM_OVERFLOW)
Serial.print("Varnum overflow");
else if (reason == lwmqtt_err_t::LWMQTT_NETWORK_FAILED_CONNECT)
Serial.print("Network failed connect");
else if (reason == lwmqtt_err_t::LWMQTT_NETWORK_TIMEOUT)
Serial.print("Network timeout");
else if (reason == lwmqtt_err_t::LWMQTT_NETWORK_FAILED_READ)
Serial.print("Network failed read");
else if (reason == lwmqtt_err_t::LWMQTT_NETWORK_FAILED_WRITE)
Serial.print("Network failed write");
else if (reason == lwmqtt_err_t::LWMQTT_REMAINING_LENGTH_OVERFLOW)
Serial.print("Remaining length overflow");
else if (reason == lwmqtt_err_t::LWMQTT_REMAINING_LENGTH_MISMATCH)
Serial.print("Remaining length mismatch");
else if (reason == lwmqtt_err_t::LWMQTT_MISSING_OR_WRONG_PACKET)
Serial.print("Missing or wrong packet");
else if (reason == lwmqtt_err_t::LWMQTT_CONNECTION_DENIED)
Serial.print("Connection denied");
else if (reason == lwmqtt_err_t::LWMQTT_FAILED_SUBSCRIPTION)
Serial.print("Failed subscription");
else if (reason == lwmqtt_err_t::LWMQTT_SUBACK_ARRAY_OVERFLOW)
Serial.print("Suback array overflow");
else if (reason == lwmqtt_err_t::LWMQTT_PONG_TIMEOUT)
Serial.print("Pong timeout");
}

void lwMQTTErrConnection(lwmqtt_return_code_t reason)
{
if (reason == lwmqtt_return_code_t::LWMQTT_CONNECTION_ACCEPTED)
Serial.print("Connection Accepted");
else if (reason == lwmqtt_return_code_t::LWMQTT_UNACCEPTABLE_PROTOCOL)
Serial.print("Unacceptable Protocol");
else if (reason == lwmqtt_return_code_t::LWMQTT_IDENTIFIER_REJECTED)
Serial.print("Identifier Rejected");
else if (reason == lwmqtt_return_code_t::LWMQTT_SERVER_UNAVAILABLE)
Serial.print("Server Unavailable");
else if (reason == lwmqtt_return_code_t::LWMQTT_BAD_USERNAME_OR_PASSWORD)
Serial.print("Bad UserName/Password");
else if (reason == lwmqtt_return_code_t::LWMQTT_NOT_AUTHORIZED)
Serial.print("Not Authorized");
else if (reason == lwmqtt_return_code_t::LWMQTT_UNKNOWN_RETURN_CODE)
Serial.print("Unknown Return Code");
}

void setup()
{
Serial.begin(115200);
Serial.print("Init camera - PID = ");
Serial.println(initCam(), HEX);
connectAWS();
}

void loop()
{
Serial.println("+++++++++++Detecting+++++++++++");
getFrame();
for(int i = 0; i<=10; i++)
{
delay(1000);
client.loop();
}
}`

image

@tcpipchip
Copy link

wow, now i see that i need PNG /JPG to AWS IoT Rekognizer...
I will have to order the OV5640

@jjsch-dev
Copy link
Contributor Author

@tcpipchip hello, it's been a long time since I sent that code, but when you have the sensor, I'll try to help you.

@tcpipchip
Copy link

Thank you!

@Sentinel8000
Copy link

I tryed the ov7670 example with the current librarys, followed the pin connections, but not working:/

This example will be important, because i want use with a parallel 8 bit display for my door-eye project, to get better speed, but there is no working driver or example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants