Portal for car enthusiasts

Running LED lights. Running lights with program selection Running lights with LEDs

Here we will talk about how to make running lights on LEDs with your own hands. The device circuit is simple and is implemented on the so-called hard logic logic chips - TTL series chips. The device itself includes three microcircuits.

The scheme consists of four main nodes:

    rectangular pulse generator;

    counter;

    decoder;

    indication devices (16 LEDs).

Here is the schematic diagram of the device.

The device works as follows. After power is applied, the LEDs HL1 - HL16 start to light up and go out in sequence. Visually, this looks like the movement of a light from left to right (or vice versa). This effect is called "running fire".

Rectangular pulse generator implemented on a chip K155LA3. Only 3 elements 2I-NOT of this microcircuit are involved. Rectangular pulses are taken from the 8th output. Their frequency is low. This allows visible switching of the LEDs.

In fact, the generator on the elements DD1.1 - DD1.3 sets the rate of switching of the LEDs, and, consequently, the speed of the "running fire". If desired, the switching speed can be adjusted by changing the values ​​​​of the resistor R1 and C1.

It is worth warning that with other ratings of R1 and C1, generation can be disrupted - the generator will not work. So, for example, the generator refused to work with the resistance of the resistor R1 equal to 1 kOhm. Therefore, it is possible to change the values ​​​​of C1 and R1 only within certain limits. If the generator does not start, one of the LEDs HL1 - HL16 will be constantly lit.

The counter on the DD2 chip is needed to count the pulses coming from the generator and supply the binary code to the K155ID3 decoder. According to the scheme, conclusions 1 and 12 of the microcircuit counter K155IE5 connected. In this case, the microcircuit will count the input C1(vyv. 14) pulses and issue at the outputs (1, 2, 4, 8) a parallel binary code corresponding to the number of received pulses from 0 to 15. That is, at the outputs (1, 2, 4, 8) K155IE5 microcircuits sequentially replace each other other 16 code combinations (0000, 0001, 0010, 0011, 0100, etc.). Further, the decoder is included in the work.

Feature of the microcircuit K155ID3 is that it converts a binary four-bit code into a logic zero voltage, which appears on one of the 16 corresponding outputs (1-11, 13-17). I think this explanation is not clear to everyone. Let's try to figure it out.

If you pay attention to the image of the K155ID3 chip, you will notice that it has 16 outputs. As you know, in a binary code of four characters, 16 combinations can be encoded. It won't work anymore. Recall that using a four-digit binary code, you can encode decimal digits from 0 to 15 (16 digits in total).

This is easy to check if you raise 2 (the base of the number system) to the power of 4 (the number of digits or digits in the code). Get 2 4 = 16 possible combinations. Thus, when a binary code is received at the inputs of the K155ID3 chip in the range from 0000 before 1111 at the exits 0 - 15 a logical zero will appear (the LED will light up). That is, the microcircuit converts the binary number to a logical zero on the output, which corresponds to the binary number. In fact, this is such a special decoder from binary to decimal.

Why does the LED light up? The output is a logical zero. The diagram shows that the anodes of all LEDs are connected to the power plus, and the cathodes to the outputs of the K155ID3 microcircuit. If the output is "0", then for the LED it is, as it were, a minus of the power supply and through it pn current flows - the LED lights up. If the output is a logical unit "1", then the current through the LED will not go.

If everything that was written is still not clear to you, then you should not be upset. Just assemble the proposed circuit, for example, on a solderless breadboard and enjoy the operation of the device. The circuit has been tested and is working properly..

If you already have a stabilized power supply (for example, such as this one), then the integrated stabilizer DA1 ( KR142EN5A) and strapping elements (C2, C3, C4) do not need to be installed in the circuit.

All ratings of elements (capacitors and resistors) can have a spread ±20%. This will not affect the operation of the device. LEDs HL1 - HL16 can be of any color (red, blue, green) with an operating voltage of 3 volts. You can, for example, use bright red LEDs with a diameter of 10 millimeters. "Running fire" with such LEDs will look very impressive.

Among the dozens of various LED flashers, a worthy place is occupied by the running lights circuit on LEDs, assembled on the ATtiny2313 microcontroller. With its help, you can create various lighting effects: from a standard alternate glow to a colorful smooth rise and fall of fire. One of the options on how to make a running fire on LEDs controlled by the ATtiny2313 MK with your own hands, let's look at a specific example.

Heart of running lights

The fact that Atmel AVR microcontrollers have high performance is a well-known fact. Their versatility and ease of programming allows you to implement the most unusual electronic devices. But it is better to start acquaintance with microcontroller technology from assembling simple circuits in which I / O ports have the same purpose.

One such scheme is running lights with program selection on the ATtiny2313. This microcontroller has everything you need to implement such projects. At the same time, it is not overloaded with additional functions for which you would have to overpay. The ATtiny2313 is available in a PDIP and SOIC package and has the following specifications:

  • 32 8-bit general-purpose working registers;
  • 120 operations performed in 1 clock cycle;
  • 2 KB of internal flash-memory withstanding 10,000 write/erase cycles;
  • 128 bytes of internal EEPROM with 100,000 write/erase cycles;
  • 128 bytes of built-in RAM;
  • 8-bit and 16-bit counter/timer;
  • 4 PWM channels;
  • built-in generator;
  • universal serial interface and other useful features.

Energy parameters depend on modification:

  • ATtiny2313 - 2.7-5.5V and up to 300 µA in active mode at a frequency of 1 MHz;
  • ATtiny2313A (4313) - 1.8-5.5V and up to 190 uA in active mode at 1 MHz.

In standby mode, power consumption is reduced by two orders of magnitude and does not exceed 1 μA. In addition, this family of microcontrollers has a number of special features. A complete list of ATtiny2313 features can be found on the manufacturer's official website www.atmel.com.

Scheme and principle of its operation

In the center of the circuit diagram is the ATtiny2313 MK, to the 13 pins of which LEDs are connected. In particular, port B (PB0-PB7), 3 outputs of port D (PD4-PD6), as well as PA0 and PA1, which remained free due to the applied internal generator, are fully used to control the glow. The first output PA2 (Reset) does not take an active part in the circuit and is connected to the MK power circuit through the resistor R1. The plus of the 5V supply is supplied to the 20th pin (VCC), and the minus to the 10th pin (GND). To eliminate interference and malfunctions in the operation of the MK, a polar capacitor C1 is installed on the power supply.
Taking into account the small load capacity of each output, LEDs should be connected, designed for a rated current of not more than 20 mA. It can be either super-bright led in a DIP package with a transparent lens, or smd3528. In total there are 13 of them in this scheme of running lights. Resistors R6-R18 act as current limiters.

The numbering of the LEDs on the diagram is indicated in accordance with the firmware.

Through the digital inputs PD0-PD3, as well as using the buttons SB1-SB3 and switch SA1, the operation of the circuit is controlled. All of them are connected through resistors R2, R3, R6, R7. At the program level, there are 11 different variations of LED blinking, as well as a sequential enumeration of all effects. The program selection is set by the SB3 button. Within each program, you can change the speed of its execution (flashing LEDs). To do this, switch SA1 is moved to the closed position (program speed) and the speed increase (SB1) and decrease (SB2) buttons achieve the desired effect. If SA1 is opened, then the buttons SB1 and SB2 will adjust the brightness of the LEDs (from weak flicker to glow at rated power).

PCB and Assembly Parts

Especially for beginner radio amateurs, we offer two options for assembling running lights: on a breadboard and on a printed circuit board. In both cases, it is recommended to use a chip in a PDIP package installed in a DIP-20 socket. All other parts are also in DIP packages. In the first case, a 50x50 mm breadboard with a 2.5 mm pitch will suffice. In this case, the LEDs can be placed both on the board and on a separate line by connecting them to the breadboard with flexible wires.

If running lights on LEDs are supposed to be actively used in the future (for example, in a car, bicycle), then it is better to assemble a miniature printed circuit board. To do this, you need a one-sided textolite with a size of 55 * 55 mm, as well as radio elements.

One option for using solid-state light sources for decorative purposes is LED running lights. There are many ways to make this simple device. Let's consider some of them.

The simplest circuit of running lights for 12 volts

On the Internet, the most common is a simple "old-fashioned" scheme using a counter and a generator (Figure 1).

Picture 1

The operation of the circuit is extremely simple and understandable. The generator is built on the basis of the pulse timer, and the counter performs its main function - it counts the pulses and outputs the corresponding logic levels at its outputs. LEDs are connected to the outputs, which light up when a logical unit appears and, accordingly, go out at zero, thereby creating the effect of running lights. The switching speed depends on the frequency of the generator, which in turn depends on the values ​​​​of the resistor R1 and capacitor C1.

The names of the microcircuits are Soviet, but they have readily available imported counterparts. If it is necessary to increase, then to increase the current, you need to connect them through buffer transistors, because. the counter outputs themselves have a rather modest load capacity.

We connect "brains"

To obtain more complex effects, the circuit must be built on a microcontroller (hereinafter MK). Although there are many schemes of running lights on the microcontroller on the Internet, built on ordinary logic, implementing a different sequence of LED ignition, their use is unjustified and impractical these days.

