Turn any RGB LED into a mood light with this controller. Uses an AVR ATmega8 microcontroller.

Table of contents

Controller

The mood light controller can control all kinds of RGB light, max 500mA per channel. The module has no voltage regulator and therefore needs 5V=, and enough current to drive the circuit and the connected LEDs. It very slowly cycles through different colors, fading one LED up or down leaving the previous LED turned on. The module can power Prolight LEDs, like this.

In firmware version 1.2, the light patterns was replaced with only one, and the operation of the DIP-switches was removed, simply because I didn’t ever use them.
Stripboard inside controller module
Stripboard inside controller module

The controller very slowly cycles through colors, fading one LED at the time. It happens so slowly that it’s hard to notice the change at all.

  1. Fade in blue color in about 12 seconds (only on first start up).
  2. Increase red.
  3. Decrease blue.
  4. Increase green.
  5. Decrease red.
  6. Increase blue.
  7. Decrease green.
  8. Go to step #2.

The fade time for each color is random and varies between 1 and 3 minutes, and changes between each fade.

Controller module connected to relay

A bit of history

Prior to firmware version 1.2 the mood light controller had different light patterns that was controlled with the four DIP switches:

  1. Pause between color change (long/short)
  2. Fade speed when changing color (long/short)
  3. Color change fade (on/off)
  4. Color mode (one color/multi color)
Color mode: One color means that one color is stable at the time, this gives three colors. Multi color has two stable color at the time, and this gives six colors (red, yellow, green, cyan, blue and purple).

After using the light for a few years, I hadn’t changed the light pattern once… And I would like for it to be more subtle. I made a new pattern, and didn’t bother spending time to write code for the DIP switches I wasn’t using anyways.

I/O

Inputs

  1. PC.2 DIP-Switch 1 (Not used from v1.2)
  2. PC.3 DIP-Switch 2 (Not used from v1.2)
  3. PC.4 DIP-Switch 3 (Not used from v1.2)
  4. PC.5 DIP-Switch 4 (Not used from v1.2)

Outputs

  1. PB.1 (OC1A) Red LED (PWM)
  2. PB.2 (OC1B) Green LED (PWM)
  3. PB.3 (OC2) Blue LED (PWM)

To make it easy to attach and detach lights, the module has a connector for the RGB light.

4-pin connector for RGB LED

Source code

Schematic drawing

Schematic drawing for the mood light controller

Parts list

  • 1 × AVR ATmega8-16PU, DIL-28, 16 MHz, 23 I/Os
  • 1 × Cable tie mount, screw, 5.1 mm, White
  • 1 × Capacitor, aluminium electrolytic, 10 µF, 25V
  • 1 × Capacitor, aluminium electrolytic, 22 µF, 25V
  • 1 × Capacitor, ceramic, 1 nF, 100V
  • 1 × DIL socket, 28-pin, 7.62mm
  • 1 × Diode, rectifier, 1 A, 400V, 1N4004
  • 1 × Enclosure, plastic (1591), 100x50x25mm
  • 1 × Fuse 5x20 mm, 800 mA, fast-acting
  • 1 × Fuse holder, open, PCB, 5x20mm
  • 1 × Fuse holder, open, PCB, Protective cover
  • 32 cm2 PCB, stripboard, 100x160mm, 160cm2
  • 1 × Power jack, panel, 2.1mm, plastic housing
  • 4 × Resistor, carbon film, 0.25W, 330 Ω, 5%
  • 4 × Resistor, carbon film, 0.25W, 4.7 kΩ, 5%
  • 4 × Resistor, carbon film, 0.25W, 10 kΩ, 5%
  • 4 × Rubber foot, adhesive, SJ-5012, Ø 12.7x3.5 mm
  • 1 × Switch, DIP, PCB, 4-pin
  • 1 × Terminal block, pluggable, 3.5 mm, 4-pin vertical male
  • 3 × Transistor, NPN, 800 mA, 45V, 0.625W, BC337-25

LED light

Prolight RGB LED mounted to heat sink

This mood light consists of a Prolight RGB 3W LED, a heat sink and four rubber feet. The four rubber feet form a base on which e.g. a glass ball, or something else transparent can be placed. It will be lit up by the LED and looks pretty cool. Powered by: 5V.

LED lighting up glass ball

Between the LED and the heat sink there is some heat conducting film, to better dissipate the heat. The LED is common anode, with resistors for use on 5 volts. It gives off 30 lumens of light in 140 degrees.

White rock candle light holder, placed on LED

Here are the parts I used for the RGB LED:

  • 1 m Control cable, 4-cores, 0.25mm2, 250 V, Ø 4.6mm
  • 1 × Heat conducting film for heatsink, Adhesive, TO220
  • 1 × Heatsink Prolight, 50x48x17mm, size 2
  • 1 × LED Prolight, RGB, 3W, 2.2 3.3 3.4V, 350mA, 140°
  • 2 × Resistor, metal film, 1W, 5.1 Ω, 5%
  • 1 × Resistor, metal film, 1W, 8.2 Ω, 5%
  • 4 × Rubber foot, adhesive, SJ-5027, Ø 16x7.9mm
  • 1 × Terminal block, pluggable, 3.5 mm, 4-pin screw female

Last commit 2021-08-06, with message: replace some youtube videos