Go Down

Topic: real data rate official wifi shield (Read 931 times) previous topic - next topic


hello everyone...for my experiment i need to test the real data rate of the official arduino wifi shield...I use an arduino uno+the shield and the data rate that i found was about 2Kbps...i think that is a little slow...there's anyone that can help me to improve the throughput?
thank you

PS here there is the sketch

#include <Arduino.h>
#include <SPI.h>
#include <WiFi.h>

//pay attention dim_pkt must be divided by four
//#define dim_pkt 100
//#define dim_pkt 200
//#define dim_pkt 300
//#define dim_pkt 400
//#define dim_pkt 500
//#define dim_pkt 600
//#define dim_pkt 700
#define dim_pkt 800

unsigned long time[2]={0,0};//calculate the trasmission time of a single byte
int cont=0;
byte bytetest;

char ssid[] = "***";      //  your network SSID (name)
char pass[] = "****************";   // your network password

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

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

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

//union that will have inside the dimension of the packet
union numero{
unsigned long dim;
byte dim_vect[4];

//union che conterra il buffer
byte bufferbyte [dim_pkt];
union buffer{
unsigned long timeer[dim_pkt/4];
byte bufferbyte[dim_pkt];

int status = WL_IDLE_STATUS;

WiFiServer server(80);

void setup() {
  //Initialize serial and wait for port to open:

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

  // attempt to connect to Wifi network:
  while ( status != WL_CONNECTED) {
    Serial.print("Attempting to connect to SSID: ");
    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
    status = WiFi.begin(ssid, pass);
  // you're connected now

int j=0;
union numero Dimension;
union buffer Buffer;

void loop() {
  // listen for incoming clients
  WiFiClient client = server.available();
  if (client == true) {
      Serial.println("client connected");

    // write bytes from the incoming client
    // to any clients connected to the server:
    for (int i=0;i <dim_pkt/4;i++) {
                 // time[1]=micros();
                  Buffer.bufferbyte[j]=i;//it's only a test of trasmission
//                  server.write(Buffer.bufferbyte[0]);//
//                  Buffer.bufferbyte[j*4+1]=i*4+1;
//                  server.write(Buffer.bufferbyte[1]);
//                  Buffer.bufferbyte[j*4+2]=i*4+2;
//                  server.write(Buffer.bufferbyte[2]);
//                  Buffer.bufferbyte[j*4+3]=i*4+3;//i*4+3
                  if ((i+1)%90==0){
                    server.write(Buffer.bufferbyte,90);//because if i write a number>90 the connected client doesn't read anything
   if (j!=0){
        Serial.println("client disconnected");

Go Up