Randomly Twinkling LEDs

In this short project we are going to use the MSP430G2452 chip that comes in the box with the Launchpad. We are going to turn it upside-down, and solder things directly to the legs of the chip. This is referred to as "dead bug" construction, and is a way to get small simple projects done quickly. It is also referred to as "ugly construction" for reasons you can see in the photos.

We glued the chip to a 3x5 card and marked the power, ground, and reset pins, since it is easy to get confused as to which pin is which when the chip is upside down.

The power supply is 3 AAA cells. There is a wire connecting the +3 volt power pin (pin 1) to the reset pin (RST, pin 16) to keep that pin high. That prevents the chip from constantly resetting itself. The LEDs are in this case simply soldered to each pair of output pins, so we have 8 lights. You could also solder one leg of the LED to each output pin, and the other leg to ground, and get 16 lights flashing at random.

The program is very simple. We set all of the pins to be outputs, and then use the random() function to get a number between 0 and 255. We then send that number to Port 1. We do the same for Port 2. We control how fast the LEDs flash using the delay() function. In this case, 100 milliseconds (a tenth of a second) gives us some pretty frenetic flashing. Without the delay, the lights would simply appear to be on, since they would be flashing faster than your eye could detect.

In case the bright lights make parts of the picture hard to see, here are a couple more shots, where the random lights are lit in different ways.

When programming the extra chip, you must first remove the MSP430G2553 chip from the Launchpad. Use a small slot screwdriver and gently work it under the pins until the chip is free. Try not to bend the pins, as repeated straightening weakens them. Then gently insert the new chip. The legs of the chip may be splayed out a little bit -- this can be fixed by gently pressing the side of the chip against the desktop before trying to insert it.

Finally, you have to remember to change the setting of the Tools|Board menu from MSP430G2553 to MSP430G2452, as shown below:


Random Twinkling LEDs