Mood Lamp on ATTiny13

Moodlamp on ATTINY13

Mood lamp is a LED RGB lamp that changes the color of light at random. There are a lot of mood lamps projects in the Internet and usually they use relatively "big" microcontrollers. I wanted to make a lamp based on simply ATTiny13 microcontroller.

The circuit of the device is very primitive and shown in the figure below:

Moodlamp circuit

Power RGB_LED is connected with the microcontroller through the field effect transistors. To change the brightness of used self-made three-channel PWM. I have used RGB LED with power 3 W. A power supply I have used phone charger with output voltage about 5.5 V. The PCB is designed for SMD components.

Control program for the microcontroller works as follows:

  • randomly generated RGB color value and a time interval for which this color is achieved
  • one of the RGB components randomly set to 0 to ensure that colors are more "beautiful"
  • the timer-counter interrupt handler performs PWM, and after each PWM loop iteration computes current LED color

I have used AVRStudio 5.0 for writing and building the firmware. As result the firmware compiled in Debug mode has a size 1022 bytes, but the firmware compiled in Release mode has a size 1094 bytes and this version is unusable for AtTiny13 with 1K flash. Although I used default AVRStudio settings.

I have used the USBASP programmator with avrdude software for writing the firmware with commandline:

avrdude -c usbasp -pt13 -u -Ulfuse:w:0x7A:m -Uhfuse:w:0xFF:m -Uflash:w:moodlamp.hex:a

Completed PCB:

Moodlamp PCB

As a radiator for the LED I used the shell of the old large aluminum electrolytic capacitor:

Photo of LED on radiator

I put the lamp in this case:

The lamp in case

Then you can watch a video of the device:

On the links below you can download the circuit, PCB-layout, the source code and firmware.

 


 

Files:

Download Circuit and PCB for Eagle + PDF and SVG files for PCB layout
Download Firmware with sources (AVR Studio 5)
Download Compiled firmware

Rating: 
0
No votes yet