Trouble setting up ESP32 cam with Raspberry Pi

Camera model
ESP32 camera module

What is the problem?
Can't set it up, can't figure out stream URL. The camera arrived with a board with USB connection. I connected it to my Raspberry Pi 3B+ via an USB cable, the LED turned on, and then... I'm stuck. I checked the logs but couldn't figure out what can be the issue or what the stream URL could be. I thought since it's an USB device, the setup will be simpler (like the connection to the printer was plug & play).

What did you already try to solve it?
Checked tons of youtube videos, googled, checked forums, checked github, etc.
I found this project, but I don't know if it could be helpful or how to use: GitHub - Linkenelis/ESP32-cam-Octoprint: Cheap ESP32-cam using 2 webstream to stream video and still be able to take a snapshot (octolapse)

Logs (/var/log/webcamd.log, syslog, dmesg, ... no logs, no support)

/boot/octopi.txt is unmodified.

Starting up webcamDaemon...

--- Configuration: ----------------------------
cfg_file: /boot/octopi.txt
camera: auto
usb options: -r 640x480 -f 10
raspi options: -fps 10
http options: -w ./www-octopi -n --listen

Explicitly USB device:

Found video devices:
config file='/boot/octopi.txt':USB device was not set in options, start MJPG-streamer with the first found video device: /dev/video10
/root/bin/webcamd: line 184: printf: 0x: invalid hex number
/root/bin/webcamd: line 184: printf: 0x: invalid hex number
<13>Sep 16 12:56:07 root: Starting USB webcam
Checking for VL805 (Raspberry Pi 4)...

  • It seems that you don't have VL805 (Raspberry Pi 4).
    There should be no problems with USB (a.k.a. select() timeout)
    Running ./mjpg_streamer -o -w ./www-octopi -n --listen -i -r 640x480 -f 10 -d /dev/video10
    MJPG Streamer Version: git rev: 5554f42c352ecfa7edaec6fc51e507afce605a34
    i: Using V4L2 device.: /dev/video10
    i: Desired Resolution: 640 x 480
    i: Frames Per Second.: 10
    i: Format............: JPEG
    i: TV-Norm...........: DEFAULT
    Error opening device /dev/video10: video capture not supported.
    Init v4L2 failed !! exit fatal
    i: init_VideoIn failed
    Done bring up all configured video device

Additional information about your setup (OctoPrint version, OctoPi version, ...)
Octoprint: 1.8.2
OctoPi: 0.18.0
Device: Raspberry Pi 3 Model B Plus Rev 1.3

Thanks in advance. :slight_smile: OctoPrint is great. :slight_smile:

No one...? :frowning: I guess I have to obtain a better supported camera then.

Hi :slight_smile:

First of all you can't just connect the esp to the pi. It doesn't come with any firmware and doesn't know what to do.
Also this isn't a usb webcam - it's a wifi cam. Afaik there is no way to use it via usb (you can power it via usb tho).

I use the tasmota firmware on my esp32-cam and it works well for me.
Here is a guide on how you flash it on the esp:

I know it seems like a lot of work, but it's not that hard. I would suggest to do it on you pi, if you don't have a pc that runs linux.

When you're done you can just paste the webcam (http://DEVICE_IP:81/cam.mjpeg) and snapshot (http://DEVICE_IP:80/snapshot.jpg) url into OctoPrint and you're good to go :slight_smile:


Thanks a lot for your answer! Well, this explains a lot.
I have only one question, my camera arrived in a different (maybe improved?) bundle. The secondary panel, which contains the USB port, does not have jumper for IO0, it has a switch instead, just like the reset (RST) one. So I cannot put it in flash mode, unless I hold it (if I have to...?).
There are no wires either, the two panels can be connected directly to each other. Or not. But there is no in between, connecting them together in custom ways is not possible, at least not without external solutions.
I believe this is intended, just I don't know how this affects the flashing process. I do not want to mess it up. Here is how it looks:

Thanks, cheers,

Iirc IO0 just needs to be shorted to ground while booting up - so you should press the switch while you plug the usb cable in and hold it for a few seconds.
It should be in flash mode now.

There isn't much that can go wrong. Either it boots up in flash mode and you're able to flash the firmware or it doesn't and you get an error while flashing :slight_smile:

By the way, I forgot to mention that you only need to do this once. From then on you can update the firmware with an OTA update via the webui.

Thanks for your help, well, I'm almost there! Unfortunately 3 of the 4 files were not found (wget commands), but I managed to flash the cam with a Windows tool via USB. Now I managed to set up the wifi connection, I gave it a static IP address via DHCP, and I see the camera feed when accessing it via my browser:

However, it does not work in OctoPrint. The snapshot works, but the camera feed doesn't. I checked the URL 5 times, and when entering it in my browser the video shows. It just doesn't work from OctoPrint. I also read somewhere that the feed requires exclusive connection, but it does not work when every other connection is closed either.

I'm so close! :slight_smile: Any more suggestions perhaps? I also try to dig around, since I think the hardest part is behind me... :wink:


By accessing Octoprint not via octopi.local but direct IP address made the camera feed work instantly. :slight_smile: Sorry, my bad, thank you for your patience and help! :clinking_glasses:

1 Like

To briefly explain what (I think) is happening so you understand, browsers don't let you mix public domain names with internal IP addresses in the same page for security reasons. They can't identify that octopi.local is actually internal and so you must access OctoPrint from an IP address so you can also access the ESP IP as well.

If what Charlie said is the issue you can also use the hostname of the esp cam instead of the ip.
You can check the hostname in the Information tab

and change it in the Configuration -> Configure Other tab.

Thank you both, I will try. Unfortunately I have some other issues now, so the printer is out of order. :frowning: