With Halloween coming up, I decided to build some LED lights to go inside our pumpkins this year instead of using candles and wanted to have something programmable but without the cost of an Arduino board so decided to try out Adafruit’s trinket microcontroller. These are Arduino-compatible (with limitations) and only cost $7.95. Here’s a video of a couple different effects that I’ve tried so far – some multicolored blinking lights and then a flickering fire/candle effect just using the red LED. This looks better in real life than it does in the video clip (especially in the dark).
To build this, I simply connected one common-annode RGB LED to the trinket with the annode connected to the trinket 5V pin and each of the RGB leads connected via a 220 ohm resistor to the trinkets 3 PWM pins – digital pins #0, #1 and #4. Because the electricity is flowing through the LED into the PWM pins writing a low value to the PWM pin turns the LED on and a high value turns it off. If you use a common cathode LED it will be the opposite of this.
Here’s how to wire this up. Note that there are different variants of the trinket out there so the 5V and Rst pins might be the other way around.
I’m using a mini breadboard which fits nicely in the lid of a gelato tub and with some tissue paper on the inside of the tub it diffuses the light nicely. The main reason for using the gelato tub is to protect the electronics from rain or the pumpkin gunk.
I’ve posted more information about this project over at Instructables: