How to increase WiFi throughput
Posted: Wed Feb 03, 2021 8:07 am
Hi.
I am trying to send ADC data to a webpage created on an AP generated by the ESP32 itself, using the following code:
The current code is sending data measured by the ADC, but the built-in ADC is only good up-to 500Hz. So I will be using an external ADC with a higher sampling rate.
I want to see what maximum rate of data I can send using this method, or in fact, ANY method would do. I just want to send as much data as possible via WiFi.
Can anyone please help or guide me on how I can do that?
Your help would be much appreciated
Regards
I am trying to send ADC data to a webpage created on an AP generated by the ESP32 itself, using the following code:
Code: Select all
#include <Arduino.h>
#include "WiFi.h"
#include "ESPAsyncWebServer.h"
const char *ssid = "dataAP";
const char *password = "123456789";
AsyncWebServer server(80);
#define ADC_PIN 10
String string_to_send;
bool status = false;
String send_data()
{
if (status == true)
{
return string_to_send;
}
else
{
return "0";
}
}
void setup()
{
pinMode(ADC_PIN, INPUT);
Serial.begin(115200);
Serial.println();
Serial.println("Setting AP");
WiFi.softAP(ssid, password);
IPAddress IP = WiFi.softAPIP();
Serial.print("AP IP address: ");
Serial.println(IP);
server.on("/voice", HTTP_GET, [](AsyncWebServerRequest *request) {
request->send_P(200, "text/plain", send_data().c_str());
});
server.begin();
}
char ADC_sample = 0;
void send_ADC()
{
ADC_sample = map(analogRead(ADC_PIN), 0, 4096, 0, 99);
string_to_send = ADC_sample;
for (unsigned int i = 0; i <= 100; i++)
{
ADC_sample = map(analogRead(ADC_PIN), 0, 4096, 0, 99);
string_to_send = string_to_send + "," + ADC_sample;
Serial.println(ADC_sample);
}
string_to_send = string_to_send + ",";
}
void loop()
{
status = false;
send_ADC();
status = true;
}
I want to see what maximum rate of data I can send using this method, or in fact, ANY method would do. I just want to send as much data as possible via WiFi.
Can anyone please help or guide me on how I can do that?
Your help would be much appreciated
Regards