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

Support for OV5640 #2162

Open
CountParadox opened this issue Mar 12, 2023 · 19 comments
Open

Support for OV5640 #2162

CountParadox opened this issue Mar 12, 2023 · 19 comments
Labels
enhancement New feature or request

Comments

@CountParadox
Copy link

CountParadox commented Mar 12, 2023

The Feature

Hi guys,

I have this module:
https://www.aliexpress.com/item/1005004521039608.html?aem_p4p_detail=20230311200737107046978822230007724708&algo_exp_id=973ada50-63fc-40e0-91c3-87db4e401cd5-2&pdp_ext_f=%7B%22sku_id%22%3A%2212000031106421469%22%7D&pdp_npi=3%40dis%21AUD%2136.52%2123.0%21%21%21%21%21%40211bf3f716785940569804937d06c0%2112000031106421469%21sea%21AU%212214764457&curPageLogUid=fhcmfz3jOSwK&ad_pvid=20230311200737107046978822230007724708_3&ad_pvid=20230311200737107046978822230007724708_3

I think the inclusion of USB-C is very convenient.
I think it should be quite simple to support, maybe just changing the pinouts defined in the code?
I was able to get it working with ESPhome very easily by doing this.

What are others opinion?

Thanks

image
image
image
image
image
image

@CountParadox CountParadox added the enhancement New feature or request label Mar 12, 2023
@caco3
Copy link
Collaborator

caco3 commented Mar 13, 2023

Did you try if it works?

AFAIK there is no pinout configuration, we simply use the ESP library which provides the support for the different cameras.
See https://github.com/espressif/esp32-camera/tree/5c8349f4cf169c8a61283e0da9b8cff10994d3f3

@caco3
Copy link
Collaborator

caco3 commented Mar 13, 2023

Compared to the currently used camera (OV2640), it has a higher resolution, thus memory might be an issue! (2592 x 1944 vs. 1600 x 1200)

@CountParadox
Copy link
Author

@caco3 looks like its supported by the underlying library, but I need to be able to define the pins its connected to, I forked and had a go at this but I am pretty bad at code...
The increased resolution may not be an issue given that its not running video, just stills ?

@Slider0007
Copy link
Collaborator

It could possibly work with some modifications:

Camera pinouts are defined here:

//******* camera model

Additionally this flag needs to set:

CONFIG_OV5640_SUPPORT=n

Be aware, that for other peripherals pins needs to be adpated as well:

Only testing can tell you, if more modifications are necessary.
This is just what came in mind to me...

@commentsonly
Copy link

I'd say according to the table shown earlier there's no flashlight soldered but the table states that pin GPIO25 is the right one, as long as not attaching a TFT which would occupy that IO port.

@caco3
Copy link
Collaborator

caco3 commented Jul 14, 2023

keep in mind that we don't have RAM to support a higher camera resolution!

@AhmedThabit
Copy link

@CountParadox could you figure out a solution for this camera?

@CountParadox
Copy link
Author

Negative, I just purchased a supported board

@AhmedThabit
Copy link

AhmedThabit commented Apr 24, 2024

can you recommend one?

@jasaw
Copy link
Contributor

jasaw commented May 4, 2024

I managed to get my OV5640 to work on my local build. I just needed to enable ov5640 in SDK config, added guards around ov2640 specific code because they are not compatible to ov5640. Zoom mode is also working on ov5640 after very slight modification in the zoom handling code in ClassControllCamera.cpp. The zoom mode will give more magnification compared to ov2640.

For anyone who's interested, I'm using this OV5640 module: https://www.ebay.com.au/itm/304414545614

@caco3 I would create a PR if I can get the html working but create reference image html on rolling branch appears to be broken? What is the state of rolling branch now? Sorry I haven't looked into this for a few months.

@caco3
Copy link
Collaborator

caco3 commented May 5, 2024

@caco3 I would create a PR if I can get the html working but create reference image html on rolling branch appears to be broken? What is the state of rolling branch now? Sorry I haven't looked into this for a few months.

