Home Heating We install LEDs in the car's turn signals. Running turn signals on WS2812 tape and Arduino Dynamic turn signal

We install LEDs in the car's turn signals. Running turn signals on WS2812 tape and Arduino Dynamic turn signal

Or for garlands, etc.

I once ordered a KIT DIY kit from AliExpress - LED running lights (). I was attracted by the ridiculous price of 63 rubles and the opportunity to practice soldering SMD radioelements.



This designer consists of a printed circuit board measuring 20x55mm and, accordingly, a set of necessary radio components. The installation location of all components and their ratings are indicated on the board, so there are no particular difficulties with installation.

The entire manufacturing process and operation of the circuit can be seen in the video:

List of tools and materials
-a set of running lights on a CD4017 or K561IE8 chip ();
-screwdriver;
- scissors;
- soldering iron;
-cambric;
- rechargeable battery from a cell phone;
-12V power supply;
- connecting wires;
- foil PCB for printed circuit board;
- K561TM2 microcircuits;
-resistors;
- transistors KT815 (or analogues);
-LEDs.

Step one. Wiring out the printed circuit board from AliExpress.

All that is needed is to solder the components of the kit onto the board. Due to the miniature size of SMD radioelements, I used a “third hand” with a magnifying glass. First, I soldered resistors, capacitors and other components of the circuit except microcircuits. At the end we solder the microcircuits and LEDs.

This circuit operates from 3 to 15V. The pulse generator is assembled on the NE555 chip, then the pulses are sent to a decimal counter with a decoder - a CD4017 (K561IE8) chip, to the ten outputs of which LEDs are connected through current-limiting resistors. The switching speed of the running lights is regulated by a trimming resistor.

Design diagram.


My circuit worked the first time I turned it on.

Step two. Modernization of the running lights circuit.
Later during the experiments, the CD4017 chip failed. As a quick fix on the wires, I had to replace it with the domestic analogue K561IE8.
I wanted to get more interesting lighting effects of running lights. As a result, I assembled another printed circuit board with K561TM2 triggers and KT815 power switches. A pulse from each K561IE8 output is fed to the trigger input using the “latch” principle, that is, at the trigger output the signal remains constant until the reset pulse arrives from leg 11 of the CD4017(K561IE8) chip. 9 channels are switched on per cycle. Power switches based on KT815 transistors are designed to connect loads up to 1-1.5A. If you need to connect a more powerful load, then you need to replace the KT815 with more powerful transistors. Since I used four K561TM2 microcircuits, I got a circuit with eight channels. In this circuit, you can get 9 channels of LED control, but then you need to add another K561TM2 chip to the circuit by connecting one trigger (the K561TM2 chip consists of two triggers), and also add one transistor switch.

Scheme after modification..



To check the operation, I connected pieces of LED strip with three LEDs to each of the eight channels.


I replaced the 50 kOhm trimming resistor with a 470 kOhm one to expand the limits of pulse frequency adjustment. Found in

The designer of running lights from Aliexpress is a printed circuit board and a set of radio components. All you need to do is solder the components onto the board.

But you can get more interesting effects of running lights from it. For example, for car turn signals or brake lights, or just for garlands for a holiday.


This circuit can operate in the supply voltage range of 3 -15 Volts. The pulse generator is assembled on the NE555 chip, then the pulses are sent to a decimal counter with a decoder - a CD4017 (or K561IE8) chip, to the outputs of which LEDs are connected through current-limiting resistors.

The switching speed of the running lights is regulated by a trimming resistor. Add a circuit with triggers and output transistor switches. No need to program anything, etc. As a result, you can get more interesting lighting effects of running lights. We need to make another printed circuit board with K561TM2 triggers and KT815 power switches. A pulse from each K561IE8 output is fed to the trigger input using the “latch” principle, that is, at the trigger output the signal remains constant until the reset pulse arrives from pin 11 of the CD4017(K561IE8) chip. 9 channels are switched on per cycle.

