I’ve seen plenty Internet Radio examples out there on various platforms, but none on Arduino. Is 2K memory just too little to stream radio effectively? Thought it was time to find out. Turns out it’s no problem at all. Using uIP on ENC28J60 for networking and VS1053 for playback, a stock ATmega328p-based Arduino can stream Internet Radio no problem with plenty RAM to spare.
On my blog is an example of a “Hello, world.” of Internet Radio. It starts up, connects to a single hard-coded stream, and plays it forever. This makes it simple! Plug and listen.
The key to making this project work was finding a small, memory-efficient TCP/IP stack in software that's mature and well-tested. For the longest time, I thought such a thing did not exist. Then I found uIP, which is part of the Contiki OS. More importantly, I found the avr-uip port which extracts uIP out of Contiki, and pairs it with the ENC28J60 driver. Even with all of its restrictions and compromises, it was able to download files from the web at 180kbytes/sec with only a 500-byte packet buffer. That's plenty fast enough to keep up with a 128kbits/sec Icecast stream with plenty of time left over for dealing with network hiccups.