You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
5
5
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.
11
11
* Air unit weighs in at 18g with camera, antenna and a 3D printed case.
12
12
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.
16
14
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.
17
16
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.
20
17
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.
23
26
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).
26
32
27
33
This is very WIP at the moment, but it proves that the ESP32 can definitely stream video with very low latency.
0 commit comments