Programmable Light Controller

Low cost, easy to build, high power LED controller with a built-in programmable timer.

Similar projects worth following
The main objective of this project is to design a maintenance free and low-cost light which automatically turns on and off at the predetermined time of the day.

To meet the above requirement I designed this controller using ATmega8 MCU and DS1307 RTC. The driver stage of this light controller is intended to work with commonly available 7W LED modules.

The core component of this programmable light is ATmega8 low power CMOS microcontroller. The main reason to select this microcontroller is it’s lower cost and higher availability. Except for the above two reasons this microcontroller also bundled with a rich set of peripherals which including 23 GPIOs, 3 independent timers, Two-wire serial interface, EEPROM, etc.

Apart from ATmega8 microcontroller, this system uses DS1307 real time clock to maintain system time. Like ATmega8, DS1307 is also a very popular RTC in the market.

This controller is designed to work with a 24V DC power supply. The main reason to select 24V is that most of the medium power LED modules in the market are designed to work with that voltage. During my search all the medium power LED modules which I found are designed to work with 20V - 28V range. Out of those LED modules, the majority of modules are rated for 24V input.

For this circuit, the recommended power supply is 24V 1.5 A portable switch mode power supply. Except for the LED driver stage the all other parts of this light controller is designed to work with 5V. MC34063 DC-to-DC converter is used to supply 5V to those components.

To reduce the size I design this system using surface-mounted components, but this system can also build using through-hole type components. At the prototype stages, I build this system entirely on a breadboard using through-hole type parts.

To build 7W light, I used LED lamp parts available in the market which including Warm white 7W LED panel, aluminum lamp shell (heatsink) and diffusing cap (lamp cover).


Gerber files to produce PCB.

gzip - 131.38 kB - 03/22/2019 at 15:48



Schematic of the programmable light controller.

Adobe Portable Document Format - 105.15 kB - 03/22/2019 at 15:48



Compiled ATmega8 firmware file.

gzip - 3.96 kB - 03/22/2019 at 15:48


  • 1 × ATmega8 Microprocessors, Microcontrollers, DSPs / ARM, RISC-Based Microcontrollers
  • 1 × DS1307 Real time clock
  • 1 × MC34063 Power Management ICs / Switching Regulators and Controllers
  • 1 × IRF540 Discrete Semiconductors / Power Transistors and MOSFETs
  • 5 × MMBT3904 Discrete Semiconductors / Transistors, MOSFETs, FETs, IGBTs

  • 1
    PCB fabrication and soldering

    The PCB design which I provide is based on 2 layers and because of that, it's advised to build this PCB using some PCB fabrication service.

    After fabricating PCB, you can start soldering the components into it. At first, try to solder SMD ICs. After soldering all 3 ICs next start with small SMD components such as resistors, capacitors and SOT-23 transistors. I highly suggest installing seven segment display, DC jack base, battery clips and terminals header at the last stages of the soldering.

  • 2
    Upload firmware into the system

    Once all the components are assembled the next task is to feed firmware into the microcontroller. To upload the firmware the most recommended method is to use AVR in-circuit programming (ISP) compliant adapter.

    This system is designed to work with standard 6-pin AVR ISP interface and there are plenty of programmers are available for this interface.

    During my prototype assembly, I used a USBasp programmer to flash the microcontroller with firmware.

    During the firmware upload process pays extra attention to ATMega8 fuse settings. To get intended results low-fuse byte should set to 0xEF and high-fuse byte should set to 0xD9. For more details refer project documentation at the GitHub.

    While using ISP make sure to disconnect the 24V power supply from the system.

  • 3
    LED module

    After uploading firmware, the only remaining task is to connect the LED module into the controller.

    Before soldering 7W LED module, fix it to the provided heatsink. To improve thermal transfer make sure to apply thermal grease between the LED module and heatsink.

    While LED lighting for long hours its temperature increase up to 70°C - 80°C. Because of this, make sure to take necessary action(s) to isolate the LED wire line with temperature. To overcome this, in prototype build I drive this wire through a high-temperature resistantBasalt sleeve.

View all 4 instructions

Enjoy this project?



George Zimbru wrote 04/25/2019 at 22:26 point

So I think adding a GPS clock would be easier instead of adding WWVB (the antenna for the WWVB is massive compared to this board). Has been on the back of my mind and then I saw KK99's work on the hackaday blog. Only issue would be clock updating indoors.

Looks like it is doable. Upgrading to a DS3231 for better accuracy would be nice too.

  Are you sure? yes | no

Dilshan Jayakody wrote 04/26/2019 at 00:36 point

Good GPS antenna may sometime help to run this indoor.

Yes, according to the datasheet DS3231 is more accurate then DS1307. I cannot find it in here as chip, so that's the reason I stick with DS1307. By looking at the datasheet it seems DS3231 has same I2C address and registry structure. I think same code-base can work with DS3231. 

  Are you sure? yes | no

George Zimbru wrote 04/12/2019 at 14:50 point

How hard would it be to add WWVB?

  Are you sure? yes | no

Dilshan Jayakody wrote 04/12/2019 at 16:07 point

Hi George, WWVB may be an interesting extension to this unit. To do that we need to build front end of the receiver and implement signal processing part in Atmega8 firmware.

I actually never try WWVB reception from here (in Sri Lanka). So I'm not sure how much of work we need to do for this, especially with firmware.

  Are you sure? yes | no

George Zimbru wrote 04/12/2019 at 16:19 point

Thanks for the reply and thanks for sharing your design! Will try building one of these when I get a chance and tinkering with it.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates