Ron Guest

Ron Guest

WiFly: Twists & Turns but it works

As I previously mentioned I got a WiFly shield from SparkFun in order to connect my Arduino to the Internet. It is a nifty little board but I immediately ran into problems getting it to join my wireless network. I’ll skip the fits and starts in my journey to diagnosis and troubleshoot a solution and instead jump to my conclusion.

But first some relevant bits about my WiFi network. I’m using WPA for security and my router publishes two SSIDs. One is the main network and another is a “guest” network with limited access and a different SSID. The main SSID has one space in the name while the “guest” SSID has two and is longer. In fact the “guest” SSID is 26 characters in length.

I initially tried to connect the WiFly to the “guest” SSID using example code included with the WiFly library. This failed with no error - in fact the example code hung at the point where it called “join”. After sending commands directly to the chip I found I could not join when using the “guest” SSID name. However I could join if I did a “scan” command and then sent a “join” command specifying the index number in the scan output. This was my main clue that the SSID name was the problem. Conclusion: either 26 characters for the SSID is too long or the chip cannot handle two spaces in the SSID name.

I next tried to join the main SSID using the example code and this too failed. However in this case I could successfully join this SSID by sending the commands to the chip and so I could conclude one space in the SSID was no problem (you do substitute a $ for the space). Reading the source code for the WiFly library I found a “TODO” comment to support spaces and hence I’m confident the library does not support spaces. I added code to set the SSID, bypassing the library’s code, and could then use the library to execute the join and access the internet successfully.

The code I used was a snippet from a post by Gary on this SparkFun Forum thread. If you have questions feel free to comment. In spite of the problems with the library, and potentially the chip having limitations on the SSID, I think this is a nifty little shield and I’m anxious to start some new projects involving connectivity.

← An IndieWeb Webring πŸ•ΈπŸ’ β†’