Sampling failed Timeout when waiting for snapshot to be started or idle

Hi, I have problems with uploading snapshots. I use an AI Tinker clone board with integrated serial to USB adapter. (I just do hope pins are identical to AI Tinker board, I have no docs. Link: Esp32-cam-mb Micro Usb Esp32 Serial To Wifi Esp32 Cam Board Ch340 Ch340g 5v Bluetooth+ov2640 Camera+2.4g Antenna For Smart Home - Integrated Circuits - AliExpress).

I modified ei_camera.h in firmware to use CAMERA_MODEL_AI_THINKER instead of CAMERA_MODEL_ESP_EYE. Successfully rebuilt the firmware on a Mac Mini M1, using ESP-IDF. Uploaded the firmware successfully. I can connect to the board either via webUSB or edge-impulse-daemon.

The problem:
Regardless what I want to capture, I always bump into a time-out.

Examples:

  1. Microphone:
    Edge Impulse serial daemon v1.14.13
    Endpoints:
    Websocket: wss://remote-mgmt.edgeimpulse.com
    API: https://studio.edgeimpulse.com/v1
    Ingestion: https://ingestion.edgeimpulse.com

[SER] Connecting to /dev/tty.usbserial-21350
[SER] Serial is connected, trying to read config…
[SER] Retrieved configuration
[SER] Device is running AT command version 1.7.0

? To which project do you want to connect this device? Zoltán / Gatekeeper
[SER] Device is not connected to remote management API, will use daemon
[WS ] Connecting to wss://remote-mgmt.edgeimpulse.com
[WS ] Connected to wss://remote-mgmt.edgeimpulse.com
[SER] Entering snapshot stream mode…
[WS ] Device “ESP32-CAM” is now connected to project “Gatekeeper”
[WS ] Go to Login - Edge Impulse to build your machine learning model!
[WS ] Incoming sampling request {
path: ‘/api/training/data’,
label: ‘face’,
length: 60000,
interval: 0.0625,
hmacKey: ‘c128732c15b2d3aa85788d9d8d9252ac’,
sensor: ‘Built-in microphone’
}
/Users/zoltansz/.npm-global/lib/node_modules/edge-impulse-cli/build/shared/daemon/remote-mgmt-service.js:443
throw new Error(‘Timeout when waiting for snapshot to be started or idle’);
^

Error: Timeout when waiting for snapshot to be started or idle
at RemoteMgmt.waitForSnapshotStartedOrIdle (/Users/zoltansz/.npm-global/lib/node_modules/edge-impulse-cli/build/shared/daemon/remote-mgmt-service.js:443:23)
at async WebSocket. (/Users/zoltansz/.npm-global/lib/node_modules/edge-impulse-cli/build/shared/daemon/remote-mgmt-service.js:296:21)

Node.js v18.0.0

  1. Camera (64x64):
    Edge Impulse serial daemon v1.14.13
    Endpoints:
    Websocket: wss://remote-mgmt.edgeimpulse.com
    API: https://studio.edgeimpulse.com/v1
    Ingestion: https://ingestion.edgeimpulse.com

[SER] Connecting to /dev/tty.usbserial-21350
[SER] Serial is connected, trying to read config…
[SER] Retrieved configuration
[SER] Device is running AT command version 1.7.0

? To which project do you want to connect this device? Zoltán / Gatekeeper
[SER] Device is not connected to remote management API, will use daemon
[WS ] Connecting to wss://remote-mgmt.edgeimpulse.com
[WS ] Connected to wss://remote-mgmt.edgeimpulse.com
[WS ] Device “ESP32-CAM” is now connected to project “Gatekeeper”
[WS ] Go to Login - Edge Impulse to build your machine learning model!
[SER] Entering snapshot stream mode…
[WS ] Incoming sampling request {
path: ‘/api/training/data’,
label: ‘face’,
length: 60000,
interval: 0,
hmacKey: ‘c128732c15b2d3aa85788d9d8d9252ac’,
sensor: ‘Camera (64x64)’
}
[WS ] Failed to sample data Error: Timeout when waiting for snapshot to be started or idle
at RemoteMgmt.waitForSnapshotStartedOrIdle (/Users/zoltansz/.npm-global/lib/node_modules/edge-impulse-cli/build/shared/daemon/remote-mgmt-service.js:443:23)
at async WebSocket. (/Users/zoltansz/.npm-global/lib/node_modules/edge-impulse-cli/build/shared/daemon/remote-mgmt-service.js:161:29)

It is not clear to me, but I suspect that capturing snapshots did not even start so this may be related to pin config. Am I right?

Could you pls point me to the direction I should go forward to fix this?

Thanks,
Zoltán

Hi @zoltansz,

Can you send AT commands to the board over a serial connection (e.g. minicom) while it is running your firmware?

I’ve had issues with a similar USB-serial carrier board on my AI-Thinker ESP32 cam. It seems to hold the ESP32 in reset unless a special command is provided. It will work with the Arduino IDE, but nothing else. For example, I cannot communicate with my ESP32 via PuTTY or other serial terminals.

As a result, you might want to try removing the USB adapter board and connecting a USB-Serial adapter to pins VDT, VDR, and GND. You’ll also need to connect a button between IO0 and GND, and you’ll want to be able to easily toggle power (e.g. a switch between your power supply and the 5V pin). Whenever I go to program the ESP32, I hold the button (IO0 to GND) and toggle power off-on to put it into the bootloader mode. This way, I can program the ESP32 and get serial working without relying on the serial daughter board.

If you can use AT commands, I recommend filing an issue with this repo: GitHub - edgeimpulse/firmware-espressif-esp32: Edge Impulse firmware for the Espressif ESP-EYE(ESP32) Development board. I’ll tag @AIWintermuteAI (who developed the firmware) so he’s aware of the issue.

Another things to contemplate is that pins might not be right (as you said it is a modified clone of ESP-CAM and not the original, so there is no guarantee that camera pins are the same).
Anyways, try running edge impulse daemon with --verbose flag and see the detailed error output. If you see camera driver crashing, it means the pins are wrong.

Hi Shawn, thx for the info. Actually, the USB interface is on a piggiback so I can remove it easily. Also, I can check the connections on the piggyback board.

Luckily, I have a couple of original ESP32-CAM boards too so I can compare them.

Thanks!
Z

Hi, thanks for your answer. --verbose is a good idea. Also, I can compare the pinouts with my original ESP32-CAM boards.

Thx,
Z