This small-size programmable camera can start taking pictures when motion is detected and transmit real-time videos. It can be hidden easily for espionage work due to its tiny size.
The webserver camera can be designed in two versions. The first version described here can send real-time video over Wi-Fi. The author’s prototype is shown in Fig. 1.
Fig. 1: Author’s prototype
- Advertisement -
The software code required for this webcam server is made in Arduino IDE. So, we first need to install the ESP32 to Arduino IDE by opening Preferences and pasting the following link here.
Next, open Board Manager, search ESP32 and install the board to Arduino IDE. After installing the latest Arduino IDE and selecting board for ESP32, if you go to “file→example→ esp32→camera→webserver” you will see the ESP32 webcam project, which is already available there.
Upload the code to ESP32 cam and search the address of ESP32 cam in the web browser. You can see the live video from ESP32 cam.
Adding OLED display
In the original code of ESP cam there was no multiplicity of Wi-Fi network choices and there was no way to know the IP address of the webcam, unless it was connected to a PC to see the serial terminal output. So, you can modify the code and add the code for the ESP32 to automatically connect to the best available Wi-Fi among all the networks in range.
To modify, you need to replace the Wi-Fi SSID network names in the list and their passwords with your own Wi-Fi network’s name and password. Then add the OLED display library in that. Next, get the IP address in the setup function and add the code line to display the IP address on the OLED display. The source code snippet is shown in Fig. 2.
Fig. 2: Code snippet for setting Wi-Fi SSIDs list and passwords
Bill of Material
Components
Quantity
Description
ESP32 with camera
1
ESP32 cam
OLED display (24.4mm)
1
SSD1306
USB-to-Serial FTDI chip
1
USB programmer
Battery/5V DC adaptor
1
Power supply
LM11173.3
1
Voltage regulator
Diode
1
1N4007
Capacitor C1
1
100µF, 10V
Circuit and working
The circuit diagram for ESP32 camera webserver is shown in Fig. 3. The circuit is built around voltage regulator LM1117, an OLED, and ESP32 cam. For programming ESP32 you need the USB-to-serial programmer shown in Fig. 4.
Fig. 3: Circuit diagram of ESP32 camera webserver
Fig. 4: Schematic of ESP32 cam programming
Software
The ESP32 camera does not come with built-in USB-to-serial interface. Therefore, to upload the sketch you need a USB-to-serial programmer. The schematic for the programmer is shown in Fig. 3.
The GPIO 0 pin is to be pulled to ground during uploading mode and reset button of the ESP32 needs to be pressed for first few seconds of uploading. After uploading the source code esp32-webcam-server.ino into ES32 board, remove the board and use it in the circuit.
The device can be powered using any regulated 5V DC adaptor, or a 6V battery, or a voltage regulator circuit. The SD card module on ESP board uses GPIO 4, GPIO 12, and GPIO 13. Only GPIO 1 and GPIO 3 are the free pins available, which can be used as serial pins for uploading the program in flash mode. The GPIO1 and GPIO 3 pins are free after uploading the program, so we can use them as I2C pins for connecting the OLED display.
Construction and testing
Upload the source code esp32-webcam-server.ino into ESP32 as described above. Assemble the circuit as per Fig. 2. On powering the device to connect it to the Wi-Fi available in the network, it will show the IP address on the OLED display connected to it.
Now open any web browser in your smartphone or laptop and search the IP address displayed on OLED display. You should be able to see the live video on your phone/laptop. The webcam with OLED to display its network name and IP address is shown in Fig. 5.
Fig. 5: Webcam with OLED to display
The low-cost ESP32 camera has wide possibilities because it is programable. By fixing a series of these cameras in line, we can get a wide object scanner of 50 to 100 metres for taking pictures of approaching vehicles’ number plates to check for over speeding. In solo mode, with a PIR sensor, it can be used as a bird snap catcher. For safety against Covid, it can be used as a scanner for high temperature detection.