You are on page 1of 8

To connect a 7-segment display to an Arduino using common anode (CA) and common cathode (CC)

configurations, you'll need to follow different approaches. Let's go through both of them:

1. Common Anode (CA) Connection:

In this configuration, the common pin of the 7-segment display is connected to the positive power
supply, while the individual segment pins are connected to Arduino digital pins through current-limiting
resistors. Here's how you can make the connections:

- Connect the common anode (CA) pin of the 7-segment display to the +5V pin on the Arduino.

- Connect each segment pin of the 7-segment display to a separate digital pin on the Arduino.

- Connect a current-limiting resistor (typically between 220-470 ohms) to each segment pin of the
display. The other end of the resistors should be connected to the respective Arduino digital pins.

- Connect a common ground between the Arduino and the display by connecting the GND pin on the
Arduino to the ground (GND) pin of the display.

Once you have made the connections, you can control the segments by turning the corresponding
digital pins HIGH or LOW. Here's a basic example that displays the number "0" on the 7-segment display:

3. Project Design Strategy:


The project involves the following steps:
- Installing Proteus software and Arduino library
- Selecting the appropriate Arduino board in Proteus
- Adding the 7-segment display component to the workspace
- Making the necessary connections between the Arduino board and the 7-segment display
according to the chosen configuration (CA or CC)
- Writing an Arduino program to control the segments of the 7-segment display
- Compiling and uploading the program to the Arduino board
- Simulating the circuit in Proteus to observe the display behavior
```arduino

const int segmentA = 2; // Connect segment A to digital pin 2

const int segmentB = 3; // Connect segment B to digital pin 3

// ... Connect the rest of the segments to appropriate digital pins

void setup() {

pinMode(segmentA, OUTPUT);

pinMode(segmentB, OUTPUT);

// ... Set other segment pins as OUTPUT

void loop() {

// Display "0" on the 7-segment display

digitalWrite(segmentA, HIGH);

digitalWrite(segmentB, HIGH);

// ... Turn on other required segments to display "0"

delay(1000); // Delay for one second

// Turn off all segments

digitalWrite(segmentA, LOW);

digitalWrite(segmentB, LOW);

// ... Turn off other segments

delay(1000); // Delay for one second

```
By selectively turning ON and OFF the required segments, you can display different numbers or
characters on the 7-segment display.

2. Common Cathode (CC) Connection:

In this configuration, the common pin of the 7-segment display is connected to ground (GND), while
the segment pins are connected to Arduino digital pins through current-limiting resistors. The
connections for the common cathode configuration are as follows:

- Connect the common cathode (CC) pin of the 7-segment display to the GND pin on the Arduino.

- Connect each segment pin of the 7-segment display to a separate digital pin on the Arduino.

- Connect a current-limiting resistor (typically between 220-470 ohms) to each segment pin of the
display. The other end of the resistors should be connected to the respective Arduino digital pins.

- Connect a +5V power supply to the VCC pin on the Arduino.

Once the connections are made, you can control the segments by turning the corresponding digital
pins HIGH or LOW. Here's an example to display the number "0" on the 7-segment display using
common cathode configuration:

```arduino

const int segmentA = 2; // Connect segment A to digital pin 2

const int segmentB = 3; // Connect segment B to digital pin 3

// ... Connect the rest of the segments to appropriate digital


To connect a 7-segment display with common anode (CA) and common cathode (CC) to an Arduino,
you'll need to follow different approaches for each type of display. Here's how you can do it:

Common Anode (CA) 7-Segment Display:

1. Connect the common anode pin of the 7-segment display to a digital output pin on the Arduino.

2. Connect the individual segment pins (a, b, c, d, e, f, and g) of the 7-segment display to different digital
output pins on the Arduino.

3. Connect a current-limiting resistor (usually around 220-330 ohms) to each segment pin of the display,
to prevent excessive current flow.

4. Write the appropriate digital output values to the segment pins to display the desired numbers or
characters on the 7-segment display.

Here's an example code snippet to display the number "8" on a common anode 7-segment display:

```arduino

const int digitPin = 2; // Digital pin connected to the common anode pin

const int segmentPins[] = {3, 4, 5, 6, 7, 8, 9}; // Digital pins connected to segment a-g

