Home > AVR Projects > AVR based Etch A Sketch with Nokia 3310 LCD

AVR based Etch A Sketch with Nokia 3310 LCD

January 25th, 2009

Summary

This project allows one to use a universal IR remote to control an AVR based Etch A Sketch.  For display, we use the Nokia 3310 LCD ($10 from SparkFun.com).  The Etch A Sketch functionality is simply the ability to draw in a straight line up, down, left, right.  The purpose of this project was to demonstrate the improvements to CC Dharmani’s NOkia 3310 library that allows per pixel access using a pixel buffer.  The improved version has been included in the source of this project *.  As originally written, the library worked great displaying fonts of two different sizes, clearing the screen, and drawing a boarder around the edges.  Because of the way one must talk to the screen, it did not allow raw pixel access or random drawing.  Doing so requires a local cache (buffer) of the pixels.  This way, if you want to set a single pixel, you have the old value that you set to modify and write it back.  The improvements shown here do just that.  Additionally, we also have included a small tool to allow a .pgm file to be converted to a header for a splash screen.  The additional routine to display the image is also included.

* Hopefully CC Dharmani and I will get together and put this library in a source repository to store continual improvements.

Details

For input, we use a 38kHz IR demodulating receiver.  These can be picked up for $4 at RadioShack or $0.75 on Digikey (parts list below).  Sparkfun.com also has a fancy one for $9.95.  For display, we use our handy dandy Nokia 3310 replacement LCD.  We talk to it using SPI.  The arrow keys on the remote move the cursor and draw a line as it goes.  The MENU or MUTE buttons swipe the screen.

Schematics

Schematic - atmega8 with 3310 LCD and IR sensor

Schematic - atmega8 with 3310 LCD and IR sensor

Nokia 3310 LCD Pinout

Nokia 3310 LCD Pinout

Source Code

3310_routines.c 3310_routines.h CC Darminitech’s Nokia 3310 LCD Library modified to support a local pixel buffer cache for individual pixel access.
avr-spiceduino-3310-drawing.tar.gz Entire source code and firmware and pgmtoheader program -
pgmtoheader.c Quickly hacked program to read in a 84×56 8-bits per pixel .pgm file and spit out a splash.h file for inclusion to an AVR project to display images.

Steps for making splash screens (included as header files) with pgmtoheader.c:

  • open a file that you want to display on your Nokia 3310 (black and white graphics are best) in GIMP or Photoshop
  • resize to a height of 56
  • use the thresholding tool to find a good value to use as the point between black and white.  You probably will have to slide it back and forth until you get a good image.
  • stretch/resize to 84×56
  • save as .pgm (raw not ascii)
  • open a hexeditor (I use khexedit) and hack off the header portion (or modify the code to skip over it)
  • compile pgmtoheader with ‘gcc -o pgmtoheader pgmtoheader.c’
  • run the pgmtoheader program on it with ‘./pgmtoheader /path/to/file.pgm > splash.h’
  • you can now #include “splash.h” in the 3310_routines.c and call LCD_drawSplash() to display it.

mike AVR Projects , , , , ,

  1. No comments yet.
  1. March 19th, 2010 at 00:08 | #1
  2. April 20th, 2010 at 14:26 | #2
You must be logged in to post a comment.