Introduction: Simple Surveillance Robot With ESP32-CAM

The ESP32-CAM module is a cheap, low power consumption module, but it provides many resource for vision, serial communication and GPIOs.

In this project, I try to utilize ESP32-CAM module resource for making a simple surveillance rc robot which can pick small object.




Regarding the streaming part, websocket is used and showed a pretty good way for streaming images captured from esp32-cam module to web browser, it is cool because you can view the streaming video and control your robot any where supports web browser, it is better comparing to my previous project when I use raw TCP socket to stream to PC. I have tested with some browsers and see that my code works well on google chrome, so if you follow my project, you should use google chrome for the best performance.

1. Camera driver part:
I use ESP32 Wrover module for this project so the HW definition would be suitable for this module, if you use another module, please consider the HW definition.

For this part, basically It is based on the sample code of the camera driver part of ESP32/Camera/CameraWebServer. In my project, I divided into 3 files: camera_pin.h, camera_wrap.h and camera_wrap.cpp.

camera_pin.h: contains the definition of ESP32 pin used for communication with the attached camera.( It should be changed in case you use another module rather than ESP32 Wrover module)

camera_wrap.cpp: contains a basic configuration for camera initialization and a function for taking image.

camera_wrap.h: contains the prototype functions which used in another module.

Source code can be found in the following github link:

2. ESP32-CAM sketch:

This part contains the main working flow of ESP32-CAM. The module play a role of a http server and a web socket server. The http server receives the request from browser and return the main page which is used as a GUI to control the robot, the web socket server is used to send the images repeatedly to the GUI display on the web browser.

The entire source can be found at:

3. AruinoUno sketch:

This part contains the source code of the Arduino module ESP32-CAM via serial then control DC, RC motors.

The source code can be found at: