Shop OBEX P1 Docs P2 Docs Learn Events
Please help! Bicolor LEDs and MAX7219 — Parallax Forums

Please help! Bicolor LEDs and MAX7219

bytor95bytor95 Posts: 53
edited 2007-07-27 17:11 in BASIC Stamp
Hi,

This one is killing me and I can't figure out what it is for weeks now.

I'm using the Max7219 LED driver trying to get bicolor LEDS to display red or green. I can't for the life of me figure out what I'm doing wrong but I can't make the driver change the color state. I did have success with using a bicolor 8x8 matrix though with the MAX7219. Actually, it worked so well I thought it would be simple to change over to discreet LED's. Has anyone been successful doing what I'm trying to do?

Here is one of the LED's I tried. I tried many others too: http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=230143471065

Thanks in advance,

Engin

Comments

  • Megaman935Megaman935 Posts: 19
    edited 2007-07-21 00:59
    Let's start with the basics.
    Bi color LED's are pretty simple when you get down to it: one lead from it is the ground, but there are three. power one of the others and viola one color. but what if you want another color too? That's right, power down that one and power the other one. this should help you:
    ConnectLEDtoMicrocontroller.jpg

    A quick example:

    BiLED:
    High 1                         'powers one color
    pause 2000
    Low 1
    pause 250
    High 2                          'powers the other
    pause 2000
    Low 2
    pause 500
    GOTO BiLED
    
    



    and that should work.
    smilewinkgrin.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Mega
    Want to know how to build your own robot?
    www.societyofrobots.com
    Need good forums for things other than programming?
    http://www.societyofrobots.com/robotforum/index.php

    Post Edited (Megaman935) : 7/23/2007 3:29:31 PM GMT
  • Philip GamblinPhilip Gamblin Posts: 202
    edited 2007-07-21 15:32
    If you power both, do you get a third color or will it damange the part?
  • Mike GreenMike Green Posts: 23,101
    edited 2007-07-21 15:39
    Yes, if you power both, you will get a third color ... sort of a yellowish. You shouldn't damage the part, although there is a maximum power dissipation and maximum current allowed and you could theoretically exceed these by driving each LED within its rating, but with the overall maximum exceeded.
  • Megaman935Megaman935 Posts: 19
    edited 2007-07-21 15:47
    You could also program the microcontroller so that when your battery power is at x, it powers down one and turns on another- and when it gets really low, you could have it power both. this is a good way to show status on a robot. roll.gif

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Mega
    Want to know how to build your own robot?
    www.societyofrobots.com
    Need good forums for things other than programming?
    http://www.societyofrobots.com/robotforum/index.php

    Post Edited (Megaman935) : 7/23/2007 3:29:40 PM GMT
  • bytor95bytor95 Posts: 53
    edited 2007-07-21 15:58
    Thanks for the replies. I can get the LED to display all three colors using the wiring diagram shown as well as using the basic stamp. It's when I use the MAX7219 that I'm having problems. I am hooking digit zero of the max7219 to green, digit one to red. I am then giving it (+) via segment A. When I turn on digit zero and not digit one, I get green. But when I reverse them, I get green as well. It's as if there is leakage or something from one anode to the other. I know I'm not explaining it properly but I had no problems hooking up to a seemingly more complex bicolor 8x8 led matrix. But for some reason, with discreet LED's I'm having problems.

    Engin
  • bytor95bytor95 Posts: 53
    edited 2007-07-23 20:20
    Man I tried to figure out what I'm doing wrong and got nowhere this weekend. Any help would be appreciated.

    Engin
  • bytor95bytor95 Posts: 53
    edited 2007-07-23 20:45
    I just put a volt meter to measure the voltage across SEGA and DIG0. I noticed that the voltage between the two pins changes from +4.4 when DIG0 is on to +3.8 when DIG0 is off. In other words it doesn't go from +4.4 to 0. Does anyone have any idea why that would be?

    Engin
  • Megaman935Megaman935 Posts: 19
    edited 2007-07-23 21:14
    bytor95 said...
    Thanks for the replies. I can get the LED to display all three colors using the wiring diagram shown as well as using the basic stamp. It's when I use the MAX7219 that I'm having problems.
    Why do you really need the MAX? I've never used a LED dirver before, so I can't help you with problems that occur with it. I will help if I can though.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Mega
    Want to know how to build your own robot?
    www.societyofrobots.com
    Need good forums for things other than programming?
    http://www.societyofrobots.com/robotforum/index.php
  • bytor95bytor95 Posts: 53
    edited 2007-07-23 21:18
    Megaman,

    I need the max because I'm trying to drive 32 bicolor LEDS. Thanks.

    Engin
  • ZootZoot Posts: 2,227
    edited 2007-07-24 23:14
    Rather than hooking each color of the LED up to different DIGITS on the MAX, try using the same digit but different SEGMENTS for each color, e.g.

    Red lead --> digit 0, segment A
    Green lead --> digit 0, segment B

    Then, writing the following to digit 0 should give you these colors:

    %00000000 --> off
    %00000001 --> red
    %00000010 --> green
    %00000011 --> yellowish

    This also gives you the start of schema for driving all 32 LEDs... with each pair of segments (A-B, C-D, etc) being an LED. After each 4 LEDs you'd need to work with the next digit.

    Does this help?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
  • kingspudkingspud Posts: 128
    edited 2007-07-25 00:40
    Hello Engin,

    Well I hope this helps...

    I have been doing some testing with the MAX7219 on my own project and what I found was if you get a two lead bi-color LED and connect the digit lead to one end and a segment lead to the other you can switch between the two colors without any problem.

    The LED I used was a LINROSE B4301H1/5 LI

    T1 3/4-2 LEAD- RED/GREEN LED w/ clear lens cap clip.

    I got it at Fry's.

    Joe

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    “Intellectual growth should commence at birth and cease only at death”
    Albert Einstein

    Post Edited (kingspud) : 7/25/2007 12:45:25 AM GMT
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-07-25 01:32
    Bytor95,

    If you have an 8x8 LED matrix then you have 2 color sets (or really 3) of 64 LEDs not 32.

    You may have seen·that I have built a tri colored clock with an SX52 (or SX48 is possible) and 4 of these 8x8 displays. Check out the Youtube video in this link:

    http://forums.parallax.com/showthread.php?p=649643

    It's been running for weeks now with no problem switching between the green, red (and yellow combination)·LEDs.

    If you see the·3rd drawing it shows that I am using·74HC573's to control the LED colors.·It should be easily adapted for your needs with the BS2, MAX7219s and LED Matrixs. The outputs of the MAX7219 chips·can go into the inputs of the 74HC573's and then the·2 /OE lines can be controlled with 2 lines·of the BS2 to set the conditions (00,01,10,11) that Zoot stated. ·You should not need ULN2803's on the outputs of the 74HC573's either (connect directly to the LED Matrix). You do not need 4 74HC573's either. My SX52 controlled 4 8x8 LED Matrixs (16x16).



    Although I have not been able to figure out how to use an SX chip with a MAX7219 yet, I have been able to cascade 2 or more together using a Basic Stamp 2 (as you know).

    http://forums.parallax.com/showthread.php?p=636061

    I am using the 8x8 LED matrixes here as seen in the pictures.



    I will try to put it together over the next couple days and post some pics and schematics if you like.

    I love how you can learn something and then apply it to your future projects!

    Post Edited (T&E Engineer) : 7/25/2007 10:13:40 AM GMT
  • bytor95bytor95 Posts: 53
    edited 2007-07-25 17:16
    Wow,

    Thanks for all the amazing replies. You guys got me thinking in many different directions.

    I found out what I'm doing wrong. I bought these LED's

    http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&item=230143471065

    Notice that it says "common cathode". So I figured that hooking up that common lead to the segment leads of the MAX7219 would do the trick. The two other leads, red and green, of the LED I thought would go to DIG0 and DIG1.

    This is how I had hooked up my 8x8 bicolor LED matrix.

    I got the LED's to work by hooking up DIG0 to the common lead of the LED and hooked up SEGA to green and SEGB to red. Works perfectly.

    My question is why does it work opposite to the 8x8 matrix. Both of them are labeled (common cathode).

    Thanks in advance,


    Engin
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-07-26 01:16
    Well my theory worked. I was able to wire up 2 74HC573 ICs to a MAX7219 and a Bi-Colored 8x8 LED Matrix and a BS2.

    I use the standard P0-P2 for the MAX7219 and P3 and P4 to control the /OE lines on each of the 74HC573 ICs. The inputs on both of the 74HC573 ICs are tied together and run back to the MAX7219. The 8 outputs of the 1st 74HC573 go to the 8 Red LED Matrix cathode lines and the 8 outputs of the 2nd 74HC573 go to the 8 Green LED Matrix cathode lines. Both LE lines are tied high and of course don't forget about Vcc and Ground on the 74HC573 ICs.

    I have attached my BS2·code which is modified from Jon Williams Nuts and Volts #70 program on the MAX7219.

    The code first flashes on the letters B then S then 2. It then scrolls across the letters P a r a l l a x·· B S 2. This happens 3 times.

    But here is the catch...

    It first time the letters are in RED, 2nd in Green and last time in Yellow. It then repeats itself.

    It also doesn't look hard to create individual colored letters if first set up in the code.

    If anyone is interested any further, I will come up with a full schematic and pictures or YouTube video. Otherwise...here is my contribution to the problem.
  • bytor95bytor95 Posts: 53
    edited 2007-07-27 14:30
    Thanks man. That gives me new ideas. How would you ever get the LED's to individually light up different colors though?


    Engin
  • TechnoRobboTechnoRobbo Posts: 323
    edited 2007-07-27 15:13
    And thats how it should work Common cathode to DIG pins.

    Here's a quote from maxim


    Eight-Digit Drive Lines that sink current from the display common cathode. The MAX7219 pulls
    the digit outputs to V+ when turned off. The MAX7221’s digit drivers are high-impedance when

    attachment.php?attachmentid=48411

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Have Fun


    TR
    806 x 62 - 41K
    LED.JPG 41.1K
  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2007-07-27 17:11
    If the 74HC573 ICs are placed inline between the MAX7219 IC and the 8x8 LED Matrix (8 red cathodes for 1 74HC573 and/or 8 green cathodes for the 2nd 74HC573 IC), then you would only be able to control an individual set of 8 LEDs because of the /OE line·on each 74HC573 IC. This means you only need 2 additional BS2 output pins for 2 sets of 8 LEDs (red and/or green).

    However, if you wanted individual control of every LED in hardware control (not sure how to do it within the MAX7219 if at all possible), you would need to be using ICs with 8 individual /OE lines or latch lines. This would require·much more I/O lines available for use on the BS2. You would first need the original 3 for control (DIN, CLK, LOAD) from the MAX7219 into the BS2 (P0-P2). Then you would need at least 8 (possibly 16) more output lines on the BS2 for /OE control of each LED. I don't know what this IC number would be for individual /OE control of each input. Most if not all of the latch chips I know of are 3 state and you would need 8 control lines for the 8 lines of data passing through.

    I suppose a (8) 2 input AND gates·might work too like 74HC08 ICs. Since they come 4 AND gates to an IC·you would need 2·ICs for 8 pass through lines and the 2nd input line to each AND gate could be sent high or low to control the data being passed through the AND gate.


    However, in my design via simple code writing you could lets say make the first letter scrolling "green" and then the next letter "red" and so on using some IF THEN statements to control the color /OE lines.

    Let me know if you would like me to create an schematics / pics if interested.
Sign In or Register to comment.