LinkSprite UART Wifi - Example Code Post

Looking for a cheap WiFi shield for my Arduino board, I stumbled upon the LinkSprite offering on eBay (http://www.linksprite.com/product/showproduct.php?id=48&lang=en). It's not a very advanced board (ex. WEP encryption), but the price was right and the documentation was available.

Since there aren't any libraries for this little guy yet, I took a stab at writing some basic interaction. Please note: I'm just a beginner Arduino hobbyist, and my forte isn't networking or real-time systems. I wanted to give those interested a starting point with my own code. It's far from complete, and I'd love to turn this into a library once time permits.

There are some very important things to note about this shield:

  • The WiFi module itself gets VERY hot. I have burned wires with just the 500ma supplied by the USB port. :-/
  • You'll need to set it up either by popping the Arduino chip and using the USB/COM port or software parameters. I don't have code written to do the latter. You're limited to ~7 profiles.
  • Documentation is in english, but far from concise. You can find it here: http://www.linksprite.com/pub/LinkSprite-UART-WiFi.pdf
  • Once the shield is on with the module in place, the UART channels will be occupied. If you want detailed debugging data, I highly recommend an LCD of some sort. My code uses a simple 2x16 display.
  • The encryption options are weak; I use an open AP to test mine right now.

My code uses a profile I've already setup. You can find a step-by-step on their site here (http://linksprite.com/pub/tutorial/wifi_uart_tutorial.pdf). In order to create the profile, you'll need their GUI interface tool (http://www.linksprite.com/pub/Test%20Tools.rar). The tutorial should get you up and running. Note the 'Service Port' is actually the port you'll be connecting to, not some secret utility interface. Easiest way to program is pop your Arduino chip (I use an Uno) and make sure the jumpers are swapped as per the instructions.

Now, assuming you have everything wired up and you've got an LCD setup via one of the LiquidCrystal library examples, you should be ready.

You can find the sketch I wrote here:

http://dl.dropbox.com/u/2658626/LinkSpriteTest.zip

It's simple; you should get updates on the screen as it connects, and each time a message is received it will display as much of it on the screen as possible. I recommend writing a simple app in Java or an easier language for a text-based server on the port of your choice (just make sure it matches the parameters).

I highly recommend wiring it so you can pop the WiFi module to upload, then put it back on to test. It seems to work just fine on the USB power supply, so uploading/testing is fairly painless. I don't recommend leaving the board on unless you have a cooling solution. I'll try heatsinks first for my longterm solution.

Unzip to your Arduino directory and give it a shot. I'll post updated code as I can. I'm hoping my comments are good enough that you will be able to expand on it and create your own solutions.

  • N.B. Jack

UPDATE 2-21-2011: Looks like LinkSprite has now officially posted a complete sketch! You can find it here: http://www.linksprite.com/upload/file/1295584599.pde . I've applied it to my own code, and it looks like a winner. Future plans on my part include building an actual library for easier integration.