Ambient light adaptive LED light dimmer

This paper presents the design of an Adaptive Light Dimmer based on the method of sensingambient light content to adjust lamp's light intensity accordingly, and thus regulating the room's light content. The device is designed to work with renewable energy sources such as wind and solar energy. This would be useful in less developed countries where AC electricity is not well spread and renewable DC sources, such as solar, can be better utilized. It functions by using the TSL2561 light sensor, ATTiny85 microcontroller to output PWM to the LED driver, LT3795 LED driver to output current to an LED and LT3014 LDO to lower the input voltage and power the microcontroller and sensor. The dimmer is designed to work with a 48V input voltage and operate from an input light range of 20 to 100 Lux. Above 100 Lux the light is off and below 20 Lux the light is fully on.


Introduction
With regard to efficiently using sustainable energy, there is a significant amount of data supporting the energy saving capabilities of light dimming technology.Some state that smart lighting, using sensors and controllers to control lighting, saves between 50% and 70% of energy compared to an uncontrolled lighting system [1][2][3][4][5].These energy savings have huge impacts, considering that lighting accounts for about 19% of the electrical energy generated worldwide.In commercial buildings, lighting accounts for even more, 30-40% [6][7][8][9][10][11].This being said, smart lighting seems to be the next logical step in saving electricity and tackling the problems of world-wide electrification in today's world.
In order to improve smart lighting technology, it makes sense to utilize electrical devices, such as microcontrollers, to increase efficiency and usability of lighting systems.Microcontrollers would be a reasonable choice for controlling light dimmer due to their decreasing costs, versatility, and ease of use [12][13][14].In addition to microcontrollers, DC-DC converters are also essential to improving smart lighting systems [15][16][17].These converters are the most efficient ways of converting DC power and consequently are used in many stages of power conversion.Without them, electronics, such as lighting systems, would be much more inefficient.Any improvements to these DC-DC converters directly improve the efficiency and performance of smart lighting systems.
There are existing solutions for AC lighting in the form of smart lighting and socket to bulb interfaces [18][19][20][21][22]. Smart lighting uses "smart systems" to control lighting with applications in computers, tablet devices, or smart phones.On a larger scale, they can also be used to control the lighting system of a room, house, or building.They can wirelessly turn on and off lights, control their brightness, set the lights on a timer, and even integrate sensors.Existing socket to bulb interfaces use a sensor in an attempt to dim the bulb appropriately but they do not function very well.An example of an AC powered smart lighting device, called a home light control module (HLCM) and designed by Ying-Wen Bai and Yi-Te Ku, uses passive infrared (PIR) sensors, light sensors, a microprocessor, and an RF module to control light intensity in all the rooms of a house [23].The system is illustrated in Figure 1.A single HLCM controls one set of luminaires.As a result, multiple microprocessors determine lighting levels, rather than a single central controller.This device uses the PIR sensors to determine the presence of any people in a room, turning off the lights if no one occupies the room.The light sensors determine ISSN: 1693-6930  Ambient light adaptive LED light dimmer (Taufik) 439 the room's brightness levels.If outside sources, like daylight, provide enough light, then the luminaires are turned off.Otherwise, the system activates the appropriate amount of luminaires to achieve the desired brightness levels.The device's RF module allows communication between different HLCMs.In the case that brightness levels are insufficient even when all luminaires are on, communication between HLCMs allows an adjacent HLCM to increase the number of lights to activate.This then affects the light intensity of the first device's room.While these components help this device operate with high efficiency, the design presented in this paper needs not contain any unnecessary modules if their inclusion greatly increases purchase costs.For example, there won't be any need to use the RF module if its use produces costs that outweigh its energy benefits.Additionally, the HLCM does not use light dimming technology while the proposed solution is based on light dimming.
Figure 1.The configuration of an HLCM system for a 2 story house [20] However, there are currently no existing DC dimmers that are inexpensive and entirely autonomous.The objective of the proposed solution is therefore to design and construct an adaptive DC light dimmer that autonomously dims a set of LEDs depending on the ambient light sensed in the room, providing the appropriate amount of light to the environment it is in.The end product of this project will save electricity usage; thus, reducing electrical costs and increasing the viability of renewable energy.

