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

Hi! I wanted to revive this thread as I’m having trouble getting the autofocus on my OV5640 to work, and I haven’t been able to find any working code examples online.

I’ve been testing the camera using the standard CameraWebServer demo, and I’ve noticed that the focus remains fixed regardless of changes in lighting conditions, resolution, or clock frequency. I also don’t see or hear the autofocus motor moving at all during this demo or when trying other camera demos from the Seeed Studio Wiki.

I also tried the “OV5640 Auto Focus for ESP32 Camera” library mentioned above. During initialization, the autofocus motor moved briefly for the first time, but didn’t work afterwards – this leads me to think that there’s probably something missing in the camera definition in the web server demo.

Has anyone successfully implemented the autofocus functionality with this camera module?