The project was built using a Atmega328pu, and Nokia 5110 LCd display on a Sparkfun dev board.
The board is custom-made (see attached Eagle CAD and images), but the project will function on a Arduino with the same microcontroller. The microcontroller is programmed with a USBTiny.
The software was written in assembly with Atmel Studio 7- initial versions written in C were far too large.
Character Development and Compression
The font was designed using our own Small Font Designer, producing variable-width characters 8 pixels tall.
Since each character is 8 pixels tall, each will fit evenly into bytes. The characters are packed to indicate their width, and each active pixel.
A => 5 wide, bytes: 0114a74620 width | data | data | data | data | data 0x05, 0x01, 0x14, 0xa7, 0x46, 0x20 These bytes expand to: . . . . . . . X . . . X . X . . X . X . . X X X . X . . . X X . . . X . . . . . Which kinda looks like an 'A'.
Messages are written to the display buffer letter-by-letter. The current character is loaded found in the program (slowly looping to save space), decompressed to individual pixels in 64-byte buffer, and written to the LCD display buffer.
After loading the message, the display buffer is written to the LCD via SPI.
Messages are received with the UART at 9600bps. A newline character 0x0A prints the message and resets the buffer. Additional newlines will be inserted by the program during word wrapping.
This example receives messages over Bluetooth, but the source could be anything.
The final program size was determined by pulling the program from flash and checking the bytes.
This is included in "program_map.txt".
|Full Application||930 bytes|
|Compressed Font||383 bytes|
|Code (decompression, LCD driver, UART, etc)||547 bytes|