7 Segment problem... what am I doing wrong?

I've got a weird problem with my new 7 Segment LED displays... I hooked one up to a 7219.. nothing. I tried running both 3.3 and 5V off the arduino both through a 330ohm resistor, then directly (only briefly), only the decimal point lights up! This is a common cathode display, I've got the pin 1 (CC) to ground, and I tried putting voltage on to all the anodes seperately, but only the DP lights up with voltage supplied. This is the same for all six digits I ordered! Here's the data sheet... any ideas what I'm doing wrong?

http://www.jameco.com/Jameco/Products/ProdDS/97201.PDF

Thanks

Hi, I had a look at the datasheet and it looks like there are 4 Leds in series for each segment. The forward voltage of ~2.0V given in the table on page 2 seems to be the on for a single led only.

So that would explain A) why the segments do not light up : They need an inputvoltage of >8V because there are 4 leds (4*2.0V) B) why the DP lights up. There are only 2 Leds on this one so it needs only 2.2.0V=4V on the input.

To test this use your 330ohm resistor in series with a single segment input and apply 9V from a battery. The segments should now light up with the higher input voltage.

The bad news is : you can't use the 7219 to drive your 7-Segment displays, because it works only with 5V power-supplies.

Eberhard

Darn! Oh well, you live you learn. It doesn't look like maxim makes anything like the 7210 for higher voltages... They do offer a solution:

http://www.maxim-ic.com/appnotes.cfm/appnote_number/1196/CMP/BTDT

But it looks like I would need 8 or so transistors per digit?

Could I use something like this? A darlington array on a chip, I believe.

http://www.sparkfun.com/commerce/present.php?p=GPSClock-6

Although it looks like this would be common anode, and my digits are common cathode. Is there a way to use a transistor array or something else to make this run off a 7219? I so do love how it works with my arduino... Maybe something like this?

http://www.allegromicro.com/en/Products/Part_Numbers/2981/2981.pdf

Or perhaps a NPN array like the Sparkfun clock, but with common anode digits instead? I've never used transistors before, so any insight would be much appreciated. Thanks! ;D

Darn! Oh well, you live you learn. It doesn’t look like maxim makes anything like the 7210 for higher voltages…
They do offer a solution:

http://www.maxim-ic.com/appnotes.cfm/appnote_number/1196/CMP/BTDT

But it looks like I would need 8 or so transistors per digit?

If I read the app-note right you would need 2 Transistors for each of the pins labeled Dig0-Dig7 . So that would add up to 16 Transistors for all 8 decimal positions. Since you said you ordered 6 7-segment-displays you would need only 12 transistors.

Could I use something like this? A darlington array on a chip, I believe.
http://www.sparkfun.com/commerce/present.php?p=GPSClock-6

I’m not sure about this one. If you meant the ULN2803, No that won’t work.
But the counterpart of the ULN2803 referenced from your next link…

Maybe something like this?
http://www.allegromicro.com/en/Products/Part_Numbers/2981/2981.pdf

This is a really interesting piece of hardware! I ordered a few of them right away!
My guess is that it will work!
Anyway, thanks for pointing this one out. Might solve my problem of doing a PWM-RGB-Matrix with the Arduino.
I knew Allegro build Soucre-Drivers with integrated shift-registers, but this one I didn’t knew about.
Eberhard

Interesting... so, if I read that right, I would put this source driver after my 7219, with each segment out going to a pin on this chip, and supply around 8 volts to the Vs pin. Now, the 7219 can't sink 8V, so what would I do with the common cathode? Some sort of NPN transistor? One of Allegro's sink drivers? Or should I just throw out the 7219 and go with one of their shift registers?

Thanks

Hi, I must confess I missed the part where the application-notes mentions that you need common-anode displays for this. I will think about this a bit and report back when I'm sure I understand how this is going to work.

