I switch on led lights in sequence using an Arduino board and PCF8574 modules . Creating a nice visual effect on the garden stairs.
Since each PCF8574 module can control 8 lights, I used 5 of them to insert a light on each of the 36 steps of the staircase.
Although in the title I indicate to simplify chasing lights, in reality the system allows you to set the lights that must be turned on moment by moment and therefore allows any play of lights.
The lights turned on in instant 1 are stored in the first 5 bytes of the step vector , that of instant 2 in the next 5 bytes and so on … Using the bits of the bytes of a vector was an obligatory choice to reduce the memory used on the Arduino board.
In this way we can make the lights turn on in sequence the way we want, in a simple sequence like the one I used, or in complex sequences by simply setting 1 on the bit of the vector.
The program is attached and it is very simple. How to carry out the realization can be deduced from the attached photos. The lights are nothing more than small pieces of three LEDs from a LED strip , greater brightness by cutting pieces of 6 or 9 LEDs.
The resulting effect is visible in the following video:
Video: “Chasing lights”
The time between instants is given by the program variable called “ Time “. Each routine has its own “ Time ” variable. It is in milliseconds. By increasing this value or reducing it, you will adjust the scrolling of the lights to your speed of travel on the stairs.
The sketch for the sliding lights can be downloaded from the following link: LuciScaleGiardinoConSensoriV2.ino
In the following photos you can deduce construction details.