rwb
1
Trying to use an ESP32-cam.
void setup() {
...
camera_config_t config;
...
esp_err_t err = esp_camera_init(&config);
if (err != ESP_OK) {
Serial.printf("Camera init failed with error 0x%x", err);
}
...
}
First attempt: error 0xffffff
.
Tried a different pin config and now I get 0x105
. (It's completely unclear how to determine what the pin numbers should be.)
I get the impression that these cameras are extremely unreliable and unlikely ever to work?
Any suggestions on what to try?
Try to compile and upload Camera example (Video streaming web server).
There in the example code you can find pin numbers. Your camera model is "AI THINKER" (search for it in sources)
1 Like
rwb
3
Hadn't seen that; thank you.
Tried them in order and eventually found one that works...
rwb
4
OK, so the example can take pictures, but when I try
camera_fb_t * fb = NULL;
void take_picture() {
digitalWrite(PIN_FLASH, HIGH);
fb = esp_camera_fb_get();
digitalWrite(PIN_FLASH, LOW);
if(!fb) {
Serial.println("Camera capture failed");
}
else {
// Upload.
}
}
I always get Camera capture failed
rwb
5
Some progress (don't know why): the first picture works but then not subsequently.
Same is true when powered from its pins, so it's nothing to do with the USB adaptor.
Seems to be the same problem: ESP32-CAM esp_camera_fb_get always fails on second photo
but I'm definitely not doing anything funny with other pins.
srnet
6
Nope, I would say the opposite, they work very well in my experience.
The Random Nerd Tutorials website examples I have found to be very reliable.
1 Like
rwb
7
that's quite plausible -- they're a bit noddy even for me.
sumguy
8
@rwb there is a github example that saves images and video to SD card for playback , it talks about other features too such as motion detection etc.
I have not personally tried that code yet but I will do soon.
rwb
9
Got it.
The solution is to call esp_camera_fb_return(fb);
to clear up before taking the next picture.
Credit: Error: failed to capture image · Issue #8 · alanesq/esp32cam-demo · GitHub
1 Like