Go Down

Topic: Dual seven segment display (Read 3 times) previous topic - next topic

fraz_s

I am starting a project with a dual seven segment cathode display with drivers, I can't find anything helpful online about it, evening wiring it up!

can any one help?

Thanks

baum

7 segment displays usually have about 10 pins - 5 on each side. Most of them have a similar pin configuration: the center one on each side is ground, but you only need to connect one. The other 8 pins are all the segments (7 numerical + 1 decimal point). You'll have to experiment to figure out the correct config. Also, don't forget a resistor on the common cathode (GND).

Now for controlling them. If you forget the decimal point, each 7seg needs 7 pins. 7+7 = 14, and unless you have an arduino mega, you won't have enough pins. Check out http://tronixstuff.wordpress.com/2010/05/06/getting-started-with-arduino-chapter-five/ for some help using 7segs with a shift register. Basically you can control both displays with only 3 arduino pins and power.

If you don't have a shift register, you'll need to use a different setup. I'll tell you that one if you don't have any shift registers.

Good Luck!
baum

fraz_s

I dont have any shift resistors and I only have an Arduino Uno, is there any way of controlling it with less than 14 pins?

Thanks

Leon Heller

#3
Mar 19, 2011, 02:00 pm Last Edit: Mar 19, 2011, 02:13 pm by Leon Heller Reason: 1
You only need nine pins if you multiplex the displays:



You probably won't need the cathode drivers for an AVR
Leon Heller
G1HSM

baum

Yep. To clarify what Leon said:

Instead of connecting the ground pins to ground, you can connect them to digital pins. If you oscillate these pins very quickly you can create the illusion that both 7 segments are on at the same time. And you shouldn't need resistors, digital mins have a max current of 20mA.

Leon Heller

Segment resistors are required!
Leon Heller
G1HSM

baum

Why? Max current per GPIO pin is 20mA, LED current is 20mA. I ran mine w/ out resistors.

Leon Heller

#7
Mar 19, 2011, 02:55 pm Last Edit: Mar 19, 2011, 03:42 pm by Leon Heller Reason: 1
It isn't a good idea, current limiting is advisable. LEDs are current-operated devices, if the resistors are omitted the maximum rating of the AVR can be exceeded - check the data sheet!
Leon Heller
G1HSM

WillR

A couple of things...

You can get chips that drive these displays and do the Heavy Lifting...  (Common Anode choip?)
http://www.nxp.com/documents/data_sheet/SAA1064_CNV.pdf

You can buy Ready made boards...
http://www.gravitech.us/i2c47di.html

You can get the Arduino Cook Book (Cheap via e-reader) See chapters 7 and 13
http://oreilly.com/catalog/9780596802486

It explains common cathode and common anode displays and has a few sections on "driving" them -- including a single digit display and a section on the MAX7221 SPI based common (Common Cathode driver)
http://www.maxim-ic.com/datasheet/index.mvp/id/1339

Sometimes it is a lot easier to go the High Tech route and buy the driver chip -- especially if you are doing a program that is ""busy elsewhere".

A little hunting on this site for Libraries to drive these and similar chips is worth the effort. There are some great examples here.
Just another Hacker

maniacbug

I used an I/O expander for mine, and a common-anode unit.

Schematics, part selection, and code on my blog post...
http://maniacbug.wordpress.com/2011/02/28/double-7-segment-led-with-io-expander-20/

VFXCode

This is my code for a multiplexed 3 digit 7 segment display almost same wiring to the schematic by Leon Heller just for three digits and without any resistors/transistors.

NumPrint () Translates each number to segments that need to be on and the ones that need to be off.
SegmentWrite () handles the lighting for each segment on the current digit.
Cursor () selects the digit.
UpdatePrint () prints the '-' symbol in all digits. Application specific you shouldnt need it.

You need to know what pin corresponds to which segment + the pins for each digit.

Basicaly LEDs that are off are reversed polarized and the ones that are on are correctly polarized. This is why you select the digit with the LOW value and the on segments with a HIGH value.


Code: [Select]