I am not aware of any recent changes on the Web UI. Can you try the latest rolling and describe your problem a bit more in detail?

@jasaw
Copy link
Contributor

jasaw commented May 6, 2024

I am not aware of any recent changes on the Web UI. Can you try the latest rolling and describe your problem a bit more in detail?

@caco3 sorry, turns out that it was just my web browser caching the previous version of the web interface causing problem with the new firmware on rolling branch. I just need to clear my browser cache.

I've created a PR to support OV5640.
#3063

@jasaw
Copy link
Contributor

jasaw commented May 9, 2024

Has anyone tried the OV5640 camera with autofocus?
This alternate aliexpress listing is for esp32cam with OV5640 but I'm not sure whether the esp32cam board has pre-connected the AF-VCC and AF-GND. If they are already pre-connected, then there's no need to solder wires.

Just need to solder 2 wires on the ESP32cam CSI connector to power the autofocus control. The first 2 pins are not connected at the moment. Connect AF-VCC to 2.8V (pin 21 of this CSI connector), AF-GND to GND.
ESP32-CAM-AI-Thinker-schematic-diagram

This is the OV5640 with autofocus pinout.
ov5640af_pinout

Here's an open source project that demonstrates the autofocus feature.
https://github.com/0015/ESP32-OV5640-AF

Here's the application note for controlling the autofocus function.
ov5640-firmware-user-guide.pdf

@jasaw
Copy link
Contributor

jasaw commented May 13, 2024

The esp32cam OV5640 autofocus aliexpress listing that I mentioned above does indeed have the autofocus AF-VCC and AF-GND connected on the CSI connector, so no soldering required.

esp32cam_plus_ov5640_af

@jasaw
Copy link
Contributor

jasaw commented Jun 3, 2024

@SybexX Just a quick update on my progress on autofocus:

  • I have seen 3 variants of OV5640 with AF: waveshare (AF-VDD on pin24), Adafruit (AF-VDD on pin23), AliExpress (AF-VDD pin23 & AF-GND pin24). I'm using the AliExpress variant.
  • Autofocus works beautifully when I power AF-VDD with 2.8V and AF-GND with GND (no zoom mode). I've shared my hardware mod photo below.
  • I am using the OV5640 autofocus microcode from https://github.com/0015/ESP32-OV5640-AF but had to modify all the other functions for AF to work.
  • ov5640-firmware-user-guide.pdf describes step by step exactly how to get AF to work. Basically the steps are, load AF microcode to initialize, then on each flow cycle, set single shot AF mode, wait for it to get focus by polling focus status, capture image for the flow cycle, release AF.
  • I haven't been able to get autofocus to work with zoom mode enabled. I suspect 4 focus zones need to be disabled, and move the 1 focus zone to the zoomed window.
  • I have yet to figure out how to manually set the focus level. I think we have to manipulate registers 0x3602 and 0x3603.

20240522_125703

@alekseyprisekin
Copy link

@jasaw. Like on this photo, does it working? Did u checked this in real? Or only in the serial monitor?
And where u connect cable, i cant understand?
Снимок экрана 2024-09-17 104006

@jasaw
Copy link
Contributor

jasaw commented Sep 18, 2024

@alekseyprisekin Yes auto focus works (I checked the captured image), but requires additional code to enable auto focus. I haven't shared my auto focus code on github yet because it's still work in progress.

On my photo, the white wire is soldered on U1 pin2, which is the 2.8V LDO output.

There are 3 different variants of OV5640 with auto focus and they require 2.8V and/or GND to be connected to different pins.

@alekseyprisekin
Copy link

alekseyprisekin commented Sep 18, 2024

@jasaw
This basic code for camerawebserver (edit for autofocus), don't work with this version of ov5640 like u have?

https://github.com/0015/ESP32-OV5640-AF/tree/main/src

@jasaw
Copy link
Contributor

jasaw commented Sep 18, 2024

@alekseyprisekin I have not tried the project that you mentioned, but I started my auto focus code based on that project and had to make changes for auto focus to work on my camera. There are 3 different datasheets floating around the Internet, but I got time to investigate further.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

7 participants