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:
- Delay between color changes (long / short)
- Fade speed when changing color (fast / slow)
- Fade when changing color (on / off)
- Color mode (one color / all colors)
Video
I/O
Inputs
- PD.0 DIP-Switch 1
- PD.1 DIP-Switch 2
- PD.2 DIP-Switch 3
- PD.3 DIP-Switch 4
Outputs
- PB.1 (OC1A) Red LED
- PB.2 (OC1B) Green LED
- PB.3 (OC2) Blue LED
LEDs
Source code
- Bascom-AVR source is available in a git repository:
- https://github.com/thomasjsn/AVR-Mood-light-1
Photos
Schematic drawing
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 2024-11-11, with message: Add lots of tags to posts.