Quite often, car owners strive to decorate them in a special way. One possible solution to this problem is the use of LED turn signals. In addition to this application, this semiconductor element can be used in car lighting, exterior design (for example, side lights).

Some go even further and install them inside the cabin to express more individuality. One example of such use would be at a door. When stopped, they turn on, the driver or passenger can easily leave the vehicle.

Video: DIY VAZ LED turn signals

Types of LEDs

An LED is a semiconductor radio component that begins to glow when exposed to electric current. The main element in them is silicon. Depending on the type of dopant used in this semiconductor element, the LED can change its light.

The most commonly used types of such microelectronic components are:

  1. Aluminum, gallium, and nitrogen are used as impurities. Depending on the concentration, the color range varies from blue to green.
  2. Based on indium, helium, phosphorus. Color can range from red to yellow.

Today, the semiconductor industry produces LEDs in all possible colors. Therefore, there are no problems with this.

One LED is unlikely to be able to illuminate the turn signal, but several can easily cope with this task

Based on power, they are divided into low-power and high-power. Power ones are designed for a current of more than 0.35 A. In turn, low-power ones operate up to this value.

Possible connection diagrams

Today, the most commonly used LEDs are:

  1. A similar connection is used to switch a long chain of LEDs (for example, along the perimeter of a car). A capacitor-type power supply is used as a voltage source. The current-limiting element in such a circuit is a capacitor. A diode bridge in combination with a filter (usually a set of resistor and capacitor) is used as an AC-to-DC converter. Be sure to install a protective resistor in series with the diode chain, which takes over the excess voltage.
  2. The second option is to connect LEDs into garlands of 3-6 pieces in series. Several such garlands can be connected in parallel to each other, depending on the power source. The role of the latter in this circuit is played by a stabilized power supply with a voltage of 12-24V. In such a circuit, it is also necessary to install a protective resistor in series with each garland.
  3. The last, third connection option is direct. In such a circuit, only a power diode can operate, which is designed for a current of more than 0.35A.

The LED has only two legs for connection - anode and cathode. The anode must be connected only to the positive pole of the power source. In turn, the cathode is to negative. If connected differently, this semiconductor element will not work.

Requirements for the performer and instrument

When carrying out any electronic installation, a tester (for taking measurements), a soldering iron, tweezers, and side cutters must be used (if these are not available, you can use pliers, which can also perform this task). To perform calculations and determine the required values, you will need a calculator. Consumable materials include fiberglass (a printed circuit board is made from it - the base for attaching this semiconductor element), solder, rosin, soldering flux and tsaponlak.

It will be difficult to make LED turn signals without a tester

Selection of the most suitable series of elements

The main parameters of any device in this series are the rated voltage. That is, the operating values ​​of these parameters at which the LED retains its original properties. The calculation is made according to Ohm's law for a section of the circuit. Each car has a current source with specified parameters - current and voltage. On the other hand, we have the characteristics of the required LED. The difference between the first and second values ​​will be the characteristics of the resistor that must be connected in series in the circuit. And knowing the parameters of the latter, the entire circuit can be assembled without much difficulty.

Let's carry out the calculation for the simplest circuit, which consists of a stabilized voltage source, an LED and a protective resistor. In other cases, the technique remains almost the same, but only due to the larger number of elements used, the calculation becomes more complicated.

For example, in a car there is a source whose values ​​are respectively 0.02A and 24V. Moreover, a constant voltage source (for example, a battery). The LED needs to receive 0.02A and 2V. Now we determine the value of the potential drop across the resistor:

UR= Upit-Ud,

where UR is the potential drop across the resistor, V

Upit – power source voltage, V

Ud – nominal (operating) potential drop across the diode, V

Using the formula given earlier, we get UR=24-2=22V. All elements of this circuit are connected to each other in series. As a result, the current does not branch off anywhere; at any point in the circuit it will be equal to 0.02A. As a result, we obtain the value of the resistor resistance according to Ohm’s law:

where R is the resistor resistance, Ohm

IR – current in the circuit, A

