( This content is related to IoT technology and is not related to Rhino modeling software.)
This summary, while focused on the ESP32-CAM and remote video, is a template approach to IoT development, allowing for many projects through variations. It involves hardware programming and Android development. The content itself is derived from fragmented prior research and exploration, then organized through personal trial and error (losing countless hairs). to produce a complete operational chain.
The hardware is the ESP32-CAM, and Android development uses the no-code platform App Inventor.
The project app prototype:
In simple functional terms, this project enables remote viewing of video captured by the camera on a mobile device, remote photography, and other additional features.
Overview of ESP32-CAM + App Inventor Workflows:
The ESP32-CAM handles the physical electronic circuit part, while App Inventor is responsible for developing mobile applications. Users operate the app on their phones, communicating remotely with the ESP32-CAM, sending commands and receiving information. For example, when a user clicks a “Take Photo” button displayed on the app, the phone responds: I understand, and sends a request via WiFi to the ESP32-CAM to open the camera. Upon receiving this, the ESP32-CAM responds: I understand, and proceeds to control the circuit to open the camera, thus achieving the functionality of remotely opening the camera.
HTTP Protocol:
The wireless communication between the ESP32-CAM and the mobile phone uses the HTTP protocol, which is one of the communication protocols between machines.
When the ESP32-CAM receives a command in a specific format like “ip/xxx”, it interprets the line of text by first removing “ip/” and reading the remaining “xxx”. It then matches this against its code to determine the corresponding operation and executes the appropriate function.
The “xxx” following the IP address is the key to activating a certain functional operation.
For instance, if the ESP32-CAM’s IP address in a certain network environment is 192.168.111, and the desired function is to turn on a light, the code can define a function called LightON (format: Void LightON() { fill in the pin output information needed to turn on the light }). Then, it is necessary to create a link between “xxx” and the LightON function: thus, if the ESP receives “xxx”, it will execute the LightON function. The name “xxx” can be defined arbitrarily; for consistency, let’s name it LightON. Therefore, if the mobile phone sends the text “192.168.111/LightON” to the ESP32-CAM, it will receive and decrypt the text, directly reading “LightON”, which leads to the execution of the LightON function, turning on the light.
Some may wonder how the mobile phone sends this HTTP text information after programming the ESP32-CAM. This is where App Inventor comes into play for Android application development.
Development on the mobile side is even simpler; data transmission is very convenient. In App Inventor, you just need to add functional buttons to the user interface and provide an interaction logic, such as: clicking this button sends a specific HTTP text over the network. Referring to the previous example, you can drag a button onto the canvas, name it “Turn On Light”, and in code block mode, set up an interaction logic: clicking this button will send “192.168.111/LightON” over the network.
Isn’t that easy?
What is ESP32-CAM:
The ESP32 can be understood as a Wi-Fi version of Arduino, very affordable (about ten yuan on Taobao) and compact with powerful Wi-Fi capabilities. The ESP series is the first choice for IoT project development. The ESP32-CAM module (around 20-30 yuan on Taobao) integrates the OV2640 image sensor, making it very convenient for image capture and data upload. The pixel value for capturing images is 200W. This price point is quite reasonable.
It is said that the native code programming experience for ESP series development boards is poor, but programming can be done using the Arduino platform, which has the same programming language as Arduino; I used the Arduino platform method.
How to Configure the Required Environment for ESP32 in Arduino:
1. Open Arduino IDE, then open File -> Preferences:
In the Additional Board Manager URLs option, enter https://dl.espressif.com/dl/package_esp32_index.json, then click OK:
2. Tools -> Board -> Boards Manager, search for ESP32, find the project “ESP32 by Espressif Systems”, and click Install.
3. After installation is complete, restart the Arduino IDE.
4. After successful installation, a series of ESP32 development board options will be displayed under Tools -> Board.
How to Program the ESP32-CAM:
Using the FTDI module, follow the wiring as shown in the image.
When the programming window shows connecting, press the reset button to upload to the board.
Disconnect the IO0 and GND wires, then press the reset button again to read the serial port.
Additionally, pay attention to the parameter settings when exporting: the board must select ESP32 Wrover Module; the parameters below must also be correct; aside from that, the basic port settings must be correct.
Common Issues: What to Do If the ESP Signal is Weak
This is likely a bug inherent to the development board, as many users complain about weak signals, especially with the ESP32-CAM. Poor network performance during video streaming is quite problematic. However, it can be resolved:
Remove the 0K resistor indicated by the red arrow in the image, and solder the three points in the red area together, then an external antenna can be connected, significantly improving the signal. The code to test signal strength can be found in “ESP32-CAM Test Network Speed Code”, which should be relatively easy to find online.
Common Issues During Hardware Testing: Using ESP32-CAM Causes Servo to Malfunction
The CAM occupies timer0 and timer1; just assign timer2 or timer3 to the servo timer.
Use the function library ESP32Servo, which can be downloaded from Arduino’s library, and the syntax for assigning the servo timer is:
ESP32PWM::allocateTimer(3);
What is App Inventor:
App Inventor is a tool developed by MIT that allows people without programming experience to quickly create Android applications. Unlike design tools like XD or Axure, the apps created are real Android applications that can run on phones, not just prototypes. There are many Android applications created by 8-year-old children available online, which are quite impressive.
After creating a new project file, you will see the operation interface shown below, where you can drag the corresponding component modules from the left sidebar, such as dragging an audio component for an mp3.
You can switch between design mode and code mode in the upper right corner. The following image shows the code block mode. Having modules is not enough; you also need to add code to create operational logic that drives the app’s actions.
This is what is referred to as the code section, where you can program by dragging blocks. This operational logic is similar to visual programming tools like Rhino’s Grasshopper and Lego blocks, allowing for a visual programming approach.
This app development tool is truly powerful; it can implement almost all necessary functions, and for more complex features, you can search for related plugins on forums, some of which are free and some paid, mostly packaged by advanced users for the convenience of beginners.
The code for implementing photo capture and intelligent networking with ESP32-CAM has been made public; see “ESP32-CAM Project Source Code” for modifications based on actual conditions! If there are no function libraries, they can be downloaded from GitHub.
The core code and function libraries for this project are derived from the modified code provided in the following link:
https://github.com/yoursunny/esp32cam/blob/main/examples/WifiCam/WifiCam.ino