Study on Illuminance Control based on Arduino Method

The paper presents a method for achieving constant illumination control by integrating various technologies, including Arduino technology, LED driver technology, and control technology. The HV9910B constant current drive chip is used to design a high-power LED driver in the form of an Arduino expansion board. The performance of the driver is tested, including efficiency testing and waveform testing. The PID control library of Arduino is utilized to write the control program rapidly. Illumination control experiments are conducted with expected results.


Introduction
Being an open-source hardware platform, Arduino has garnered extensive attention and is widely employed as a foundational technology for educational and research purposes in universities [1] [2].Its concise and user-friendly integrated development environment empowers developers to achieve desired functionality with minimal code by utilizing reusable libraries that define objects.This significantly enhances development efficiency without necessitating an in-depth understanding of microcontroller architecture and operational principles.Illuminance is a crucial indicator associated with the lighting effect, indirectly reflecting the brightness of the light source.Generally, higher illuminance levels correspond to brighter light sources.Illuminance not only impacts visual perception but also influences emotional states and work efficiency, known as non-visual effects of illumination.Specifically, optimal illuminance levels have been found to enhance work productivity significantly.It is important to maintain moderate illuminance levels as both excessively high or low levels can negatively affect work efficiency.Compared to low illuminance, high illuminance has shown substantial improvements in office efficiency.Varying illuminances can help alleviate fatigue and sustain productivity compared to a constant level of illumination [3][4][5].Therefore, control over illuminance plays a pivotal role in various domains such as production, daily life, and scientific research.In imaging applications where stringent control over light intensity is required (e.g., scene simulators in missile simulation systems), accurate management of illuminance becomes necessary.However, for general lighting purposes, high precision control over illuminance is unnecessary due to human perception's Just Noticeable Difference (JND) characteristic that makes it challenging to perceive minor fluctuations in luminous flux (20~30 lux) [6][7].LED light sources possess advantages such as high luminous efficacy, convenient dimming, and colour adjustment, which have led to their substitution of conventional light sources in numerous domains.However, the increase in LED temperature can lead to a decrease in luminous flux and illuminance.Additionally, there is significant variation in luminous flux among LEDs of the same type, which can impact product consistency [8][9][10].The application of illuminance control technology can overcome these limitations by maintaining stable illuminance levels and ensuring product uniformity.In daylight-responsive lighting systems, the utilization of illuminance control enables constant integration of electric lighting with natural daylight while conserving energy -achieving a mutually beneficial outcome.Methods employed for illuminance control include fuzzy logic methods and PID methods [11]- [13].This article utilizes Arduino's PID library for illuminance control to expedite system implementation.

Design of Illumination Control System
The illuminance control system comprises a processing unit, LED driving unit, and sensing unit.The processing unit employs an Arduino UNO board, while the LED driving and sensing units are integrated into an Arduino UNO expansion board on a single circuit board.This expansion board is connected to the Arduino UNO circuit board in a stacked configuration, shown as in Figure 1.The input voltage range for the Arduino UNO is 7-12V, whereas that for HV9910B ranges from 8-450V.Consequently, by combining both systems, an input voltage range of 8-12V is achieved, which also serves as the voltage range for the LED driving unit.Furthermore, the sensing unit operates at 5V derived from the Arduino UNO's 5V output.

LED Driver Unit
The HV9910B provides two types of switching signals, namely constant period and constant low-level time, which are output from the GATE pin to the gate of the field switch Q1.As depicted in Figure 2, this study utilizes jumpers for signal output selection.One end of the frequency-selecting resistor R1 is grounded, while the other end is connected to the RT pin to generate a switch signal with a constant period.Similarly, one end of the frequency-selecting resistor R4 is linked to the RT pin, and its other end is connected to the GATE pin for producing a switch signal with a constant low-level time.In buck mode, it is advisable to employ a switch signal with a fixed low-level time when the duty cycle exceeds 0.5 (i.e., when the output voltage surpasses half of input voltage) in order to prevent sub-harmonic oscillation generation.The HV9910B supports both analogue and PWM dimming techniques.The PWM dimming signal is input through pin 5, which should not be left floating.When not in dimming mode, it must be connected to a high level to drive the LED.This functionality is facilitated by jumper J3 as shown in Figure .2when the expansion board operates independently without requiring dimming, the jumper cap is installed to connect this pin to a high level.However, when working in conjunction with Arduino, the jumper cap should be removed so that this pin can be connected to Arduino's PWM signal output pin.

