Skip to content

Commit 552f53b

Browse files
committed
Simplified the esp-camera component even more
Attempted to increase the data throughput from the camera to allow for even better quality
1 parent 1275346 commit 552f53b

File tree

4 files changed

+95
-297
lines changed

4 files changed

+95
-297
lines changed

README.md

+23-14
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,35 @@ esp32 cam digital, low latency FPV
33

44
This project uses a modified esp-camera component running on an AI Thinker board to send low-latency mjpeg video to a Raspberry PI base station with 1-2 wifi cards using packet injection and monitor mode.
55

6-
It uses FEC encoding (K4 N7 currently configured) 1400 byte packets and it achieves quite good performance:
7-
* Up to 16Mbps video rate.
8-
* More than 90 FPS @400x296 or lower with 20-50 ms latency.
9-
* 34-44 FPS (temperature dependent) @800x600 or 640x480 with 50-80 ms latency.
10-
* 12 FPS @1024x768 with >100 ms latency.
6+
It uses FEC encoding (4/7 currently configured) with 1400 byte packets and it achieves quite good performance:
7+
* Up to 12Mbps video rate.
8+
* More than 90 FPS at 400x296 or lower with 20-50 ms latency.
9+
* 34-44 FPS at 800x600 or 640x480 with 50-80 ms latency.
10+
* 12 FPS at 1024x768 with >100 ms latency.
1111
* Air unit weighs in at 18g with camera, antenna and a 3D printed case.
1212

13-
The ESP wifi is fully configurable (rate, power).
14-
The GS wifi cards have to be among the ones supported by wifibroadcast projects (EZ-wifibroadcast and the like) but the 2.4 GHz band only.
15-
The system uses channel 11 at the moment (hardcoded in the air unit firmware).
13+
It's based on an Ai Thinker board with an OV2640 camera board and the esp-camera component.
1614

15+
The data is received from the camera module as JPEG ar 20MHz I2S clock and passed directly to the wifi module and written to the SD card if the DVR is enabled.
1716
The ESP camera component was modified to send the data as it's received from the DMA instead of frame-by-frame basis. This decreases latency quite significantly (10-20 ms) and reduces the need to allocate full frames in PSRAM.
18-
The CPU usage on the ESP32 is quite low right now - around 25% per core with most of it being used for the FEC encoding and WIFI TX task.
19-
So there is still room to add quite a lot of processing - including saving the video to a SD card.
2017

21-
The link is bi-directional so the RPI can send data to the esp air unit. ATM it can send camera and wifi configuration data but I plan to have a full bi-directional serial port for telemetry coming soon.
22-
The back link uses 64byte packets with a 2/6 FEC encoding (so quite solid) at a low wifi rate (I think 1Mb).
18+
The wifi data is send using packet injection with configurable rate - from 2 MB CCK to 72MB MCS7 - and power.
19+
20+
The air unit can also record the video straight from the camera to a sd card. The format is a rudimentary MJPEG without any header so when playing back the FPS will be whatever your player will decide.
21+
There is significant buffering when writing to SD (3MB at the moment) to work around the very regular slowdowns of sd cards.
22+
23+
24+
25+
The receiver is a Raspberry PI 4 with 2 wifi adapters in monitor mode (TL-WN722N). The adapters work as diversity receivers and the data is reconstructed from the FEC packets.
2326

24-
For the base station I'm using a raspberry 4 in a RasPad3 tablet form for ease of use. The base station software supports both X11 and Dispmax.
25-
Raspberry PI 3 should work, but Zero is too slow and it will increase latency quite a lot (but still usable).
27+
The JPEG decoding is done with turbojpeg to lower latency and - based on the resolution - can take between 1 and 7 milliseconds.
28+
It's then uploaded to 3 separate textures as YUV and converted to RGB in a shader.
29+
30+
The link is bi-directional so the ground station can send data to the air unit. At the moment it sends camera and wifi configuration data but I plan to have a full bi-directional serial port for telemetry coming soon.
31+
The back link uses 64byte packets with a 2/6 FEC encoding (so quite solid) at a low wifi rate (I think 1Mb).
2632

2733
This is very WIP at the moment, but it proves that the ESP32 can definitely stream video with very low latency.
2834
I plan to use this is a long range micro quad.
35+
36+
Here is a video shot at 30 FPS at 800x600:
37+

0 commit comments

Comments
 (0)