Monday, May 14, 2012

LED Matrices

       My first semester sophomore year I decided to buy an arduino microcontroller so I could play around with it and learn how to use it. In order to teach myself the basics of the arduino language and microcontroller I gave myself a project and started googling everything I could about it. I wanted to change the color of an RGB LED depending on the music coming out of my iPhone. I used an audio jack and its breakout board that I stole borrowed from 2.s994 (Electronics for Mechanical Engineers). I connected two of these audio jacks so I could listen to my iPhone's music while the arduino sensed it. Before I got my hands on an RGB led I tried to "make" my own RGB LED by sticking a blue, red, and green LED inside a ping pong ball. The ping pong ball would diffuse the different lights from the three LED's.  This way I could use PWM to display other colors besides red, green, and blue. Sadly, I don't think I have any pictures of this project since my computer was stolen when I went back home for Christmas break. It was stolen within the first three hours I got home :/ but that's a story for another day.

       Throughout that semester I kept nagging my curly-haired Salvadorean roommate Roberto Melendez to help me make an LED matrix. He's a meche but (unlike most meche's) he knows a lot about electrical engineering. The Sunday after the first week of classes I was really bored (I didn't want to start my homework) so I (once again) asked him to help me make an LED matrix. He must have been having a bad day because he yelled at me, "just do it yourself!" So I did. Thanks Roberto!

Ghetto-engineering ftw!
      The first thing I had to do was to find a suitable frame for the LED's. I was going to use cardboard at first but I decided it was too frail so instead, I got a hammer and broke open an old speaker we had in our room. I drilled twenty-five holes (mainly because something larger than a 5x5 would end up being way too much soldering) that had a slightly smaller diameter than the LED's diameter. The most time-consuming part of this project was soldering the LED's together. To do this I completely stripped off some 5'' jumper wires and connected the LEDs' cathodes in rows and the anodes in columns. This way I could control each LED independently. For example, if I wanted to light up the center LED I would supply 5 volts on the third cathode and ground the third row, thereby lighting up the (3,3) LED. Problems arose when I tried to light up the 3x3 central square without the center square. In other words, the (2,2), (2,3), (2,4), (3,2), (3,4), (4,2), (4,3), and (4,4) LED's.
Arduino Uno
       To bypass this problem I took advantage of the persistence of vision phenomenon. I used an arduino to light up one row at a time very quickly. It "waves" through the five columns so quickly that the human eye can't notice it and it appears to be one 5x5 image.

matrix displaying TDC
     Now that I had a working prototype I wanted to build something better. Mainly bigger and prettier. So the week before Science Extravaganza, a statewide educational outreach event that MAES hosts here at MIT, I decided to make a new LED matrix. The architecture lab had given the MAES exec-board temporary access to their laser cutters so that we could laser cut 200 "Aurora Domealis" for the middle-school students coming to Science Extavaganza. Credit for this LED boxes goes to Adrian Tanner; I made very minor changes to his design and added the eagle on the front.
Aurora Domealis
I'll probably write a post about Science Extravaganza later on, but the point of this was that I had one week left before I got my laser-cutter access taken away, so I HAD to taken advantage of this and laser cut something cool. I had also recently learned about t-bolt slots and how useful they are. Both Charles and Candace used them in their 2.007 robot designs, so I thought this would be a good use of the laser cutter.

laser cutted frame
First, I designed the LED matrix frame in solidWorks. I made the top have 64 holes that have diameters that are 1mm less than the LEDs' diameters. One of the sides have two holes so I can connect the arduino to my computer and/or a power supply without unscrewing the hole frame. I was going to add a mount and some holes to screw the arduino on the frame but my laser cutter access could be taken away any day so I decided not to. 

LED matrix soldered, time to start coding
 I learned several things from making the 5x5 prototype, but the biggest thing I learned was that I needed to figure out an easier way of soldering the LED's together. On the 5x5 I used stripped jumper wires and soldered all the rows close to the frame and all the columns in the air on top of the rows. Soldering the jumper wires in the air made it really annoying and it took me several hours to finish soldering everything together. That was 25 LED's connected directly to the jumper wires. There are two connections per LED which means I had to solder 50 connections. On the 8x8 I'm soldering a resistor to each LED so that means 3 connections per LED making a total of 192 connections. There was no way I was ever going to finish if I tried using jumper wires again to solder all of those LED's. Instead I bought copper tape online and then used electrical tape to insulate the intersections between the rows and the columns. Soldering all the connections still took a really long time but it is nowhere near what it would have taken me to solder all LED's using jumper wires.
Working on the matrix while drinking on the second deck of TDC
Hi Haley :)
Now that the frame was done I just needed to worry about coding the matrix. I couldn't use the same code I used for the 5x5 matrix because the arduino doesn't have enough pins to power every column and row. To get around this I needed shift registers. Perfect excuse to read and teach myself how to use this integrated circuits (IC's). I used two 74HC595 chips which, if connected in series, will take up three pins on the arduino, but allow me to control 16 LED's or in this case, 16 rows and columns of LED's. If you want to learn how to use shift registers I highly recommend that you read this tutorial on the Arduino website. Anyway, it's almost 7am and I should probably start studying for my finals....
It works!



2 comments: