WS2812 LEDs are wonderful, but if you try and power them only through your
chipKIT board you may run into limitations or strange erratic behavior from the
chipKIT board (too much current draw will shut the chipKIT down or worse, if
you are powering off of a PC, you can damage the USB port on your PC).
To help with this, you may want to run your kit off of an external power
WS2812 LEDs require a constant 5V power supply (the smoother the better). A
wall power supply would be ideal, but if you want mobility you will need to
look into other battery solutions.
When looking at battery solutions, finding one that didn’t have voltage that
varied greatly as the battery depleted and one that could supply up to 2A of
current... USB battery packs were found as a good solution.
Using a chipKIT protoshield, we were able to create a custom USB battery
supply adapter to power the chipKIT + the WS2812 LEDs. This instructable walks
you through creating that.
*Note there is no information about powering the WS2812 LEDs directly,
instead this is only focused on making the shield adapter we used. The full instructable
how to make our Maker Faire demo will follow shortly with information how to
power the LEDs we used.
Step 1: Gather Materials
There are a lot of extra things in the picture (I like to have things just in case), but to do this portion of the tutorial you will need:
- chipKIT ProtoShield
- Solding Iron
- soldering braid (in case you need to fix)
- a chipKIT (I used the WF32 since that is what was running my Maker Faire demo)
- USB cable you don't mind cannibalizing, the type doesn't matter since you are using the computer connection.
- Two breadboard wires with female endings
- Wire clippers and strippers
- a 1000uF electrolytic capacitor
- quick set epoxy or hot glue
- external battery pack (with USB connectors)
Step 2: Open Your ChipKIT Protoshield and Get to Know the Parts
NKC electronics is the maker of the chipKIT protoshield.
Inside of the bag your should have everything you need to continue with the tutorial.
The major things to have are:
- ceramic disc capacitor
- 1 set of the headers (the bag comes with dual rows, but we only need to populate one).
Take a look at the shield.
There is two center channels on the shield that cut the shield in half.
Those are the power buses that we will be focusing on.
You can get a better understanding of the shield by reading the data sheet NKC created.
Once you have the components you need from the bag + the shield we can work on assembling it.
Step 3: Mount the Indicator Components
There are a variety of different ways to solder components into the protoshield.
I like to put all of the components through the board first and bend the legs so they stay in. Then, it's just a matter of adding a dab of solder in one step and clipping the excess leads off.
Others may suggest that you trim the leads prior to placing them into the board. No matter how you do it, you need to solder the indicator resistor, LED , capacitor and the button onto the shield.
Step 4: Solder the Headers and Check Them
Soldering headers can be tricky at times.
Unsoldering headers is harder than soldering them, so take your time here.
The best way I have learned to do it is to place all the headers in place and only solder one pin on each. That way if you get the header crooked, fixing it is just a matter of reheating the pin and moving the header around.
Another way is to use a dead breadboard to hold the header pins in place. You should use a DEAD breadboard because heat from the soldering iron can ruin the connectors inside of the board.
Once you have your headers soldered, mount the shield to check that you aligned the headers correctly.
Step 5: Create Your Power Connectors
The shield will be using the two external power headers that are right next to the barrell jack on the chipKIT.
You need to have two breadboard wires that have female ends at least on one end (M-F or F-F)
Take the female jumper wires and cut each in half.
Then, strip the ends of each so you have one breadboard end and one stripped end.
You'll be soldering the stripped end into the protoshield.
Step 6: Solder Wires Into Breadboard at the Power Terminals
(this set of instructions is better if you use the photos for guides, but I'll try and explain it).
If you look at the back of the protoshield there are a row of holes with faint boxes around it marked with + and - and + and - (photo 1).
We will be using the - of the first box and the + of the second.
If you are able to look closely at the back of the board you'll see traces extending from the holes.
Make sure to solder throughly the wire into that spot (even leaking over to the next hole if needed (photo 3).
Step 7: Test Your Shield Is Getting Power
Now you have the jumpers soldered on you're ready to test it to see if power is connected.
Make sure your power jumper setting is set to UART, then connect the protoshield to your chipKIT.
Then, connect your breadboard wires to thier respective terminals, + and -.
Get your USB cable and connect the chipKIT to a power source (or computer).
You should see the yellow LED light up.
If you don't, then check your jumper setting again, you can try the USB setting.
Otherwise you will need to check how you soldered your connector wires.
Step 8: Solder in 1000uF Capacitor
Since I'm using my shield to drive WS2812 LEDs-- I need to solder a 1000uF capacitor to the power terminals as reccomended in the Best Practises section of the Adafruit NeoPixel Uber Guide.
Determining the power busses on the shield, just put the capacitor into the correct orientation (electrolytics are marked + and -) and solder, then clip the legs (like in the previous step).
Your complete protoshield should look like the third photo.
Step 9: Prepare Your USB Cable
Since we are connecting to a USB battery supply we will need a USB connector.
The easiest way I have found to do this is by using an old USB cable that I don't mind cutting up.
Get a USB cable (any type will do).
Decide the appropriate length and cut the cable to that length to keep the computer connector side.
Then strip a portion of the rubber shielding to show the insides of the USB cable.
USB generally has 4 wires (sometimes there are more depending on the type), but you will see a Power, Datain, Dataout and Ground as well as a lot of shielding material (the silver stuff in my photo). Find the red and black wires (power and ground) and bend the remaining wires behind (you will be cutting these off later).
Step 10: Solder the Power and Ground to the Protoshield
Strip the red and black wires so expose bare wire to solder into your
These will be thin wires, so be careful, but if you mess up, you can always
cut your cable shorter and start over again.
Once you have your stripped ends you'll be soldering them into their
respective power busses. If you used red and black wires like I did it will be
red to red and black to black.
Soldering these thin wires can be tricky, but just make sure you don't
accidentally solder over into the opposite power bus (causes a short). If that
happens you can get your solder braid and wick up the solder and start over
For me (in this example) I had trouble getting the wires to be side by side,
so mine are offset. It doesn't matter too much where the wires are soldered
into the same row, just as long as they are in their correct column.
Picture 4 shows what it should look like when it's complete.
Step 11: Test External Power
Once you have your USB cable soldered on it's a good idea to test it.
Move your jumper on your chipKIT from UART to EXT (external)
Connect your protoshield (connect the external power jumpers).
Then, connect your usb cable to an external battery pack.
The power should be going this time from the protoshield to the chipKIT (instead of the previous time from the chipKIT to the protoshield).
The yellow LED should light up, but make sure to check the chipKIT and see if it is lighting up too.
If you see that the LED is lit up, but not the chipKIT this means that you will need to go and check your breadboard wires.
If you see nothing light up, then you will need to check your USB wires.
If both light up then you are good!
Step 12: Good Idea: Seal Your USB Cable In
the wires are very fragile from your USB and since battery packs get changed a lot, it may be a good idea to seal those wires in.
I used expoy in this photo, but you can use hot glue also.
Just cover the wires and part of the cable so both don't move excessively.
If you use expoxy, you should let it dry overnight before trying to use the shield.
Step 13: Connect a Battery Pack and Use!
With your protoshield + a batterypack you should be able to use your chipKIT wherever you need external USB battery power!
These photos are from our maker faire demo and have WS2812 LEDs connected to the shield.