But here is another idea for your problem: Someone put this here on the playground: http://www.arduino.cc/playground/Main/DirectDriveLEDMatrix First think that strikes the onlooker :there should be some resitors in series with the Leds.

But you would build it a bit different anyway : You would use a 2981 to drive the segments of your 7-seg-displays. The common-cathode pins of the displays would be connected to a ULN2803 that switches (software-driven) between the digits of the display (i.e. multiplexing the array).

You would need a Led-driving voltage of at least 12V (I recommend 15V, or the use of a variable voltage regulator lm317 for experimenting). 8 volts will "eaten" by your leds (take care of the DP which only burns 4V!), and both the 2891 and 2803 will take away another 1.6V when driven.And then there is the current-limiting resistor which reduce the voltage even more.

If you want to try a shift resistor-solution here is an application-note to build a led-array with shift-registers that already have a driver stage: http://www.codemercs.de/Downloads/AN1.pdf

The app-note was written for some other device, but the hardware from figures 1-3 should work with the arduino (+software of course). Warning : The schematic in figure 4 of the app-note does not work, because of timing problems!

Eberhard

Wow, this is getting pretty crazy.

You would use a 2981 to drive the segments of your 7-seg-displays. The common-cathode pins of the displays would be connected to a ULN2803 that switches (software-driven) between the digits of the display (i.e. multiplexing the array).

Interesting... I might run into a problem with direct driving from the arduino, as I also have an Xport and RTC to take care of (for the other half of the clock). Please correct my if I'm wrong, but isn't this method (segment outputs, digit outputs, multiplexing, etc.) exactly what a 7219 does? And at the same voltage level? So, hypothetically, could I use the 2981 to drive the segments from the segment outputs of the 7219 (rather than the arduino pins) and drive the common cathodes with the ULN2803 from the 7219 digit outputs (as opposed to the arduino pins)?

This would be a rather amazing solution if it works. Do you see any reason why it can't? Voltage or timing issues?

Also,

(take care of the DP which only burns 4V!)

I assume you mean use some sort of resistor to drop the voltage so I won't burn it? I don't think I'll be using the DP at all, just curious.

Thanks!

Wow, this is getting pretty crazy.

You would use a 2981 to drive the segments of your 7-seg-displays. The common-cathode pins of the displays would be connected to a ULN2803 that switches (software-driven) between the digits of the display (i.e. multiplexing the array).

Interesting... I might run into a problem with direct driving from the arduino, as I also have an Xport and RTC to take care of (for the other half of the clock).

Suppose you had a standalone-programmer, you could use a dedicated ATMega168 for driving those Leds and talk to it via IIC, (aka. TWI aka. the Wire-Lib) from your main sketch.

Please correct my if I'm wrong, but isn't this method (segment outputs, digit outputs, multiplexing, etc.) exactly what a 7219 does?

I don't know enough about the inner workings of the 7219 Led-Driver-Stage, but yes, you are probably doing the same, but at a lower price (in germany that would be 5,60 [ch8364] for a 7219 vs. 2.85[ch8364] for an ATMega 168 running on the internal oscillator).

And at the same voltage level?

That's what the 2981/2803 drivers are for : driving higher currents and higher voltages.

So, hypothetically, could I use the 2981 to drive the segments from the segment outputs of the 7219 (rather than the arduino pins) and drive the common cathodes with the ULN2803 from the 7219 digit outputs (as opposed to the arduino pins)?

This would be a rather amazing solution if it works. Do you see any reason why it can't? Voltage or timing issues?

I don't see any reason yet why it shouldn't work, but in my head its still tagged : experimental!

You're going to try this?

When my 2981 arrive I will try the ATMega+2981+2803 approach with a 4x4 PWM LedMatrix.

(take care of the DP which only burns 4V!)

I assume you mean use some sort of resistor to drop the voltage so I won't burn it? I don't think I'll be using the DP at all, just curious.

Yes. I have an extra "Ooops forgot the current-limit resistor, led-/transistor-/diode-burnout bin on my desk" Eberhard

