DIY LED running lights - circuit based on an ATtiny2313 microcontroller. Running lights on LEDs Running lights on atmega8 with LEDs

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

The simplest circuit of 12 volt running lights

On the Internet, the most common one is a simple “old-fashioned” circuit using a meter and a generator (Figure 1).

Picture 1

The operation of the circuit is extremely simple and clear. The generator is built on the basis of a pulse timer, and the counter performs its main function - it counts pulses and produces the corresponding logical levels at its outputs. LEDs are connected to the outputs, which light up when a logical one 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 resistor R1 and capacitor C1.

The names of the microcircuits are Soviet, but they have easily accessible imported analogues. If you need to increase , then to increase the current you need to connect them through buffer transistors, because The meter outputs themselves have a fairly modest load capacity.

Connecting the “brains”

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

The schemes turn out to be more cumbersome and expensive. The MK allows you to flexibly control individual LEDs or their groups, store many lighting effect programs 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.

Let's consider the basic principle of constructing a circuit of running lights 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 LEDs to the I/O pins (Figure 2). These MK pins are capable of providing a current of 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 current value is calculated using the formula I=(U power -U LED)/R. The MK power supply and reset circuits are not shown in the figure so as not to clutter the circuit. These circuits are standard and are performed in accordance with the manufacturer's recommendations in the Data Sheet. If it is necessary to precisely set time intervals (the duration of ignition of individual LEDs or a complete cycle), you can use a quartz resonator connected to pins 4 and 5 of the MK.

If there is no such need, you can get by with a built-in RC generator, assign the freed pins 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 you can switch the running fire modes.

Figure 2

That's all for hardware. Then everything 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 a microcontroller before, but if you are too lazy or don’t have time to study programming, and really want to “revive” a running fire on LEDs, you can always download ready-made software.

A brake light serves to warn drivers of vehicles coming from behind that the driver is braking. with LEDs is very important, since during heavy traffic it is sometimes unclear whether the brake light is on or the lights are on. Running lights on LEDs attract additional attention from drivers, and the advertising effect will work. Thus, rear traffic participants will have additional time to react to braking (video author - evgenij5431).

Next, we’ll look at how to make an LED brake light with your own hands. Below is a detailed description of the scheme for creating changing lights. To implement dynamic lights, red LED lamps are used, which are switched on in pairs. After switching on, the lights in the center light up first, and then spread out from the center to the edges.

LEDs are controlled in pairs. LED lights HL1 and HL2 light up first, then HL3 and HL4. After the previous pair of lights goes out, the next one lights up. The bulbs are lit in pairs until the last pair HL11 and HL12. When the last pair lights up and goes out, the process repeats.

The LED lights will run as long as power is supplied to the input of the circuit.

The first LEDs are in the middle, the rest are arranged in pairs at equal distances to the edges. The algorithm of running fire from the center of the brake light to its edges has actually been implemented. You can get creative and come up with a different algorithm according to which each light bulb will blink.

Description of the electrical circuit

For the practical implementation of the above circuit, a multivibrator is required, the basis of which is the DD1 K561LA7 microcircuit and the DD2 K561IE8 counter microcircuit. Using the first microcircuit, pulses are created that turn on the LEDs. Thanks to the counter chip, power is switched for certain groups of LED lights.

Transistors VT1-VT2 are used as amplifiers, which open due to the voltage coming from the meter leg. Capacitors C2 and C3 play the role of power filters. By selecting the capacitance of capacitor C1, you can decrease or increase when the LEDs are switched. To mount the LED stop structure, a printed textolite board with dimensions of 37 x 50 mm is best suited.

This design requires minimal current and hardly heats up. This makes it possible to make the assembly that controls the LEDs in the same brake light housing. In this case, the power can be connected to the removed standard lamp.

Below is a diagram that is easy to implement.


According to this group diagram, to the outputs Out1 - Out3. How many LEDs there will be in total depends on the power supply. If there are too many light bulbs, then you need to take into account what kind of power is supplied to the circuit from the on-board network, which is 12 V. KT972A transistors must be protected using heat sinks. If desired, you can replace the KT972A transistor with a pair of less powerful KT315 transistors and a powerful KT815 element or similar elements.

