7 Segment LED Display (Common Cathode)
7 Segment LED Display (Common Cathode)
The 7 Segment LED Display (Common Cathode) is a type of electronic display device that uses light-emitting diodes (LEDs) to display numerical and alphanumeric information. It is a popular choice for various electronic projects, including digital clocks, calculators, and measurement instruments.
The 7 Segment LED Display (Common Cathode) is designed to display numeric and alphanumeric characters by illuminating a combination of seven LED segments. Each segment is a rectangular LED that can be turned on or off independently to form the desired character. The display is organized into seven segments, labeled A to G, with each segment consisting of several LEDs in series.
The display operates on the principle of a common cathode configuration, where all the cathode pins of the LEDs are connected together and tied to a common ground. The anode pins of the LEDs are connected to individual pins on the display, allowing for independent control of each segment.
| The 7 Segment LED Display (Common Cathode) is commonly used in various applications, including |
Digital clocks and watches
Calculators and scientific instruments
Measurement instruments, such as multimeters and oscilloscopes
Industrial control panels and automation systems
Automotive dashboards and displays
Medical equipment and appliances
Consumer electronics, such as toys and games
| The pinout and dimensions of the 7 Segment LED Display (Common Cathode) may vary depending on the manufacturer and specific model. However, a typical 7 Segment LED Display (Common Cathode) has 10 pins, with the following pinout |
| Pin | Description |
| --- | --- |
| 1 | Segment A |
| 2 | Segment B |
| 3 | Segment C |
| 4 | Segment D |
| 5 | Segment E |
| 6 | Segment F |
| 7 | Segment G |
| 8 | Common Cathode |
| 9 | Decimal Point (optional) |
| 10 | Backlight (optional) |
The dimensions of the display are typically around 27mm x 18mm, with a thickness of around 7mm.
Overall, the 7 Segment LED Display (Common Cathode) is a versatile and widely used component in various electronic applications, offering a simple and effective way to display numeric and alphanumeric information.
7 Segment LED Display (Common Cathode) DocumentationOverviewThe 7 Segment LED Display (Common Cathode) is a widely used component in various electronic projects, including IoT devices, digital clocks, and scoreboards. It is a single digit display that shows numbers from 0 to 9, as well as some special characters. This display consists of 7 segments (A to G) and a decimal point (DP), with a common cathode (negative leg) connected to all the segments.PinoutThe typical pinout of a 7 Segment LED Display (Common Cathode) is:| Pin | Segment |
| --- | --- |
| 1 | DP (Decimal Point) |
| 2 | A |
| 3 | B |
| 4 | C |
| 5 | D |
| 6 | E |
| 7 | F |
| 8 | G |
| 9 | CC (Common Cathode) |ConnectionsTo use the 7 Segment LED Display (Common Cathode), connect the common cathode (pin 9) to a digital ground (GND), and the remaining pins to digital outputs of a microcontroller or a driver circuit.Code Examples### Example 1: Arduino UnoIn this example, we will use an Arduino Uno board to display the number "5" on the 7 Segment LED Display.```c
const int segmentPins[] = {2, 3, 4, 5, 6, 7, 8, 9}; // A, B, C, D, E, F, G, CC
const int digitPins[] = {10}; // Only one digit in this examplevoid setup() {
for (int i = 0; i < 8; i++) {
pinMode(segmentPins[i], OUTPUT);
}
for (int i = 0; i < 1; i++) {
pinMode(digitPins[i], OUTPUT);
}
}void loop() {
displayDigit(5); // Display the number 5
delay(1000); // Hold for 1 second
}void displayDigit(int digit) {
switch (digit) {
case 0:
setSegments(false, true, true, true, true, true, true); break;
case 1:
setSegments(true, true, false, false, false, false, false); break;
case 2:
setSegments(false, true, false, true, true, false, true); break;
case 3:
setSegments(false, true, false, true, false, false, true); break;
case 4:
setSegments(true, false, true, false, false, true, false); break;
case 5:
setSegments(false, false, true, true, false, true, true); break;
case 6:
setSegments(false, false, true, true, true, true, true); break;
case 7:
setSegments(false, true, false, false, false, false, false); break;
case 8:
setSegments(false, true, true, true, true, true, true); break;
case 9:
setSegments(false, true, true, true, false, true, true); break;
}
}void setSegments(boolean a, boolean b, boolean c, boolean d, boolean e, boolean f, boolean g) {
digitalWrite(segmentPins[1], a ? LOW : HIGH); // A
digitalWrite(segmentPins[2], b ? LOW : HIGH); // B
digitalWrite(segmentPins[3], c ? LOW : HIGH); // C
digitalWrite(segmentPins[4], d ? LOW : HIGH); // D
digitalWrite(segmentPins[5], e ? LOW : HIGH); // E
digitalWrite(segmentPins[6], f ? LOW : HIGH); // F
digitalWrite(segmentPins[7], g ? LOW : HIGH); // G
digitalWrite(segmentPins[0], LOW); // CC (Common Cathode)
}
```### Example 2: ESP32 with MultiplexingIn this example, we will use an ESP32 board to display the numbers "0" to "9" on multiple 7 Segment LED Displays using multiplexing.```c
const int segmentPins[] = {16, 17, 18, 19, 20, 21, 22, 23}; // A, B, C, D, E, F, G, CC
const int digitPins[] = {13, 12, 14, 27}; // 4 digitsvoid setup() {
for (int i = 0; i < 8; i++) {
pinMode(segmentPins[i], OUTPUT);
}
for (int i = 0; i < 4; i++) {
pinMode(digitPins[i], OUTPUT);
}
}void loop() {
for (int digit = 0; digit < 10; digit++) {
for (int i = 0; i < 4; i++) {
displayDigit(digit, i);
delay(5); // Hold for 5 milliseconds
}
}
}void displayDigit(int digit, int digitIndex) {
// Set the digit pin low to enable the digit
digitalWrite(digitPins[digitIndex], LOW);
switch (digit) {
case 0:
setSegments(false, true, true, true, true, true, true); break;
case 1:
setSegments(true, true, false, false, false, false, false); break;
case 2:
setSegments(false, true, false, true, true, false, true); break;
case 3:
setSegments(false, true, false, true, false, false, true); break;
case 4:
setSegments(true, false, true, false, false, true, false); break;
case 5:
setSegments(false, false, true, true, false, true, true); break;
case 6:
setSegments(false, false, true, true, true, true, true); break;
case 7:
setSegments(false, true, false, false, false, false, false); break;
case 8:
setSegments(false, true, true, true, true, true, true); break;
case 9:
setSegments(false, true, true, true, false, true, true); break;
}
// Set the digit pin high to disable the digit
digitalWrite(digitPins[digitIndex], HIGH);
}void setSegments(boolean a, boolean b, boolean c, boolean d, boolean e, boolean f, boolean g) {
digitalWrite(segmentPins[1], a ? LOW : HIGH); // A
digitalWrite(segmentPins[2], b ? LOW : HIGH); // B
digitalWrite(segmentPins[3], c ? LOW : HIGH); // C
digitalWrite(segmentPins[4], d ? LOW : HIGH); // D
digitalWrite(segmentPins[5], e ? LOW : HIGH); // E
digitalWrite(segmentPins[6], f ? LOW : HIGH); // F
digitalWrite(segmentPins[7], g ? LOW : HIGH); // G
digitalWrite(segmentPins[0], LOW); // CC (Common Cathode)
}
```NotesIn the above examples, the common cathode (CC) is connected to a digital ground (GND) and the remaining pins are connected to digital outputs of the microcontroller.
The `setSegments` function sets the individual segments of the display based on the input digit.
In the ESP32 example, multiplexing is used to control multiple displays. The `displayDigit` function sets the digit pin low to enable the digit and then sets the segments using the `setSegments` function. The digit pin is then set high to disable the digit.
The examples are simplified and do not include error handling or debouncing. In a real-world application, you may need to add these features depending on the specific requirements.