LED Lighting options - quasics/quasics-frc-sw-2015 GitHub Wiki
If you want to add lighting effects to your robot, LED strips are a great way to start it out.
LED strips break down into a couple of major types, which are:
- "Analog" strips, where all of the lights on the strip will always be the same color
- "Digital" strips, where you can typically set the color for each LED on the strip independently of the others.
We also have to worry about the power (voltage) that the lights will take, and their power consumption (amperage).
- Voltage will be consistent for a given strip, regardless of its length, and is usually either 5V or 12V.
- Amperage is dependent on the number of LEDs on the strip, how brightly you plan on lighting them, etc.
Analog LED strips
Analog LED strips basically work from an electrical standpoint as though they are a single (huge) LED. As a result, while you can get some interesting effects with them (e.g., flashing, "breathing", etc.), you're going to be turning the whole strip on/off at once every time. However, this can also make them easier to work with than a digital LED strip, and you can easily work up your lighting effects with a single RGB LED plugged into the circuit outside of the robot, and then just swap in the LED strip and everything will work exactly the same way (other than a higher power requirement).
You may choose to control the LEDs directly from the Rio, or you may choose to have a co-processor (Arduino, Raspberry Pi, etc.) do so, optionally under some sort of "remote control" from the Rio.
Digital LED strips
Digital LED strips have tiny microprocessors embedded into the strip along with the lights. As a result, each LED is individually programmable, allowing you to do more sophisticated stuff (e.g., use different colors along the strip, "chasing" lights that run around the strip, etc.).
But with this sophistication comes greater complexity of control: you're pretty much going to have to use a computer of some sort (e.g., the RoboRio, or some other processor like an Arduino, Raspberry Pi, etc.) to drive them. This drives up the cost of materials and programming effort.
Note: 99% of the time, when FRC teams are talking about lighting and LED strips, they're talking about digital strips, since they let you do all kinds of cool lighting effects.
Voltage options for digital lighting
When deciding on our lighting strategy, we have to balance electrical safety, wiring complexity, and visual precision. This section breaks down the pros and cons of each voltage standard.
Quick Comparison Matrix
| Feature | 5V Addressable (WS2812B) | 12V Addressable (Modern/REV) | 12V Addressable (Legacy/WS2811) |
|---|---|---|---|
| Power Source | VRM or USB Power Bank | Direct to PDH (Fused) | Direct to PDH (Fused) |
| Current Draw | High (~60mA/LED) | Low (~20mA/LED) | Low (~20mA/LED) |
| Voltage Drop | High (Pink-ish ends) | Very Low (Consistent) | Very Low (Consistent) |
| Granularity | 1 LED per Pixel | 1 LED per Pixel | 3 LEDs per Pixel |
| RoboRIO Risk | Low (5V safe) | High (12V can fry RIO) | High (12V can fry RIO) |
The trade-offs involved
1. Power Efficiency & Voltage Drop
- 12V is the winner for long runs. Because it operates at a higher voltage, it requires less current ($I = P/V$) to produce the same brightness. This prevents "voltage drop," where the resistance in the copper traces causes the LEDs at the end of the strip to look dim or discolored (usually turning pink/orange).
- 5V is better for short runs. For a small status indicator, 5V is easy. For a 2-meter run, you would likely need to "inject" power at both ends to keep the colors accurate.
2. Control Precision (The "Pixel" Factor)
- 5V (Standard): Every physical LED has its own driver chip. This allows for high-resolution animations.
- 12V (Legacy/Standard): Older or "budget" 12V strips (WS2811) wire three LEDs in a series for every one driver chip. If you tell "Pixel 1" to turn Blue, a 2-inch segment of three LEDs will turn Blue.
- 12V (Modern/REV Robotics): Modern high-end 12V strips use advanced driver ICs that allow for Individual Pixel Control (1 LED = 1 Pixel). This gives you the precision of a 5V strip with the electrical efficiency of a 12V system.
3. Wiring Complexity vs. Safety
- 12V - "Clean but Risky": You don't need a Voltage Regulator Module (VRM), which saves space and weight. However, 12V is "lethal" to the RoboRIO. If a power wire frayed and touched a PWM signal pin, the RoboRIO's processor would likely be destroyed instantly.
- 5V - "Bulky but Safe": You are limited by the VRM's 1.5A continuous rating (approx. 25 LEDs). While it requires more components and wiring, it is much safer for the expensive electronics if a wiring mistake occurs.
General Recommendations
- Check the Hardware: Before coding, look at the strip. If you see a cut line every 3 LEDs, it's Legacy 12V (grouped). If there is a cut line every 1 LED, it's 5V or Modern 12V (individual).
- Standardize: If the team wants a full-robot underglow, go 12V (Modern) for the efficiency. Use bright red/yellow tape to label these wires as "12V - DO NOT PLUG INTO RIO POWER."
- Safety First: If this is a rookie's first wiring project, 5V is a safer learning environment because the consequences of a "magic smoke" event are much lower.
Options for supplying power
5V LED strips have the advantage of being the "native" power provided by the Rio's PWM ports, and thus we don't have to worry about over-voltage leaking through to the Rio and damaging it. And for a fairly short strip, we can just connect it to the PWM for both control and power.
However, for anything over 10-15 LEDs, we run the risk of damaging the Rio by drawing too much power through the PWM port.
This means that for longer LED strips, we need to find other alternatives for supplying power, while still controlling them via the RoboRio. In such cases, we've got a couple of broad options:
-
Supply the strip with power via a power step-down unit (e.g., a VRM or some other buck-boost module) that is tied into the PDH.
- Note that a VRM would need to be connected to a low-current channel on the PDH (ports 20, 21, or 22), with a 10A fuse, and 18 AWG wire.
- A VRM can supply 1.5A of current (steady load), with a peak load of 2A.
- A single WS2812B LED pulls roughly 60mA at full-brightness white, which means that 25 LEDs is the absolute maximum that we can safely power with a single VRM, if we assume that we need to be able to handle continuous full load, and it's arguably safer to hold to no more than 15.
- If we want a longer strip, we have to use "power injection" by segmenting the power line, and using multiple VRMs.
- Sample power requirements:
- 1 meter of 5V LEDs (assuming RGB, and 30 pixels/meter) will pull about 1.8 amps at full intensity (white) (so, 2 VRMs for safety, if we go that route).
- 1 meter of 5V LEDs (assuming RGB, and 60 pixels/meter) will pull about 3.6 amps at full intensity (white) (so, 4 VRMs).
-
Find another source of power for the strip that can be "strapped onto" the robot (e.g., a USB battery pack, etc.).
- In this case, we'll also need to ensure that we've got a "common ground" between that source and the Rio (i.e., that the ground line used for the power being supplied to the LED strip is also connected to a ground line for some other part of the robot).
- It's OK to tie together ground lines for different circuits (e.g., 12V and 5V).
- In this case, we'll also need to ensure that we've got a "common ground" between that source and the Rio (i.e., that the ground line used for the power being supplied to the LED strip is also connected to a ground line for some other part of the robot).
Using a USB power pack is a classic "pro-hack," especially for off-season demos or when you want to save your VRM for more critical sensors. Most high-quality power banks can comfortably put out 2.1A or 2.4A continuous, which actually gives us a slightly better power budget than a single VRM (about 35–40 LEDs).
The biggest "gotcha" here is that the power bank is a floating power source. Since it isn't physically wired to the robot's main battery, the RoboRIO and the LEDs won't share a "Common Ground" unless we explicitly build one. Without that shared ground, the data signal will just look like static to the LEDs.
Estimating power consumption (amps)
Estimating the power consumption that's needed for your LED strip can be a little tricky, but is important. You'll basically need to look at:
- The number of individual LEDs (pixels) on your strip
- The number of color channels for each pixel (e.g., 3 for RGB, 4 for RGBW, etc.)
- The maximum power draw per pixel, per channel
A sample spreadsheet for looking at a couple of different options for a given linear run can be found here.