Pages: [1]   Go Down
Author Topic: how many 7 segment LEDs can a arduino run?  (Read 1531 times)
0 Members and 1 Guest are viewing this topic.
UK
Offline Offline
God Member
*****
Karma: 0
Posts: 529
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

How many 7 segment LEDs can a arduino run before using a LED Driver IC?

Really want to have 4 counting down 60.00 to 00.00 (MM.SS)
Logged

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

You can run a 4-digit LED display from the arduino.  I have a 4 digit display from digikey(67-1450-ND) running right now.  You'll need 12 IO.

edit:12 IO, not 16.
« Last Edit: August 12, 2009, 04:22:09 pm by jotux » Logged

UK
Offline Offline
God Member
*****
Karma: 0
Posts: 529
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

how about 4 separate 7 segments?
Logged

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

That display is 4 separate segments.  There are 8 segments per digit, and 4 common cathodes.

You connect the 8 segments and 4 cathodes to 12 IO and drive each digit sequentially.  Here's some code I threw together to display numbers on that particular display.

note: this code isn't all that great, or even all that complete.

Code:
#include <TimerOne.h> // this is non-standard, download it from the arduino site

const int num_digits = 10;
const byte num_pins   = 8;
const byte num_grounds= 4;
byte grounds[] = {3,2,1,0};                        // g1,g2,g3,g4
byte segments[]  = {9,6,13,12,11,8,7,4};      // A,B,C,D,E,F,G,P

byte num_to_display[]={0,0,0,0};

int led_nums[num_digits][num_pins]=
{
      {1,1,1,1,1,1,0,0},      // 0
      {0,1,1,0,0,0,0,0},      // 1
      {1,1,0,1,1,0,1,0},      // 2
      {1,1,1,1,0,0,1,0},      // 3
      {0,1,1,0,0,1,1,0},      // 4
      {1,0,1,1,0,1,1,0},      // 5
      {1,0,1,1,1,1,1,0},      // 6
      {1,1,1,0,0,0,0,0},      // 7
      {1,1,1,1,1,1,1,0},      // 8
      {1,1,1,1,0,1,1,0},      // 9
};

void setup()
{
      int i;
      for (i = 0;i < num_pins;i++)
      {
            pinMode(segments[i],OUTPUT);
            if (i < num_grounds)
            {
                  pinMode(grounds[i],OUTPUT);
                  digitalWrite(grounds[i],HIGH);
            }
      }
      
      Timer1.initialize(550);
      Timer1.attachInterrupt(updateDisplay);
}

void updateDisplay()
{
      int g,d;
      
      for (g = 0; g < num_grounds;g++)
      {
            for (d = 0;d < num_pins;d++) if(digitalRead(segments[d]) == 1) digitalWrite(segments[d], LOW);      // clear used
            digitalWrite(grounds[g],digitalRead(grounds[g])^1);      // enable digit
            for (d = 0;d < num_pins;d++) digitalWrite(segments[d], (led_nums[num_to_display[g]][d] == 1) ? HIGH : LOW); //write segments
            digitalWrite(grounds[g],HIGH);      // disable digit
      }
}

void loop()
{
      setDigits(1,2,3,4);
}

void setDigits(byte n1, byte n2, byte n3, byte n4)
{
      num_to_display[0] = n1;
      num_to_display[1] = n2;
      num_to_display[2] = n3;
      num_to_display[3] = n4;
}


« Last Edit: August 12, 2009, 04:12:09 pm by jotux » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey guys, it doesn't look like this was ever answered proper.  I have a similar need:

I need to run 3 separate 8-segment LED displays independently.  Meaning, 1) Stopwatch Timer  2)  Temperature  3)  Calculation

Is three of these overkill? Sparkfun 7-Segment Serial Display
sku: COM-09230

Can the Arduino handle all that?

Thanks!
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

These are what I was asking about.

http://www.sparkfun.com/commerce/product_info.php?products_id=9230
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 603
Posts: 33387
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes you can control as many as you want with the arduino. Use the SPI interface and then connect the CSN line of each display to an arduino output to enable it. In that way you can talk to as many devices as you have output pins on the arduino, or even more if you use I/O expanding chips.
Logged

0
Offline Offline
Full Member
***
Karma: 1
Posts: 236
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I don't know if size/brightness does matter:
But if you want to show just much numbers, maybe an LCD 2x16 is more suitable?
For the 3x13$ you get a nice LCD. For an LCD you normally need 6 digipins, no matter of coulumn and row of the LCD.
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 603
Posts: 33387
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If you look at this page:-
http://www.andreadrian.de/schach/#Selbstbau_Schachcomputer_SHAH
You will see the schematic has four 7 segment displays multiplexed. The Text is about a chess computer using an arduino and is in German but fortunately the diagram is in schematic an I read that very well.  smiley-wink
Logged

Pages: [1]   Go Up
Jump to: