This project contains firmware for ESP32S3-based camera modules, designed to create an FPV (First Person View) RC car. It's suitable for AI car experiments and control theory research.
- Develop a prototype for FPV RC cars
- Provide an experimental platform for AI cars
- Facilitate practical research and verification in control theory
.
├── platformio.ini
├── src
│ └── main.cpp
└── host
└── python
├── cams3tx.py
└── test_cams3tx.py
This project supports two hardware configurations:
- Unit CamS3 Wi-Fi Camera (OV2640)
- Seeed Studio XIAO ESP32S3 Sense
This repository includes submodules. Use the following command to clone the repository and initialize the submodules:
git clone --recursive https://github.com/maruta/cams3-rx-udp.git
If you've already cloned the repository, initialize the submodules with:
git submodule update --init --recursive
- Install Visual Studio Code: https://code.visualstudio.com/
- Install PlatformIO IDE for VSCode:
- In VSCode, go to the Extensions tab and search for "PlatformIO IDE"
- Open the cloned project folder in VSCode
Use the platformio.ini
file to select the environment for your hardware:
-
Open the
platformio.ini
file in VSCode. -
The file contains environment definitions like this:
[env:m5_cams3unit] board = esp32s3box board_build.partitions = custom-16M.csv build_flags = ${env.build_flags} -D ESP32S3BOX [env:seeed_xiao_esp32s3] board = seeed_xiao_esp32s3 board_build.partitions = custom-8M.csv build_flags = ${env.build_flags} -D SEEED_XIAO_ESP32S3
-
Add the
default_envs
option at the top of the file to specify the environment you want to use:- For Unit CamS3 Wi-Fi Camera (OV2640):
[platformio] default_envs = m5_cams3unit
- For Seeed Studio XIAO ESP32S3 Sense:
[platformio] default_envs = seeed_xiao_esp32s3
- For Unit CamS3 Wi-Fi Camera (OV2640):
-
Save the file.
This applies the appropriate hardware settings for the selected environment. To switch environments, simply change the value of default_envs
.
-
In the
platformio.ini
file, locate the following lines:build_flags = -DCAMS3RX_WIFI_SSID=${sysenv.CAMS3RX_WIFI_SSID} -DCAMS3RX_WIFI_PASSWORD=${sysenv.CAMS3RX_WIFI_PASSWORD} -DCAMS3RX_WIFI_MODE_${sysenv.CAMS3RX_WIFI_MODE}
-
Set environment variables or specify values directly:
- For AP mode:
build_flags = -DCAMS3RX_WIFI_SSID='"ESP32CAM_AP"' -DCAMS3RX_WIFI_PASSWORD='"password123"' -DCAMS3RX_WIFI_MODE_AP
- For STA mode:
build_flags = -DCAMS3RX_WIFI_SSID='"YourHomeWiFi"' -DCAMS3RX_WIFI_PASSWORD='"YourWiFiPassword"' -DCAMS3RX_WIFI_MODE_STA
- For AP mode:
- Use "PlatformIO:Upload" button to upload the firmware
- Install Python: https://www.python.org/downloads/
- Install required packages:
pip install opencv-python pygame
- Power on the ESP32S3 board
- WiFi connection:
- AP mode: Connect to the access point created by ESP32S3 in your PC's WiFi settings
- STA mode: Ensure both ESP32S3 and your PC are connected to the same WiFi network
- Navigate to the
host/python
directory in the command line - Run the following command:
python test_cams3tx.py
- The camera image will be displayed in a window, and RTT and frame rate information will be output to the console
-
ESP32S3 Wireless Transmission Power: Some revisions of ESP32S3 may require lowering the wireless transmission power for stable communication. In the
main.cpp
file, you'll find a commented-out line:// esp_wifi_set_max_tx_power(55);
If you experience unstable communication, try uncommenting this line and adjusting the value.
-
Unit CamS3 Camera Clock and WiFi Interference: Under certain conditions, Unit CamS3 may experience interference between the camera clock and WiFi, leading to unstable communication. There are currently no known solutions to this issue. If you encounter this problem, you may need to experiment with different WiFi channels or other approaches.