Speedtest command of Arduino Uno or WiFiESP.h or another library?

Is there a command such as showing the bandwidth, latency, and internet speed in the Serial monitor of my ESP01-s through Arduino Uno? I finally connected to wifi and also ping Google.. now I want to show in the serial monitor mentioned three related information on wifi module if there's a command like that.



/*
 WiFiEsp example: ConnectWPA
 
 This example connects to an encrypted WiFi network using an ESP8266 module.
 Then it prints the  MAC address of the WiFi shield, the IP address obtained
 and other network details.

 For more details see: http://yaab-arduino.blogspot.com/p/wifiesp-example-connect.html
*/

#include "WiFiEsp.h"


// Emulate Serial1 on pins 6/7 if not present
#ifndef HAVE_HWSERIAL1
#include "SoftwareSerial.h"
SoftwareSerial Serial1(6, 7); // RX, TX
#endif

char ssid[] = "ssid";            // your network SSID (name)
char pass[] = "password";        // your network password
int status = WL_IDLE_STATUS;     // the Wifi radio's status

void setup()
{
  // initialize serial for debugging
  Serial.begin(9600);
  // initialize serial for ESP module
  Serial1.begin(9600);
  // initialize ESP module
  WiFi.init(&Serial1);

  // check for the presence of the shield
  if (WiFi.status() == WL_NO_SHIELD) {
    Serial.println("WiFi shield not present");
    // don't continue
    while (true);
  }

  // attempt to connect to WiFi network
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to WPA SSID: ");
    Serial.println(ssid);
    // Connect to WPA/WPA2 network
    status = WiFi.begin(ssid, pass);
  }

  Serial.println("You're connected to the network");
}

void loop()
{
  Serial1.print("AT+PING=\"www.google.com.ph\"\r\n");
       Serial1.setTimeout(1000);
         if (Serial1.find("ERROR\r\n")== 0)
          {
   
           Serial.println("There is      ");
   
           Serial.println("a Connection!       ");
         }
        else 
        {
   
         Serial.println("No Connection!            ");
    }
  // print the network connection information every 10 seconds
  Serial.println();
  printCurrentNet();
  printWifiData();
  
  delay(10000);
}

void printWifiData()
{
  // print your WiFi shield's IP address
  IPAddress ip = WiFi.localIP();
  Serial.print("IP Address: ");
  Serial.println(ip);

  // print your MAC address
  byte mac[6];
  WiFi.macAddress(mac);
  char buf[20];
  sprintf(buf, "%02X:%02X:%02X:%02X:%02X:%02X", mac[5], mac[4], mac[3], mac[2], mac[1], mac[0]);
  Serial.print("MAC address: ");
  Serial.println(buf);
}

void printCurrentNet()
{
  // print the SSID of the network you're attached to
  Serial.print("SSID: ");
  Serial.println(WiFi.SSID());

  // print the MAC address of the router you're attached to
  byte bssid[6];
  WiFi.BSSID(bssid);
  char buf[20];
  sprintf(buf, "%02X:%02X:%02X:%02X:%02X:%02X", bssid[5], bssid[4], bssid[3], bssid[2], bssid[1], bssid[0]);
  Serial.print("BSSID: ");
  Serial.println(buf);

  // print the received signal strength
  long rssi = WiFi.RSSI();
  Serial.print("Signal strength (RSSI): ");
  Serial.println(rssi);
}                                

Short answer: no.

There is no such value as "Internet speed". You can measure the speed to a specific server at the moment but that information if usually completely irrelevant on an IoT device so there was no need to include such a functionality into the firmware.

Latency and bandwith aren't relevant for most IoT devices and cannot be detected in a general way.

Why do you think you need these values?

I need those values because it is requirement for our activity in school. actually, there is LCD i2c, we need to show them on the LCD. We need to do it just Arduino Code. Just a while ago I got the latency and finally displayed, from AT+PING="www.google.com". The 23 something on the picture. Or am I wrong?

image

I don't know because you didn't specify what you wanted to achieve. With that command you get the turnaround time (in ms) to the next available Google server (which might be anywhere). This might check if you're connected to the Internet but the actual value doesn't really mean much.

It sounds like this isn't an actual project but you got a task from your teacher. I sincerely hope the task description doesn't say "show the latency on the LCD" because that would show that your teacher has no clue about network and how they work. So if that's a school work, you probably should tell us what exactly you're asked for.

For some idea of the bandwidth you get you can ask for the WiFi standard used in that network: AT+CWSTAPROTO?

For the latency you might try to ping the WiFi router and return half of that value.

For the Internet speed you need a counterpart in the internet to where you want to test the speed. This counterpart should be as near as possible to you (in network terms, the actual physical distance is irrelevant). If your WiFi network is modern enough and the Internet connection is powerful enough you won't get to that limit with an ESP8266 connected to an Arduino UNO by serial. I hope you have an Internet connection that gives you more than the 9600 baud you have to the ESP.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.