// Define the binary representation of each number from 0 to 9

const byte numberMap[] = {

B11111100, // 0

B01100000, // 1

B11011010, // 2

B11110010, // 3

B01100110, // 4

B10110110, // 5

B10111110, // 6
B11100000, // 7

B11111110, // 8

B11100110 // 9

};

void setup() {

for (int i = 0; i < 7; i++) {

pinMode(segmentPins[i], OUTPUT); // Set segment pins as outputs

pinMode(digitPin, OUTPUT); // Set common anode pin as output

void loop() {

displayNumber(8); // Display the number 8

delay(1000);

void displayNumber(int number) {

digitalWrite(digitPin, HIGH); // Turn off the common anode

for (int i = 0; i < 7; i++) {

digitalWrite(segmentPins[i], bitRead(numberMap[number], i)); // Set segment pins according to the


binary representation

digitalWrite(digitPin, LOW); // Turn on the common anode to display the number

```

Common Cathode (CC) 7-Segment Display:

1. Connect the common cathode pin of the 7-segment display to a GND (ground) pin on the Arduino.
2. Connect the individual segment pins (a, b, c, d, e, f, and g) of the 7-segment display to different digital
output pins on the Arduino.

3. Connect a current-limiting resistor (usually around 220-330 ohms) to each segment pin of the display,
to prevent excessive current flow.

4. Write the appropriate digital output values to the segment pins to display the desired numbers or
characters on the 7-segment display.

Here's an example code snippet to display the number "8" on a common cathode 7-segment display:

```arduino

const int digitPin = 2; // Digital pin connected to the common cathode pin

const int segmentPins[] = {

**Report: 7-Segment Display Connection with Arduino (Common Anode)**

**1. Project Description:**

The project aims to interface a 7-segment display with a Common Anode configuration with an Arduino
microcontroller. The 7-segment display is a popular electronic component used to display numerical
digits and some characters. This project focuses specifically on the Common Anode type, where the
common anode pin is shared among all the segments and needs to be connected to the Arduino.

**2. Project Requirements:**

To successfully complete this project, the following components are required:

- Arduino board (such as Arduino Uno)

- 7-segment display (Common Anode)

- Current-limiting resistors (usually around 220-330 ohms)

- Jumper wires

- Breadboard (optional, for easy circuit prototyping)


**3. Project Design Strategy:**

The project will follow the basic principles of connecting a 7-segment display with a Common Anode
configuration to an Arduino. The design strategy involves the following steps:

a. Connect the common anode pin:

- Connect the common anode pin of the 7-segment display to a digital output pin on the Arduino.

- This connection allows the Arduino to control the common anode, enabling the desired segments to
be illuminated.

b. Connect the segment pins:

- Connect the individual segment pins (a, b, c, d, e, f, and g) of the 7-segment display to different digital
output pins on the Arduino.

- By controlling the state (HIGH or LOW) of these pins, the Arduino can turn on or off the
corresponding segments.

c. Implement current-limiting resistors:

- Connect a current-limiting resistor to each segment pin of the display to prevent excessive current
flow.

- Use resistors with values between 220-330 ohms to regulate the current passing through each
segment.

d. Write the appropriate digital output values:

- To display specific numbers or characters on the 7-segment display, the Arduino needs to write the
appropriate digital output values to the segment pins.

- By manipulating the digital output states (HIGH or LOW), the Arduino can turn on or off the segments
required to form the desired display pattern.

**4. Project Design Diagram:**

Here is a simplified diagram illustrating the connections for a Common Anode 7-Segment Display with an
Arduino:

```
Arduino 7-Segment Display

-------- -----------------

Pin CA -----|> Common Anode

Pin A -----|> Segment A

Pin B -----|> Segment B

Pin C -----|> Segment C

Pin D -----|> Segment D

Pin E -----|> Segment E

Pin F -----|> Segment F

Pin G -----|> Segment G

--------------------------------

```

**Conclusion:**

This report has provided a brief overview of connecting a Common Anode 7-Segment Display with an
Arduino. By following the project requirements and design strategy outlined in this report, users can
successfully connect and control the display to showcase desired numbers or characters based on their
Arduino program. It is important to refer to the datasheet or documentation of the specific 7-segment
display for pin configurations and other technical details during the implementation process.

You might also like