WS2812b LED strip lights
Adafruit NeoPixel Digital RGB LED Strip

Overview

I saw this YouTube Video a while back with syncronized LED strip lights to music, and I just thought it was amazing. I had to have something similar for my own room. These blog posts are documenting my adventure into DIY electronics. This will be my first project in DIY electronics.

Through the post, I’ll try my best to explain each of the steps I’m taking. Before this, the only thing I really knew about electronics was Ohm’s Law (Voltage = Current * Resistance) and the power law (Power = Current * Voltage). My understanding of electricity was also somewhat basic. I still think about the analogy of electricity in wires as water in the hose. That is, think if “Current” (amperes) as the flow of water through the hose, and “Voltage” (volts) as the water pressure at each end of the hose. Also, I remember some notion that circuits in parallel are different from cicuits in series somehow from an introductory physics course I took. That’s about the extent of knowledge I had coming into this project, and if you want to follow along, the relevant concepts will be explained along the way.

This first blog post will cover the materials you might need and the background information about LED strips and electronics

Materials

These materials are the minimum you will need. I’ve included some links I used to purchase the items below just as an example. You may be able to hunt around for a better deal with similar specifications.

These materials aren’t strictly speaking necessary, but you may find that they help. Electronic hobbyists or DIYers are likely to have these already on hand:

  • Multimeter
  • Wire stripper
  • Breadboard
  • Soldering iron
  • Logic level shifter if your board and lights operate at different voltages.

I got an electronics starter kit that included the DuPont wires, a whole slew of capacitors and resistors, as well as the breadboard. I had the Arduino before this, but you may find even cheaper starter kits with everything packaged together.

LED Strip

The most important thing is the LED strip. There are many different types of LED strips, all suited for various applications. See this LED strip light buying guide if you are thinking about other lighting applications. In our particular case, I needed the lights to be individually addressable, meaning I want to be able to control the color and intensity for each of the LEDs on the strip. There are IC chips on each of the LEDs, which is the WS2812b. This type is also sometimes called Neopixel lights. There are some strips in which groups of 3 will have a single address, instead of each individual one. Normally the product information will specify.

You can see here that each “LED” is actually made up of 3 LEDs, red, green and blue each of which are driven by the IC chip.

There are a few things to look for when buying an LED strip. The length and lights per meter. Most commonly, there will be either 30 or 60 LEDs per meter. With more LEDs per meter, the color animation on the strips will look a little more fluid.

The other consideration is power draw. The more LEDs you have, the bigger the power supply you will need in order to run all the lights at full brightness. The rule of thumb is that each little LED draws 20mA at full brightness, so since each “LED” has 3 little LEDs, that’s 60 mA. With 60 “LEDs” per meter, a 4m strip will need 14.4A to power. That’s a lot of amps! By comparison your dishwasher only uses 10A.1 With a 5V power supply this turns out to be 72 watts for the entire roll (P=IV). Our calculations match up with the product information.

If you need to manipulate the LED strip (chain them, cut them, rewire them) there are some great videos and sites that go into a little more detail about the connectors to expect on the LED strips, and where you need to cut.

If you still need something more of a complete overview than what is provided here, I think Adafruit does a fine job here.

Programmable Microcontroller

I would suggest using either a standard Arduino Uno as it seems to be the most popular. Depending on application, some people prefer I’m not too knowledgeable in this regard, but you should just make sure you match the board to your power supply. If you will be using 5V, make sure the board can take a 5V in. If you use a 3.3V device, such as a Raspberry Pi you will need a logic level shifter. I will be using an Arduino 101.

Power Supply

In addition to powering your microcontroller, you will also need a power supply that matches the operating voltage of your LED lights. In our case, I needed a 5V power supply capable of supplying 72 watts or 15 amps (calculated above). You should not draw power the LED lights through your microcontroller. The maximum you should output through an Arduino for example is 200mA. 2 This is only recommended if you’re powering fewer than 10 total LEDs. You can however use the SAME power supply, you will just have to wire them in parallel, not in series. I will be powering my Arduino through a separate power supply through USB.

