This afternoon I finally got a hold of the Freetronics EtherTen board. I've been fascinated by Arduino for a while now, initially finding an application for one in a PC case-mod project I'll detail later. I often struggle to think of a good application for such electronics after getting excited by all the features available. Loving the idea of networking every device, big or small, an Arduino with built in ethernet gives me some great ideas.
I spent some time this evening testing a few features of the EtherTen and getting to grips with its supported libraries, the possibilities and the limitations.
After downloading the latest version of Arduino (it's been a few month since I have played with one) I loaded up the blink test sketch to make sure it was talking. All good. Now on to the fun part!
Popping in a Micro SD card, I uploaded the Read/Write example sketch to get an idea of how the card library functioned. Reading and writing files is very easy thanks to the library included with the latest versions of Arduino. Remove the delete file lines from the example and put the card into a reader to see the file the EtherTen wrote.
When putting a server sketch together I learnt one key line that must be used for SD card reading to work
The 4 in this case corresponds to the chip select line for the reader. On the EtherTen, this is pin 4. Pin 10 (hardware Slave Select) must also be set to output.
One of the ethernet example sketches sends the values of the analogue pins as a basic HTML page to and other client on the network requesting port 80 from the EtherTen's IP address. I uploaded this sketch and tried to open the address I set in my web browser. Nothing happened at first, but I noticed the ethernet port lights were all dark. Suspecting the small voltage available from the USB port wasn't enough to power the Wiznet ethernet chip, I dug out a power adapter and the board sprang to life, delivering a web page!
I compiled a quick sketch to serve a HTML page stored in a file called example.txt on the SD card. Debug information is sent to a serial console over USB. It's pretty neat to see a web page served up from a tiny device without needing any other computer.
There are a couple of limitations I discovered today
- Initialisation of card fails on soft-reboot until card is taken out and reinserted. (This should be able to be rectified with some careful software debugging)
- Large files take forever to send. I couldn't embed a JPEG image much larger than 50Kb in the http response. It might be possible to optimise the sending routine or it may just be a limitation of the technology. Such a device is probably better suited to small burst of data.
I have plans to experiment with DHCP, DNS, Bonjour and OSC libraries and I'm looking forward to making everything ethernet-capible! The EtherTen is a very cool piece of kit.