Substituting the necessary values, we get R=22/0.02=1100 Ohm. Next, we determine the second most important parameter of any resistor - power. It is determined by the formula:

The result is PR = 0.02 * 22 = 0.44 W. From the existing series of resistors, we select the nearest largest values ​​- 1.1 kOhm and 0.5 W. At this point the calculation can be considered complete - the parameters of all elements of the electrical circuit have been determined.

One example of using LEDs

One of the most common uses of these elements in cars is as a . Now let's look at how to make LED turn signals from regular ones.

The procedure is as follows:

  1. The most suitable connection scheme is selected
  2. The required LED is selected
  3. Next, all other radio components of the electrical circuit are calculated
  4. Based on the calculations performed, protective resistors and other components are selected
  5. Then a list of necessary radio components is compiled. With this list, you need to visit the nearest store of this profile and buy all the necessary equipment there.
  6. All necessary documentation is being developed (including a drawing of the printed circuit board and its installation drawing)
  7. Then you need to make a printed circuit board to mount radio components on it. To do this, a pre-designed pattern is applied to the fiberglass board using varnish. All necessary holes for mounting radio components are drilled. She is immersed in ferric chloride. After the design on the board is etched, it is removed. Wash with plain water. Then the protective layer is removed using a solvent. The next step is rinsing again with running water. And only after that it dries. Upon completion of all completed procedures, we receive a ready-made board for further work. Since there are only 4 turn signals, 4 boards must also be made.
  8. At the next stage, based on the diagram and the developed board drawing, all elements of the circuit are installed. Upon completion of assembly, all contacts must be opened with tsaponlak (it will provide the necessary insulation and protection of the circuit in case of moisture getting here)

  1. Then you need to dismantle the old turn signals and carefully disassemble them. And in such a way as not to damage it.
  2. The old lighting element (lamp) is completely turned off and removed.
  3. The joints where everything was previously filled with glue must be cleaned using a needle file and sandpaper. Then this joint is degreased with alcohol. Then all this is washed with water and should dry.
  4. New lighting elements are installed in place of the old lighting element. If necessary, minor design changes can be made to simplify the installation process.
  5. Then reassemble in reverse order. It is necessary to apply glue to the joint and glue the disassembled turn signal. Then you need to wait until the glue hardens. In the future, this turn signal is installed in the old place and the old wires are connected to it.
  6. The next step is to make changes to the . To do this, the old wires are broken and an additional stabilized power source is wedged into it (you can purchase it separately or make it yourself). Moreover, its output is set to an LED. The input is supplied with voltage from the contact group of the intermediate relay. It is most convenient to place this element in the dashboard of a car. At the final stage, you need to check the polarity of the connection visually. The anode must be connected only to the positive pole of the power source. In turn, the cathode is to negative. If connected differently, this semiconductor element will not work and may even fail.
  7. Then it is necessary to inspect the assembled circuit and compare it with the initial version for compliance.
  8. Next, power is supplied and the functionality of the circuit is checked. If everything is fine, then the installation is complete. Otherwise, it is necessary to find the cause of the malfunction and eliminate it.

Video: homemade turn signals

Conclusion

This article discusses how to make LED turn signals on your own. There is nothing complicated about this, and with sufficient qualifications and well-prepared preliminary work, it can be done without any problems. Thanks to such circuit upgrades, you can achieve significant savings in battery life and significantly extend its service life.

  • News
  • Workshop

The Mercedes-Benz E-Class coupe was spotted during testing. Video

The video featuring the new Mercedes-Benz E Coupe was filmed in Germany, where the car is undergoing final testing. The video was published on the walkoART blog, which specializes in spy footage. Although the body of the new coupe is hidden under protective camouflage, we can already say that the car will receive a traditional appearance in the spirit of the Mercedes E-Class sedan...

Study: Car exhaust is not a major air pollutant

As participants in the energy forum in Milan calculated, more than half of CO2 emissions and 30% of harmful particulate matter enter the air not due to the operation of internal combustion engines, but due to residential heating, La Repubblica reports. Currently in Italy, 56% of buildings belong to the lowest environmental class G, and...

