Computers Windows Internet

Two-color seven-segment indicator. Seven-segment indicator management. Static LED control

Surely you have already seen the indicators - "eights". This is a seven-segment LED indicator, which serves to display the numbers from 0 to 9, as well as the decimal point ( DP- Decimal point) or comma.

Structurally, such a product is an assembly of LEDs. Each assembly LED illuminates its own segment.

Depending on the model, the assembly can consist of 1 - 4 seven-segment groups. For example, the ALS333B1 indicator consists of one seven-segment group, which is capable of displaying only one digit from 0 to 9.

But the KEM-5162AS LED indicator already has two seven-segment groups. It is two-digit. The photo below shows different seven-segment LED indicators.

There are also indicators with 4 seven-segment groups - four-digit (in the photo - FYQ-5641BSR-11). They can be used in homemade electronic watches.

How are seven-segment indicators indicated on the diagrams?

Since the seven-segment indicator is a combined electronic device, its image on the diagrams does not differ much from its appearance.

One has only to pay attention to the fact that each pin corresponds to a specific character segment to which it is connected. There is also one or more common cathode or anode leads - depending on the model of the device.

Features of seven-segment indicators.

Despite the seeming simplicity of this detail, it also has some peculiarities.

First, there are seven-segment LED indicators with a common anode and a common cathode. This feature should be considered when buying it for a homemade design or device.

Here, for example, the pinout of the already familiar 4-digit indicator FYQ-5641BSR-11.

As you can see, the anodes of the LEDs of each digit are combined and brought to a separate output. The cathodes of LEDs that belong to the sign segment (for example, G) are connected together. A lot depends on what kind of connection scheme the indicator has (with a common anode or cathode). If you look at the schematic diagrams of devices using seven-segment indicators, it becomes clear why this is so important.

In addition to small indicators, there are large and even very large ones. They can be seen in public places, usually in the form of wall clocks, thermometers, informers.

To increase the size of the numbers on the display and at the same time maintain sufficient brightness for each segment, several LEDs are used, connected in series. Here is an example of such an indicator - it fits in the palm of your hand. it FYS-23011-BUB-21.

One segment consists of 4 LEDs connected in series.

To light one of the segments (A, B, C, D, E, F or G), you need to apply a voltage of 11.2 volts to it (2.8V per LED). It is possible and less, for example, 10V, but the brightness will also decrease. An exception is the decimal point (DP), its segment consists of two LEDs. It only needs 5 - 5.6 volts.

There are also two-color indicators in nature. They incorporate, for example, red and green LEDs. It turns out that two indicators are built into the case, but with LEDs of different glow colors. If you apply voltage to both LED chains, you can get the yellow color of the segments glow. Here is the wiring diagram for one of these two-color LEDs (SBA-15-11EGWA).

If you switch pins 1 ( RED) and 5 ( GREEN) to "+" power supply through key transistors, then you can change the glow color of the displayed numbers from red to green. And if you connect pins 1 and 5 at the same time, then the color of the glow will be orange. This is how you can play around with indicators.

Seven-segment display management.

To control seven-segment indicators in digital devices, shift registers and decoders are used. For example, a widespread decoder for controlling indicators of the ALS333 and ALS324 series is a microcircuit K514ID2 or K176ID2... Here's an example.

And to control modern import indicators, shift registers are usually used. 74HC595... In theory, it is possible to control the display segments directly from the outputs of the microcontroller. But such a scheme is rarely used, since this requires using quite a few pins of the microcontroller itself. Therefore, shift registers are used for this purpose. In addition, the current consumed by the LEDs of the sign segment can be greater than the current that the ordinary output of the microcontroller can provide.

To control large seven-segment indicators, such as the FYS-23011-BUB-21, specialized drivers are used, for example, a microcircuit MBI5026.

What's inside a seven-segment indicator?

Well, a little tasty. Any electronics engineer would not be such if they were not interested in the "insides" of radio components. This is what is inside the ALS324B1 indicator.

The black squares on the base are LED crystals. You can also see the gold jumpers that connect the crystal to one of the leads. Unfortunately, this indicator will no longer work, since these very jumpers were cut off. But then we can see what is hidden behind the decorative panel of the scoreboard.

An LED (or light emitting diode) is an optical diode that emits light energy in the form of "photons" when forward biased. In electronics, we call this process electroluminescence. The color of visible light emitted from LEDs ranges from blue to red and is determined by the spectral light emitted, which in turn depends on various impurities that are added to semiconductor materials during their manufacture.

LEDs have many advantages over traditional lamps and luminaires, and perhaps the most important of them are their small size, durability, different colors, low cost and easy availability, and the ability to easily interact with various other electronic components in digital circuits.

But the main advantage of LEDs is that due to their small size, some of them can be concentrated in one compact package, forming the so-called seven-segment indicator.

The seven-segment indicator consists of seven LEDs (hence its name) arranged in a rectangle, as shown in the figure. Each of the seven LEDs is called a segment, because when illuminated, the segment forms part of a digit (decimal or 12-digit) Sometimes an 8th additional LED is used within one package. It serves to display the decimal point (DP), thus allowing to display if two or more than 7-segment displays are connected together to represent numbers greater than ten.

Each of the seven LED display segments is connected to the corresponding pad of the contact row located directly on the rectangular plastic case indicator. The LED pins are labeled with labels a through g representing each individual segment. The other pins of the LED segments are connected to each other and form a common terminal.

So, forward bias applied to the corresponding pins of the LED segments in a specific order will cause some segments to light up, while the rest will remain darkened, which allows the desired character of the pattern number to be displayed on the display to be highlighted. This allows us to represent each of the ten decimal digits from 0 to 9 on a 7-segment display.

General pin is usually used to determine the type of 7-segment display. Each LED display has two connection leads, one of which is called the "anode" and the other, respectively, is called the "cathode". Therefore, a seven-segment LED indicator can have two types of circuit design - with a common cathode (OK) and with a common anode (OA).

The difference between these two types of displays is that in the design with OK, the cathodes of all 7 segments are directly connected to each other, and in the circuit with a common (OA) anode, the anodes of all 7 segments are connected to each other. Both schemes work as follows.

  • Common cathode (OK) - the interconnected cathodes of all LED segments have a logic level "0" or are connected to a common wire. Individual segments are highlighted by applying a "high" logic level or logic "1" signal to their anode output through a limiting resistor to create a forward bias of individual LEDs.
  • Common anode (OA) - the anodes of all LED segments are combined and have a logic level "1". Individual segments of the indicator light up when each specific cathode is connected to ground, a logic "0" or low-potential signal through the corresponding limiting resistor.

In general, 7-segment common-anode meters are more popular because many logic circuits can draw more current than the power supply can supply. Also note that the common cathode display is not a direct in-circuit replacement for the common cathode display. Conversely, this is the same as turning the LEDs back on, and therefore no light is emitted.

Although the 7 segment LED can be viewed as a single display, it still consists of seven individual LEDs within a single package, and as such these LEDs need overcurrent protection. LEDs emit light only when they are forward biased and the amount of light they emit is proportional to the forward current. This only means that the intensity of the LED light increases approximately linearly with increasing current. So, to avoid damage to the LED, this forward current must be monitored and limited to a safe value by an external limiting resistor.

These seven-segment indicators are called static. Their significant drawback is the large number of pins in the package. To eliminate this drawback, dynamic control schemes for seven-segment indicators are used.

The seven-segment indicator has gained great popularity among radio amateurs because it is convenient to use and easy to understand.

In this article, we will talk about digital readouts.
Seven-segment LED indicators are designed to display Arabic numerals from 0 to 9 (Fig. 1).

Such indicators are single-digit, which display only one number, but there can be more seven-segment groups combined in one body (multi-digit). In this case, the numbers are separated by a decimal point (Fig. 2)


Fig. 2.

The indicator is called seven-segment due to the fact that the displayed symbol is built from separate seven segments. Inside the case of such an indicator there are LEDs, each of which illuminates its own segment.
It is problematic to display letters and other symbols on such indicators, therefore, 16-segment indicators are used for these purposes.

There are two types of LED indicators.
In the first of them, all the cathodes, i.e. the negative leads of all LEDs are combined together and a corresponding lead is allocated for them on the case.
The rest of the indicator leads are connected to the anode of each of the LEDs (Fig. 3, a). This is called a common cathode circuit.
There are also indicators in which the LEDs of each of the segments are connected according to a scheme with a common anode (Fig. 3, b).


Fig. 3.

Each segment is identified by a corresponding letter. Figure 4 shows their location.

Fig. 4.

As an example, consider a two-digit seven-segment indicator GND-5622As-21 with a red glow. By the way, there are other colors, depending on the model.
With the help of a three-volt battery, you can turn on the segments, and if you combine a group of pins and apply power to them, you can even display numbers. But this method is inconvenient, so shift registers and decoders are used to control seven-segment indicators. Also, often, the indicator outputs are connected directly to the outputs of the microcontroller, but only if indicators with low current consumption are used. Figure 5 shows a fragment of the circuit using the PIC16F876A.


Fig. 5.

To control a seven-segment indicator, the K176ID2 decoder is often used.
This microcircuit is capable of converting a binary code consisting of zeros and ones to decimal digits from 0 to 9.

To understand how it all works, you need to collect simple scheme(fig. 6). The K176ID2 decoder is made in a DIP16 package. It has 7 output pins (pins 9 - 15), each dedicated to a specific segment. Point control is not provided here. Also, the microcircuit has 4 inputs (pins 2 - 5) for supplying binary code... The 16th and 8th pins are supplied with plus and minus power, respectively. The other three conclusions are auxiliary, I will talk about them a little later.


Fig. 6.

DD1 - K176ID2
R1 - R4 (10 - 100 kΩ)
HG1 - GND-5622As-21

There are 4 toggle switches in the circuit (you can use any buttons), when you press them, a logical unit from the power supply is supplied to the decoder inputs. By the way, the microcircuit itself is powered by a voltage of 3 to 15 volts. V this example the whole circuit is powered by a 9-volt "crown".

There are also 4 resistors in the circuit. These are the so-called pull-up resistors. They are needed to guarantee a low level at the logic input in the absence of a signal. Without them, the readings on the indicator may be displayed incorrectly. It is recommended to use the sameresistances from 10 kOhm to 100 kOhm.

In the diagram, pins 2 and 7 of the HG1 indicator are not connected. If you connect the DP pin to the minus of the power supply, then the decimal point will light up. And if you apply a minus to pin Dig.2, then the second group of segments will also light up (it will show the same symbol).

The decoder inputs are designed in such a way that to display the numbers 1, 2, 4 and 8 on the indicator, only one button is required (the breadboard has toggle switches corresponding to the inputs D0, D1, D2 and D3). If there is no signal, the number zero is displayed. When a signal is applied to the D0 input, the number 1 is displayed. And so on. To display other numbers, you need to press a combination of toggle switches. And which ones you need to press, Table 1 will tell us.


Table 1.

To display the digit "3" it is necessary to apply a logical unit to the input D0 and D1. If you give a signal to D0 and D2, the number "5" will be displayed(fig. 6).


Fig. 6.

Here is an expanded table, in which we see not only the expected figure, but also those segments (a - g) that will make up this figure.


Table 2.

Auxiliary are 1, 6 and 7th pins of the microcircuit (S, M, K, respectively).

In the diagram (Fig. 6), the 6th terminal "M" is grounded (to the minus power supply) and there is a positive voltage at the output of the microcircuit for working with an indicator with a common cathode. If an indicator with a common anode is used, then one should be applied to the 6th output.

If a logical unit is applied to the 7th pin "K", then the indicator sign is extinguished, zero enables indication. In the circuit, this pin is grounded (to the minus power supply).

A logical unit (plus power supply) is fed to the first output of the decoder, which allows the converted code to be displayed on the indicator. But if you apply a logical zero to this pin (S), then the inputs will stop receiving the signal, and the current displayed sign will freeze on the indicator.

It is worth noting one interesting thing: we know that the D0 toggle switch includes the number "1", and the D1 toggle switch includes the number "2". If you press both toggle switches, the number 3 will be displayed (1 + 2 = 3). And in other cases, the indicator displays the sum of the digits that make up this combination. We come to the conclusion that the decoder inputs are well thought out and have very logical combinations.

You can also watch the video for this article.

Or thermometers with large numbers, it is difficult to find suitable indicators (such as ALS), and sometimes you need a size that is not available at all. For this, each element (segment) of numbers is often assembled from several ordinary round LEDs. We offer a more perfect and convenient version of such a solution, using the 74HC595 microcircuit. The project resulted in signs of almost 10 centimeters in height, which can be seen over long distances. If necessary, a large number of digits can be serially connected to each other through a dedicated connector.

Schematic diagram

This circuit is a one digit 7-segment display controller using a large set of 5 LEDs per segment and a shift register to easily control the microcontroller through the input. Each of the LEDs used in this project are 5mm in diameter.

The ULN2003 IC helps amplify the current flowing through the LEDs. Resistors R1 - R8 are current limiting resistors for LEDs, which are connected in series in the circuit.

Good day! After my long and forced break, we will continue mastering the Arduino Programming course. In one of our previous lessons, we already worked with a sequence of LEDs, now it's time to move on to the next step of the training. The topic of today's article will be the 7-segment indicator.

The introduction to the 7-segment display will be divided into two parts. In the first part, we will superficially "go over" the theoretical component, work with the hardware and write simple programs.

Last time we worked with a sequence of 8 LEDs, today there will also be 8 (7 - LED strips and 1 point). Unlike the previous sequence, the elements of this set are not lined up (one after another), but are arranged in a certain order. Due to this, using only one component, you can display 10 digits (from 0 to 9).

Another significant difference that makes this indicator stand out against the background of simple LEDs. It has a common cathode (or rather, two equivalent legs 3 and 8, to which the cathode is connected). It is enough just to connect one of the cathodes to ground ( GND). All indicator elements have individual anodes.

A small digression. All of the above applies to 7-segment displays with a common cathode. However, there are indicators with a common anode. Connecting such indicators has significant differences, so please do not confuse "sinful with righteous". It is necessary to clearly understand what type of seven-segment player you have in your hands!

In addition to the differences between simple LEDs and 7-segment displays, there are similarities. For example: indicators, like LEDs, can be mounted in a row (sequence) to display two-, three-, four-digit numbers (digits). However, I do not advise you to bother too much about the self-assembly of segment sets. On sale "next to" single-digit indicators, multi-digit ones are also sold.

I hope you haven't forgotten about the need to use current limiting resistors when connecting LEDs. The same applies to indicators: each element of the indicator must have its own resistor connected. 8 elements (7 + 1) - 8 resistors.

I had at hand a seven-segment device marked 5161AS (common cathode). Pinout of contacts:



Schematic diagram

As I said earlier, in order to turn on the "A" segment, connect the "ground" to any common contact (3 or 8), and supply 5V power to pin 7. If the indicator is with a common anode, then we supply 5V to the anode, and “ground” to the output of the segment!

Let's put together a test bench. We connect the wires in order, starting with the first leg, which goes to the 2nd pin of the Arduino board. Connect the ground to the 8th output of the indicator.

After the stand is assembled, you can start writing the firmware.

To check the indicator, let's run the written program. Select the element "A" and blink it.


Now let’s blink the number 2. To do this, turn on a few more elements.

To display one digit, you need to write n-number of lines of code. Difficult, don't you think.

There is another way. In order to display any digit on the indicator, you first need to represent it in the form of a certain sequence of bits.

Table of correspondence.

If the display has a common anode, then 1 must be replaced by 0, and 0 by 1!

The hex column is a byte representation of a digit (we'll talk about this in more detail in the second part).

A number in binary notation is written as follows: 0b00000000. 0b- binary system. Zeros mean all LEDs are off.

When connecting, we used pins from 2 to 9. To turn on the 2 output, write a unit = 0b00000001. The fourth bit from the right is responsible for the point. The very last bit is responsible for the line in the middle of the indicator.

Let's write an example of outputting the digit 0.

To reduce the number of typed lines, we will use a loop that allows us to “iterate over” all 8 bits. Variable Enable_segment the value of the bit to be read is assigned. After that, the current pin is set to the appropriate mode ( presence or absence of signal).

Note: the bitRead () function reads the state of the specified bit and returns the state value (0 or 1).bitRead (x, n)where, x is the number, the bit of which must be read; n is the number of the bit, the state of which must be read. Numbering begins with the least significant bit (rightmost) numbered 0.

And at the end of the first part, we will write a small counter.