Unit for Measuring Light Intensity
By utilizing a photoresistor for light intensity measurement, instead of employing digital sensors like Bh1750, we not only achieve cost reduction but also attain a higher sampling rate.The application circuit depicted in Figure 3 is utilized for the photoresistor, wherein the voltage at node A4 exhibits an increase with rising light intensity.To obtain a digital value corresponding to illuminance from the A4 node voltage, calibration of the photoresistor becomes necessary.Calibration is conducted within a darkroom environment and involves the utilization of dimmable lights and an illuminance meter.Some calibration results are presented in Table 1, where the program reads and transmits the digital voltage value to the serial monitor.

Requirements of Design
The determination of component parameters of HV9910B is influenced by the output voltage and current of the LED driver unit.The specific requirements are as follows: (1) The output current should be 0.35 A with a ripple factor of 0.3; (2) For driving 1-2 high-power LEDs rated at 1W, the output voltage should range between 3.3-6.6Vwhen the input voltage is within 8-12V; (3) When the input voltage is 12V, the output voltage should be set to 9V for driving three high-power LEDs rated at 1W.

Calculation of Resistance Parameters
The HV9910B is well-suited for buck conversion and requires only three additional components in conjunction with the voltage transformation circuit: the current sensing resistor RCS, frequency selection resistor RT, and a 0.1μF filtering capacitor.The values of the current sensing resistor and frequency selection resistor can be determined through (1) and ( 2) respectively [14] [15].
The equation ( 1) represents the method for calculating the current sensing resistor when the ripple coefficient is 0.3.Here, ILED denotes the operating current of the LED, and substituting the design value of 0.35 A yields RCS = 0.62 Ω.On the other hand, equation (2) presents a calculation method for selecting a frequency-determining resistor in relation to a switch signal with constant period represented by tosc or a switch signal with constant low-level time also represented by tosc.In this study, we adopt the recommended low-level time of 5 μs, resulting in RT = 100 KΩ [16].

Inductance Parameter Calculation
Under the influence of the switch signal depicted in Figure 4(a), the buck circuit shown in Figure 5 The principle of efficiency measurement is illustrated in Figure 6, wherein the output current and voltage of the expansion board, as well as the input current and voltage, are measured.The output power and input power are separately calculated based on P = UI, while the driving efficiency is determined using equation ( 4).The efficiency of driving one and two LED series was measured using an input voltage range of 8~12V, while a fixed input voltage of 12V was used to measure the efficiency of driving three LED series.As depicted in Figure 7, when the input voltage is held constant, driving two LEDs exhibits higher efficiency compared to driving only one LED.This can be attributed to the fact that connecting two LEDs in series results in a higher overall voltage, thereby reducing the voltage difference (i.e., the discrepancy between input and output voltages) and consequently enhancing the driving efficiency.Notably, when driven by an input voltage of 12V, the maximum achievable efficiency reaches up to 89% for three LEDs.

Testing of Waveforms
The switch signal output from the GATE pin of HV9910B and the PWM dimming signal input from the PWMD pin were experimentally evaluated, as depicted in Figure 8. Channel 1 measured the PWM dimming signal input by Arduino, while channel 2 monitored the switch signal output from the GATE pin.From Figure 8(a), it can be inferred that during high-level periods of the PWM signal, only a switch signal is generated at the GATE pin.Consequently, the actual output of the GATE pin results from an "AND" operation between continuous switch signals and PWM dimming signals.As shown in Figure 8(b), it can be observed that the low-level duration of the switch signal is consistent with its design value of 5μs.