The schemes are more cumbersome and expensive. MK also allows you to flexibly control individual LEDs or their groups, store many programs of lighting effects in memory and, if necessary, alternate them according to a predetermined sequence or by an external command (for example, from a button). In this case, the circuit turns out to be very compact and quite cheap.

Consider the basic principle of building a running lights circuit on LEDs using a microcontroller.

For example, let's take the ATtiny2313 chip - an 8-bit MK costing about $ 1. The simplest circuit can be implemented by directly connecting the LEDs to the I/O pins (Figure 2). These MK pins are capable of providing up to 20 mA, which is more than enough for indicator LEDs.

The required current value is set by resistors connected in series with the diodes. The value of the current strength is calculated by the formula I \u003d (U pit -U LED) / R. The power supply and reset circuits of the MK are not shown in the figure so as not to clutter up the circuit. These chains are standard and are made in accordance with the manufacturer's recommendations given in the Data Sheet. If it is necessary to accurately set the time intervals (the ignition duration of individual LEDs or a complete cycle), you can use a quartz resonator connected to terminals 4 and 5 of the MC.

If there is no such need, you can get by with the built-in RC generator, and assign the freed outputs as standard outputs and connect a couple more LEDs. The maximum number of LEDs that can be connected to this MK is 17 (Figure 2 shows an option for connecting 10 LEDs). But it is better to leave one or two outputs for the control buttons, so that it is possible to switch the running fire modes.

Figure 2

That's all for the hardware. Then it all depends on the software. The algorithm can be anything. For example, you can store several modes in memory and set the repetition interval for each, or connect two buttons: one to switch modes, the other to adjust the speed. Writing such a program is a fairly simple task even for a person who has never worked with MK before, but if you are too lazy or have no time to study programming, but you really want to “revive” the running fire on the LEDs, you can always download ready-made software.

Currently, the Internet is full of schemes with running lights. In our article, we will consider the simplest circuit assembled on two popular microcircuits: the 555 timer and the CD4017 counter.

We will collect according to this scheme (click on it to enlarge):

The scheme is not very complicated, as it seems at first glance. So, to assemble it, we need:

1) three resistors with a nominal value: 22 KiloOhm, 500 KiloOhm and 330 Ohm

2) NE555 chip

3) CD4017 chip

4) 1 microfarad capacitor

5) 10 Soviet or Chinese 3 Volt LEDs

Pinout 555


Currently, most microcircuits are produced in the so-called DIP package. DIP- from English. - Dual In-line Package, which literally means “two-row assembly”. The pins of the microcircuits in the DIP package are in opposite directions from each other. The spacing between pins is mostly 2.54 mm, but there are also exceptions. Depending on how many pins a microcircuit has, this is how the case for this microcircuit is called. For example, a 555 chip has 8 pins, therefore, its package is called DIP-8.

In red circles, I marked the so-called “keys”. These are special labels with which you can find out the beginning of the marking of the microcircuit pins.


The first conclusion is just next to the key. Count goes counterclockwise


So, on the NE555N chip, the pins are numbered like this:


All the same applies to the CD4017 chip, which is made in a DIP-16 package.


The numbering of the conclusions comes from the lower left corner.

Device assembly

Collecting our running lights. On the breadboard, they look something like this:


Here is the circuit in action:

The whole circuit works in this way: a rectangular pulse generator is assembled on the 555 timer. The pulse repetition rate depends on the resistor R2 and capacitor C1. Further, these rectangular pulses are counted by the CD4017 counter chip and, depending on the number of rectangular pulses, it outputs signals to its outputs. When the counter in the chip overflows, everything starts over. The LEDs blink in a circle as long as there is voltage on the circuit.

Keep in mind that there are a lot of analogues of 555 and CD4017 microcircuits. There are even Soviet counterparts. For the 555 timer, this is KR1006VI1, and for the counter chip K561IE8.

Creating a strip of running LEDs is a great way to use a light source for decorative purposes. It is quite simple to make a running fire with your own hands, especially since in the end the product can have different effects, including the attenuation of light and the alternate operation of the elements.

ATtiny2313 microcontroller for running lights

This device belongs to the Atmel brand AVR microcontroller series. It is under his control that a running light tape is most often made, since the operational characteristics of the model are quite high. Microcontrollers are easy to program, multifunctional and support the implementation of various electronic devices.

