Transmission speed of HTTP via the AP module on the OpenMV N6 board

Hi,kwagyeman,one of my colleagues is using the OpenMV N6 board to implement real-time video streaming over HTTP. Below are the transmission speeds he achieved with the AP module. He would like to ask whether you encountered any issues when transmitting data via the AP module. He is trying to figure out if his problem stems from the configuration file or the firmware.

Hi, it should be able to do much higher. However, there are a few things to note for wifi support.

  1. The chip antenna on the N6 is tuned, but doesn’t have amazing high performance. You may wish to install the uFL option if you want to increase the performance. Note that this is a one-way hardware install, as you need to remove the inductor and cap on the matching network. But once you have an offboard antenna, the gain will be much higher.
  2. The TCP LWIP buffers may need to be increased. This requires a firmware change. If you make them larger, you can get much higher TCP performance.
  3. A much bigger issue is how you write the MicroPython code; the N6 has a rather high cost for periodic garbage collection. You need to be very careful with how you slice and copy bytes() and bytearrays() as you can end up creating huge deep copies everywhere which quickly use up the heap and trigger garbage collection. When this happens, you get large hiccups. The way to fix this is to pre-allocate buffers, use memoryview, etc. For example, if you run the same code on the N6 versus the AE3, you’ll notice the AE3 does not hiccup because its garbage collection cost is much lower.
  4. You want to send video data using UDP versus TCP. TCP will always have a lower performance than UDP. See the RTSP video streaming protocol.

Anyway, start with a UDP protocol for data transfer first, then do all the memory optimizations as they matter, then examine LWIP issues, and finally change to a uFL antenna. The hardware is perfectly capable of everything you want to do. For test purposes, connect the N6 using an Ethernet shield to isolate wifi issues from general IP performance.