AVR homebrew device with iPhone aspirations

Can you make an iPhone out of an AVR? No. Can you get a surprising amount of functionality out of a humble 8 bit processor and a cheap touch LCD? Yes.

The iPhone runs more than 30 times faster (417Mhz ARM vs 12Mhz AVR) and has more than 30,000 times as much ram RAM (128M vs 4k) yet this frumpy little device can ape some of the iPhones neater tricks.

Hardware
320×240 LCD with 4 wire resistive touch screen – a ELT240320ATP variant from a dead Sylvania MP3 player – uses a ILI9325 controller.
12Mhz Atmega644 CPU with 64k Flash and 4k RAM – demo fits in 32k.
USB connector for PC communication and charging.
Lithium polymer battery with software controlled power.
Software controlled backlight.
SD Micro slot.

Software
LCD driver to support blitting image decompression and smooth scrolling.
Z-sorted span 3D engine with zero overdraw.
Basic UI framework for gadgets and poorly drawn pictures.
USB mouse or keyboard HID support.
Sampling profiler.
Movie playback.
Sprite engine.

Tricky Bits
4K of RAM might sound like a lot but it isn’t. Getting a 3D renderer to fit comes down to the representation of the active triangle edges – this engine uses 16 bytes for a double sided edge so you can have lots of triangles on a horizontal scanline and still run the whole thing in 8k of Flash and 512 bytes of RAM.

Pacman just fits in 8K flash and 512 bytes of RAM. It uses the sprite engine and runs at > 60fps.

None of the images or animations ever linger in RAM, the go straight from the SD card to the screen. The SD card is a wonderful alternative to RAM. Reading a 512 byte block takes ~1ms; not snappy but plenty fast enough for human interation.

At 3.3v, the Atmega644 is limited to about 12Mhz. Pretty pokey when you consider you can buy a  50Mhz ARM Cortex-M3 with the same flash and ram for about 1/3 as much as the 644. Don’t get me wrong; I love the Atmel parts but a little more CPU would not go astray.

Source
Source code, demo files, Eagle PCB and schematics at https://sourceforge.net/projects/microtouch/

Uzebox/Digital Photo Frame love child


Gotta love the Uzebox. Good old fashinoned fun. But now that my main TV has nearly a dozen devices in the AV switch loop I need a stand alone version of my favorite homebrew videogame.

I picked up a Sunpak 5.6 inch digital photoframe from Fry’s for $20 (online for < $25). Inside a resonably attractive case was a Sharp LQ056A3AG01 lcd, audio amp, speaker and power supply; just the thing to host a stripped down Uzebox parasite.

The parasite uses a ATMega644p but does not need the AD725 RGB to NTSC coverter as we will be driving the lcd directly. I opted for surface mount resisitor nets for the D to A ladder because
i) I had some lying around
ii) It needed to be small
iii) I hate drilling holes
iv) I hate soldering 805 resistors

I needed to cut 4 traces (RGB and SYNC) on the board near the lcd’s FPC connector (note that this is a zif socket, pull out the dark brown bit rather than yanking on the cable) to get the video signal into the lcd.  There are 7 attach points – VCC,GND, Audio to the TDA2882 amp, RGB and SYNC.

I drilled a hole in the case between and inserted a SNES controller cable, knotted it for strain relief and soldered the 5 wires (VCC,GND, CLK, Latch and Data) to the parasite. Double sided tape holds the beasty in place.

Close case, enjoy. $20 for the photo frame, $7 for the ATMega644p,  $2 for crystal, caps and resistors, $3 for the controller, $1 for the homebrew board.