This project uses an AVR ATtiny2313 to cycle an RGB LED randomly through the color spectrum and the light from the LED is diffused through a ping pong ball. The code and schematics for this project are on GitHub at https://github.com/dragongears/AVR-ATtiny2313-RGB-LED-Glow-Ball-Project.
The main goal of this project is to have the LED cycle randomly through the color spectrum. The LED should remain bright and should never dim or fade to black. There are two pushbuttons on the circuit board, one for changing the mode between color cycling and a steady color and another for changing the speed with which the colors cycle or for changing the color of the LED, depending on the mode. When changing the speed that the the LED changes color, the LED will blink to indicate the speed (1 blink = slow, 2 blinks = medium, 3 blinks = fast).
The RGB LED Glow Ball is a very simple circuit with an Atmel ATtiny 2313 with two pushbutton switched connected to Pins PD0 and PD1 and an RGB LED on pins PB0 – PB2.
The PWM for each of the three colors of the RGB LED in this project is implemented in software using a timer driven interrupt. Reading through the spec sheet for the ATtiny 2313 I saw that it had two timers (one 16 bit timer and one 8 bit timer) which led me to believe that the ATtiny 2313 only had two PWM outputs. Further research after I finished this project turned up that each timer has two PWM registers, so it should be possible to use the hardware PWM for all three colors of the LED. Maybe one day I’ll create an RGB LED Glow Ball Mark II that uses the hardware PWMs.