Design Methodology and Requirements
For the proposed design, the adaptive light dimmer must be able to produce the same or more light than a normal 60W incandescent light bulb at maximum brightness.This was determined to be roughly 800 lumens.If the adaptive light dimmer is incapable of producing the appropriate amount of light, a house may not be bright enough during darker hours of the day.Another important aspect is the efficiency of the device.Having better efficiency leads to less costs in terms of both energy and money.While both are definitely important, reduction in energy costs will likely have a greater impact on those rural areas depending on renewable energy sources, since these energy resources are much more limited.The adaptive light dimmer should have at least an efficiency of 70% at full load.
In addition, the device should consume a relatively low amount of power.Considering that the LED being used is a 5 W rated LED, the maximum output power must be 5 W. Derived from the efficiency requirement, the maximum input power must be 7.14 W. The device must be  ISSN: 1693-6930 TELKOMNIKA Vol.17, No. 1, February 2019: 438-447 440 able to operate from a 48 V input, for example to match the DC bus used by the DC house project [24].It should ideally be able to operate at other DC voltages as well for other applications.The device must also be quick to respond without causing abrupt changes.So, the device should be able to adjust its output at least once every two seconds.Each adjustment may need to be gradual for any sudden changes in the surrounding brightness levels.
The sensor should be sensitive enough that it can differentiate changes in daylight throughout the day.The sensor measures light intensity in lux, so the placement of the sensor can have a significant effect on measurement values.The best place to put the sensor is near the floor, as this minimizes the vertical movement of the sensor.Near the floor, the expected lux measurements range from 35 to 150 lux.The device will be connected to a lamp, so the entire system will be fairly large.Approximately, the height must be 4 to 5 feet, and the base should be about a foot in diameter.The height will also help to spread the light to the entire room.
Figure 2 depicts the block diagram of the design, consisting of specialized blocks each with their individual inputs and outputs (I/O).It specifies the types and connections of these I/Os and how it achieves the desired output to the level 0 block diagram.The system first takes the 48 V DC and sends it through a Low-Dropout Regulator (LDO) to lower the voltage to 5 V so that it may be used to power the microcontroller and photosensitive sensor.The photosensitive sensor communicates via i2c to the microcontroller to give a light intensity reading.The microcontroller then maps this reading to a corresponding pulse width modulated (PWM) control voltage that it outputs to the LED driver.Based on the PWM voltage it receives from the microcontroller, the LED driver outputs appropriate PWM current using the 48 V DC from the bus.The LED is driven by the current output and produces the correct amount of light out.The software flow diagram as illustrated in Figure 3 describes the process performed by the microcontroller.The microcontroller initializes the photosensitive sensor and then goes into an endless loop consisting of three stages.First it requests a reading from the sensor.Once it has received and stored this reading, it maps the reading to an appropriate PWM output value through a lookup table.The PWM is then written out to the appropriate pin.