Parts DD1.1 and DD1.2 included in the circuit play the role of a generator, which serves to supply pulses to the input of the K561IE8 counter. Similar to the previous case, control pulses for transistors are generated using a counter. When selecting resistance R6, its nominal value should be at least 1 kOhm. You can use a printed circuit board to create running lights. Thanks to the hanging installation, the design is miniature in size.


Naturally, the LED bulbs are placed directly on the brake light panel, since the circuit board is too small to fit LEDs on it. You should remember about reliability, so it is necessary to ensure maximum protection of electrical connections and contacts from moisture. To provide power to the additional stop, it is connected to the wiring of the main stop in the trunk. It is possible to connect lighting devices to the board.

If everything is assembled correctly, no additional configuration is required. Diode brake lights begin to work immediately after connection.

Conclusion

Having at least a little experience in electrical installation work, using the diagrams given in the article, you can tune your car yourself by making a running light on the LEDs for the brake light. If you don’t have enough experience and knowledge to implement running lights yourself, you can buy factory brake lights with this function. Such devices have more functions.

Depending on the algorithm, the running LEDs can light up during an emergency stop, during braking, if the driver reverses, etc. To install factory brake lights, no special signs are needed, so even a novice driver can handle their installation.

The first amateur radio version of the LED running lights circuit is built on the already proven ATtiny2313 microcontroller. The firmware contains twelve possible combinations of various lighting effects, such as smoothly changing lights, shimmering shadow, growing fire, etc. Below we consider designs without a microcontroller, but on a somewhat outdated element base.


This design is capable of controlling thirteen LEDs, which are connected through current-limiting resistors directly to the ports of the ATtiny2313 microcontroller.

Toggle switch SA3 can be used to switch between possible operating options. Using toggle switches SA1 and SA2, you can adjust the speed of movement of the lights or the blinking frequency of each LED separately. All this depends on the position of the SA4 toggle switch. In the upper position, it regulates the speed of the running lights, and in the lower position, the blinking frequency.

When installing LEDs in a line, you must follow the order shown in the figure from HL1 to HL11. The ATtiny2313 microcontroller is clocked from the existing internal oscillator with a frequency of 8 MHz.

In the proposed device, the sequence of lighting the garlands to create the effect is carried out using three electromagnetic relays by using different voltage values ​​supplied to the circuit of their windings


When supply voltage is supplied from the network, it is supplied to the primary winding of the network transformer T1, to the secondary winding of which a rectifier is connected, assembled according to a circuit with doubling the voltage on diodes VD1, VD2 and capacitors C2, SZ. The effective voltage of the secondary winding of the transformer is 13.5 B. Therefore, the rectified voltage as a result of doubling turns out to be about 32 V. In the initial state, transistor VT1, connected in a circuit with a common collector, is locked, since capacitor C1 is discharged. In this case, all relays are de-energized and the HL1 garland is on.

The charging of capacitor C1 begins. As the capacitor charges, the voltage across it and at the emitter of the transistor increases. When it reaches a value at which the current in the short-circuit relay winding exceeds the operation current, contacts K3.1 will switch, lamps HL1 will go out, and lamps HL2 will light up. A further increase in the voltage at the emitter of the transistor triggers relay K2, which, using contacts K2.1, turns off the lamps HL2 and turns on HL3. Finally, a continued increase in voltage causes relay K1 to operate, whose contacts K1.1 discharge capacitor C1.

As a result, the transistor is locked, all relays are de-energized, lamps HL1 are lit, and contacts K1.1 are opened. Then the capacitor begins to charge again and the process repeats. The speed of charging the capacitor and moving the running flame can be adjusted by variable resistor R2. The vertical scanning output transformer TVK-110LM from black-and-white TVs is used as a network transformer. Of the two secondary windings, the one whose resistance is 1 ohm is used. The author proposed using electromagnetic relays of the RES9 type.

