OV5640 Camera for XIAO ESP32S3 Sense - How to use Autofocus?

The Seeeduino Store page with the OV5640 camera description claims the following:

The sensor comes with an auto-focusing function to help users take clear photos and videos more easily. The auto-focusing function can automatically adjust the focus distance, ensuring that the captured images and videos are always clear and sharp.

However, I cannot get it to work. Seeed Studio doesn’t seem to offer any sample code, and I also tried the “OV5640 Auto Focus for ESP32 Camera” library, modifying the pins for the XIAO, but the auto-focus functions failed.

There is an “AF_VCC” listed on the expansion board schematic, so I assume the power for the voice coil motor is being supplied to the module.

Can someone explain to me how to get the autofocus working, please, preferably with a working code sample? I’m reviewing the ESP32S3 Sense board for my YouTube channel, and wish to address this issue in the video.

Thanks!

Hi,
The camera’s autofocus function does not require additional code to implement, the camera itself comes with an autofocus algorithm

And unbelievably, this thing has a focus motor.

Hi, I have ESP32S3 Sense with a ov2640 and using a sample micropython the camera works, but if you change the OV2640 for the OV5640 the code fails, Although the Seeed wiki indicates that the OV5640 works with the same code as the OV2640. Can you provide sample code either Micropython or Arduino IDE. Thanks

Hello,
Regarding the Arduino IDE code samples provided in this Wiki, all the Arduino IDE code shown is applicable to both camera models without any modifications.

When you mentioned the MicroPython examples, are you referring to those code samples?

Have you tried using the MicroPython code directly without any changes on your camera to see if they work?

Hi, thanks for your answer, I did try it in Arduino and the OV5640 works, but there is a problem with the camera, it displays green lines as seen in attached picture.

Regarding Micropython, I did try the examples there except for the open CV, when I swapped the camera a I got a failed response on the cam = camera.init() statement, and the program failed.