3 x 7 segment LED

hi guys, i have 3 of 7 segment leds. i would like to connect it to arduino, how can i do that , wil i have to use some circuits ? i don't want to occupy all exits of controller.

thank you

You can use 7 pins to drive segments and 3 to drive digits. That leaves 9 pins of the 19 for other purposes.

Here is code I wrote to show a timer display on a 4-digit 7-segment display. Because the pulses are so quick (3mS) I didn't use any current limiting resistors.

#define DIGIT4 14  // LSD
#define DIGIT3 2
#define DIGIT2 3
#define DIGIT1 4  // MSD

// Bit maps for the seven segment display
const unsigned char Segments[] =
{
  0b11000000, // 0
  0b11001111, // 1
  0b10100100, // 2
  0b10000110, // 3
  0b10001011, // 4
  0b10010010, // 5
  0b10010000, // 6
  0b11000111, // 7
  0b10000000, // 8
  0b10000011, // 9
};


// List of digit select lines, least significant digit first
const unsigned char Digits[4] = {
  DIGIT4, DIGIT3, DIGIT2, DIGIT1};


void setup()
{
  for (int i=2; i<15; i++)
  {
    pinMode(i,OUTPUT);
    digitalWrite(i,LOW);
  }
  digitalWrite(12, HIGH);
  digitalWrite(13, HIGH);
}

void loop()
{
  // Get time since last reset
  unsigned long hundredths = millis() / 10;
  unsigned long seconds = hundredths / 100;
  unsigned long minutes = seconds / 60;
  int hours = minutes / 60;
  int clock;

  // Display minutes:seconds up to 100 minutes, then hours/minutes
if (seconds < 100)
    clock = (seconds % 100) * 100 + (hundredths % 100);
else
if (minutes < 100)
    clock = (minutes % 100) * 100 + (seconds % 60);
  else
    clock = (hours % 100) * 100 + (minutes % 60);

  // Clear all segments before enabling a digit
  for (int s=5; s<14; s++)
  {
    digitalWrite(s,HIGH);
  }

  // Display each digit, right to left
  for (int i=0; i<4; i++)
  {
    
    // Peel a digit off the low end of the number
    int digit = clock % 10;
    clock /= 10;
    
    // Blank the MSD if it is zero
    if (i==3 && digit == 0)
    {
      for (int s=5; s<12; s++)
        digitalWrite(s,HIGH);
    }
    else
    {
      // Display the digit on the seven segments
      unsigned char segments = Segments[digit];
      for (int s=5; s<12; s++)
      {
        digitalWrite(s,segments & 1);
        segments >>= 1;
      }
    }


    if (seconds < 100)
    {
      // Steady decimal point when showing seconds and hundredths
      digitalWrite(12, HIGH);
      digitalWrite(13, LOW);

    }
    else
    if (minutes < 100)
    {
      // Steady colon when showing minutes and seconds
      digitalWrite(12, LOW);
      digitalWrite(13, LOW);

    }
    else
    {
      // Make the colon blink each second
      digitalWrite(12, seconds & 1);
      digitalWrite(13, seconds & 1);
    }

    // Turn on the digit briefly
    digitalWrite(Digits[i], HIGH);  // Select one digit
    delay(3);
    digitalWrite(Digits[i], LOW);
  }
}

"the pulses are so quick (3mS) I didn't use any current limiting resistors"

Bad engineer, don't go encouraging bad design practices elsewhere.

Thank you for your time, the last question is how do you connect 3 leds together and to controller, pins?
Thank you very much

johnwasser:
You can use 7 pins to drive segments and 3 to drive digits. That leaves 9 pins of the 19 for other purposes.

Here is code I wrote to show a timer display on a 4-digit 7-segment display. Because the pulses are so quick (3mS) I didn't use any current limiting resistors.

#define DIGIT4 14  // LSD

#define DIGIT3 2
#define DIGIT2 3
#define DIGIT1 4  // MSD

