CE 432 Fall 2021
Tutorial 3: Video Streaming Web Server and Robot Car (Module 4 in Rui's textbook)
Taylor Nakai
tsnakai@fortlewis.edu

Introduction:
In tutorial, we built on top of what we learned in Tutorial 1: Getting Started and Tutorial 2: Take Photos. We followed the examples in Module 4, which involved advanced ways of using the ESP32-CAM's camera. The examples had us start and stop video streaming on a webserver, video streaming with a sensor's readings (temperature, altitude, and pressure), build a remote controlled car robot with a camera, and design a PCB in Eagle to replace the prototype PCB that holds that ESP32-CAM and voltage regulator on the robot. The code used can be found in Tutorial_3.txt.

Materials:
MaterialsQuantity
ESP32-CAM1
FTDI Cable1
Power Supply1
External Antenna1
BMP180
1
Prototype Board
2
Jumper Cables12
Bread Board1
Soldering Iron
1
Voltage Regulator
1
Motor Driver
1
Robot Kit
1

Task 1:
In task 1, we followed the example in Module 4, Unit 1 of Rui's textbook. This example allowed us to use a video web server that allowed a user to control when to start and stop video streaming. When the user opens the ESP32-CAM's IP address they have two options, start and stop. Start allows for the video stream to begin and stop allows for the video stream to end. They can access the IP address through either a mobile device or a computer as seen in Figure 1 and Figure 2.


Figure 1. Video streaming web server with start and stop buttons.


Figure 2. Video streaming web server with start and stop buttons on mobile device.

Task 2:
In task 2, we followed the example in Module 4, Unit 2 of Rui's textbook. This example allowed us to add useful sensor readings from a BMP180 (temperature, altitude, and pressure) to the video streaming web server page that we have previously established in earlier tasks and tutorials. The cool thing that I found was that the readings were automatically updated every 30 seconds on the web page using server-sent events (SSE). To begin we needed to solder the pins on the BMP180 and add the 'Adafruit_BMP085' library. Once that was completed, we had to modify the given code as the BMP180 did not have a humidity sensor so we changed it to read altitude and we needed to change somethings that were compatible with the BME280 but not our BMP180. The user could go the ESP32-CAM's IP address and webpage from task 1 would appear but with added temperature, altitude, and pressure readings as seen in Figure 3.


Figure 3. Video streaming web server with start button, stop button, and BMP180 readings.

Task 3:
In task 3, we followed the example in Module 4, Unit 2 of Rui's textbook. This example allowed us to build a wifi controlled robot with a camera. The basic functionality on the robot is that the user could control it through the web server that we created using the live video stream to see where it is and control its movements using 5 controls (forward, backward, left, right, and stop) on the web server. The robot will move in the direction specified as long as the button on the web server is pressed and allowing for emergency breaking using the stop button. The first thing we had to do was solder all the connections on 2 prototype boards, then build the robot using the provided kit, and finally test the robot's functionality. The finished product for this task is seen in Figure 4 and Figure 5. The user is able to go to the ESP32-CAM's IP address and see the video streaming and controls as seen in Figure 6 and Figure 7. A demonstration video of using the web server with the robot is seen in Figure 8.


Figure 4. Top view of robot built.


Figure 5. Front view of the robot built.


Figure 6. Video stream of what the robot sees and interface for controlling the robot.


Figure 7. Different orientation of video stream of what the robot sees and interface for controlling the robot.


Figure 8. Web sever controlling ESP32-CAM robot.

PCB:
About 3 weeks after we finished designing, assembling, and testing out ESP32-CAM web server robot, we finally got our PCBs back that would house our voltage regulator, ESP32-CAM, H-Bridge connecting pins, programming pins for ESP32-CAM, and input power from the 3-3.7V lippo batteries. The schematic of the PCB in EAGLE can be seen in Figure 9, showing how everything is expected to be connected. The BRD view of the PCB in EAGLE can be seen in Figure 10, showing the physical layout and connections of the PCB. The bare PCB can be seen in Figures 11 and 12, as you have a general idea of where each component will be placed. Once we had our PCBs it was our job to solder on the pins for voltage regulator, ESP32-CAM, H-Bridge connecting pins, reprogramming pins, and power. Once everything was connected, as seen in Figure 13, we were able to connect it to power to see if everything was turning on. Once we verified that everything turned on, we needed to upload the code to the ESP32-CAM to get the address to the webserver where we could see if it was functioning properly. In Figure 14, it shows that after the code was uploaded it was showing a live video as desired. Figure 15, it shows all the funtionalities that we had implemented previously were working as designed.


Figure 9. PCB schematic view in EAGLE showing all the components being connected.


Figure 10. PCB BRD view in EAGLE showing physical layout and connections of the parts.


Figure 11. Bare front side of PCB.


Figure 12. Bare back side of PCB.


Figure 13. Complete PCB will all the parts soldered on.


Figure 14. Demonstrating that the robot works as designed.


Figure 15. Demonstration video showing that the PCB works as designed and performs all the actions.

Discussion:
By completing this tutorial, we were able to gain more comfortability using the ESP32-CAM. It was nice to learn how to embed a video stream from the camera of the ESP32-CAM on a web page allowing for the user to start or stop, integrate sensor reading onto the web page, and using the web sever to control the ESP32-CAM robot. There are so many uses for the ESP32-CAM and being able to work with it in different applications is interesting. This was a fun tutorial as building the robot and soldering all the connections were worthwhile at the end. Getting a refresher in EAGLE was needed, as we were able to design the schematic and BRD for the PCB. It was frustrating we soldering on the parts, as I messed up and had to redo one part. Being able to see that the PCB functioned as desired felt really good, as it was an indication that I did everything correctly. I was able to successfully complete all the requirements without much trouble. Overall, I learned some really cool things through this tutorial and I could possibly see myself using these skills outside of school.
---------------------------------------------------------------------------------------------------------------------------------------