Wednesday, May 4, 2011

[AVR]+[320x240 LCD]+[Resistive Touchscreen]+[USB]+[SD Card]

AVR Board with 320x240 LCD, USB, SD-Card and Touchscreen
Possibilities
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.

Functionality
Some functionality of this project are Graphical Menu, 3D Geometry, Sliding Picture Frame, PacMan Game and Wikipedia. Here are some images :

Graphical Menu

3D Geometry

Sliding Picture Frame

PacMan Game
 
Wikipedia

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.

Watch video
Project in action



Hardware
320x240 LCD with 4 wire resistive touch screen (ELT240320ATP - 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/

Original Post