Pages: [1]   Go Down
Author Topic: Dual seven segment display  (Read 2713 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Connecticut
Offline Offline
Edison Member
*
Karma: 16
Posts: 1216
RTFD (Datasheet in our case)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

St. Leonards-on-Sea, E. Sussex, UK.
Offline Offline
Sr. Member
****
Karma: 2
Posts: 301
Ancient developer
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You only need nine pins if you multiplex the displays:



You probably won't need the cathode drivers for an AVR
« Last Edit: March 19, 2011, 08:13:45 am by Leon Heller » Logged

Leon Heller
G1HSM

Connecticut
Offline Offline
Edison Member
*
Karma: 16
Posts: 1216
RTFD (Datasheet in our case)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

St. Leonards-on-Sea, E. Sussex, UK.
Offline Offline
Sr. Member
****
Karma: 2
Posts: 301
Ancient developer
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Segment resistors are required!
Logged

Leon Heller
G1HSM

Connecticut
Offline Offline
Edison Member
*
Karma: 16
Posts: 1216
RTFD (Datasheet in our case)
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

St. Leonards-on-Sea, E. Sussex, UK.
Offline Offline
Sr. Member
****
Karma: 2
Posts: 301
Ancient developer
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
« Last Edit: March 19, 2011, 09:42:30 am by Leon Heller » Logged

Leon Heller
G1HSM

Georgina Ontario
Offline Offline
Sr. Member
****
Karma: 5
Posts: 437
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Just another Hacker

Seattle, WA
Offline Offline
God Member
*****
Karma: 8
Posts: 673
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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/
Logged


Offline Offline
Newbie
*
Karma: 0
Posts: 17
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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;;
    }
}
Logged

New York
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 26
Posts: 4119
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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


 

« Last Edit: May 03, 2012, 02:00:02 pm by floresta » Logged

Western New York, USA
Offline Offline
Faraday Member
**
Karma: 26
Posts: 4119
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Pages: [1]   Go Up
Jump to: