Library for ESP32 to use OV5640's autofocus function

Overview

arduino-library-badge

Enable OV5640's autofocus function on ESP32 AI-THINKER Board

This library contains the necessary firmware and source code to enable the OV5640 autofocus mode on the ESP32.

Installation

ESP-32 Core Library

You need to install the ESP32 core libraries. The install instructions for your specific OS are here: https://github.com/espressif/arduino-esp32

Using Arduino Library Manager

From Arduino IDE, go to menu Sketch -> Include Library -> Manage Libraries... In Library Manager Window, search "OV5640" in the search form then select "OV5640 Auto Focus for ESP32 Camera" Click "Install" button.

Manual installation

Download zip file from this repository by selecting the green "Code" dropdown at the top of repository, select "Download ZIP" From Arduino IDE, select menu Sketch -> Include Library -> Add .ZIP Library...

Or use git:

cd ~/arduino/libraries/
git clone [email protected]:0015/ESP32-OV5640-AF.git

Then you should see the examples and be able to include the library in your projects with:

 #include "ESP32_OV5640_AF.h"

Usage

This works like a standard Arduino library. Here's a minimal example:

// Create an object from OV5640 class at the top of your sketch
OV5640 ov5640 = OV5640();

// To start OV5640, neet to pass the pointer of the esp camera sensor
sensor_t* sensor = esp_camera_sensor_get();
ov5640.start(sensor);

// Download Firmware for AF
if (ov5640.focusInit() == 0) {
 Serial.println("OV5640_Focus_Init Successful!");
}

// Set Continuous AF MODE
if (ov5640.autoFocusMode() == 0) {
 Serial.println("OV5640_Auto_Focus Successful!");
}

See the OV5640_Console_Test example for a more fully-featured example.

Hardware Modification

To use the AF function of the OV5640 on the ESP32 AI-Thinker board, you need to connect 3.3v to the last 24th pin(AF-VCC). I share what I've been working on.You can also see how AF works.

Updates

  • v0.1.1
    • Only Added CONTINUOUS AUTOFOCUS Mode

License

This software is written by Eric Nam and is licensed under The MIT License. Check License file for more information.

Issues
  • Board modification seems to be wrong; AF-VCC is pin 4 of camera connector

    Board modification seems to be wrong; AF-VCC is pin 4 of camera connector

    I tried with ESP32-CAM board bur something seems to be wrong. I connected 3V3 to pin 24 of camera connector but produced a shortcut. I looked at pin 24 and found out it's connected to GND. Datasheet of OV5640 says that AF-VCC is pin 4 and not 24 and pin 4 has 3V3. What is going wrong?

    opened by SchneHa 4
  • Auto focus doesnt work

    Auto focus doesnt work

    Hello,

    I tried replicating the result on my esp32 cam, but the auto focus function doesn't work. I bought a slightly different version of the ov5640 model, which has Auto-VDD at pin #23 instead of #24, and I did connect that pin to the 3V power pin from the board accordingly. I ran the unmodified example code you provided, and the monitor console did indeed show the camera was focusing and focused. However, I didn't hear any sounds from the motor while the camera was focusing, nor did I get a clear picture when I took a shot with it. Any thoughts on what could cause it? I tried it on several camera modules from different vendors, same result.

    This is the one I bought.

    Screenshot 2022-07-29 144105
    opened by jasonhongpro 1
  • Question on Autofocus

    Question on Autofocus

    I haven't tried this yet - but it looks excellent!

    https://github.com/0015/ESP32-OV5640-AF/blob/e3c18173181c8cca4de39ef967f88ca43757d519/src/ESP32_OV5640_cfg.h#L34

    Do you know what this microcode actually does? Is there source code that could be modified? Or an 5640 microcode programming manual?

    Is it your understanding that the esp32-camera driver does not have that auto-focus microcode?
    I thought it did, but as I look at it right now, it is not there, so the standard esp32 drivers must leave it in infinity focus mode.

    I've seen a few similar things like this, but never put the time to understand it.

    https://www.its304.com/article/hwytree/118992955 https://gitlab.com/k2wl/g2_kernel/-/blob/4472ce5be96571f65dcfad53a6aa32c58d5553bd/drivers/media/video/msm/ov5640.h#L1046

    opened by jameszah 0
Releases(0.1.1)
Collection of DLL function export forwards for DLL export function proxying

dll-exports Collection of DLL function export forwards for DLL export function proxying. Typical usecase is for backdooring applications for persisten

Magnus Stubman 35 Jul 1, 2022
C-function for traversing files/directories effectively and calling a given function with each encountered file and a void-pointer as parameters

C-function for traversing files/directories effectively and calling a given function with each encountered file and a void-pointer as parameters