New generation Ford Fiesta: already in 2018-2019

The appearance of the new product will be made in the style of the larger Focus and Mondeo of the current generation. OmniAuto reports this with reference to sources within the company. Based on the information received, the publication's artist also created an image on the computer showing what such a car could look like. Headlights and a Mondeo-style radiator grille are not the only things that will...

Mercedes plant in the Moscow region: project approved

Last week it became known that the Daimler concern and the Ministry of Industry and Trade plan to sign a special investment contract, which involves localizing the production of Mercedes cars in Russia. At that time, it was reported that the site where it was planned to launch the production of Mercedes would be in the Moscow region - the Esipovo industrial park under construction, which is located in the Solnechnogorsk district. Also...

Video of the day: electric car reaches 100 km/h in 1.5 seconds

The electric car, called Grimsel, was able to accelerate from zero to 100 km/h in 1.513 seconds. The achievement was recorded on the runway of the air base in Dübendorf. The Grimsel car is an experimental car developed by students from ETH Zurich and the Lucerne University of Applied Sciences. The car was created to participate...

Self-driving taxis coming to Singapore

During the tests, six modified Audi Q5s capable of driving autonomously will hit the roads of Singapore. Last year, such cars traveled unhindered from San Francisco to New York, Bloomberg reports. In Singapore, drones will move along three specially prepared routes equipped with the necessary infrastructure. The length of each route will be 6.4...

Citroen is preparing a magic carpet suspension

In the Advanced Comfort Lab concept presented by the Citroen brand, built on the basis of the serial C4 Cactus crossover, the most noticeable innovation is, of course, the plump chairs, more like home furniture than car seats. The secret of the chairs is in the padding of several layers of viscoelastic polyurethane foam, which is usually used by manufacturers...

Suzuki SX4 has undergone restyling (photo)

From now on, in Europe, the car is offered only with turbocharged engines: liter gasoline (112 hp) and 1.4-liter (140 hp) units, as well as a 1.6-liter turbodiesel engine developing 120 horsepower. Before modernization, the car was also offered with a 1.6-liter 120-horsepower naturally aspirated gasoline engine, but in Russia this unit will be retained. In addition, after...

Magadan-Lisbon run: there is a world record

They traveled across all of Eurasia from Magadan to Lisbon in 6 days, 9 hours, 38 minutes and 12 seconds. This run was organized not only for the sake of minutes and seconds. He carried a cultural, charitable and even, one might say, scientific mission. Firstly, 10 eurocents from every kilometer traveled was transferred to the organization...

The iconic Toyota SUV will sink into oblivion

The complete cessation of production of the car, which until now was produced for the markets of Australia and the Middle East, is planned for August 2016, reports Motoring. The production Toyota FJ Cruiser was first shown in 2005 at the International Auto Show in New York. From the start of sales until today, the car was equipped with a four-liter petrol...

HOW to order a car from Japan, a car from Japan in Samara.

How to order a car from Japan Japanese cars are top sellers all over the world. These machines are valued for their reliability, quality, maneuverability and ease of repair. Today, car owners want to be sure that the car came straight from Japan, and...

Which car should a family man choose?

A family car should be safe, roomy and comfortable. In addition, family cars should be easy to use. Types of family cars As a rule, most people associate the concept of “family car” with a 6-7-seater model. Station wagon. This model has 5 doors and 3...

Rating of reliable cars 2018-2019

Reliability, of course, is the most important requirement for a car. Design, tuning, any bells and whistles - all these trendy tricks inevitably pale in importance when it comes to the reliability of the vehicle. A car should serve its owner, and not cause him problems with its...

HOW to choose and buy a car, Buying and selling.

How to choose and buy a car The choice of cars, both new and used, on the market is huge. And common sense and a practical approach to choosing a car will help you not to get lost in this abundance. Do not give in to the first desire to buy the car you like, carefully study everything...

What did the stars drive in the 20th century and today?

