Project Requirements
- Educational: I’d like people to learn something while tinkering with it.
- Durable: It will need to take a lot of abuse.
- Exposed: This might conflict with durability, but I don’t really want it hidden away in an enclosure. I’d like the guts to be visible.
- Open source and hardware: I’d like to share this as freely and widely as possible.
- Inexpensive: Ideally $30 or less, so that people can afford to actually build them.
- Quality: May conflict with inexpensive, but there’s no point building these cheaply if they don’t last.
- Accessible: Easy to assemble, but so easy that nothing is learned by bulding one. All components need to be through-hole. No surface mount soldering, reflow oven, etc should be required.
With these goals in mind, I created this PCB.
Printed Circuit Board
Here are the Eagle files (schematic & board)
Features
The switch will change the potentiometers from controlling RGB to HSV. The PCB includes the NeoPixel “best practices” capacitor and resistor, and pins to connect more LEDs (a strip, ring, etc). The tactile momentary push button could be used to change modes, from the tutorial to patterns, animations, etc.
The mounting holes below the Teensy LC will allow the PCBs to be mounted on a board, so they don’t fall off the table or “walk away”.
Parts List
| Name | Qty | Price | Total | Supplier |
|---|---|---|---|---|
| PCB | 1 | $4.52 | $4.52 | OSH Park |
| Teensy LC | 1 | $11.65 | $11.65 | PJRC |
| 14 Pin Header | 2 | $0.28 | $0.56 | PJRC |
| 14 Pin Socket | 2 | $0.70 | $1.40 | PJRC |
| NeoPixel Stick 8x | 1 | $5.95 | $5.95 | Adafruit |
| SPDT Slide Switch | 1 | $0.95 | $0.95 | Adafruit |
| Tactile Button (6mm) | 1 | $0.25 | $0.25 | Adafruit |
| 10k Linear Pot | 3 | $0.83 | $2.49 | Digi-Key |
| 10µF Capacitor | 1 | $0.17 | $0.17 | Digi-Key |
| 330 Ohm Resistor | 1 | $0.10 | $0.10 | Digi-Key |
| 10K Ohm Resistor | 1 | $0.10 | $0.10 | Digi-Key |
| 5 Pin Header | 1 | $0.30 | $0.30 | Digi-Key |
| 5 Pin Socket | 1 | $0.62 | $0.62 | Digi-Key |
| 4 Pin Right Angle Header | 1 | $0.45 | $0.45 | Digi-Key |
| 4 Pin Socket | 1 | $0.60 | $0.60 | Digi-Key |
| Total | 19 | $29.06 |
Components
LEDS
I decided to go with NeoPixel Stick 8x. They are a bit cheaper and include more LEDs than the Breadboard-friendly NeoPixels.
Microprocessor
In an effort to minimize the parts cost, while maintaining the ease of assembly and use, I initially thought about using a 5V Trinket. They’re inexpensive, but still high quality, and won’t require a level shifter. They just don’t have enough inputs, so I switched to the 5V Pro Trinket. Then I remembered the Teensy LC, which is less than $2 more, has a 5V digital output pin, faster processor, more RAM, FLASH, etc. It can also be ordered from OSH Park with the PCB. I was also warned by several people that the upload process for the Trinket can be a bit tedious.
Soldering
Note: Double-check the position, alignment, and orientation of each component very carefully before soldering!
If you’re new to soldering, I highly recommend buying the Teensy LC with header pins already soldered. It’ll save you some time and effort.
I also recommend reading through a good soldering tutorial, such as the ones by Adafruit and SparkFun.
Teensy LC
Carefully solder 0.1 inch (2.54 mm) header pins to the Teensy LC. It’s easiest to insert the header pins into a breadboard and soldering the Teensy on from there, as shown in this tutorial by SparkFun.
You can also use the PCB to line up and solder the pins, after you’ve added the female headers, if you don’t have a breadboard available.
You will need to solder the 5 header pins on the end of the Teensy as well. At the very least, you must solder one header pin to the hole for pin 17 on the end. This is the 5V logic output pin used to drive the NeoPixels.
PCB

I prefer to add components to the PCB from the shortest to the tallest. I find this way is easiest to hold the PCB steady when soldering. If you have a third hand, it can help as well.
Tactile Push Button
If you’re using a tactile push button that is shorter than the resistors, insert and solder it first.
Resistors
Bend one leg of each resistor 180 degrees and insert them in their respective places on the PCB. Make sure you put them in the correct places, as labeled on the PCB. Solder them in place.
Switch
If your switch has little metal tabs on the end (like the ones from Adafruit), you may need to clip them off or bend them to get the switch to sit flush on the PCB. Solder the switch to the PCB, as labeled. The orientation of the switch will not matter.
Female Headers
If you have a breadboard and some Extra-long male header pins, you can use these to align and hold the female headers while you solder.
You can also insert the Teensy LC into the female headers, then insert the female headers into the PCB to ensure they’re correctly aligned.
Insert, align, and solder the female header sockets. Make sure these are aligned correctly before soldering!
Tactile Push Button
If you’re using a tactile push button that is taller than the resistors, insert and solder it now.
Capacitor
Insert and solder the capacitor. Note: Make sure the negative lead, marked with a minus (-) sign, is inserted into the labeled negative hole in the PCB!
Potentiometers
Insert and solder the potentiometers.
NeoPixels

Use a third hand, clothes pin, paper clip, etc to hold the short side of the right-angle header pins on the “DIN” side of the NeoPixel strip while you solder. The longer legs of the pins, with the black plastic insulator, should be sticking up at a right angle from the NeoPixel stick.
Assembly
Insert the Teensy LC into the sockets on the PCB. Make sure it’s oriented correctly, with the USB port on the edge of the PCB.
Insert the NeoPixel strip into the sockets. Double-check the alignment, comparing the labels on the strip to those on the PCB.
Knobs for the potentiometers are nice, but not required. I bought some cheap knobs on Amazon, but had to trim them down with some wire cutters, and drill out the center hole a bit to make them fit.
You could, alternatively, put a little red, green, and blue paint or nail polish on the top of the potentiometer posts.
If you have a multimeter that can measure resistance, it’s a good idea to make sure there are no shorts between power and ground on the board after assembly. You should measure infinite (or at least very high) resistance between the 5V and GND pins on the Teensy LC, NeoPixel strip, connector, etc.
After double-checking that all components are correctly aligned, you can connect the Teensy LC to a computer via a Micro USB cable.
Software Setup
Arduino IDE
Download and install or extract the (Arduino IDE](https://www.arduino.cc/en/Main/Software).
Teensyduino
To compile a sketch for the Teensy, you’ll need an add-on for the Arduino IDE called Teensyduino. Download and install it.
You will be asked to install additional libraries during the Teensyduino installation. Do not install all the libraries! Click ‘None’.
FastLED Library
If you’re unfamiliar with them, Adafruit’s Arduino Libraries tutorial will tell you everything you ever wanted to know about libraries, including more detailed installation instructions.
Download the latest version of the FastLED library, then unzip the file and rename the folder to “FastLED” (no quotes). Copy the file into your Arduino/Libraries folder.
Or use git to clone the FastLED repository:
cd ~/Documents/Arduino/libraries
git clone https://github.com/FastLED/FastLED.git
Either way, you’ll likely need to restart Arduino for the library to get loaded and show up.
Code
I created a simple Arduino sketch to show how RGB & HSV work to combine to create different colors. I also included a rainbow pattern that is displayed when the momentary tactile button is held pressed.
Copy and paste the code into a new Arduino sketch (it’s also on GitHub as FastLED-RGB-HSV-Tutorial.ino):
#include "FastLED.h"
// How many leds in your strip?
#define NUM_LEDS 8
// Data pin for the LEDs
#define DATA_PIN 17
// Potentiometer pins
#define POT_0_PIN A0
#define POT_1_PIN A1
#define POT_2_PIN A2
// Switch pin
#define SWITCH_PIN 9
// Push button pin
#define BUTTON_PIN 2
// Define the array of leds
CRGB leds[NUM_LEDS];
// setup is called once by Arduino automatically
// all initial setup work should be done here
void setup() {
// start the serial port, so we can log data to the Arduino IDE
Serial.begin(9600);
// start FastLED, tell it about our LEDs
FastLED.addLeds<WS2811, DATA_PIN, GRB>(leds, NUM_LEDS);
// set the LED brightness
// this is a global brightness, applied regardless of what color(s) are shown on the LEDs
FastLED.setBrightness(64);
// set the switch and button pins to input mode (as opposed to output), since we'll be reading from them
pinMode(SWITCH_PIN, INPUT);
pinMode(BUTTON_PIN, INPUT);
}
void loop() {
int value0 = analogRead(A0); // read the value from the first potentiometer
int value1 = analogRead(A1); // read the value from the second potentiometer
int value2 = analogRead(A2); // read the value from the third potentiometer
// read whether the button is pressed
boolean buttonIsPressed = digitalRead(BUTTON_PIN) == HIGH;
// read whether the switch is on or off
boolean switchIsOn = digitalRead(SWITCH_PIN) == HIGH;
// scale the potentiometer values from 10-bit (0-1023) to 8-bit (0-255)
byte byte0 = map(value0, 0, 1023, 0, 255); // scale the value of first potentiometer
byte byte1 = map(value1, 0, 1023, 0, 255); // scale the value of second potentiometer
byte byte2 = map(value2, 0, 1023, 0, 255); // scale the value of third potentiometer
// log the scaled potentiomenter values to the Serial port
printValues(byte0, byte1, byte2);
// if the button is pressed, show rainbows!
if (buttonIsPressed) {
spinningRainbow();
// adjustableRainbow(byte0, byte1, byte2);
}
else if (switchIsOn) {
// if the button is not pressed, but the switch is on,
// set the color using RGB - red, green, and blue
setColorRGB(byte0, byte1, byte2);
}
else {
// if the button is not pressed, and the switch is not on,
// set the color using HSV - hue, saturation, and value (or brightness)
setColorHSV(byte0, byte1, byte2);
}
// use FastLED to show the color(s) we've set
FastLED.show();
}
void setColorRGB(byte r, byte g, byte b) {
// create a new RGB color
CRGB color = CRGB(r, g, b);
// use FastLED to set the color of all LEDs in the strip to the same color
fill_solid(leds, NUM_LEDS, color);
}
void setColorHSV(byte h, byte s, byte v) {
// create a new HSV color
CHSV color = CHSV(h, s, v);
// use FastLED to set the color of all LEDs in the strip to the same color
fill_solid(leds, NUM_LEDS, color);
}
// show a spinning or scrolling rainbow
void spinningRainbow() {
// variable used for the initial hue of the rainbow
// we start it out at 0
// but since it's static, it'll keep it's value as we change it
static byte initialHue = 0;
// increase the hue by 1 each time
initialHue = initialHue + 1;
// the amount we want the hue to change between each LED
// by dividing the number of hues (255), by the number of LEDs,
// this code makes each LED a different color
// and covers the entire rainbow spectrum (red, orange, yellow, green, blue, indigo, violet)
byte changeInHue = 255 / NUM_LEDS;
// use FastLED to fill the LEDs with a rainbow
fill_rainbow(leds, NUM_LEDS, initialHue, changeInHue);
}
// show a rainbow that is adjustable by the potentiometers
void adjustableRainbow(byte numToFill, byte initialHue, byte changeInHue) {
// the "red" or "hue" knob will be used to set how many LEDs to fill with the rainbow
numToFill = map8(numToFill, 1, NUM_LEDS);
// the amount the color's hue will change between each LED
// we need to remap this from 0-255 to between 0 and the number of LEDs we have
changeInHue = map8(changeInHue, 8, 255 / NUM_LEDS);
// set all LEDs to black
FastLED.clear();
// use FastLED to fill the LEDs with the rainbow
fill_rainbow(leds, numToFill, initialHue, changeInHue);
}
void printValues(int value0, int value1, int value2) {
// keep track of the former values, so we can log only when they change
// since these are static, they'll keep their value between calls
static int lastValue0 = 0;
static int lastValue1 = 0;
static int lastValue2 = 0;
// if any of the values have changed
if (value0 != lastValue0 || value1 != lastValue1 || value2 != lastValue2) {
// print the new values to the Serial port
Serial.print(value0);
Serial.print(", "); Serial.print(value1);
Serial.print(", "); Serial.print(value2);
Serial.println("");
// store the new values
lastValue0 = value0;
lastValue1 = value1;
lastValue2 = value2;
}
}
Compiling
Configure Arduino
- In the Arduino IDE, click the Tools menu, then Board, then click Teensy LC.
- Click the Tools menu again, then Port, and then the port your Teensy LC is plugged in to.
- Click the Verify button (check mark) in the toolbar.
- It should finish, and say Done compiling in the status bar at the bottom of the window.
- Now click the Upload button (right arrow) in the toolbar.
More details coming soon…



