Simple mood light controller with three PWM channels, max 100 mA per channel. Uses the AVR ATmega8 microcontroller.

Table of contents

Details

This simple mood light controller has three PWM controlled channels; red, green and blue. Each capable of delivering 100 mA, or about five LEDs. This can easily be improved by using a more powerful transistor. I’ve used 3x3 LEDs soldered to a tiny circuit board as the light source, and placed them inside a frosted glass. A better solution would be to use a powerful RBG LED. Just remember to use another transistor if you want to use bigger LEDs.

Settings

The settings can be changed with four DIL-switches:

  1. Delay between color changes (long / short)
  2. Fade speed when changing color (fast / slow)
  3. Fade when changing color (on / off)
  4. Color mode (one color / all colors)

Video

I/O

Inputs

  1. PD.0 DIP-Switch 1
  2. PD.1 DIP-Switch 2
  3. PD.2 DIP-Switch 3
  4. PD.3 DIP-Switch 4

Outputs

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

LEDs

4-pin connector for the LEDs

Source code

Photos

Circuit board, without AVR microcontroller
Circuit board, with 3×3 LEDs
Testing the controller unit and LEDs
Blue LEDs inside frosted glass
Green LEDs inside frosted glass
Red LEDs inside frosted glass
Finished controller board and frosted glass
Mounted on speaker in the living room

Schematic drawing

Schematics for the mood light controller

Parts list

  • 1 × AVR ATmega8-16PU, DIL-28, 16 MHz, 23 I/Os
  • 1 × Capacitor, aluminium electrolytic, 10 µF, 25V
  • 2 × Capacitor, aluminium electrolytic, 47 µ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, 400 mA, fast-acting
  • 1 × Fuse holder, open, PCB, 5x20mm
  • 3 × LED 5mm clear, Blue, 4.9V, 20mA, 350mcd, 12°
  • 3 × LED 5mm clear, Green, 2.1V, 20mA, 385mcd, 6°
  • 3 × LED 5mm clear, Red, 2.0V, 20mA, 140mcd, 6°
  • 1 × Power jack, panel, 2.1mm, plastic housing
  • 10 × 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%
  • 3 × Resistor, metal film, 0.6W, 1 kΩ, 1%
  • 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 screw female
  • 1 × Terminal block, pluggable, 3.5 mm, 4-pin vertical male
  • 3 × Transistor, NPN, 100 mA, 45V, 0.5W, BC547B
  • 1 × Voltage regulator +5V, 1 A, 7805PI

Resources

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