Everyone has long understood that a car is not just a means of transportation, but an indicator of status in society. By looking at the car you can easily determine which class its owner belongs to. This applies to both the common man and pop stars. ...

The cheapest car in the world - TOP 52018-2019

Crises and the financial situation are not very conducive to buying a new car, especially in 2017. But everyone has to drive, and not everyone is ready to buy a car on the secondary market. There are individual reasons for this - those whose origin does not allow them to travel...

How to choose a car brand When choosing a car, you need to study all the pros and cons of the car. Look for information on popular automotive websites where car owners share their experiences and professionals test new products. Once you have collected all the necessary information, you can make a decision...

2018-2019: rating of CASCO insurance companies

Every car owner strives to protect himself from emergency situations related to road accidents or other damage to his vehicle. One of the options is concluding a CASCO agreement. However, in conditions when there are dozens of companies on the insurance market providing services...

Which sedan to choose: Almera, Polo Sedan or Solaris

In their myths, the ancient Greeks talked about a creature with the head of a lion, the body of a goat and a snake instead of a tail. “The Winged Chimera was born as a tiny creature. At the same time, she sparkled with the beauty of Argus and horrified with the ugliness of Satyr. It was the monster of monsters." The word...

  • Discussion
  • In contact with

Many car enthusiasts, in order to improve the appearance of their car, tune their “Swallow” with LED lights. One of the tuning options is a running turn signal, which draws the attention of other road users. The article provides instructions for installing and configuring turn signals with running lights.

[Hide]

Assembly instructions

LED lamps are semiconductor elements that glow when exposed to electric current. The main element in them is silicon. Depending on what impurities are used, the color of the light bulbs changes.

Photo gallery “Possible options for dynamic direction indicators”

Tools and materials

To make a running turn signal with your own hands, you will need the following tools:

  • soldering iron;
  • side cutters or pliers;
  • soldering iron and soldering material;
  • tester.

You need to prepare fiberglass laminate from consumables. It is needed for the manufacture of a printed circuit board on which the semiconductor element will be placed. The required LEDs are selected. Depending on the characteristics of the LEDs and the current and voltage values ​​of the on-board network, the characteristics of the protective resistors are calculated. Using calculations, the remaining components of the network are selected (the author of the video is Evgeny Zadvornov).

Work sequence

Before making turn signals, you need to choose a suitable scheme.

Then, based on the diagram, make a printed circuit board and apply markings on it to place future elements.

The assembly consists of a sequence of actions:

  1. First, you should turn off the power to the car by disconnecting the negative terminal from the battery.
  2. Next, you need to remove the old turn signals and carefully disassemble them.
  3. Old light bulbs should be unscrewed.
  4. The joints should be cleaned of glue, degreased, washed and allowed to dry.
  5. In place of each old element, a new running light turn signal is installed.
  6. Next, assembly and installation of the lights is done in the reverse order.
  7. After installation, the wires are connected.

At the next stage, an additional stabilized power source is connected to the network. Its input receives power from the intermediate relay, and the output is connected to a diode. It is better to place it in the instrument panel.

When connecting LEDs, you must ensure that the anode is connected to the plus of the power source, and the cathode to the minus. If the connection is not made correctly, the semiconductor elements will not light up and may even burn out.


Features of installation and configuration of running direction indicators

You can install dynamic turn signals instead of conventional LEDs. To do this, the board with LEDs and current-limiting resistors is removed and dismantled. On the repeater you need to tear the glass away from the body. Then you should carefully cut out the reflector and remove it.

In place of the remote reflector, an SMD 5730 board is installed, on which yellow LEDs are located. Since the repeater has a curved shape, the board will have to be delaminated and bent a little. You need to cut off the part with the connector from the old board and solder it to connect the controller. Then all components are returned to their place.

To adjust the timing of the running LED lights, a switch is soldered to the microcontroller. When a suitable speed is found, jumpers are soldered in place of the switch. When connecting two pins to ground, the minimum time between LED flashes will be 20 ms. When the contacts are closed, this time will be 30 ms.


Price issue

