Instructables

RGB LED lighting effects with Adafruit Trinket

Picture of RGB LED lighting effects with Adafruit Trinket

This instructable is to make programmable light effects using an RGB LED (this is an LED containing individual Red, Green and Blue elements) and the low cost Adafruit Trinket microcontroller. These lights can be used and re-used for multiple projects such as night lights, party lights and pumpkin lights for Halloween. The entire project only costs around $10 fully assembled.





 
Remove these adsRemove these ads by Signing Up

Step 1: Preparation

Picture of Preparation
Here are the components I used for this project:

1 x Adafruit Trinket (5V) (http://www.adafruit.com/products/1501)
1 x Adafruit Perma Proto Breadboard PCB (http://www.adafruit.com/products/589)
1 x Diffuse common-annode RGB LED (http://www.adafruit.com/products/302)
3 x 220 ohm resistor
1 x 9V battery connector
Some female headers that shipped with the trinket
Some male headers (http://www.adafruit.com/products/392)

Note that you can use a solderless breadboard instead of soldering this onto a PCB (and you should always do this first to make sure it works before committing to PCB). However, if you want to keep and reuse this project, I definitely recommend using a PCB. The great thing about the Adafruit breadboard PCB is that it is laid out exactly like a regular breadboard with lines of connected pads which makes soldering so much easier in my opinion.
tarekisfree11 months ago
Are you able to actually modulate pin #4 on the (blue) with the code above? My understanding is that you need to jump through some hoops to enable PWM on pin #4, as described in this Adafruit tutorial.
agrove3 (author)  tarekisfree11 months ago
I did run into this issue and posted a message on the Adafruit forum here:

http://forums.adafruit.com/viewtopic.php?f=52&t=43951&p=219302&hilit=trinket+pwm#p219302

There is some information here what to work around the issue. I haven't actually tried it myself yet but it is supposed to work. Hope that helps.
agrove3 (author)  agrove325 days ago

Adafruit just posted a solution to this issue. See the end of this page:

https://learn.adafruit.com/introducing-trinket/programming-with-arduino-ide#analogwrite

geocacher210 months ago
Do you have the re-written code with the fix for the pin 4 PWM issue? If so, could you add it to the instructable? I'd like to adapt it for a project I'm working on. Thanks
billchensg11 months ago
This is great keep up the good work