However, not a single relay of this type is designed for switching 220 V alternating voltage (only 115). Therefore, we advise you to install the RES10 relay, passport RS4.524.302 (RS4.529.031-03 according to GOST 16121-86). Their response current is 22 mA, and the winding resistance is 630 Ohms. Thus, device K3 will operate at an emitter voltage of VT113.9 V. Thanks to the inclusion of resistors R4 and R5, the remaining two relays operate at a higher voltage at the emitter of the transistor. Relay K2 operates at a voltage of 20.5 V, and relay K1 - at a voltage of 23.3 V. The maximum permissible voltage on the winding of a relay of this type is 36 V. Its contacts allow switching alternating voltage with a frequency of 50 V and a voltage of up to 250 V at an active current loads up to 0.3 A. Hence, each garland can be assembled from 9 incandescent light bulbs of type MH26-0D2 connected in series, designed for a rated voltage of 26 V and a current of 0.12 A.

The design is a multivibrator consisting of three stages. The transistors are unlocked and the LEDs included in their circuits are ignited sequentially one after the other.

When assembling the device, it is advisable to select transistors with the highest possible current gain and capacitors with minimal leakage.

Scheme of running lights on K561LA7 and K561IE8 microcircuits

The circuit is quite simple and consists of two microcircuits and a dozen LEDs that light up one by one.

Potentiometer R2 is used to adjust the speed of the running lights.

The homemade LED running lights circuit presented in this article is based on a fairly popular one. Up to 12 programs of various lighting effects are stored in the program memory, which can be selected as desired. This includes running fire, running shadow, growing fire, and so on.

This automatic lighting effects machine allows you to control thirteen LEDs, which are connected through current-limiting resistors directly to the ports of the ATtiny2313 microcontroller. As mentioned above, 11 different independent combinations of light patterns are hardwired into the microcontroller’s memory, and it is also possible to sequentially cycle through all 11 combinations once, this There will already be a 12th program.

Button SA3 allows you to switch between programs.

Using the SA1 and SA2 buttons, you can control the speed of movement of the lights or the flickering frequency of each LED (from constant glow to light flickering). It all depends on what position the SA4 switch is in. When the switch SA4 is in the upper position according to the diagram, the speed of the running lights is regulated, and in the lower position the flickering frequency is adjusted.

When installing LEDs in a line, you should follow the same order as numbered in the diagram from HL1 to HL11.

The ATtiny2313 microcontroller is clocked from an internal oscillator with a frequency of 8 MHz.

Video of work: LED running lights

(1.1 Mb, downloaded: 3,650)

Among dozens of different LED flashers, a worthy place is occupied by a circuit of running lights on LEDs, assembled on an ATtiny2313 microcontroller. With its help, you can create various lighting effects: from a standard alternating glow to a colorful smooth increase and decrease of fire. Let's look at one of the options for how to make a running fire on LEDs controlled by the ATtiny2313 microcontroller with your own hands, using a specific example.

Heart of running lights

It is a well-known fact that Atmel AVR microcontrollers have high performance characteristics. Their versatility and ease of programming allow you to implement the most extraordinary electronic devices. But it’s better to start getting acquainted with microcontroller technology by assembling simple circuits in which the input/output 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. ATtiny2313 is available in PDIP and SOIC packages and has the following technical characteristics:

  • 32 8-bit general purpose working registers;
  • 120 operations performed in 1 clock cycle;
  • 2 kB of in-system flash memory that can withstand 10 thousand write/erase cycles;
  • 128 bytes of in-system EEPROM that can withstand 100 thousand 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 functions.

Energy parameters depend on the 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 µA in active mode at a frequency of 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 properties. A complete list of ATtiny2313 capabilities 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 there is an ATtiny2313 microcontroller, with LEDs connected to its 13 pins. In particular, to control the glow, port B (PB0-PB7), 3 pins of port D (PD4-PD6), as well as PA0 and PA1, which remained free due to the internal generator used, are fully used. The first pin PA2 (Reset) does not actively participate in the circuit and is connected to the MK power circuit through resistor R1. The plus of the 5V power supply is supplied to the 20th pin (VCC), and the minus is supplied 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 pin, LEDs rated for a rated current of no more than 20 mA should be connected. These can be either super-bright LEDs in a DIP package with a transparent lens, or smd3528. There are a total of 13 of them in this pattern of running lights. Resistors R6-R18 act as current limiters.

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

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

Printed circuit board 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 pitch of 2.5 mm will be sufficient. In this case, the LEDs can be placed both on the board and on a separate line, connecting them to the breadboard with flexible wires.

If LED running lights are intended 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 will need a one-sided textolite measuring 55*55 mm, as well as radio elements.