Awesome, please let me know how the ATMega+2981+2803 approach works. I'm going to order a 2981 and 2803 and attempt to use them with the 7219. I got something like 4 or 5 of them for free as samples from maxim, and because I'm relatively new to programming, I really like the ease of the LED Control library, rather then manual multiplexing + getting another Atmega and programmer + figuring out the Wire library and inter-Arduino communications.

Thanks!

Well, I guess my idea didn't work. I wish I had an easy way to make a schematic on my computer. It went something like this:

7219 Segment Output (source) > Allegro 2982 > LED Anode 7219 Digit Output (sink) > ULN2803 > LED Common Cathode.

I was able to get things to light with various permutations, but then it started getting weird, I ended up with all the segments on, just pulsing between high and low brightness (when the software was attempting to light a 0 and 1 alternating at one second intervals)

I was able to get flashing DPs through the Allegro when the CC was sunk directly to ground, but I think I burned them out. I also tried transistors, PNP and NPN in every conceivable configuration - still nothing. I guess I can try the direct method, however that would mean I would need two arduinos talking to each other for my clock project... which would suck. Any luck on your end?

I wish I had an easy way to make a schematic on my computer...

I've been playing with Eagle a lot lately, http://www.cadsoft.de/freeware.htm , it's pretty nice for free, has some quirks, but a lot of PCB makers can use the eagle files. This is just a test circuit for a jumbo LED display driven by 10 arduino pins, I have no idea if it works, but it was done with eagle. The LEDs are Red @ about 1.85V apiece.

Hi,

It went something like this: 7219 Segment Output (source) > Allegro 2982 > LED Anode 7219 Digit Output (sink) > ULN2803 > LED Common Cathode.

I would would have done it be exactly like this. But you did use 8 resistors on the Allegro2982 outputs for limiting the current through the Leds? What was the supply-voltage for powering the Leds?

I was able to get things to light with various permutations, but then it started getting weird, I ended up with all the segments on, just pulsing between high and low brightness (when the software was attempting to light a 0 and 1 alternating at one second intervals)

Just thinking : I'm not sure what the happens on the 7219 Digit-outputs (2803-driver) when a row is selected :-? If the Digit-output is driven LOW for the selected digit, we would need an Inverter for the signals, because the 2803 inverts the signal again.

Say, if digit 2 is selected the state at the 7219 would be HHHHHLHH. But that would make the ULN2803 switch on the transistors on all but the digit2 column. With an inverter we would have LLLLLHLL on the 2803 inputs and only the current through digit 2 can pass through.

There is the LedControl-Library for the Arduino that has some commands to drive 7-Segment-Displays. You could use that for easier testing.

Any luck on your end?

I obviously made the mistake of ordering an uncommon I2C bus-extender alongside the 2891. So nothing arrived yet!

Eberhard

Hi, I would would have done it be exactly like this. But you did use 8 resistors on the Allegro2982 outputs for limiting the current through the Leds? What was the supply-voltage for powering the Leds?

I used a single resistor on the cathode end. I figured 6 resistors for the cathodes is better than 48 for the anode segments. Or will that not work? Supply voltage was 18V (two 9V in series) although I tried 9V and 12V as well.

I have a feeling you are correct in that the 7219 pulls the digit pins low to sink the current (as the digit pins are meant to connect to common cathodes). Please tell me if I'm not making sense, I'm still learning the terminology :P

I was indeed using the LedControl library to set the digits. That's the reason I wanted to keep the 7219, because setDigit is so much easier than learning shift registers. I also tried using different transistors in place of the 2803, and I also tried attaching the common cathode directly to ground, in the hope that the TTL output of the 7219 would drive the 2982 to drive the LED anode segment.

On first try it would not work with the output of the 7219, nor the 5V output of the Arduino. It DID work when +9V was applied directly to the input pin I was using on the 2982. I changed my Arduino from USB to External (9V) power, and only then did the 5V output of the Arduino board drive the 2982 to drive the segment under test.

I'm guessing the higher supply voltage brought the TTL level up to a full 5V, which was then sufficient to drive the 2982 from the 7219. Using setDigit and a delay, I was able to get a flashing decimal point. I believe this was with common cathode tied to ground (which I shared between the negative side of the 9V battery and the Arduino ground. I believe I was using 9V into the 2982 at that point. 9V adapter into Arduino Diecimila, 9V battery into 2982, shared grounds).

Later, with all anode segments connected, I got strange behavior where it would alternate dim to bright with all segments on. The program was supposed to alternate a number 1 and 0 with a delay. I believe this was also accomplished with cathode tied to ground.

Sorry for all that, hopefully there's something in there that will give you a hint as to why my circuit is so screwy :-?

Hi, Here is (sort of) a schematic how I think it should work. Download from here: http://www.wayoda.org/share/pictures/MAX72XX-HighLoads.jpg

I used a single resistor on the cathode end. I figured 6 resistors for the cathodes is better than 48 for the anode segments.

You won't need 48 Resistors, just 8 : 7 for the segments that make up the number and one for the decimal-point which also needs to be calaculated seperately because there are only 2 Led's in series for the DP.

Supply voltage was 18V (two 9V in series) although I tried 9V and 12V as well.

12V should work fine : The UND2981 will take away roughly 1.6V from this and the uln2803 another 0.9V the you have the segments with 8V (check datasheet again for this) which leads to a resistor of (12v-1.6V-8V-0.9V)/0.02A=75 Ohm. Before you burn out you digits I would go for a higher value for testing (330Ohm). Also note that the resistor on the DP is calulated as: (12v-1.6V-4V-0.9V)/0.02A=275 Ohm. (Since there are only 2 Leds in series on the DP)

I have a feeling you are correct in that the 7219 pulls the digit pins low to sink the current (as the digit pins are meant to connect to common cathodes). Please tell me if I'm not making sense, I'm still learning the terminology :P

Here comes the Part in the schematic called "Inverter". I didn't give a part-number any TTL-inverter should do (74LS06 should do for your purpose since you only need 6 digits)

Eberhard

I've got the inverter ordered ordered, I'll let you know how it goes. Thanks!