You can make a running light turn signal from daytime running lights. Their cost is 600 rubles. In this case, you can use “pixel” RGB LEDs as light sources in the amount of 7 pieces for each running turn signal. The cost of one element is 19 rubles. To control the LEDs, you need to purchase an Arduino UNO costing 250 rubles. Thus, the total cost will be 1060 rubles.

I said “Gop” last year - it’s time to jump :)
Or rather, do the promised review of running turn signals.
I ordered 1 meter of black WS2812B tape (144 LEDs) in a silicone tube, when ordering I chose “Black 1m 144led IP67” (perhaps someone will like the white color of the substrate, there is such a choice).

A word of caution

I received a tape soldered from two half-meter pieces. The downside of this is a vulnerable soldering point (contacts may break over time) and an increased gap between the LEDs.
Before purchasing, check with the seller about this point.

Contact wires were soldered to the tape on both sides to connect several pieces in series, because I didn’t need this, so I unsoldered the wires on one side, sealed everything with a neutral sealant and wrapped a little more black electrical tape.



Attached to the glass using double-sided transparent adhesive tape, for example.

Installation details

I degreased the surfaces, first glued adhesive tape to the tube (I’ll call it that, even though the cross-section is rectangular), cut off the protruding excess of the wider tape, pushed the edges of the tube into the cracks between the ceiling and the upper parts of the decorative panels of the rear pillars (the contact wires with the connector were hidden behind one panel ), centered it and began to press it against the glass, slowly pulling out the protective layer of the tape.
Unfortunately, there is no video - there were no free hands for filming, and everyone’s car is different.
If anything is unclear, ask in the comments.
The test in the summer heat was successful - nothing came off or floated.
The only negative is that the angle of the glass is gentle, the LEDs shine more upward. On a sunny day it’s hard to see, but since these are duplicate signals,

Now let's move on to the electronic stuffing.
I used it, but discovered it not long ago

For about the same cost we get more goodies

The sketch will work without any special modifications on Wemos when programming in the Arduino IDE, and if you implement a small web server, then when connected to it via Wi-Fi, you can change the values ​​of variables such as the delay time between flashes, the amount of deceleration during emergency braking etc.
Here in the future, if someone is interested in implementing a project on the ESP8266, I can post an example for changing settings via the web interface, saving them in EEPROM, and then reading them.
The web server can be launched, for example, through the turn signal being turned on and the brake pedal being pressed when the ignition is turned on (in the setup procedure, poll the status of the corresponding inputs).

To implement a flashing mode during heavy braking, I purchased
The sketch monitors the level of deceleration when pressing the brake pedal; if it exceeds 0.5G (sharp deceleration, but without squealing brakes), then a flashing mode is turned on for a few seconds to attract additional attention.
Control signals to the Arduino inputs from the “plus” of stops, turn signals and reverse are supplied through galvanic isolation - optocouplers with current limiting resistors, which ultimately form the LOW level at the Arduino inputs (constantly pulled to positive through 10 kOhm resistors).
Power supply - 5 volts via a DC-DC step-down converter.
The whole thing is folded into a sandwich and packed in a suitable box, on which the installation direction is marked with an arrow for the correct orientation of the gravity sensor

Diagram and photo



The nominal value of pull-up (to positive) resistors is standard - 10 kOhm, limiting the current of the optocoupler resistors - 1 kOhm. I removed the optocouplers from old boards, two were PC123, two were PC817.


In the first photo you can see two additional terminals; I made them for the turn signals. Since in my car there is a short to ground when the steering column lever is turned on, I connected the wires to the lever block and the Arduino inputs. If the steering column lever switches the plus or you take the signal from the “+” of the left/right turn signal lamps, then connect them through galvanic isolation.



Well, now the sketch itself (Arduino IDE)