// Bit maps for the seven segment display
const unsigned char Segments[] =
{
  0b11000000, // 0
  0b11001111, // 1
  0b10100100, // 2
  0b10000110, // 3
  0b10001011, // 4
  0b10010010, // 5
  0b10010000, // 6
  0b11000111, // 7
  0b10000000, // 8
  0b10000011, // 9
};

// List of digit select lines, least significant digit first
const unsigned char Digits[4] = {
  DIGIT4, DIGIT3, DIGIT2, DIGIT1};

void setup()
{
  for (int i=2; i<15; i++)
  {
    pinMode(i,OUTPUT);
    digitalWrite(i,LOW);
  }
  digitalWrite(12, HIGH);
  digitalWrite(13, HIGH);
}

void loop()
{
  // Get time since last reset
  unsigned long hundredths = millis() / 10;
  unsigned long seconds = hundredths / 100;
  unsigned long minutes = seconds / 60;
  int hours = minutes / 60;
  int clock;

// Display minutes:seconds up to 100 minutes, then hours/minutes
if (seconds < 100)
    clock = (seconds % 100) * 100 + (hundredths % 100);
else
if (minutes < 100)
    clock = (minutes % 100) * 100 + (seconds % 60);
  else
    clock = (hours % 100) * 100 + (minutes % 60);

// Clear all segments before enabling a digit
  for (int s=5; s<14; s++)
  {
    digitalWrite(s,HIGH);
  }

// Display each digit, right to left
  for (int i=0; i<4; i++)
  {
   
    // Peel a digit off the low end of the number
    int digit = clock % 10;
    clock /= 10;
   
    // Blank the MSD if it is zero
    if (i==3 && digit == 0)
    {
      for (int s=5; s<12; s++)
        digitalWrite(s,HIGH);
    }
    else
    {
      // Display the digit on the seven segments
      unsigned char segments = Segments[digit];
      for (int s=5; s<12; s++)
      {
        digitalWrite(s,segments & 1);
        segments >>= 1;
      }
    }

if (seconds < 100)
    {
      // Steady decimal point when showing seconds and hundredths
      digitalWrite(12, HIGH);
      digitalWrite(13, LOW);

}
    else
    if (minutes < 100)
    {
      // Steady colon when showing minutes and seconds
      digitalWrite(12, LOW);
      digitalWrite(13, LOW);

}
    else
    {
      // Make the colon blink each second
      digitalWrite(12, seconds & 1);
      digitalWrite(13, seconds & 1);
    }

// Turn on the digit briefly
    digitalWrite(Digits[i], HIGH);  // Select one digit
    delay(3);
    digitalWrite(Digits[i], LOW);
  }
}

First, connect all 3 of the 'a' segments together, all 3 of the 'b' segments together, and so on. Each of the 7 (or 8 if using the decimal point) bundles of 3 segments is connected to an Arduino output pin via a current limiting resistor. Total 7 pins and 7 resistors so far (8 of each if using the d.p.).

How you connect the 3 digit connections depends on what current you want to drive them at. If you are happy choosing the current limiting resistors to give 5mA per segment, then you can connect each digit connection direct to an Arduino pin. However, they won't be very bright at 5mA. Otherwise, you need to drive each digit pin from a transistor. Use PNP transistors for common anode displays (emitter to +5v, collector to digit), or NPN transistors for common cathode displays (emitter to ground, collector to digit). Either way, connect a series resistor (1k will do) from each transistor base to an Arduino pin.

Okay, here's a schematic showing 4 segment displays. These would be common cathode type.
This is one of the easiest ways to do it.
If you have common anode, then everythings gets reversed.
The 4 anode get switched thru PNP transistors, and the cathodes are pulled low by the arduino.

And the Common Anode version...

What cad software is that?

expresspcb.com, great for drawing up stuff like this for discussions, or building something that doesn't need a PCB made.