Reliability Test: Uno R3 + Wifi Shield UDP

Written by  on April 29, 2014 

* A log of reliability tests and subsequent findings when working with the Uno R3 + Wifi Shield *

Arduino IDE 1.5.6-r2
Arduino Uno r3
Arduino Wifi shield updated with the firmware that comes with Arduino IDE 1.5.6-r2

Learning the hard way: When you get the Arduino wifi shield it’s reccomended that you update the firmware. At the time I tried it it was a problematic process. I followed the step by step photo guide here.
I was stymied by two things using that guide: The first is that when using the FTDI cable (which is optional) it’s not clear of the orientation of the FTDI connector on the wifi board as it isn’t labelled. It turns out the DTR pin is closest to the USB connector and the GND pin is closest to the reset button.
The other thing is I couldn’t find firmware that would actually load, got all sorts of weird errors from the firmware updater. None of the download locations on either the Binary Task Force guide or the official Arduino site gave me usable files. In the end I used the ones already on my computer that had been isntalled with the 1.5.6r2 Arduino IDE. The ones that worked had sizes in the hundreds of kb. Ones that didn’t were quite small.
The end result is that I updated the firmware from something with a build date in 2012 to something with a build date in 2013 but it’s not clear what version number or if this is actually the very latest version.

Learning the hard way: When using the wifi UDP example sketches make sure the Wifi.begin function is set for WPA (or WEP as required), by default it is for open (no password) networks. At the top of the sketch there is a constant where you can set your password however it isn’t included in the begin function by default.
Original (for open network):
status = WiFi.begin(ssid);
Correction (for WPA):
status = WiFi.begin(ssid, pass);

Test A – Reliability Test – Wifi UDP over WPA. Based on the WifiUDPSendReceiveString
Using WifiUDPSendReceiveString_test – same as demo sketch but with my wifi info and with it modified for WPA. I wrote a vvvv patch to send it the test packets.

– Results 1 –
Works but not seeing echo, although its apparently transmitted so potentially vvvv problem.
Trasmitting a packet to the Arduino every 1 second seems ok.
0.25 second transmit locks it up
transmit while it’s rebooting and it seems to screw up and never receive anything. That’s not very robust.

– Results 2
At 0.25s transmission intervals it runs for about 30 sec before freezing

– Results 3
At 0.1s transmission interval runs for about 10 seconds then freezes

– Results 4
at 1s transmission interval runs for 5 minutes then freezes
Pretty shitty for the demo program that comes with the shield

– Results 5
With 1s transmission interval, 4 byte packet.
Runs for 4.5 minutes then freezes

– Results 6
With 0.25s transmission interval, 4 byte packet
Runs for 30 seconds then freezes

==== Conclusion ====
Wifi shield is not a reliable product at the moment, at least not with UDP which is pretty basic. Disappointing. The firmware and libraries I’m using are the ones that came with IDE 1.5.6 r2. I’d tell you what version number firmware I’m using but I’m not even sure because of this firmware updating/github fiasco.

Final Sketch

Test, identical to WifiUDPSendReceiveString demo, but without while (Serial.

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

int status = WL_IDLE_STATUS;
char ssid[] = "yourSSID"; //  your network SSID (name)
char pass[] = "yourPass";    // your network password (use for WPA, or use as key for WEP)
int keyIndex = 0;            // your network key Index number (needed only for WEP)

unsigned int localPort = 2390;      // local port to listen on

char packetBuffer[255]; //buffer to hold incoming packet
char  ReplyBuffer[] = "acknowledged";       // a string to send back

WiFiUDP Udp;

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:
    while (true);

  String fv = WiFi.firmwareVersion();
  if ( fv != "1.1.0" )
    Serial.println("Please upgrade the firmware");

  // 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);

    // wait 10 seconds for connection:
  Serial.println("Connected to wifi");

  Serial.println("\nStarting connection to server...");
  // if you get a connection, report back via serial:

void loop() {

  // if there's data available, read a packet
  int packetSize = Udp.parsePacket();
  if (packetSize)
    Serial.print("Received packet of size ");
    Serial.print("From ");
    IPAddress remoteIp = Udp.remoteIP();
    Serial.print(", port ");

    // read the packet into packetBufffer
    int len =, 255);
    if (len > 0) packetBuffer[len] = 0;

    // send a reply, to the IP address and port that sent us the packet we received
    Udp.beginPacket(Udp.remoteIP(), Udp.remotePort());

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");

What next:
Let’s look at the Seeduino Ethernet as a base unit. See if we can get UDP working without worrying about wifi. Check it out.