Introduction to Arduino PID
As depicted in Figure 9, PID control is a methodology that performs proportional, integral, and derivative operations on the deviation ( ) (i.e., the disparity between the reference value ( ) and the output value ( )), subsequently accumulating it to generate the control variable u(t).The simulation of PID control can be mathematically represented by equation (5 The role of Kp, Ki, and Kd remain consistent with the equation ( 5) The Arduino utilizes a positional digital PID control algorithm, which necessitates the definition of the PID object through a constructor.In the standard routine, there are two methods for invoking the constructor.PID(&Input, &Output, &Setpoint, Kp, Ki, Kd, Direction) PID(&Input, &Output, &Setpoint, Kp, Ki, Kd, POn, Direction) The "Input" represents the feedback value of the controlled variable.The "Output" is the control variable generated through PID calculation on the deviation (the difference between Setpoint and Input), which is utilized for actuator control.The "Setpoint" signifies the desired value of the controlled variable.Additional member functions provided by the PID class includes parameter adjustment, parameter display and PID operation.Figure 10 depicts the procedural steps involved in the implementation of the PID library.

Experiment on Keeping Constant Illuminance
The "Input" parameter in the constructor represents the feedback voltage of illuminance, which is a digital value ranging from 0 to 1024.The "Output" parameter represents the duty cycle of the PWM dimming signal, determined by the compute() function and ranging from 0 to 255.As illustrated in Figure 11, we utilize analog input pin A4 on the Arduino circuit board for receiving and digitizing the feedback voltage of illuminance using an analog-to-digital converter.Additionally, digital pin 3 is employed for outputting the PWM dimming signal to adjust LED brightness on the expansion board.The coefficients Kp, Ki, and Kd in equation ( 6) must be carefully chosen to ensure satisfactory results; otherwise, the light source will experience flickering.After multiple adjustments, appropriate coefficients were determined leading to stable light output.In an environment with lower illumination

Light intensity sensor
Output than the reference illuminance, the brightness of the light source is regulated to maintain a total illuminance close to the reference value, thereby achieving a consistent lighting effect.

Conclusion
Research on illuminance control based on Arduino technology was conducted, and an expansion board was designed and produced for easy integration with Arduino UNO board.The expansion board includes a driver unit for LEDs and a sensor unit with photoresistor.The program was written using the PID library of Arduino, and the coefficients were determined through repeated adjustments to achieve uniform illumination by superimposing the light source with background illuminance.

Figure 1 .
Figure 1.Arduino and LED driver expansion board.
(a)   alternates between states (b) and (c).During the low voltage period of the switch signal, it operates in state (c), where UL is equal to UOUT.Therefore, we can calculate the value of inductance using (3), where ∆ represents a time interval of 5 μs and ∆ is obtained by multiplying 0.35 A by 0.3, resulting in a value of 0.1 A For design requirement (2), a value of 330 μH is calculated for L when UOUT = UL = 6.6 V, while for design requirement (3), a value of 450 μH is calculated for L when UOUT = UL = 10V.To satisfy both conditions (2) and (3) simultaneously, the inductance needs to be at least 450 μH; therefore, an inductance of 470 μH was chosen.

Figure 4 .
Figure 4.The correlation between PWM signal and inductor current of buck circuit.

Figure 5 .
Figure 5.The topology and state transition of the buck circuit.

Figure 6 .
Figure 6.The principle of efficiency measurement.

Figure 7 .
Figure 7. Correspondence of the voltage with efficiency.

Figure 8 .
Figure 8. Waveform diagrams of switch signal and dimming signal 5. Illuminance Control

Figure 9 .
Figure 9. Block diagram of PID control principle.Figure10.General process of using the PID library.

Figure 10 .
Figure 9. Block diagram of PID control principle.Figure10.General process of using the PID library.

Figure 11 .
Figure 11.Block diagram of illuminance control system

Table 1 .
Calibration results of the photosensitive resistor