Still no luck :/ tried it exactly like the schematic (minus the capacitors - didn't have them). Finally got it to source and sink, but all I got was a jumbled mess, no matter what digit I wrote to the display.

Should I give up and try one of those allegro high power shift registers with a common anode display?

Still no luck :/ tried it exactly like the schematic (minus the capacitors - didn't have them). Finally got it to source and sink, but all I got was a jumbled mess, no matter what digit I wrote to the display.

I guess you had no luck turning single segments on and off?

Should I give up and try one of those allegro high power shift registers with a common anode display?

My UDN2981 will arrive either today or tomorrow, then I will try to control an array of Leds from an ATMega that acts as an I2C-device (similar to this : http://thingm.com/products/blinkm)

The Allegro shift registers are quite expensive (here in Germany) and I'm not sure how much Arduino processing power is demanded by this solution. I will post a schematic for my prototype tomorrow... Eberhard

Success! I took the plunge and bought six common anode displays off ebay, and six Allegro 6278 sink drivers from DigiKey ($1.55 apiece). Took me some fiddling to get ShiftOut to work, but I was able to get it working. He’s my code - I stole it from an example so it looks a little weird, but it counts from 0 to 9 on one display.

int latchPin = 8;

int clockPin = 12;

int dataPin = 11;

//holders for infromation you're going to pass to shifting function
byte dataRED;

byte dataArrayRED[10];


void setup() {
  //set pins to output because they are addressed in the main loop
  pinMode(latchPin, OUTPUT);
  Serial.begin(9600);

  //Arduino doesn't seem to have a way to write binary straight into the code 
  //so these values are in HEX.  Decimal would have been fine, too. 
  dataArrayRED[0] = 0x3F; 
  dataArrayRED[1] = 0x06; 
  dataArrayRED[2] = 0x5B; 
  dataArrayRED[3] = 0x4F; 
  dataArrayRED[4] = 0x66; 
  dataArrayRED[5] = 0x6D; 
  dataArrayRED[6] = 0x7D; 
  dataArrayRED[7] = 0x07; //00000111 
  dataArrayRED[8] = 0x7F; 
  dataArrayRED[9] = 0x67; //01100111





}

void loop() {

for (int i = 0; i<10; i++)
{
 
    dataRED = dataArrayRED[i];

    //ground latchPin and hold low for as long as you are transmitting
    digitalWrite(latchPin, 0);
    //move 'em out

    shiftOut(dataPin, clockPin, dataRED);
    //return the latch pin high to signal chip that it 
    //no longer needs to listen for information
    digitalWrite(latchPin, 1);
    delay(300);

  
  delay(1000);
}
}



// the heart of the program
void shiftOut(int myDataPin, int myClockPin, byte myDataOut) {
  // This shifts 8 bits out MSB first, 
  //on the rising edge of the clock,
  //clock idles low

  //internal function setup
  int i=0;
  int pinState;
  pinMode(myClockPin, OUTPUT);
  pinMode(myDataPin, OUTPUT);

  //clear everything out just in case to
  //prepare shift register for bit shifting
  digitalWrite(myDataPin, 0);
  digitalWrite(myClockPin, 0);

  //for each bit in the byte myDataOut?
  //NOTICE THAT WE ARE COUNTING DOWN in our for loop
  //This means that %00000001 or "1" will go through such
  //that it will be pin Q0 that lights. 
  for (i=7; i>=0; i--)  {
    digitalWrite(myClockPin, 0);

    //if the value passed to myDataOut and a bitmask result 
    // true then... so if we are at i=6 and our value is
    // %11010100 it would the code compares it to %01000000 
    // and proceeds to set pinState to 1.
    if ( myDataOut & (1<<i) ) {
      pinState= 1;
    }
    else {      
      pinState= 0;
    }

    //Sets the pin to HIGH or LOW depending on pinState
    digitalWrite(myDataPin, pinState);
    //register shifts bits on upstroke of clock pin  
    digitalWrite(myClockPin, 1);
    //zero the data pin after shift to prevent bleed through
    digitalWrite(myDataPin, 0);
  }

  //stop shifting
  digitalWrite(myClockPin, 0);
}

Of course it doesn’t multiplex so you need one register per display, and I havn’t tried more than one display yet, but it seems to work. I do have a slight problem with the segments dimming with the number of lit segments (number 1 is very bright, number 8 is very dim), but I’m guessing that’s because I have one resistor on the anode, instead of one resistor per segment, correct? The register does have an external resistor to limit the current (as it’s a constant current driver), so I suppose I can trust that (once I get the right resistor. I don’t trust it just yet, as I only have 6 of the displays!)

hey everyone,

I know this thread is almost a year old now but I am having some problems figuring out exactly what to do. I have gone through every post and followed every link in all of the posts and I can't quite seem to put all of the pieces together.

Here is where I am at. I have the 6inch 7 segment displays from sparkfun, I have the Allegro 6278 sink drivers and a 12v power supply.

I can get all of the segments to light up by simply running them through my power supply. But I am still not sure how to hook them up to Arduino to make them display the numbers. Any help would be greatly appreciated, even a pretty picture would be fantastic. :)

Thanks for the help.

So after some experimenting and more digging I as able to get this working.

Here is a diagram of how I hooked it up. The chip in the middle is an Allegro 6278EAT, the resistor is 15k and I used a 12v/1700mA power supply to power the digit only.

It also uses the Arduino sketch in the above reply.

I hope this helps someone out.

Cheers