How to Use ESP32Cam as Webcamera with MicroPython?

Hi, i’m working on a new project with my ESP32Cam. Before i used ESP32Cam like security camera. Now i want to use it like barcode and qrcode reader. How can you do this? With this post you will learn.

First you have to own an ESP32Cam. It is very cheap ESP32 with a camera module on it. It is cheap and so camera quality doesn’t excellent but works fine for me.

After that you will need a USB TTL converter for programming ESP32Cam. It is cheap too.

Now you must download and install Thonny Python IDE and Python 3.11 or newer version.

After that you need to connect your ESP32Cam to USB TTL converter and plug it to the USB port of your computer. You can see the connection diagram below.

ESP32CAM to USB TTL Connection.

Important Notice: After programming, please remove orange cable from ESP32Cam.

Now we can update ESP32Cam firmware. For firmware update click link and download esp32cam python firmware Rar file. Unrar file to folder. Open Thonny python editor. Click right bottom “Configure interpreter…” as seen below:

A new window will pop-up. İn this window select “Micropython (ESP32)” as interpereter and after select your USB TTL plugged port as seen below:

Now click blue “Install or update Micropython”. A new window pop-up too. In this window select again your USB TTL plugged port and after that browse for firmware. You can locate it in before downloaded and unrared folder “firmware.bin”. Select “firmware.bin” and click “Install” as seen below:

Upgrade will start immediately and it will be finished about 2 or 3 minutes. After that processes your ESP32Cam is will be ready for streaming. Now you can remove orange jumper cables from ESP32Cam from GPIO0 and GND pin as seen USB YYL connection diagram.

Return your Thonny editor end browse for downloaded and unrared “esp32-cam-micropython-2022-main” folder. You will see several python files in this folder. In this folder double click and open wifi.py file and write your wifi name and password and save it by clicking save button. Now select help.py, html.py, site.py, webcam.py and wifi.py and than click right your mouse and click to “upload to /” as seen below:

Wait for upload and after uploading double click webcam.py file in your MicroPython device and open file. Now hit F5 on your keyboard or click Run Script button(green button with grey triangle play symbol). Your code will be start and you will get your stream link as seen below:

If everything fine you can click Try- ip address at the bottom of shell or write ip address at your browser. You will see a commend page at that ip. If you wanna see stream directly write “/live” or “/webcam” after ESP32Cam ip like this: http://192.168.1.186/webcam

I’m working on a project with ESP32cam which for reading QR and Barcode reading live stream. I wanna post it to if Allah give me permission.

Thanks for reading. Please Subscribe my blog, RSS and share it.

3 thoughts on “How to Use ESP32Cam as Webcamera with MicroPython?

  1. May I ask you how did you get/build your firmware? Its the only version that allows me to init camera without crashing.

  2. I’m trying to follow you tutorial but the version of Thonny I’ve just installed is quite different from yours and some options are missing or changed.
    Every time I try to install the firmware I get the message “Device is busy or does not respond….”
    The version of Thonny I’m using is 4.1.4 on Win10, and using an ESP32-CAM-MB as USB interface.

    I’d appreciate any help.

Leave a Reply

Your email address will not be published. Required fields are marked *