Good afternoon, dear readers, I would like to acquaint you with my version of the project of automatic illumination of the stairs based on the Arduino Pro Mini controller. Perhaps for someone this article will become the basis for their own projects, well, I will be pleased to read the strict criticism in the comments. The purpose of the project: to mount the staircase lighting on the second floor under the following conditions.
Automation works only in the dark.
Each stair step is highlighted after turning on the previous one.
Steps are highlighted from bottom to top and vice versa.
There is a reserve of time completely illuminated stairs.
Preparation for installation
As a controller, I used the familiar Arduino Pro Mini.
First, about the stairs itself, the number of steps 11, width 550 mm. A total of 6 meters of LED strip is required (ordered 2 pieces of 5 meters 5050 SMD), with an IP67 degree of protection (i.e., protection against dust and water) so that you can wipe off the dust and not worry about whether you are under stress or damage the tape.
After connecting a 5 m LED strip, the current through it turned out to be only 2.5 A, that is, for a 6 m LED strip, a 36 W power supply unit is needed. The choice stopped on the Chinese power supply 12 V 8.3 A 100 watts. 100, of course, a lot, but it took 12 V for another project, so I connected to it. ')
As a power supply of the controller itself, as well as sensors (5 V power supply), I used a simple low voltage circuit with the help of a voltage regulator L7805CV and two ceramic capacitors 0.1 μF and 0.33 μF.
As sensors detecting movement, he stopped on the HC-SR04 ultrasonic sensors, since they emit a narrow beam of ultrasonic pulses and you can adjust the operating distance. Thus, it can be set to track the intersection of the pulse in the first and last stages. Going into the details of the characteristics, method of connection, the principle of the sensor does not see the point in the Internet a lot of information about them.
The question of measuring the illumination was solved, also, quite simply with the help of a voltage divider circuit, in which the Gl5516 photoresistor is used as a variable resistor.
Next, we consider the question of the number of contacts used 11 digital for the stages, 4 for two sensors and one analog for measuring illumination. A total of 15 digital, which does not give us the Arduino. Without thinking, I used a 74S595N microcircuit, or rather a cascade of two shift registers to increase the number of Arduino digital outputs.
After reading the literature and opinions of radio amateurs, he put a 0.1 μF ceramic capacitor on the 12th leg of the STcp of the first register, ostensibly to minimize noise when applying a “latching” pulse. When testing the cascade “on the table” by me, it really works better with a capacitor, especially when the power supply to the chips is first applied.
It’s one thing to connect a weak load to the Arduino, like an LED, and another to connect a piece of LED strip 500-550 mm long (the maximum current for the Arduino digital output is 40 mA). The ULN2003A microcircuit (Darlington assembly) turned out to be more accessible to me; the maximum current through one output of which is 0.5 A.
I want to note that the Echo contact of the second sensor comes to the 13th Arduino contact, on which the LED of the controller itself is located.
This was done specifically, for convenience, at the moment when the condition “is it dark enough for the start of sensor polling?” Is satisfied, the LED on the 13th contact starts flashing.
Plata painted in Sprint-Layout. He emphasized that the chips and the controller were removed, soldered the SCS-14 and 16 panels, and also the socket on the PBS 2 × 12 2.54 board. The only negative was to arch the legs of the 74S595N chips to the other side.
Drawing a sketch
When compiling the sketch, only one Ultrasonic library was used (for working with the HC-SR04 sensors) and it was possible to do without it. I had to tinker with bit operations, since it was necessary to load two bytes in a cascade of shift registers in a certain way (in the sketch itself I made intelligible explanations).
// void Turing_Downward() { for (int i = N; i >= 0; i--) { bitSet(leds, i); // N 1 ( HIGH). updateShiftRegister(); // . delay(T_Stair); // . } delay(T_Ladder); // . leds = 0; // . updateShiftRegister(); // . }
Installation Features
Now about the installation, to lay the LED strip, of course, it is better to create a profile specially for her, but its cost is quite high. I took the cable channel 12 × 12, cut off the excess stationery with a red-hot stationery knife, the following happened.
To hide the sensors HC-SR04, I found for them the size of the box IEK 20 mm.
The installation of the panel was also not difficult, since the installation of screw terminal blocks was planned in advance on the board.
Total
The resulting project has satisfied all the tasks, during the operation of the automation there were no failures, comments.
The only thing, in my opinion, could be to make the shield more compact and completely close it from other hands.
Equipment
Arduino Pro Mini Atmega 328 5 V 16 MHz Controller
one
Ultrasonic sensor HC-SR04
2
Power supply 12 V 8.3 A 100 W
one
LED strip 5050 SMD 5 m IP65
2
Chip 74NS595N
2
IC ULN2003A
2
PBS 1 × 40 2.54 socket
one
MGSHV 0.75 wire
PUNP cable 2 × 2.5
Cable telephone ShTLP-4 0.12 × 7
Single pole 1 A circuit breaker
one
Single-pole circuit breaker 10 A
one
Photoresistor Gl5516
one
Voltage stabilizer L7805CV
one
0.33 uF ceramic capacitor
one
Ceramic condenser 0.1 microfarad
2
10 kΩ resistor
one
Socket for chip SCS-14
2
SCS-16 chip socket
2
Distribution box IEK 20 mm
2
Two-pin screw terminal
13
Fiberglass 95 × 105 mm
Textolite
SRK terminal through passage
12
Cable channel 12 × 12 × 2000
Cable channel 16 × 16 × 2000
Consumables (glue, glue Moment Crystal, solder, rosin, TAGS flux)