ATtiny2313 is made according to a simple scheme, where the port for output and input has an identical value. It is very easy to choose a program (one of 12) on such a microcontroller, because it is not overloaded with unnecessary options. The model is available in two cases - SOIC and PDIP, and each option has identical characteristics:

  • 8-bit general registers in the amount of 32 pieces;
  • the possibility of 120 operations per clock cycle;
  • 2 kB flash memory inside the system with support for 10,000 erase and write cycles;
  • 128-byte internal EEPROM with support for 100 thousand cycles;
  • 128 bytes of built-in RAM;
  • 4 PWM channels;
  • counter-timer for 8 and 16 bits;
  • built-in generator;
  • user-friendly interface and other functions.

The microcontroller has two types in accordance with the energy parameters:

  • the classic model ATtiny2313 has a voltage of 2.7 to 5.5 V and a current of up to 300 μA at a frequency of 1 MHz in active mode;
  • the ATtiny2313A (4313) variant has 1.8-5.5 V and 190 µA at the same frequency.

In standby mode, the device has a power consumption of no more than 1 μA.

As already mentioned, the memory of the microcontroller is equipped with 11 combinations of light circuits, and the ability to select all combinations of LEDs in sequence is 12 programs.

Scheme of running lights and the principle of its operation

The created scheme of running lights on LEDs is based on the placement of the microcontroller in the center. All its output ports are connected to LEDs:

  • port B or PB0-PB7 is used entirely for glow control;
  • three outputs from port D (PD4-PD6) are maximally involved;
  • PA0 and PA1 also work, since they are freed by a realizable internal oscillator.

Pin 1 - PA2 or Reset - is not an active link in the circuit, so the resistor R1 is connected to the ATtiny2313 power circuit. The positive part of the 5 V supply goes to pin #20 - VCC, and the negative part goes to #10 (GND). A polar capacitor C1 is installed to prevent malfunctions and dampen interference in the operation of the MK.

Given that each output has a low load capacity, it is advisable to put LEDs on them with a rating of up to 20 mA.

Both classic smd3258 and high-brightness LEDs in a DIP package are suitable. There should be 13 in total. The current limit function is assigned to the resistors R6-R18.

The operation of the circuit is controlled by means of switch SA1, buttons SB1-SB3 and digital inputs PD0-PD3, which are connected through resistors R2, R3, R6 and R7. This design allows you to turn on the blinking of the LEDs in 11 different modes, setting a specific program with the SB3 button. And with the help of the SA1 switch, the flashing speed is changed. For this:

  1. SA1 is moved to the closed position.
  2. The speed is changed with the buttons SB1 (acceleration) and SB2 (deceleration).

Please note that when the switch is opened with these buttons, the brightness of the LEDs changes from a barely noticeable flicker to maximum power.

Assembly Options

There are two affordable and relatively simple options for assembling running lights: on a printed circuit board or on a breadboard. In both cases, it is desirable to take as a basis the circuit in the PDIP package on the DIP-20 socket. In this case, it is necessary that the remaining components also be in DIP packages.

When assembling on a breadboard, a 50x50mm model in 2.5mm increments will suffice. LEDs can be placed not only on the board itself, but also on an external line by connecting them to the circuit using flexible wires.

A miniature printed circuit board is a more practical option for those cases when do-it-yourself running lights on LEDs are made for active further operation.

For example, when they are mounted on a bicycle or car. In this case, you will need the following components:

  • one-sided textolite 55×55 mm;
  • capacitor 100 uF-6.3V;
  • DD1 - Attine 2313;
  • resistor 10 kOhm-0.25 W ± 5% (R1);
  • 17 resistors 1 kOhm-0.25 W ± 5% (R2-R18);
  • 13 LEDs with a diameter of 3 mm (color is not important);
  • 3 buttons KLS7-TS6601 or equivalent (SB1-SB3);
  • sliding switch ESP1010 (SA1).

For radio amateurs with practical experience in assembling printed circuit boards, it is better to take an Attine2313 SOIC with SMD resistors for this circuit. Due to this, the overall dimensions of the circuit will be reduced by almost two times. You can also install super-bright SMD LEDs as a separate unit.

This 12 volt running light circuit is widely known on the net, as it has a very simple and understandable design. The pulse timer acts as a mode generator, and the counter, counting them, supplies the corresponding logical levels to the outputs. The LED element connected to each output lights up at a logic one and goes out at zero. The effect of running lights is created by sequential flickering. The speed of "running" is set by the generator, the operation of which is controlled by the nominal parameters of the capacitor C1 and resistor R1.

The brightness of the LEDs is enhanced by increasing the supplied current, but for this they must be connected through buffer transistors. The fact is that the outputs of the counter do not have a high load capacity.

This old scheme shows the Soviet designations of components and microcircuits, but nowadays it is not difficult to find foreign-made analogues corresponding to them.

Firmware