null 1 Jun 27, 2022
The function is based on MQTT. When the original serial of ESP8266/ESP32 cannot be used, it can replace serial print.

MqttPrint and MqttMonitor The function is based on MQTT. When the original serial of ESP8266/ESP32 cannot be used, it can replace serial print. MqttPr

fw-box 3 Jan 10, 2022
null 251 Aug 5, 2022
Repository created to store a C function library to use in 42 School

Libft of 42. Make with ❤︎ for Luiz Cezario ?? Index What's this Repo? List of Functions Technologies How to Run Find a Bug? Or somenthing need to chan

Luiz lima cezario 8 Feb 20, 2022
Allows for multiple SwitchBot buttons and curtains to be controlled via MQTT sent to ESP32. ESP32 will send BLE commands to switchbots and return MQTT responses to the broker. Also supports Meter/Temp Sensor

SwitchBot-MQTT-BLE-ESP32 Switchbot local control using ESP32. no switchbot hub used/required. works with any smarthub that supports MQTT https://githu

null 270 Jul 31, 2022
AnalogWrite for ESP32 and ESP32-S2 with LEDC PWM. Includes PWM Phase Control, DAC and Smart GPIO resource management.

analogWrite() ESP32 Installation Instructions This library was tested using using the ESP32 Arduino IDE Boards Manager installation method. Stable rel

null 22 Jun 18, 2022
ESP32 + GitHub Actions + Husarnet. A boilerplate project for ESP32 allowing in-field firmware update using GitHub Actions workflow.

esp32-internet-ota ESP32 + GitHub Actions + Husarnet. A boilerplate project for ESP32 allowing in-field firmware update using GitHub Actions workflow.

Husarnet 29 Aug 4, 2022
Trial port of the rtf_433 Library for use with OpenMQTTGateway on a ESP32 and a CC1101 Transceiver

This is an attempt at creating an Arduino library for use on ESP32 boards with a CC1101 transceiver with the device decoders from the rtl_433 package.

Northern Man 72 Jul 26, 2022
A utility library to use/bootstrap Soracom Arc easily on ESP32 Arduino boards

soracom-arc-esp32-arduino A utility library to use/bootstrap Soracom Arc easily on ESP32 Arduino boards. Synopsis #include <SoracomArcESP32.h> #includ

Soracom Labs 2 Dec 20, 2021
A couple of demos showing how to use the Ultra Low Power coprocessor on the ESP32

ESP32 Ultra Low Power (ULP) coprocessor You can watch a video explanation of this code here This repo contains two demo project: ulp-gpio Shows you ho

atomic14 5 Jan 21, 2022
Turn 2 esp32 boards into pixhawk telemetry for use with Ardupilot/Ardurover Mission Planner.

RoverLink Turn 2 esp32 boards into pixhawk telemetry for use with Ardupilot/Ardurover Mission Planner I used to use these cheap Chinese 900mhz Pixhawk

Jeffrey Berezin 2 Jan 18, 2022
ESP32 IR transmitter for use with the PriceHax project.

PricehaxESP32 This is an ESP32 based implementation of an IR transmitter for use with Furrtek's Android App or Python code for communicating with infr

Skip Hansen 1 Dec 21, 2021
Turn your ESP32 into a easy to use micro web-server allowing to interact with any GPIO by simple http(s) calls.

WebhooksTriggeredESP32WiFi Turn your ESP32 into an easy to use and manage wireless micro web-server allowing it to process reliably and asynchronouly

JayDeLux 4 Jun 1, 2022
Wave Function Collapse library in C, plus a command-line tool

wfc Single-file Wave Function Collapse library in C, plus a command-line tool License: MIT Version: 0.01 This is an early version that supports the ov

krychu 300 Jul 27, 2022
Technical Analysis Indicator Function Library in C

Tulip Indicators Introduction Tulip Indicators is a library of technical analysis functions written in ANSI C. Lots of information is available on the

Tulip Charts LLC 606 Jul 29, 2022
A different way of calling the notify function on the ps4 for homebrew development.

PS4-Notify A different way of calling the notify function on the ps4 for homebrew development. Calling the new Notify void Notify(char* IconURI, char*

Greg 21 Jul 29, 2022
Nameof operator for modern C++, simply obtain the name of a variable, type, function, macro, and enum

_ _ __ _____ | \ | | / _| / ____|_ _ | \| | __ _ _ __ ___ ___ ___ | |_ | | _| |

Daniil Goncharov 1.4k Aug 3, 2022
ads1115 full function driver

LibDriver ADS1115 English | 简体中文 ADS1115 is an ultra small package, low power, IIC bus interface, 16 bit conversion accuracy, internal voltage referen

Shifeng Li 38 May 25, 2022