With the previous article and the first small control of the motors, the robot car has already driven straight ahead. So it was clear that the technology works and now only a more complex control system has to be programmed with which the robot car can be actively steered. This includes a minimalistic web-interface and the possibility to control the motors with different speed and direction of rotation. In this article I will explain how I realized the web interface and which functions like rotating the camera image are possible. If you have worked through all articles step by step you don’t need to install any new libraries in your Arduino IDE.
The web interface with live video stream looks like the picture below.
Introduction to the program adaptations
The basis is again the sample program CameraWebServer, which has been adapted considerably. In many places there is certainly a need for optimization but I would be happy if readers with more programming experience like me would put an optimized version online.
The program can be downloaded here as a ZIP file: robot_car_20201003.zip
I put it online on GitHub as well with the hope that it will be of interest and improved.
Here you can find the program on GitHub: (not yet available…)
Again, the program consists of the four already known files:
- robot_car.ino (the logic of the program was changed)
app_httpd.cpp (the logic and HTML code has been changed)
camera_index.h (no adjustments were made)
camera_pins.h (no adjustments were made)
Please unpack the ZIP file and open the file robot_car.ino with the Arduino IDE.
Rotate camera image
In the file app_httpd.cpp the camera image can be rotated. This may be necessary if the camera image is upside down, for example. This happens again depending on how the camera is aligned in the robot car. For example, I rotated the ESP32-CAM module by another 90° in the front of the robot car, because I wanted to have an image that is wide instead of high. Afterwards I didn’t have to rotate the image anymore and set the degree number to 0° in the HTML code at the following position.
page += "<p align=center><IMG SRC='http://" + Camerafeed + ":81/stream' style='width:350px; transform:rotate(0deg);'></p><br/>";
Of course, the HTML code that generates the small web interface for the controller can be customized. It was only important to me that the HTML code is as simple as possible.
For my part I think this was the most important information about the small program and now it’s time to transfer the program to the ESP32-CAM module and to drive the robot car through the apartment.
Summary
Now you should have a robot car with live video and a little web control that you can program and design as you like. With the knowledge that you have acquired over this series of articles it should now be possible to easily build e.g. a surveillance camera for the goldfish pond with connected automatic feeders. The possibilities are now huge what can be realized. For example, in the summer I will implement a control system for my pool with live video images of whether the pump is running and the water from the pool is not leaking.
Article Overview ESP32-CAM Robot Auto:
ESP32-CAM building your own robot car with live video streaming – project startESP32-CAM building your own robot car with live video streaming – Set up development environment
ESP32-CAM building your own robot car with live video streaming – USB-serial adapter wiring
ESP32-CAM building your own robot car with live video streaming – Installing the live video streaming software
ESP32-CAM building your own robot car with live video streaming – Design of the chassis
ESP32-CAM building your own robot car with live video streaming – Cabling in general
ESP32-CAM building your own robot car with live video streaming – Wiring the I²C hub
ESP32-CAM building your own robot car with live video streaming – robo car example programs
ESP32-CAM building your own robot car with live video streaming – programming the WIFI remote control
ESP32-CAM building your own robot car with live video streaming – connect external WIFI antenna
Hi
Greetings from India, Mumbai, hope you and your Family is Safe
I am a Robotic Enthusiast, this has been my passion, but due to my work in IT, i was unable to follow this and continued with my regular boring work, just recently i restarted to follow my passion (of course Pandemic Lock down helped :-), i am being collecting parts from a long time
I really appreciate your work, i am planning to implement this for my Rover Project, but instead i want to use 2 x PCA9685 and 3 x L298n Driver, just need help
Robot / Rover Configuration, is similar to Mars curiosity Rover
3 x Left Motors / 3 x Right Motors [12 V DC Motors], later plan to add another 4 Servos for Steering control,
Custom built Robotic Arm, 6 x Servo Motors [6 DOF]
need to implement Different driving mode (Manual Remote / Autonomous / Bluetooth)
I also plan to add Raspberry Pi, that make this rover /Robot intelligent that can communicate with peoples using Voice Assistant
Few things i want to add and achieve
GPS Navigation using Ublox NEO-6M GPS
Face Tracking – Pan/Tilt
Face Recognition and object detection and custom actions based in identified object face
GY-87 MPU-9265 3-axis 9-DOF Attitude Gyro Magnetometer Accelerator Sensor Module
4 x Sensor HCSR04 (detect obstacle & guide the rover to turn
4 x Line Follower Sensor
BPM / Temp & Humidity Sensor
QUERY:
can you explain,
in main code:
extern int servo_l = 10; [what does the number 10 signifies]
extern int servo_r = 10;
Also, there is HCSR04 mounted in your Chassis, but there is no Code for it,
PS: i am not good in Programing pretty new, for say still learning (C++ & Python), but my knowledge to understand code working is ok
Regards
Romeo Chatiar
Mumbai, India
I do not want to take this full-time, but wanted to build this Project for many years, along with my Son, who is now 10 yrs old and showing some interest in Robotic & Programing