#include #include //a few general comments // I turned off one of the outermost LEDs, because... they reflected on the decorative panels of the racks //visible in the example of this cycle for (int i=1; i<143; i++) //если отключать не нужно, заменяем на for (int i=0; i<144; i++) //задний ход и аварийка у меня не используются, т.к. в первом случае яркость никакая, во втором надо подключать входы к лампам поворотников //поворотники и стоп-сигнал одновременно не включаются, чтобы это реализовать, нужно переписывать соответствующий код скетча (делить ленту на три секции, подбирать тайминги миганий, менять диапазон переменных циклов). //Дерзайте - все в ваших руках // Пин для подключения управляющего сигнала светодной ленты const int PinLS = 2; //Пины для подключения датчиков //если более удобно будет подключать контакты в другом порядке - просто поменяйте значения переменных const int buttonPinL = 3; const int buttonPinR = 4; const int buttonPinS = 6; const int buttonPinD = 5; //начальные статусы входов (подтянуты к плюсу) int buttonStateS = HIGH; int buttonStateD = HIGH; int buttonStateL = HIGH; int buttonStateR = HIGH; // пауза pause_pov1 (в миллисекундах) нужна, чтобы синхронизировать циклы "пробегания" полоски и включения лампочки поворотника // такое может быть, если используется меньше половины светодиодов // в моем случае паузы нет (pause_pov1 = 0) int pause_pov1 = 1; // этой паузой регулируем длительность состояния, когда все светодиоды выключены //я определял опытным путем - включал поворотник, засекал по отдельности время ста мыргов лампочкой и ста беганий полоски, разницу делил на 100, на полученное время увеличивал или уменьшал значение переменной (в зависимости от того, отставали или убегали вперед лампочки) int pause_pov2 = 62; // переменная для получения значения ускорения int ix; Adafruit_NeoPixel strip = Adafruit_NeoPixel(144, PinLS, NEO_GRB + NEO_KHZ800); Adafruit_ADXL345_Unified accel = Adafruit_ADXL345_Unified(12345); void setup() { pinMode(buttonPinS, INPUT); pinMode(buttonPinD, INPUT); pinMode(buttonPinL, INPUT); pinMode(buttonPinR, INPUT); strip.begin(); // гасим ленту for (int i=0; i<144; i++) strip.setPixelColor(i, strip.Color(0,0,0)); strip.show(); accel.begin(); // ограничиваем измеряемый диапазон четырьмя G (этого хватит с большим запасом) accel.setRange(ADXL345_RANGE_4_G); accel.setDataRate(ADXL345_DATARATE_100_HZ); } void loop() { // СТОПЫ: если включены - высший приоритет //Чтобы сделать меняющуюся по ширине полоску в зависимости от интенсивности торможения //(уточнение - никакой светомузыки, ширина полосы после нажатия на тормоз не меняется!) //от плавного торможения до тапки в пол. //Добавляем еще одну переменную, например, ix2, //присваиваем ей значение ix с коэффициентом умножения, //заодно инвертируем и округляем до целого //ix = event.acceleration.x; //ix2 = -round(ix*10); //ограничиваем для плавного торможения в пробках //(чтобы не менялась при каждом продвижении на 5 метров) //if (ix2<10) ix2 = 0; //и для резкого торможения. //Реальный диапазон изменения переменной ix - от 0 до -5 //для максимальной ширины полосы при G равном или большем 0.5 //if (ix2 >50) ix2 = 50; //then change the cycles in the STOP block for (int i=1; i<143; i++) на for (int i=51-ix2; i<93+ix2; i++) //Получаем минимальную ширину полоски ~30 см (для стояния в пробке) и максимальную для резкого торможения //конец комментария buttonStateS = digitalRead(buttonPinS); if (buttonStateS == LOW) { sensors_event_t event; accel.getEvent(&event); ix = event.acceleration.x; // проверка резкого торможения - мигающий режим // значение 5 - это 0,5G, минус - торможение if (ix < -5) { for (int is=0; is<15; is++) { for (int i=1; i<143; i++) strip.setPixelColor(i, strip.Color(240,0,0)); strip.show(); delay(10 + is*10); for (int i=1; i<143; i++) strip.setPixelColor(i, strip.Color(0,0,0)); strip.show(); delay(10 + is*3); buttonStateS = digitalRead(buttonPinS); if (buttonStateS == HIGH) return; } } // помигали - и хватит, включаем постоянный режим, если педаль тормоза еще нажата // или если не было резкого торможения и предыдущее условие не сработало if (buttonStateS == LOW) { for (int i=1; i<143; i++) strip.setPixelColor(i, strip.Color(200,0,0)); strip.show(); while(buttonStateS == LOW){ buttonStateS = digitalRead(buttonPinS); delay(50); } // плавно гасим for (int is=0; is<20; is++) { for (int i=1; i<143; i++) strip.setPixelColor(i, strip.Color(190 - is*10,0,0)); strip.show(); delay(10); } // СТОПЫ конец } } else // если СТОПЫ выключены { // ЗАДНИЙ ХОД: если включен - средний приоритет buttonStateD = digitalRead(buttonPinD); if (buttonStateD == LOW) { for (int i=1; i<37; i++) strip.setPixelColor(i, strip.Color(63,63,63)); for (int i=107; i<143; i++) strip.setPixelColor(i, strip.Color(63,63,63)); strip.show(); while(buttonStateD == LOW){ buttonStateD = digitalRead(buttonPinD); delay(50); } //плавно гасим for (int is=0; is<16; is++) { for (int i=1; i<37; i++) strip.setPixelColor(i, strip.Color(60 - is*4,60 - is*4,60 - is*4)); for (int i=107; i<143; i++) strip.setPixelColor(i, strip.Color(60 - is*4,60 - is*4,60 - is*4)); strip.show(); delay(10); } } buttonStateL = digitalRead(buttonPinL); buttonStateR = digitalRead(buttonPinR); // если включена аварийка if (buttonStateL == LOW && buttonStateR == LOW) { for (int il=0; il<71; il++) { strip.setPixelColor(71-il, strip.Color(63,31,0)); strip.setPixelColor(il+72, strip.Color(63,31,0)); strip.show(); delay(pause_pov1); } for (int il=0; il<71; il++) { strip.setPixelColor(71-il, strip.Color(0,0,0)); strip.setPixelColor(il+72, strip.Color(0,0,0)); strip.show(); delay(pause_pov1); } delay(pause_pov2); } // если включен ЛЕВЫЙ ПОВОРОТНИК if (buttonStateL == LOW && buttonStateR == HIGH) { for (int il=0; il<71; il++) { strip.setPixelColor(il+72, strip.Color(220,120,0)); strip.show(); delay(pause_pov1); } for (int il=0; il<71; il++) { strip.setPixelColor(il+72, strip.Color(0,0,0)); strip.show(); delay(pause_pov1); } delay(pause_pov2); } // если включен ПРАВЫЙ ПОВОРОТНИК if (buttonStateL == HIGH && buttonStateR == LOW) { for (int il=0; il<71; il++) { strip.setPixelColor(71-il, strip.Color(220,120,0)); strip.show(); delay(pause_pov1); } for (int il=0; il<71; il++) { strip.setPixelColor(71-il, strip.Color(0,0,0)); strip.show(); delay(pause_pov1); } delay(pause_pov2); } //правый поворотник конец } //конец условия else Стоп // задержка для следующего опроса датчиков delay(10); }

I tried to comment on it as much as possible, but if there are questions, I will try to add comments (that’s why I’m placing it in the text of the review, and not as an attached file). This, by the way, also applies to other points of the review - I will also supplement it if there are significant questions in the comments.

And finally, a demonstration of the work (for the video I used a sketch with demo mode).

Upd. I made the sketch with the demo mode specifically to fit everything into one short video.
The brake light flashes only during hard braking (this was discussed above); during slow braking and when standing in traffic jams, it simply lights up, without irritating the drivers behind.
The brightness at night is not excessive, because Due to the tilt of the glass, the lights are directed more upward than backward.
The standard lights work as usual, this strip duplicates them.

I'm planning to buy +97 Add to favorites I liked the review +89 +191

New on the site

>

Most popular