Introducing the Mini Mood Light v1

Over the coming months I will use this site to try and document some of my previous electronics projects, as well as covering my future work and activities.  Kicking things off I’ll introduce the Mini Mood Light v1 kit.

Most of my recent projects have involved light emitting diodes (LEDs), you could possibly go as far as saying I’m obsessed. Some of my recent projects required hundreds and thousands of LEDs.

For the beginner working with a standard LED is relatively simple. It just requires a LED, a voltage source (battery) and a resistor with the correct value (ohms law is your friend). Working with a Tricolour or RGB (Red, Green and Blue) LED is a bit more complicated.

To achieve the larger range of possible colours with a RGB LED you can use pulse-width modulation (PWM). PWM is used to control the intensity of the LED by rapidly turning it on and off and by varying the amount of time that the LED is on or off. With a RGB LED the human eyes and brain are able to combine the different intensity of the individual red, green and blue LEDs into a particular colour.

The Mini Mood Light v1 provides a simple way for you to experiment and learn about working with RGB LEDs. The circuit combines two independent RGB LEDs, four buttons and a micro controller (MCU) on a small circuit board.

The Mini Mood Light v1 uses a MSP430G2211 MCU from Texas Instruments (TI). This MCU doesn’t contain any PWM hardware, but it’s relatively straight forward to implement PWM functionality in code using a loop and a comparison. The following fragment of C gives a very simple implementation.

int pwm = 128;
while (1) {
    enable_led();
    for (int i = 0; i < 256; i++) {
        if (i == pwm) {
            disable_led();
        }
    }
}

The combined pins of the MCU have a maximum source or sink current of 48 milliamperes. Reasonable luminous intensity for a typical LED is achieved at about 20 milliamperes. Which for the six LEDs in the Mini Mood Light that make up two RGB LEDs would exceed the maximum current rating of the MCU. To overcome this a Darlington transistor array (ULN2003A) is used as a switch to control the LEDs. With a suitable resistor setting the current for each LED to 20 milliamperes.

Four tactile buttons are connected directly to the MCU and can be sampled and debouched by polling or using a timer interrupt within the MCU. A 3.3 volt low dropout linear regulator (MCP1702), reverse polarity protection diode and a number of decoupling capacitors round out the circuit.

The Mini Mood Light v1 kit is being used as a hands on activity during a set of electronics workshops I’m giving in the TOG Hackerspace in Dublin. The workshops called Building it! are part of their Science Week 2010 and Innovation Dublin Festival 2010 activities.


Posted

in

by