Tip: If you have a computer battery laying around, I believe they are capable of supplying 3.3, 5, or 12V, which makes them very flexible for whatever LEDs or microcontroller you use.

Passive Components and Best Practice

The resistor will be used to limit the current flowing into the Arduino’s data pin. The capacitor is to “smooth out” the current flowing into the LEDs to prevent sudden changes in current draw by the strip. For more details, Adafruit has some best practices for the neopixels here and for a deeper explanation of the resistor for the data line, there is a stackexchange post.

Another best practice to highlight is that there should be a wire connecting the two GND if you use two different power supplies.

Wiring Diagrams

The best wiring diagrams for the various power supply situation are found in hamburgtech YouTube video. Note this scheme doesn’t use the capacitor component. The capacitor is shown stuffed across the battery terminals in the Adafruit Best Practices. Adafruit also has the wiring diagram (shown below) for if you use two separate power supplies. Note, the LED strips have polarity, so make sure you connect the positive power end to the +5V lead, otherwise you risk frying your LED strip. Be ABSOLUTELY SURE that you’ve wired everything correctly before you connect your power supply!

Basic Electrical Concepts

How to (not) hurt yourself

Beyond the standard things you were taught as a child, (not sticking a fork in the electrical socket), I found it surprisingly difficult to find relevant information for keeping safe around DIY projects. I’ll admit I got a little scared when I learned that these innocent little LED lights would draw more current than a dishwasher and toaster. The bulky looking power supplies also don’t help the fear of hurting myself. So here’s some of what you need to know (not exhaustive) –

Disclaimer: I’m not a professional electrician, actually far from it. You should consult an expert if you have any doubt about what you are doing.

  1. 0.1 Amps passing through your heart can kill you. 3
  2. “Amps kill, not volts”, kind of true, but it’s really both. The Volts DRIVE the Amps. 4
  3. Your outside skin has about 100 kOhms, but drops to around 1kOhm when wet. 4
  4. Capacitors can explode if you apply too much voltage than what it’s rated for.5
  5. Electricity takes the path of least resistance. So beware of short circuits, which can heat up very quickly and are risk for fire. This can happen if you reverse the polarity of your wires, things will get hot very quickly. 6

Follow the links through to all the resources cited. They provide some good safety information. In addition, you should remember some standard advice – “don’t change around circuits in a live system”, “connect to ground first”, “don’t ingest your electrical components”. You know, the standard stuff.

Multimeter and Kirchoff Law Review

This is a really useful tool for debugging any sorts of electrical problems. Measures resistivity, voltage and current up to 10A. Can detect “continuity” or if electricity can flow, as well as polarity of wires, (which is positive and negative). Overall one of the first tools you should consider learning. It will help review how voltage and current behave in circuits in parallel or series. I.e. you may need to review Kirchoff’s Circuit Laws for current and voltage.

The first law for current says at a junction, “current in is equal to current out”.

Kirchoff's Current Law

The second law for voltage says that for any closed directional loop, the voltage will sum to 0.

Kirchoff's Voltage Law
From Electronics Tutorials

The upshot is voltage applied across parallel circuits will be the same, but drop across resistive components in series. The opposite is true for current, in which current across resistive components will be constant, but drops in parallel circuits. Hence, when using a multimeter, voltage must be measured as a parallel circuit, and amperes must be measured series.

This Sparkfun site has the best overview I’ve found, with an associated video. Think of the “COM” socket as negative (normally black) and the other as positive.

American Wire Gauge

The thickness of the wires is related to the maximum load it can carry. The thicker the wire the more current it can carry. There is a standard size system for solid wire, called American Wire Gauge (AWG), with smaller number corresponding to thicker wires. Normal wires in electronics projects will probably be around 22 AWG. Check the maximum load charts for the corresponding wire gauges you use.

Conclusion

We’ve covered some of the basic starting materials and background electricity considerations before we get started with the build. In the next post, we’ll cover some more of the software and the build itself.

References


Michael Liou

Statistics PhD Student at UW-Madison