1. Introduction
Over the past decades, LED lighting technologies have not only rapidly developed and improved, but at the same time, their use in various fields has increased significantly. The main reasons for the investment in LED technologies and the increase in their consumption are that using LEDs can save huge amounts of electricity (compared to old incandescent bulbs, use of LEDs can save 10 times more electricity) [
1,
2,
3]. Another important reason for the popularity of LEDs is that the entire spectrum of visible light can be easily obtained. This is especially relevant in various industrial processes and productions (such as plant cultivation, advertising technologies, LED screens, etc.). It is believed that by 2035, LEDs will make up 98% of lighting technologies [
4,
5,
6]. With the increasingly widespread use of LEDs, the method of controlling their light becomes especially important, which determines both the color and intensity of the light, as well as other LED operating parameters. It is well known that LED lighting parameters directly depend on the supplied current. However, the relationship between the LED power supply voltage and current is not linear. In addition, the supply current and voltage values determine the LED temperature and efficiency [
7,
8,
9,
10]. Therefore, it is very important to improve not only the LED light itself, but also its control, which influences the efficiency, color, temperature, frequency, etc. of these types of lights. The LED reaction time to changes in the control signal is very fast and reaches the order of nanoseconds. Therefore, such a short LED response time is very convenient for creating various control-technology-based changes in electrical signal characteristics. One of these lighting control methods is pulse-width modulation (PWM)-based lighting controllers. PWM is a powerful electronic signal modulation technique that allows you to effectively change the power or voltage of a signal over time. This is achieved by periodically generating pulses with variable propagation times. The main idea is to control the “on” and “off” lengths so that the average signal power corresponds to the desired value [
1,
2,
11]. Using PWM, it is possible to effectively control LED lighting parameters such as light color, intensity, flicker rate, etc. When the PWM method is used to control LED lighting parameters, it is observed that the mathematical dependence between the lighting parameters (intensity, etc.) and the LED characteristics is often a linear expression. When using PWM controllers for LED control, it is very important to apply various programming strategies that would allow lighting control at the highest LED energy consumption efficiency [
2,
3,
12,
13,
14,
15].
DMX (Digital Multiplex) is a standardized protocol for digitally controlling various lights and similar stage devices, including LED lights. This protocol is widely used in events, theater, concerts, and other performance environments. DMX allows you to precisely set the connection intensity, color, and other properties of each LED light. This gives you a lot of creative control when designing lighting or creating different lighting effects. The DMX transmission rate is limited, so there may be limitations if you need to control fast and high-resolution light effects (based on LED technology). RDM (remote device management) is a technology that allows remote control and configuration of various devices, including LED lights, using the DMX (Digital Multiplex) communication protocol [
3,
4,
16,
17,
18,
19,
20]. This technology enriches traditional DMX control by providing more functions and possibilities. Using RDM may require additional management devices that support this technology. This can increase costs and the complexity of systems. Support for remote control may raise security issues, especially if security mechanisms against unwanted access or hacking are not properly implemented. KNX (Konnex) is a standardized international building automation and control system protocol used to control various homes and buildings [
1,
2,
3,
21,
22,
23,
24]. KNX makes it possible to control not only lighting, but also other elements of building systems, such as heating, ventilation, security, etc. This makes it possible to create a comprehensive building management system. KNX GUIs can be limited when controlling LEDs, so additional hardware is required if more complex control effects are desired. Initial equipment and installation costs can be high, especially compared to other simpler light control systems. DALI (Digital Addressable Lighting Interface) is a standard lighting control communication protocol that is widely used for LED lighting systems. DALI allows individual control of each LED light or group of lights. It provides high flexibility, allowing it to create various lighting scenarios and atmospheres [
2,
3,
24,
25,
26,
27,
28]. DALI uses a single wire, eliminating the need for complex wiring systems or additional control channels. This increases the ease of installation and reduces costs. DALI signal transmission can be limited by long cables or electromagnetic noise conditions [
1,
2,
3,
4]. Controlling LEDs using microcontrollers offers many advantages, allowing efficient and flexible control of light parameters.
Microcontrollers allow you to control each LED light source or a group of light sources individually. This enables the creation of dynamic and complex light patterns. Microcontrollers can support a wide range of light control functionalities, including PWM (pulse-width modulation) control strategies, temperature control, and other functions that allow the creation of a variety of light effects. The essential control aspects of LED strips and lighting systems are presented in
Table 1.
After analyzing the literature, it became clear that there are not many studies that analyzed the control of LED strips and lighting devices using a microcontroller and PWM. In addition, the studies discussed in the literature usually used the microcontroller itself to generate the PWM signal. This strategy of modulating and using the PWM signal has a disadvantage, because the percentage change resolution of the PWM signal is limited (at least every 20%). In this way, it is difficult to ensure the required amount of light flux is emitted by LED light sources (e.g., LED strips). The larger the number of light flux values, the more evenly it is possible to regulate the light flux emitted by LED lighting devices. In order to solve this problem and expand the limits of LED lighting device control possibilities, the goal of this study was to design and investigate an LED controller based on the concept of a PIC microcontroller and a separate PWM driver, thus expanding the amount of variable values of the light flux emitted by LED devices (e.g., LED strips).
3. Results and Discussion
The electric circuit of the LED controller consists of a microcontroller, a power source, a DC/DC converter, optocouplers, and a BLUETOOTH module. The main electrical diagram of the LED controller is shown in
Figure 2.
The design and production of the electrical scheme were also part of the research, since the process included the search for original and optimal solutions and the process of optimizing the electrical circuits. The LED controller controls the light flux of the LED strips and other parameters by controlling the power supply of the LED strips and receiving information from motion sensors. Optocouplers are used to protect the microcontroller, through which information from motion sensors is also transmitted. By using optocouplers, it is possible to avoid random voltage jumps in the circuit (such jumps are likely to occur in a motion sensor circuit due to the random induction caused by extraneous sources) and thus protect the microcontroller circuit from damage [
2,
3,
4]. In order for the user or the system operator to receive primary information about the operation of the LED controller, INPUT SIGNAL INDICATOR LEDS can be used, through the operation of which it is possible to understand whether the LED controller has executed the necessary commands and whether the main power source is switched on. In order to change from 12 V DC to 5 V DC, a DC/DC type converter was used. A voltage of 5 V was required to power the microcontroller. A bus with a programmer input was created on the PCB for programming the microcontroller. An ICS-type programmer was used for programming. The LED controller was designed and manufactured in such a way that its operating modes can be changed. For this purpose, a BLUETOOTH module was used to receive commands from a mobile application. The system components are closely related to each other and have a logical connection: the microcontroller program executes commands according to the information of the motion sensors and the BLUETOOTH module. Based on this information, the microcontroller controls the power supply signals to power the LED strips. In order to provide the user with initial information (about the state of the LED controller), information LEDs are needed. Meanwhile, optocouplers (as mentioned earlier) have a dual function, they protect against voltage spikes and generated electromagnetic noises that can occur in cables used for powering and controlling LED strips.
The lighting mode and parameters of the LED strips are controlled using a PWM signal. A PWM driver was used to generate the PWM signal.
The PWM driver receives commands from the microcontroller by changing logic states (see diagram in
Figure 3). Based on the logic states/commands programmed in the outputs of the microcontroller, the PWM driver forms a PWM signal of the appropriate width/duration. In order for the LED strip to emit a lower light flux than the maximum value, it is necessary that the average electrical power of the PWM signal is lower than the maximum power supply of the LED strip diodes. In this way, by changing the duration of the PWM signal generated by the PWM driver, it is possible to control the light flux of the LED strip, since the average power of the PWM signal changes. The transfer of commands between the microcontroller and the PWM driver takes place using the I2C protocol. The PWM driver chip at the outputs cannot generate the necessary electrical power to power the LED strips. MOSFET-type transistors are used to power the LED strips, which are respectively controlled by the PWM driver by transmitting PWM pulses of the appropriate duration. According to the control pulses, power is transferred to the LED strip from the power source through the MOSFET. Such is the operational scenario for the power and control channels of one LED strip. The LED controller has 16 power and control channels for LED strips.
As described earlier, the control of the LED controller is based on microcontroller commands. A program and its algorithm were developed for the control of LED strip lighting. The principal diagram of the program algorithm is presented in
Figure 4a. The program starts with the START PROGRAM command. A request to the phone application follows. An array of stored data are read when the query is executed. The resulting data array is analyzed. Following receiving data from the application, the microcontroller sends commands to the PWM driver, which changes the parameters of the PWM signal accordingly. If the data in the application are unchanged, the LED controller executes the latest commands saved in the application. According to the commands received from the microcontroller, the PWM driver transmits the commands to the control channels of the MOSFET transistors. It is checked whether the entire program cycle has been completed and the application is informed about the successful completion via the BLUETOOTH module. If new data are entered into the application, the entire cycle is repeated, and the data entered into the application are saved. The control of the LED controller takes place using an application on a smartphone [
1,
2,
3,
4,
5]. This application is designed for smart devices with the Android operating system. The block diagram of the application program algorithm is presented in
Figure 4b. The application program starts with the START PROGRAM command (the control application is created using JavaScript). Communication with the LED controller is in progress. The LED controller sends a response about its last state. The presentation of application data on the smart device screen is in progress. If required (depending on the user), data are entered into the application and the application sends the changed information to the LED controller. Based on these data, configuration of the LED controller is carried out and adjustment of the LED strip light flux is carried out. The application program checks the status of whether the LED controller correctly controls the LED strips according to the newly entered commands.
As mentioned earlier, the application is designed for smart devices (mostly phones). An image of the application program window is presented in
Figure 5. Control applications are a convenient and modern way to manage various environmental parameters (in this case, the LED light flux).
As mentioned earlier, the concept of this LED controller is intended for controlling the lighting of stairs, so the application is most suitable for this purpose. In the first step, the application receives information from the controller about the current state. The next step prompts the user to make changes. If no changes are made, the application works according to the last parameters. It is possible to change the sequence of lighting of LED strips and the time interval (after how long the next LED strip be activated and so on) between individual LED strips. After entering the lighting commands and parameters and sending them to the LED controller, the application can be turned off, and then the LED controller works independently according to the pre-entered control parameters. If a deviation in the control parameters of the LED controller is noticed, the user is informed and information about the changes in the control of the LED controller is visible on the screen. Using the BLUETOOTH communication, it is possible to transmit commands to the LED controller at a distance of several tens of meters. In the case of deviations in the operation of the LED controller, the application can offer the operator a choice of possible actions (such as rebooting the system, etc.).
The LED controller designed and tested in this study is a fairly compact device that does not take up much space. It can be installed on various objects where it is necessary to control the LED lighting according to a certain scenario. The LED controller can be installed in control panels together with other auxiliary devices (e.g., power supplies, contact rows, power supplies, etc.). A real image of the LED controller under consideration during this study mounted on a control panel is shown in
Figure 6.
The LED controller also has a liquid crystal display that shows its operating status and parameters. These parameters can not only be changed using the application, but also by using the physical buttons on the controller. It is worth noting that such control panels are quite compact and can be installed in residential or industrial premises, shopping centers, etc. When designing control panels, it is necessary to take into account the general concept of the premises and the principles of ergonomics of the arrangement of devices, as well as the general design [
2,
3,
4,
5].
As mentioned earlier, the operation of the LED controller is achieved using two essential parts of the microcontroller—PIC24FV32KA302 and PWM driver PCA9685. The characteristics of the PWM pulse are controlled programmatically by the microcontroller via the PWM driver. The PWM driver is also a rectangular pulse generator. During the study, the dependence of the reaction time on the length of the command was determined. The results of these studies are presented in
Figure 7. The I2C protocol is used for communication between the microcontroller and the PWM driver. I2C has a master–slave architecture, where one device is the master and the other devices are controlled by the master device (slaves). This allows you to quickly and efficiently organize communication between a large number of devices. I2C can operate in different speed modes, allowing adaptation to specific system requirements. I2C uses two—data (SDA) and synchronization (SCL)—lines, making it very resource efficient. A certain time interval is required for the microcontroller to send the command to the PWM driver. This time (reaction time) depends on the length of the microcontroller command and the speed of the protocol used.
As can be seen from the research results, the response time was the lowest (0.5 ms) when the length of the command sent by the microcontroller was 1 bit. The reaction time is the duration after which, after sending a command to the microcontroller, a change in the output signal of the PWM driver is received for controlling the lighting parameters of LED strips. In order to measure the dependence of the reaction time on the length of the command, the microcontroller was programmed to send commands of variable lengths (1–10 bits). Microcontrollers have timer modules or timers that can capture the time between two events. In this case, a timer module was configured in the microcontroller, which recorded the moment when the command was sent to the PWM controller. Then, when the first signal change from the PWM controller was observed, the microcontroller set the timing. The reaction time was calculated as the difference between these two time points. As can be seen from the results, the dependence of the reaction time on the length of the command was linear. This dependence is convenient, as it is possible to predict the speed and time of operation of the LED controller with sufficient accuracy. Reaction times were measured programmatically using the measurement/counting functions on the microcontroller.
As mentioned, control of the LED strip light flux was carried out by changing the characteristics of the PWM signal. The characteristics of the PWM signal were changed by transmitting commands from the microcontroller to the PWM driver. For the sake of the universality of the study, the change in the PWM signal was measured as a percentage, where 100% PWM was the maximum duration signal used in this study.
Control of the PWM signal was performed programmatically in the microcontroller program code, by changing logic values from 0 to 4095. The dependence of the PWM signal characteristic on the logic values generated by the microcontroller is presented in
Figure 8. As can be seen from the measurement results, when the logic values of the microcontroller changed from 1000 to 4000, the size of the PWM signal changed from 25 to 100%. When the percentage of the PWM signal was changed, this changed the power supply to the LED strips. As it can be seen from the research results, this dependence was linear. Such a result allows the use of a simpler (shorter) program code for controlling the PWM signal. In addition, it allows shortening the reaction time, because in the case of a simple linear dependence, the length of the microcontroller commands transmitted to the control contacts of the PWM driver is shortened.
As the percentage of the PWM signal was shortened, the light flux decreased more and more. When you shorten the PWM signal, the electric current and voltage of the signal do not change, but when the PWM is shortened, the total power supplied to the LED strip decreases. The dependence of the light flux LED strip on the percentage of the PWM signal is presented in
Figure 9. LED strips with a maximum light flux of 1000 lm were selected for this research. As can be seen from the research results, when the percentage of the PWM signal was changed from 10 to 100%, the light flux of the LED strip changed from 100 to 1000 lm. As can be seen from the results, in this case the dependence graph is close to straight. When the on-time percentage of the PWM signal was higher, the light flux of the LED strip was generally higher. This means that the LEDs were on for a longer time per cycle, therefore providing more light. The reason for this has to do with how the PWM signal controls the LEDs. When the PWM signal is on, the LEDs light up and use power. The longer the PWM signal is on per cycle, the more energy is transferred to the LEDs, and they shine with a brighter light flux.
The linear dependence allows directly determining the level of light flux according to the percentage value of the PWM signal. This simplifies the control logic and programming by eliminating the need for complex mathematical operations or non-linear algorithms.
As mentioned, the designed and tested LED controller has 16 power channels. Each channel can be connected to an LED strip of the corresponding capacity and its light flux can be controlled. The maximum power of one channel is 12 W. The PWM driver cannot generate such power directly; therefore, the power supply from the power source to the individual channels of the LED controller is modulated by the same law as the PWM signal change using MOSFET-type transistors. The results of studies of the dependence of the power of one channel on the percentage of the PWM signal are presented in
Figure 10. As can be seen from the measurement results, the power of one channel changed from 1 to 12 W when the PWM signal was changed from 10 to 100%. It is worth noting that, in each specific case, the power of the power supply channel may vary depending on the characteristics of the power source used [
2,
3,
4,
5].
During this research, how the light flux changed when the power of one power channel changed was studied. As mentioned, the power was changed by modifying the PWM signal.
The results of light flux dependence on one channel power are presented in
Figure 11. As the percentage value of the PWM signal, which determines the on period, changed in the LED strip, the amount of average electricity that powered the LED strip changed. The higher the percentage of on-time, the more time the LED strip was on and the more electricity it received, and therefore the higher the light flux. As can be seen from the presented results, the light flux changed from 100 to 1000 lm when the power of one channel of the LED controller was changed from 1 to 12 W. This dependence was close to linear. After reaching a power of 8 W, the light flux increased a little more slowly, until it reached the maximum value. Such a slowdown in the growth of the light flux could have been influenced by phenomena occurring in the LED diodes, such as changes in the recombination rate of holes (vacancies) and electrons, etc. The non-linearity of this dependence could have been influenced by the fact that LEDs convert part of the electrical energy into heat.
LED strip PWM controllers based on a microcontroller and PWM driver are very useful, due to their flexibility, efficiency, and accuracy. Microcontroller-based LED controllers provide great flexibility for programming of LED strip light output. They allow programmers to easily change light intensity, light flux, colors, effects and other functions according to their needs [
3,
4,
5,
6]. It is also possible to create complex lighting effects and dynamic models controlled programmatically. PWM signals can be used to regulate the light flux with minimal power dissipation. This allows saving energy and increasing the life of LED strips. Microcontrollers with integrated PWM drivers ensure a high precision of light control. They can generate stable and accurate PWM signals with specific on times, so the desired light flux can be achieved without large deviations or flicker. Microcontrollers and PWM drivers can be easily integrated with other devices and their control systems, for example with sensors, control panels, or computer interfaces. This makes it possible to create complex and integrated light control systems.