Control High-powered LEDs by Arduino and Real-Time Clock


  1. Is this enough tutorial for an LED controller around? Yes, there are many LED control guides from display color to build an studio lighting. I often asked this question to make sure I did not repeat someone else and my writing should provide additional utility. One objective of my quest was to control a powered LED panel with a defined profile light intensity and a real-time clock, and a light sensor to double check the output of LED panel. The input, output of the light intensity are logged into an SD card for post-analysis.

  2. What are the parts? Below are the parts I used in this project and the details will be present along the way.

  3. Optional: I want to mimic any profile of solar intensity, which depends on the region and a season. A solar profile can be simple as the hours vs. intensity of light for 24 hours. I grew microalgae for research so that the particle density (µE, a photon) of light is the primary metric. The max intensity could reach 2400 µE/m2-s in the range of 400-700 nm in the summer's noon). Other light units are W/m2, lux, candle/ft. Converting between those sources has to be taken into account the light source (incandescent, halogen, flourescent, solar, LED) or in more techical the spectra of the light source.

  4. Optional: One key difference of the setup in this tutorial with other solar simulations is that two arrays were defined in the Arduino code. One is for hours to map a time to change the intensity. The second is solar values converted to percentage (between 0-1.0) to the max value of the profile. With a definedinterval, in this case 5 minutes, the program reads the real-time value and checks the corresponding value for light stored in the second array. If a new value is found, the Arduino writes the value of intensity in Pulse-Width Mudulation (PWM) format to the pins that controls the LED driver. See this chart for a less wordy explanation.

  5. Important: If you have not played with LED before, then here some basics I learnt. LED is one type of diode that emits light so both polarity and forward voltage are the key. To turn on an LED light, a voltage larger than the forward voltage is applied. The LED light (which is a special diode) turns from non-conductible (the internal resistor is very large) to conductible (the resistant is very small). The chip will allow whatever current on the DC source to run through. If no heatsink is attached, the chip will be burnt out because of too much heat. You have less than 2 secs to see the busting of an LED chip. That means limiting the current below the forward current is a MUST for any LED light.

But first, let start with an intro video about LED light:

Summary:An LED light only turned on with a approx. voltage called forward voltage (Vf). Vf can be in a range of 2-3.2V with +/-0.2V, and depends on the color of LED with the red is the lowest and blue is the highest. After the LED is turned on, the current is increased from zero to couple of A and will destroy LED unless the current is limited.

The table below gives us a quantitative comparison.

Comparisons between Traditional Incandescents, Halogen Incandescents, CFLs, and LEDs

60W Traditional Incandescent

Energy-Saving Incandescent



60W Traditional 43W Halogen 60W Traditional 43W Halogen

Energy $ Saved (%)






Annual Energy Cost*





Bulb Life

1000 hours

1000 to 3000 hours

10,000 hours

25,000 hours

*Based on 2 hrs/day of usage, an electricity rate of 11 cents per kilowatt-hour, shown in U.S. dollars. The cost seems to be normalized for a whole life-time of an LED.