Type Here to Get Search Results !

ESP32 Cam video streaming - Live video streaming tutorial with ESP32 Cam

Hello all and welcome to another knowledgeable blog post. Today we're looking at the ESP32-CAM. It's a low power, low cost system on a chip microcontroller with integrated WiFi and Bluetooth. Using this serial adapter is optional, most instructional videos I've seen use a different adapter wired up via a breadboard, but for this post we're using the simpler option you see here. Now let's have a look in the layout first.

ESP32 Cam specification –

On the left at the top you can see the antenna, below it is an antenna socket. The large white or silver area is the ESP32-S. It and the antenna are actually a separate board. On the right we have the rear view, there is an SD card slot, camera connector and an LED which can be used for a flash. I believe only 4GB is accessible through the SD slot. For this video we won't be using the SD card, we'll be accessing it wirelessly. It's a small module, 27 x 40.5 x 4.5mm very low power. It can be used for various IOT applications. It supports the most common Wi-Fi and bluetooth protocols. It can run off 5V or 3.3V. I do understand some people have had trouble running it from 3.3V. Once it's programmed, we just need to feed in 5V on the 2 appropriate pins something like a USB charger is sufficient.

The USB to serial adapter, you may only need one of and you could buy multiple camera modules and program them with it. The external antenna is optional. For use around the home or place of business you may not need it. OK let's install some software. First we'll need the Arduino IDE. Now you have to choose the suitable one for your operating system. I'm using Mac OS Big Sur, so I'll click on Mac OS. This software is free to download. Once it's done downloading, just go ahead and install it. Next we need the driver for the USB to serial adapter. Here you can see it is a CH340C. The best place to get the driver is actually the Chinese website, fortunately everything you need is written in English. So choose your operating system and download the correct driver. The link kept dropping out on me, but after a few tries eventually it went through. Again just as with the Arduino IDE, go ahead and install the driver. You'll need to reboot once it's finished. Once you've restarted, plug it into a USB port and check the USB to serial driver is installed. If that's good to go, you can load up the Arduino IDE. Go ahead and select the USB to serial adapter, then click on Arduino and preferences on the top left. Need to copy in some board manager URL's. 

How do I program my ESP32 cam?

I can't remember if all 3 were required, but it can't do any harm so it doesn't matter. Go through and update anything if necessary. Next go into the board manager via the tools menu and type in ESP32. Install the Espressif systems package. It might take a while depending on your internet speed, when that's done click on tools, board, ESP32 and scroll all the way down until you see AI-Thinker ESP32-CAM. If your board is somehow different from mine, make sure that you select the correct one. Keep in mind the get board info button doesn't do anything on this device (USB serial adapter).

If you have done all the things properly, we should be ready to program it. Go up into file, examples, ESP32, camera, camera web server. You can see it's got 4 tabs, we're just concerned with this first one today. We need to change a few things and then we can compile it. As I've got the Ai-Thinker variant, I'll comment out the WRover kit and we'll put camera model Ai-Thinker in its place. Next I put in my SSID and password. With that done we're ready to click on the verify button. That might take a while depending on how fast your computer is. If there's no errors we can move on to uploading. It'll show its progress in orange text. It'll finish with "hard resetting by RTS pin". We're almost there. We just need to check if it's connected to the Wi-Fi and find out what the IP address is.

How do I stream video with ESP32 cam?

Now go to tools and then click on serial monitor. Next we select the correct baud rate 115200 baud. And there we have the IP address. Type it in the browser. And there we have our interface. Select a resolution. The higher the resolution, the lower the frame rate. You'll have to choose what fits your needs best. There we have it, we're live streaming video over the Wi-Fi network! Any of these settings or resolutions can be changed on the fly, you don't need to stop or start the stream. Well that's nice, but how about saving the output to a file? You can download a separate firmware that records directly to the 4GB SD card, or we can stream and convert it to a file with VLC player. Right click on the stream and copy image address. On my device it's 192.168.1.30:81/stream. Open up VLC player. Click on file, open network and then paste in that address. Then click on stream output and settings. Choose a format. Incidentally if you want QuickTime or iMovie compatibility on a Mac choose QuickTime and under transcoding options video choose h.264. The only downside is my Mac is too slow to display the output and record at the same time. Other formats did work fine so I can convert them (to Quicktime format) later. Don't forget to select "display the stream locally" (if you want) so you can see what's going on. Click open. And there it is.

Live video streaming with ESP32 Cam –

We're streaming video and recording it to the hard drive! If you want to connect to and record the same stream later, you just need to click on the same. It will overwrite the old stream. Here I've got the camera outside, it's running from a USB power bank. It's very windy today. The camera is looking straight up at the sky. Here I'm just trying to figure out that if I can flip the display horizontally instead of vertically. Of course we can always do that in the camera's settings. Here's a quick look at what some of the adjustments and various settings do.

One final thing! Let's have a look at connecting the ESP32-CAM directly to 5V without using the usb to serial adapter. The 2 pins we want are right here, right next to each other. I'm using a faulty charging cable. Just cut the end off. Let's check the voltage. We've got 5V. Of course you can use any 5V supply that's stable enough. Cut off the data wires. Tin everything first. And we'll solder them on. I'm soldering them on the top so I can plug in the USB to serial adapter later (if needed). Well there we have it! That was our introduction to the ESP32-CAM.