WIFI speed, signal interference...

alkorismus
Posts: 8
Joined: Tue Feb 26, 2019 1:55 am

WIFI speed, signal interference...

Postby alkorismus » Sat Feb 19, 2022 5:20 am

Full title:
Question about WIFI data transfer speed variation, possible RF interference...


I am testing capture frames with ESP-CAM device and transfer data using WIFI to a Rasp4.
The results shown below are from 2 instances of 1000 frames in total.

2 first graphs below represent measurement taken in different hours of the day.
There are a big difference, as the graph shows...
graph-fast.jpg
fast
graph-fast.jpg (41.2 KiB) Viewed 3129 times
graph-slow.jpg
slow
graph-slow.jpg (59.52 KiB) Viewed 3129 times
Vertical is time, measured in seconds (8secs max scale).
Horizontal is 1000 pictures transferred by wifi, from ESP to Pi 4.
-----------------------------------

Table below show the actual numbers from eash measurement.

Code: Select all

-----------------------------------

fast-GRAPH
Start  :2022-02-17 20:23:12.201321	
Finish :2022-02-17 20:26:57.507617	
Total seconds: 0:03:45.306296	
	
0.225187827348709	  AVERAGE
0.054800987243652	  MINIMUM
0.956576824188232	  MAXIMUM

-----------------------------------

slow-GRAPH
Start  :2022-02-18 15:20:17.437005	
Finish :2022-02-18 15:30:14.457416	
Total seconds: 0:09:57.020411	
	
0.59687663269043	  AVERAGE
0.04627799987793	  MINIMUM
7.35434556007385	  MAXIMUM

-----------------------------------
Hardware setup:
ESP32-WROOM-32E (M5Stack UnitCam) to RaspberryPI 4 RaspOS 32Bit
Antenna to Antenna = 7cm apart

Software setup:
ESP32 { sketch to capture CIF (400x296) JPEG, send by WIFI (ESPAsyncWebServer) }
P4 { python3 script to get jpeg img from ESP32, save to ramdisk directory }

Eash JPEG image size is approx. 5.5 Kilo Bytes

At this point, it does NOT seems to me that the issue is related to software, since the soft setup is exactly the same, and simple...

Around the time for the SLOW graph, there was more or less 30 SSID detected in the area (Arduino IDE "scan wifi" sketch example)...
Scanning for about 4 hours continuosly, around the same time of this measument, shows a total of about 160 different SSIDs, with the maximum simultaneos number of 46 SSID at a given time...

The third graphic is the numbers of networks as detected by Arduino IDE "scan networks" sketch.
Vertical (RED) is the number of SSIDs detected.
Horizontal are the hours: start around 11AM to little past midnight.
graph-nets-time-LEGEND.jpg
scan ssid
graph-nets-time-LEGEND.jpg (71.49 KiB) Viewed 3129 times
Unfortunatelly, I don't have yet these 2 sets of measurements in 24 hours period to place side-by-side and look for possible correlations... and see if the number of WIFI networks can show effects in the average time for frames (JPEG) transmission... looks like these measurements will be a MUST to be taken, in the pursue of a better understanding of the issue...


[Questions]
Is the SLOW measurement result of some kind of "RF pollution" (too many WIFI/RF around the location)?

If this is some constraint of the PCB Antenna, what can be done to mitigate the issue?

Is there any recommendation to get a more uniform result in a 24hour operation scenario?


I have just started to collect data by making measurements.
At some point I will be doing measuments changing distance, size of picture, as well as protocol of communication, like TCP, UDP, WebSocket, etc...
By then, I should have a fairly good idea of the limitations of my hardware/software setup and what are the option which gives me the most uniform results.

The reason I am asking for recommendations or if there are any "secrets" to know, without even finishing a first round of tests is because, comparing the total time, in seconds, that the first instance took to transfer 1000 photos (Total seconds: 0:03:45.306296), with the second instance (Total seconds: 0:09:57.020411), I was a little bit surprised and decide to share this initial result and ask if there are any recommentation to follow in the search of a more uniform behavior...

I have already spend some time testing how much the (wired) serial interface can do to transfer images from ESP to SBC, now I will be doing some tests with WIFI...

My current goal for the ESP-CAM is simple: transfer still frames of about CIF (400x296) resolution in JPEG format to a PC/SBC, something around 2 frames/second should be fine.
So, 1 second latency is OK, but the 8 seconds is a concern...

Considering all the variables (distance, protocols, framerate, framesize) there are a LOT of possible tests to run, so I have to choose some percentage/fraction of them to perform, until I reach a satisfactory conclusion with a practical result to adopt...
In doing so, I intend to share some information about the experiments and its results, so that people can use the collected data to make things using the ESP-CAM...