void setup() {
  firstdigit =1;
  seconddigit = 2;
  thirddigit = 3;
}

void loop()
{
  Print ();
}

void Print () {
  Cursor(1); NumPrint(firstdigit);
  Cursor(2); NumPrint(seconddigit);
  Cursor(3); NumPrint(thirddigit);
}

void UpdatePrint() {
  Cursor(4);
  SegmentWrite(HIGH,HIGH,HIGH,HIGH,HIGH,HIGH,LOW);
}

void NumPrint (int number) {
  switch ( number )
      {
         case 0:
            SegmentWrite(LOW,LOW,LOW,LOW,LOW,LOW,HIGH);
            break;
         case 1:
            SegmentWrite(LOW,HIGH,HIGH,LOW,HIGH,HIGH,HIGH);
            break;
         case 2:
            SegmentWrite(HIGH,LOW,LOW,LOW,LOW,HIGH,LOW);
            break;
         case 3:
            SegmentWrite(LOW,HIGH,LOW,LOW,LOW,HIGH,LOW);
            break;
         case 4:
            SegmentWrite(LOW,HIGH,HIGH,LOW,HIGH,LOW,LOW);
            break;
         case 5:
            SegmentWrite(LOW,HIGH,LOW,HIGH,LOW,LOW,LOW);
            break;
         case 6:
            SegmentWrite(LOW,LOW,LOW,HIGH,LOW,LOW,LOW);
            break;
         case 7:
            SegmentWrite(LOW,HIGH,HIGH,LOW,LOW,HIGH,HIGH);
            break;
         case 8:
            SegmentWrite(LOW,LOW,LOW,LOW,LOW,LOW,LOW);
            break;
         case 9:
            SegmentWrite(LOW,HIGH,LOW,LOW,LOW,LOW,LOW);
            break;
         case -1:
            SegmentWrite(HIGH,HIGH,HIGH,HIGH,HIGH,HIGH,HIGH);
            break;
         default:
            SegmentWrite(HIGH,HIGH,HIGH,HIGH,HIGH,HIGH,LOW);;
      }
}

void SegmentWrite(bool a,bool b,bool c,bool d,bool e,bool f,bool g) {
  digitalWrite(0, a);
  digitalWrite(1, b);
  digitalWrite(2, c);
  digitalWrite(3, d);
  digitalWrite(4, e);
  digitalWrite(5, f);
  digitalWrite(6, g);
}

void Cursor(int CurPos) {
  delay (1);
  SegmentWrite(HIGH,HIGH,HIGH,HIGH,HIGH,HIGH,HIGH);
  switch ( CurPos )
    {
      case 1:
        digitalWrite(7, LOW);
        digitalWrite(8, HIGH);
        digitalWrite(9, LOW);
        break;
      case 2:
        digitalWrite(7, LOW);
        digitalWrite(8, LOW);
        digitalWrite(9, HIGH);
        break;
      case 3:
        digitalWrite(7, HIGH);
        digitalWrite(8, LOW);
        digitalWrite(9, LOW);
        break;
      case 4:
        digitalWrite(7, HIGH);
        digitalWrite(8, HIGH);
        digitalWrite(9, HIGH);
        break;;
    }
}

Hawkeyes

How do you make the two common cathodes to osilate quickly?

floresta

#12
May 03, 2012, 08:58 pm Last Edit: May 03, 2012, 09:00 pm by floresta Reason: 1
Quote
... and without any resistors/transistors.


AARRGGHH

Quote
Max current per GPIO pin is 20mA


What gave you that idea?

Quote
I ran mine w/ out resistors.


What does that prove?   That's like saying 'I drove 70 in a 55 zone and didn't get a ticket'.

Don





floresta

Quote
How do you make the two common cathodes to osilate quickly?


Treat them as you would ordinary LEDs.

1.  Turn 'A' on and 'B' off
2.  Wait a while
3.  Turn 'A' off and 'B' on
4.  Wait a while
repeat

Search for 'Blink without delay' - but when you find it think of it as 'Blink without delay()' which is really what it is all about.


Don

Go Up