1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Planning Arduino LED matrix (Suggestions needed)

Discussion in 'Modding' started by tyrandan, 16 Apr 2010.

  1. tyrandan

    tyrandan Pink Lemonade.

    Joined:
    2 Mar 2009
    Posts:
    194
    Likes Received:
    15
    Okay guys a short introduction:

    I'm a noob when it comes to microcontrollers. In fact, this is my first ever microcontroller project! I've had experience with electronics, computers (mostly computers) and programming (python, very little C++) before, but I am nowhere near the expertise that I want and need. I am planning a case modding project right now, but it's on an indefinite hiatus. So in the meanwhile, I thought I would practice and learn some skills.

    This is going to be kind of a mood light for my girlfriend. Currently I have 99 LEDs:
    33 red
    17 green
    33 blue and
    16 amber (these are for a different project probably, but if you think I should incorporate these...)

    Now, here is my plan so far:

    I am going to put 5 each of the Red, Green and Blue in kind of a staggered matrix, 5x3. Each row will be one color of course, and each row will be controlled independently from an output pin of an arduino. Now, as far as operation goes, I want to be able to dim each row independently from 0-100% brightness (So, probably 0-30 mA?) to make a variety of colors, and a program on the Arduino to control the cycling of colors. Now I know the Arduino probably doesn't supply enough power from its output pins so I thought about using transistors to provide enough current to each group of LEDs (I planned to use one transistor for each color, or each group of five LEDs). However, I need to be able to dim each LED group, so can I do that using transistors? A friend of mine mentioned something about Shift Registers or something, but I don't have much experience with ICs. However, if it is needed, then I will use it because I am willing to learn and get my hands dirty. This is, after all, a project designed for me to learn.

    So, the suggestion part:
    First, the Arduino. I know Arduino has it's naysayers as well as its fans. I also know that the Arduino just might be a little overkill for this simple project. However, I plan to use an arduino board for one of several reasons: I think this will be a great way to apply my programming skills, as well as learn about the Arduino platform and microcontrollers in general. So, I'm sticking with Arduino. But, what type should I use? Initially I thought about using the Duemilanove, but if you have another (better) suggestion, please let me know!

    Second, the LED array. Are transistors a good idea and if so, could I use them to dim the LEDs? I don't have experience in this area (Again, the reason for this project...) but I know that this community contains plenty of experienced people in this area, so again, if you have any good alternatives (What about MOSFETs? And yes, I know they are transistors too, But I planned to use amplifying transistors...) PLEASE let me know. This is a learning project for me, so any and all thoughts and suggestions you might have on this would be very very much appreciated.

    -Tyrandan

    A footnote: Has anyone ever heard of buy-leds-online.com? Great site, got the red leds for 5 cents each, and the others were similarly cheap.
     
  2. capnPedro

    capnPedro Hacker. Maker. Engineer.

    Joined:
    11 Apr 2007
    Posts:
    4,381
    Likes Received:
    241
    Any Arduino will be fine, although the Mega is way way way overkill, but will allow for future projects. A Freeduino might be cheaper. I prfer Ladyada's Boarduino, because I do a lot of work on breadboards.

    Transistors. Yes. You're very much on the right track here. Read this. I'll explain anything you don't understand.

    As for dimming, look into pulse width modulation (PWM). Read this. Standard Arduinos have 6 PWM digital I/O pins (3,5,6,9,10 & 11) so you don't need a shift register as you want three channels (R, G & B). If you wanted each LED addressable, you could use shift registers or charlieplexing/multiplexing, but we won't go there yet.

    Don't forget your current limiting series resistors on your LEDs.
     
  3. tyrandan

    tyrandan Pink Lemonade.

    Joined:
    2 Mar 2009
    Posts:
    194
    Likes Received:
    15
    Thanks for the transistors link, it certainly cleared some things up.

    Pulse width modulation is a great idea! I do know the principle behind it, but I don't know why I didn't think of it before. And this tutorial will certainly help with using PWM on the Arduino.

    Yes, I didn't think of the Freeduino either for some reason. Quick google search found me a Duemilanove-compatible Freeduino board for 2/3 the price. However, it's not final and I will definitely take a look at Boarduino before making a final decision.

    Thanks for the helpful suggestions :D
     
  4. Moriquendi

    Moriquendi Bit Tech Biker

    Joined:
    3 Nov 2005
    Posts:
    1,691
    Likes Received:
    58
    Looks like you're well on your way so I'll stick my oar in and see if I can't confuse the issue.

    You can amplify with a Mosfet just as well as a BJT (Bipolar Junction Transistor), a Mosfet works as a voltage controlled resister where the resistance between drain and source is inversely proportional to the gate voltage (as gate voltage goes up resistance goes down). This is one way of using a Mosfet. The other way is to use it in digital mode where the resistance is either very high (tens or meg-Ohms or greater) or very low (less than 1 Ohm).

    I would suggest that you use Mosfets as the drivers for your LEDs with the Mosfets in turn switched by the Arduinos PWM outputs. The advantage of this is that a Mosfet in digital mode can be treated very much like a switch, it's either on or off and you don't have to mess around with biasing.

    Moriquendi
     
  5. tyrandan

    tyrandan Pink Lemonade.

    Joined:
    2 Mar 2009
    Posts:
    194
    Likes Received:
    15
    Hmm, interesting.

    I will consider it, they both seem to be good methods to use. I guess when it comes down to it I will probably use low-cost and simplicity.


    On another note, I will not be ordering the duemilanove (Did you know that means 2009?) until next monday. Until then, i'm waiting for some more stuff to arrive for this. So right now it's kind of creeping by.

    Also, does anyone know any good (free) circuit design software?
     
  6. capnPedro

    capnPedro Hacker. Maker. Engineer.

    Joined:
    11 Apr 2007
    Posts:
    4,381
    Likes Received:
    241
    Eagle is the defacto go to software, for making schematics (for free). Sparkfun did a fairly good tutorial for getting started.

    There was a piece of software aimed at Arduino users that did actual simulation of the running circuit, but I can't remember the name of it right now.

    Edit: It could have been Fritzing that I was thinking of.
     
    Last edited: 17 Apr 2010
  7. Moriquendi

    Moriquendi Bit Tech Biker

    Joined:
    3 Nov 2005
    Posts:
    1,691
    Likes Received:
    58
    I use eagle, it's a great program and very powerful but it can be a bit... irritating to use as it doesn't conform to the standard windows shortcut pattern. It is well worth getting to know it though, if you have any problems give me a shout and I'll see if I can walk you through it.

    Moriquendi
     
  8. tyrandan

    tyrandan Pink Lemonade.

    Joined:
    2 Mar 2009
    Posts:
    194
    Likes Received:
    15
    @capnPedro: Fritzing is pretty good, thanks for the suggestion!

    Checking in: I'm ordering the Arduino today, I did end up going with a regular Duemilanove. I've been messing around in fritzing, once I have everything figured out, I will visit the local Radioshack and stock up. All I need is resistors and some transistors, however I do have a quick question: How much amps is the Arduino PWM pins able to supply? I'm indecisive about powering the LEDs, but I cannot find anywhere how much current the PWM pins supply (individually and together). As soon as I figure this out I'll know what type of transistors i'll need (or even if I need them at all).
     
  9. capnPedro

    capnPedro Hacker. Maker. Engineer.

    Joined:
    11 Apr 2007
    Posts:
    4,381
    Likes Received:
    241
    http://arduino.cc/en/Main/ArduinoBoardDuemilanove

    40mA*. That's pretty standard for a uC. Anytime you're thinking of switching more than one LED, there should be a simple transistor circuit to handle the current.

    * Source. If memory serves, the ATmegas can sink a little more than they can source. 50mA or thereabouts.
     
  10. Moriquendi

    Moriquendi Bit Tech Biker

    Joined:
    3 Nov 2005
    Posts:
    1,691
    Likes Received:
    58
    You will probably find that there's a limit on the PWM port that's means you cant have all the pins sourcing 40mA at the same time. I know that with the PIC (the uC I'm most familiar with) the maximum for a port is 125mA for an 8 pin port where each pin can source 25mA. Your best bet would be to use a Mosfet which would mean that the current sourced by the PWM pin is almost non-existant.

    Moriquendi
     

Share This Page