Design and Simulation Results
The main purpose of the Adaptive Light Dimmer is to both minimize costs by using cheaper materials while maximizing efficiency and to operate from a DC voltage source, allowing renewables to be a direct source of power.Simplifying the design can also allow the device to operate without worry of installation.The Adaptive Light Dimmer has three main parts to design.First is the LED driver, which has to drive a 5 V LED at a maximum current of 800 mA.The second is the LDO linear regulator, which had to step down the 48 V input to 5 V in order to power the microcontroller and the light sensor.The last portion of the design is the combination of the microcontroller and the light sensor, both of which have to operate at 5V.
The LED driver used is Linear Technology's LT3795 since it can operate with an input voltage of 48V.The circuit is a buck mode LED driver meant to operate from 24 V to 80 V and output a controlled current to the LEDs.This current can be controlled directly by changing the control voltage or by sending a PWM signal into the PWM pin of the device.The components that has to be changed are the input capacitor CIN, the inductor L, the input current sense resistor R INSENSE , the LED current resistor R LED , the PMOS, the NMOS, and the PNP BJT.These components directly affect the operation of the circuit, so they are changed in order to produce the correct maximum output current and to keep the circuit from damaging any components in the design.Because the input voltage was 48 V, during transient operation, the voltage could reach upwards of 63V; thus, requiring careful consideration when designing the circuit.The equation used to find the appropriate value of C IN in microfarads is: the equation for sizing the inductor: The input current sense resistor is determined more loosely.Because the configuration is a buck LED driver, the input current should not be very high, so R INSNS is chosen as 100 mΩ.By the equation below, the maximum input current can be determined.
The PMOS and PNP BJT transistors are chosen differently because the ones from the datasheet are not readily available for both simulation and hardware tests.The same is true for the NMOS transistor, but in addition, the NMOS transistor is chosen to minimize the gate charge.Higher gate charge values increases the current in the INTVCC pin and could disrupt the operation of the circuit by dropping the INTVCC pin below the threshold.
The timing resistor, which determines the switching frequency of the LED driver, is determined to yield 400 kHz.This frequency is neither too low, which would increase component sizing, nor too high, which would increase losses.The feedback resistors, which set the maximum output voltage, are adequate because the LEDs operated at 5 V.The sense resistor R SNS is used to measure the actual current through the LEDs.Its value must be less than 0.07 V/I LED , which for 800 mA, is calculated to be 87.5 mΩ.The final design of the LED driver is shown in Figure 4. Simulations of the design were done using LTSpice.Results are shown in Figures 5 and 6 for the output voltage and the input current at 100% duty cycle, respectively.The second portion of the dimmer is the low drop-out regulator (LDO) circuit which lowers the 48 V input to a usable 5V for the microcontroller and sensor.The LT3014 was chosen because it fits well into the design; it has the capability of dropping 48 V to 5 V, and it would incur little power loss since the microcontroller/sensor circuit would not pull a significant amount of current.Figure 7 shows the configuration of the LDO to be implemented taken from the LT3014 datasheet.This configuration is setup for "5 V Supply with Shutdown" according to the datasheet and fits the needs of the light dimmer.The value of the capacitor on the output was specified to be at least 0.47 µF to prevent oscillations.The final portion of the dimmer consists of the sensor and microcontroller circuits.The VEML6070 is chosen due to its ability to communicate via I2C and to detect UV light, and because its operating voltage range that is the same as the ATTiny85.The ATTiny85 is chosen for its low cost, I2C capability and ability to produce a PWM output.In addition, it also can be programmed with the Arduino UNO using Sketch's built in "ArduinoISP" library.Since the VEML6070 communicates via I2C, the SDA (data line) and SCL (clock line) have 4.7 kΩ pull up resistors to ensure proper logic levels.These are connected to the 5 V from the LDO, which supplies voltage to the microcontroller and UV light sensor.The output PWM on pin six on the microcontroller connects to the PWM input of the LED Driver.The ACK pin of the VEML6070 sends a signal if the UV light reading drops below a built in threshold and was not connected since the feature is not necessary for the function of the device.The ground is common to the LED driver and LDO circuits as well.The design of the circuit is shown in Figure 8.

Hardware Construction and Results
The hardware of the light dimmer was built and tested in separate stages.The LED driver, LDO, microcontroller, and sensor were tested individually and then combined to construct the entire system.After constructing the circuit on the PCB as shown in Figure 9, testing the individual components, and checking all possible connections, power was applied and the entire system to evaluate its functionality.Results from the test demonstrate that when dark below 10 Lux, the LED driver received 100% duty cycle and the lamp went to full brightness, and when bright above 100 Lux, the LED driver receives 0% duty cycle and the lamp outputs no light.Different duty cycles were assigned to different ambient light levels in between 0 and 100 Lux.This approach reduces the complexity in the operation of LED drive using the pulse density modulation [25][26].

