My Projects‎ > ‎

TinyMatrix


This project started in an unlikely place, DEFCON 21. My girl and I attended DEFCON this year because we find it interesting and because we have lots of friends that go. While we were hanging out in the hardware hacking room, we saw someone soldering together a LED display project and asked where he got it. Turns out Makertronic was selling several DIY solder kits, including what they call the LED Matrix Pendant Kit. My girl wanted to try her hand at soldering (yup she is a very cool girl, even geeky at times!). So we forked over $15 and off we went. About an hour later we connected the battery, only to find out that I instructed her to solder the display on backwards. Dammit. No biggie, 5min later I had it desoldered and resoldered on the right way. It was awesome and so I decided I needed to have one also. 

Fast forward to the next week ... there I was soldering my kit together in my lab at work, and thinking how cool this project would be for my Intro to Electrical Engineering students. So I set out to figure it out. A lengthy Google search finally revealed what I assume is the original project page, TinyMatrix, complete with parts list, how-to and source code. 

Step 1: Getting the parts
Here is a list of the parts I used in this project
  • Attiny4313-PU - Digikey p/n: ATTINY4313-PU-ND 
  • LTP747C-01 - 5x7 LED matrix display (several colors available, C is red) - Jameco p/n: 2005420
  • Coin cell holder - Digikey p/n: 952-1737-1-ND
  • Pushbutton SPST-NO switch - Digikey p/n: P8080SCT-ND
  • 100K resistor
  • CR2032 battery
  • Wire - 18 AWG, a very flexible type
You will need a way to program the Attiny4313 microprocessors. Some people might already have something but I did not, so I picked up an Arduino Uno kit that came with wires and a small breadboard.

Step 2: Programming the Attiny4313
I am new to both Atmel processors and Arduino boards. I started out by using Google to find a few how-tos and then I spent several hours tinkering with it to finally get it to work. I had hell trying to get the Arduino to recognise the Attiny. It's often the small things that stop us in our tracks.

Okay now on to programming, first setting up the Arduino Uno
  1. Install the Arduino software on your computer. Simply download it from the Arduino site and install it.
  2. Install the AVR compiler. In Ubuntu "sudo apt-get install gcc-avr binutils-avr gdb-avr avr-libc avrdude". For windows install WinAVR.
  3. Plug in the Uno and figure out what port it is on. Dmesg for Ubuntu, device manager in Windows. Mine shows up on "/dev/ttyACM0".
  4. Start Arduino Sketch. Setup: Board = Arduino Uno, Serial Port = your port, Programmer = AVR ISP.
  5. Go to File -> Examples and choose ArduinoISP
  6. Click Verify and then Upload.
Now the Arduino is ready to program the Attiny. Time to wire it up. If you are like me and you bought the kit with the wires and breadboard, you are ready to go. If not, you will need a method of connecting the Attiny to the Arduino. Below are the pin connections needed for connecting an Arduino Uno R3 to a Attiny4313 (Uno port -> Attiny pin):
  • Port 5V -> Pin 20 (VCC)
  • Port GND -> Pin 10 (GND)
  • Port 13 (SCK) -> Pin 19 (SCK)
  • Port 12 (MISO) -> Pin 18 (MISO)
  • Port 11 (MOSI) -> Pin 17 (MOSI)
  • Port 10 (SS) -> Pin 1 (RESET)
   

It is time to get/create a hex file to upload to the Attiny. You can download one or compile your own. Without going into much detail, here is now to compile "program.c" in Ubuntu:
  • avr-gcc -Wall -Os -DF_CPU=4000000 -mmcu=attiny4313 -c program.c
  • avr-gcc -g -mmcu=attiny4313 -o program.elf program.o
  • avr-objcopy -j .text -j .data -O ihex program.elf program.hex
Once I had a viable hex file to upload, this is the command I used to do it:
  • avrdude -P /dev/ttyACM0 -b 19200 -c avrisp -p attiny4313 -u -U flash:w:"program.hex":
Step 3: Assembly

more to come ...

ċ
TinyMatrix.c
(24k)
Chris Pauli,
Nov 21, 2013, 12:10 PM