Introduction: Arduino Random Letter Generator

Welcome to my first instructable. This little device displays, upon pressing a button, a randomly generated capital letter on a 5x7 LED dot matrix using an Arduino board.

I built this for my kids for playing a game which is called "Stadt-Land-Fluss" ("city-country-river") here in Germany. A letter is selected randomly and then everybody has to say or write down a city, a country, a river, etc. that starts with that particular letter.

In order to keep the parts count low, I decided against using a shift register for interfacing with the LED matrix. I also did not use any transistors for driving the LEDs. The only external parts besides the LED matrix are current limiting resistors of 470 Ohm value.

It seems that directly driving an LED matrix with the Arduino pins is not the orthodox approach but my Arduino hasn't complained yet.

I am a beginner in the field of Arduino programming. With respect to the LED matrix, it is multiplexed in a standard way. The problem I had to overcome was how to translate a bit pattern from a font matrix into addressing the individual output pins. The way I solved it was using bit math operations to select individual bits for addressing the respective output pins. My source for this is here: http://www.arduino.cc/playground/Code/BitMath#quickref

The pin mapping with the Kingbright TC07-11EWA 5x7 LED matrix is:

Arduino pin/LED matrix pin (470 Ohm resistor between each Arduino pin 0-6 and its corresponding LED matrix pin)
0/6 (Row 7)
1/5 (Row 6)
2/4 (Row 5)
3/9 (Row 4)
4/2 (Row 3)
5/11 (Row 2)
6/12 (Row 1)

8/1 (Column 1)
9/3 (Column 2)
10/10 (Column 3)
11/7 (Column 4)
12/8 (Column 5)

Arduino pin 7 is the input pin for the button. Using the other available pin 13 somehow didn't work out for me.

I hope the attached code is self-explanatory. The next revision of the design is to fit everything into an Attiny 2313 microcontroller which has only 2 KB of memory. Preliminary results using direct port manipulation instead of digitalWrite and storing the font matrix in PROGMEM have shown to be promising.

Enjoy!

Anomalocaris