445
The LED dimmed and grew brighter according to how much light reached the sensor, and the brightness changed smoothly without visible leaps in light output.The adaptive light dimmer worked as expected as ambient light levels increased and increased in brightness during low light.When dark, below 10 Lux, the LED driver received 100% duty cycle and the lamp went to full brightness and when bright, above 100 Lux, the LED driver receiver 0% duty cycle and the lamp outputs no light.Different duty cycles were assigned to different ambient light levels in between 0 and 100 Lux.The LED dimmed and grew brighter according to how much light reached the sensor, and the brightness changed smoothly without visible leaps in light output.Furthermore, the proposed design was quick to respond to changes in the environment, as the LED was able to change more quickly than once every two seconds and each change was gradual.This is important to prevent the LED's dimming from bothering users.Overall, the proposed adaptivelight dimmer is an improvement in functionality compared to the results presented in [2].
However, this achievement comes at the cost of efficiency because the microcontroller and sensor draw about 30 mA, increasing the input power needed while the output power of the LED stays constant.This current is relatively significant compared to 115 mA input current needed for the LED driver.Thus, the microcontroller and sensor increased the input current to yield input power by 26%.The high input voltage of 48 V meant that input power increased by about 1.44 W, about 1.29 W of which was dissipated through the LDO.Figures 10 through 12 detail the hardware test results of the adaptive light dimmer prototype.These results indicate the linear operation of the light dimmer as duty cycle is varied.The efficiency after connecting the microcontroller and LDO was 48.7%, which is well below that presented in [27].Based on these results, the main function of sensing ambient light levels and dimming appropriately has been achieved by the proposed solution.

ft radius with varying duty cycle
There are several ideas to improve the performance of the proposed adaptive light dimmer.One example involves the addition ofa 0.47 µF LDO output capacitor will be included on the PCB design to ensure that the microcontroller and sensor circuit were receiving a more stable voltage.This capacitor needs to be connected close to the supply of the microcontroller and sensor.The easiest way to do this would be to connect a 0.47 µF through-hole ceramic capacitor between the input voltage to the sensor on the PCB and the ground to the sensor on the PCB.

Conclusion
An adaptive LED light dimmerwhich operates automatically based on ambient light condition was presented in this paper.The design has been shown through computer simulation and hardware prototype tests to successfully perform the dimming function following the changing condition of the ambient light.Theproposed solution reduces the complexity of previous approaches and it can be adapted to any DC system operating at different DC voltage levels.Further improvements of the proposed solution involves increasing the overall system efficiency.This could be done by utilizing a snubber to the NMOS switch to reduce switching losses at 400 kHz.The PCB design could also be optimized for better signal integrity since many components are farther apart on the current PCB design.Additionally, an alternative to the LDO utilized in the proposed designmust be sought to further improve the overall efficiency.

Figure 2 .
Figure 2. Block diagram of the adaptive light dimmer

Figure 3 .
Figure 3. Software flow diagram of the adaptive light dimmer


ISSN: 1693-6930 TELKOMNIKA Vol.17, No. 1, February 2019: 438-447 442The LED current resistor is chosen such that the maximum LED current is 800 mA.Because the control pins are tied high, the equation used to determine the LED current resistor is simplified to:

Figure 4 . 443 Figure 5 .Figure 6 .
Figure 4. Final schematic of LED driver for the adaptive light dimmer

Figure 7 .
Figure 7.The LDO section of the adaptive light dimmer

Figure 8 .
Figure 8. Sensor and Microcontroller Circuit Diagram of the adaptive light dimmer

Figure 10 .Figure 11 .Figure 12 .
Figure 10.Hardware test results on input and output currents with varying duty cycle

Lux 4 ft
Radius vs. Duty Cycle