ESP32CAM/OV2640, how do you read sensor values?

davefes
Posts: 4
Joined: Mon Oct 13, 2025 6:31 pm

ESP32CAM/OV2640, how do you read sensor values?

Postby davefes » Mon Oct 13, 2025 7:17 pm

I would like to get the sensor values so that I can save them after taking
3 pictures. Go to lightsleep for a few minutes, wakeup and recall those
values. Then try to only take one snapshot, hopefully without the green
tint.

I tried following through:
https://github.com/espressif/esp32-came ... s/ov2640.c
but got lost. How do I run ov2640_detect(), specifically how do I tell
it where the sensor is? I have found the sensor address to be 0x3C, but now
can't work out how to use

Code: Select all

sensor_id_t *id
Has anyone managed to get the camera sensor values?

ahsrabrifat
Posts: 201
Joined: Sat Jan 18, 2025 2:31 pm

Re: ESP32CAM/OV2640, how do you read sensor values?

Postby ahsrabrifat » Wed Oct 22, 2025 8:32 am

ov2640_detect() needs a sensor_t with the I2C address and a sensor_id_t to store ID info.

Initialize SCCB first.

Use SCCB_Read()/SCCB_Write() to dump or restore sensor registers.

Save settings in NVS or RTC memory before lightsleep.

Restore on wakeup to avoid green tint and inconsistent exposure.
That green tint happens because:

The auto white balance (AWB) or auto gain/exposure resets after sleep.

To fix it, you can capture the AWB / exposure settings from the sensor registers after a good frame, save them, then restore them before next capture. You can also see this project on how to capture photos with an ESP32-CAM. https://www.pcbway.com/project/sharepro ... d7727.html

Who is online

Users browsing this forum: ChatGPT-User, meta-externalagent and 3 guests