The hardware components of this system are not worth drawing a circuit diagram for:
- Basic ATmega328 with 16MHz crystal and 22pF balancing capacitors (you know the score)
- An ENC28J60 ethernet module (e.g., from eBay)
- An ST7735 TFT display with SD-card (e.g., from Adafruit)
- Stripboard, connectors, etc.
- Err, that's it!
The software is where the real action lies. This baby (a 600+ line sketch!) crams in the following libraries:
- Adafruit_GFX and Adafruit_ST7735 for drawing the pretty pictures,
- EtherCard for Internet connectivity (DHCP, DNS and Web-client),
- TinyXML to parse Web-service responses, such as this one,
- Petit FatFS to read from the SD card,
- MemoryFree to see how tight RAM was getting.
The restrictions of the AVR chip steered the implementation in interesting directions:
- All string constants stored in flash, using either F() or PSTR().
- Using the TFT screen for debugging rather than Serial (saves 128 bytes RAM).
- Graphics downloaded from Yahoo! in advance, converted into bitmaps and stored on a cheap SD card.
- Buffer-sharing between the XML parser and reading from the SD-card. (In particular, most SD-card libraries require their own 512-byte buffer for output, see this earlier post.)
- Reclamation of some flash on the AVR using Optiboot.
- Displaying wind-direction without using transcendental functions (i.e., sin, cos) used the nice trick of successive rotations. (This is apparently due to the legendary Marvin Minsky, in hakmem 149.)
There is almost no free space left on the chip: just under 200 bytes of RAM (which I guess is needed for the stack) and 512 bytes of flash!
Here's another picture showing forecast data: