Build your own video surveillance robot and control it through the Internet with iPhone.
Imagine if you have a robot that has camera on board and can be controlled through the Internet.
It would open a lot of opportunities of using it.
For example, you could send the robot to the kitchen to check if you accidentally left the kettle on the stove!
I found that with ESP32-CAM it can be done easily.
The ESP32-CAM is a very small camera module with the ESP32-S chip that costs approximately $10-$15.
The ESP32-CAM module can be programmed with Arduino IDE. The ESP32-CAM module also has several GPIO pins to connect to external hardware.
HOW TO BUILD THE ROBOT
Here are the main parts we will need for the project.
Assemble the robot chassis with two DC motors, 3 wheels and L298N motor drive controller.
Platform with L298N controller
Video Surveillance Robot Schematic
Platform with DC motors, wheels and L298N motor drive controller
Pan/Tilt with SG-90 servos. In this project we use only the tilt servo.
Attach Pan/Tilt with servos to the platform
Using MB102 Breadboard Power Supply Module is optional. You can always take 5V and Ground for ESP32-CAM and servo motor from the L298N motor driver, but I found that with the MB102 it is much more convenient. The power supple module has a power button and gives you more flexibility with wiring.
In order to attach the module the the chassis platform, I removed the pins on the bottom of the MB102. Then, I attached it to the top of the chassis with double sided mounting tape.
Just cut pins in order to attach the module to the platform with double sided mounting tape
Connect all parts using the schematic. Use a piece of foam and double sided mounting tape to attach the ESP32-CAM to the Pan/Tilt platform.
HOW TO UPLOAD CODE
Install the ESP32 Add-on on Arduino IDE:
Follow one of the next tutorials to install the ESP32 add-on, if you haven’t already:
Make sure that you have two tabs with code in the Arduino IDE:
Before uploading the code, you need to insert your network credentials in the following variables:
Connect the ESP32-CAM board to your computer using an FTDI programmer. Follow the next schematic diagram:
Important: GPIO 0 needs to be connected to GND so that you’re able to upload code.
Press the ESP32-CAM on-board RST button before upload the code.
Run Arduino IDE and click Upload to build and flash the sketch to your device.
Press the ESP32-CAM on-board RST bottom before upload the code
GETTING THE IP ADDRESS
After uploading the code, disconnect GPIO 0 from GND.
Open the Serial Monitor at a baud rate of 115200. Press the ESP32-CAM on-board RST button.
The ESP32-CAM IP address should be shown in the Serial Monitor.
CONTROL A VIDEO SURVEILLANCE ROBOT
Disconnect the ESP32-CAM from the FTDI programmer.
Connect the ESP32-CAM back to the Pan/Tilt platform, turn on power and press the ESP32-CAM on-board RST button.
Run the App on your iPhone, enter the ESP32-CAM IP address and play with the robot!
HOW TO CONTROL THE ROBOT THROUGH INTERNET
You should open up your router settings. (google how to do this for your router). There you will find some settings, including something along the lines of Forwarding or Port Forwarding.
The important thing to note here is the "Port Range" and the "Device" or "IP address".
In "Port Range" you should type 80-81.
For "Device" you should select your ESP32-CAM device. In some routers you should put the IP address of your ESP32-CAM instead of a device name.
Go to www.whatsmyip.org and copy your IP. Use this IP in the App when you are outside your home network.