I am (also) working on a small and simple tutorial on the ESP-CAM, because I believe that, the ESP-CAM is a kind of "killer application", one which is VERY POWERFUL!
For me, the ESP-CAM is something equivalent to the VisiCalc Spreadsheet software for the Apple II Personal Computer. An idea/product so powerful back then, that many people consider it to be the "killer-app" that propels the Apple II to the masses, in doing so, propel the Personal Computer to the masses... it also invented the spreadsheet software...

As such (above), I think that ESP-CAM deserves a simple and clear tutorial, crafted with this thinking in mind (ESP-CAM as killer app), and so I am doing it, and the current tests I am conducting are in part related with the creation of the tutorial itself... some data from the tests will, probably end up being used in the tutorial...

BAD START WITH ESP-CAM
There was a FACTOR that largely explain the reasoning for my current motivation, it was a "bad" start with the ESP-CAM few weeks ago...
Soon after getting the M5Stack UnitCam (ESP32-WROOM-32E), I started to look for Arduino IDE samples to understand how it works, and ONE AFTER OTHER, all samples and demos I choose FAIL to execute...
Then I went to ESP-IDF, also with NO success...

THERE WAS NOT A SINGLE WEBSITE SHOWING THE M5STACK UNITCAM working with a demo code!!!

I could find ONLY ONE individual, that seems to have done some, but after going to his website, he was using some kind of Blocky Visual Programming, and I could NOT see how his site/language works... there was NO way to compile, NO way to save... nothing that resembles Blockly or APP Inventor, which are popular Visual Languages out there...

I spend hours and hours without even knowing what-tha-**ck-is-going-on...

Maybe M5Stack had a custom made ESP32...???
Maybe M5Stack had a custom made ov2640...???
Maybe my unit cam was defective...???

HOW CAN IT BE?
This thing is supposed to be THE COOLEST THING IN TOWN (according to me)!!!
And yet, I was TOTALLY LOST AND CONFUSED by that time...

The M5Stack Company main goal is to sell easy to connect and play devices, with already programmed firmware, so, asking for help on the M5 Forum is not the best thing to do, if you want to upload your own code to one of their devices... it is just beyond the scope of the Company and outside the sphere of interest of the majority of their users...

It was a "dark" beginning...

Until I went to ESP-CAM Github repository...
Somebody had already detected that there is a problem and did report there...
What happens is that, there was a bug on the ESP-CAM software, that ALWAYS compile the binary to use PSRAM, which the M5Stack UnitCam DOES NOT HAVE, and so, not only Arduino IDE fails, also ESP-IDF fails...
https://github.com/espressif/esp32-camera/issues/334


I then look for older versions of the code, then, SUCCESS...
This "little thing" is really, the coolest thing in town... AT LAST...
At that very instant, an ESP-CAM tutorial was born... lol... I knew it... lol...

The tutorial then became a little project, because I believe that this is THE KILLER APPLICATION, so powerful that can change forever the mindset around microcontrollers...

Some challenges around RF signals that may exist/appear, should not be a matter of concern, when put into the perspective of the large end-result available to us all...

The journey into this tutorial lead me to a little bit of methods of science here, running some experiments and collecting data, then, by looking at the data we gain understanding of the issues and insight into what we can do to get the best results....

For now, thanks all,
Valter

alkorismus
Posts: 8
Joined: Tue Feb 26, 2019 1:55 am

Re: WIFI speed, signal interference...

Postby alkorismus » Mon Feb 21, 2022 8:27 am

Just want to show another preliminary data.

This time, instead of HTTP, just using TCP socket.
And, instead of JPEG frame from ov2640, just random 10 kilo bytes...

First M5Stack:
rand-10k-tcpsocket-m5stack.jpg
rand-10k-tcpsocket-m5stack.jpg (49.16 KiB) Viewed 3018 times

Below is DevKitC:
rand-10k-tcpsocket-devkitc.jpg
rand-10k-tcpsocket-devkitc.jpg (49.42 KiB) Viewed 3018 times

Code: Select all

M5Stack UnitCam - Pure TCP Socket Array Random 10 kilo bytes
ESP32-WROOM-32E
0.077702605724335	Average
0.058227062225342	Min
2.69398665428162	Max

ESP32 DevKitC - Pure TCP Socket Array Random 10 kilo bytes
ESP32-WROOM-32D
0.078360189437866	Average
0.057132959365845	Min
2.481693983078		Max
Data is about twice the size of the JPEG frames of the first post.

The large variation in time is GONE!
Result shows a very uniform envelop.

The M5Stack (WROOM-32E) and DevKitC (WROOM-32D) shows basically the same result...

Looking at these preliminary numbers, RF interference, if exists and impacting the results, is now at very low levels...

I was expecting that pure tcp and udp packets will show better results, but I am surprise to see a smooth behavior, very uniform, almost without any variation!

Well, I will continue, hoping to have also udp, websocket to compare...

Regards,
Valter

Who is online

Users browsing this forum: Bing [Bot] and 120 guests