Please bear with me here as my team is brand new to LEDs…
This is our current setup for LEDs. We have WS2812B LED Strips and a roboRIO 2. I read on WPILib’s documentation about AddressableLEDs that WPILib has an API for controlling LEDs via the PWM port, so we just soldered a PWM cable to the LED strip. When we try to run the code, it does not light up. What’s wrong with our current setup?
This is the code that I’m currently trying to run - just making the entire strip blue. The length of the strip is 60 if that’s relevant.
private LED() {
this.setName("LED");
this.register();
this.control.setLength(this.buffer.getLength());
for (int i = 0; i < this.allianceColorCutoff; i++) {
this.buffer.setRGB(i, 0, 0, 255);
}
this.control.setData(buffer);
this.control.start();
}
This is most likely a wiring issue. Most LED strips you’ll find operate on 5V, however the RoboRIO’s PWM output pin supplies 6V. I suggest that you power the LEDs from elsewhere (such as the VRM) and only route the signal wire to the RoboRIO.
Also, be mindful about the current draw of those LEDs, a strip of 60 probably requires at least 3 to 4 Amps from what I’m guessing.
Hi there! It seems that you might want to adjust your wiring a bit. My team used a blinkin led driver last year however, this year we will be using a PWM port on the RoboRio, so I might be able to help you out a bit. (Not with the programming part however)
As mentioned above, a lot of LED strips operate either in 5V or 12V whilst the PWM ports of the RoboRio deliver 6V. Therefore, it’s best practice to power your LEDs from somewhere else than the V+ on the PWM ports (They also don’t deliver a lot of current). For this you could use the 5V ports on a VRM or use a buck converter, we use the latter.
I’m not currently at our shop however, I found a picture of one of my test setups (it was still a test, the final product is tidier):
In the picture you see on the right a 12V to 5V-5A Buck converter, which has a capacitor soldered to it.
You can also see a black and a white wire going to our RoboRio, the white one is the signal wire and black is the neutral wire.
Both the neutral of the buck converter and of the RoboRio are soldered to the neutral of the LED strip. The +5V of the buck converter is soldered to the Vin/+5V of the LED strip and the signal wire of the RoboRio is soldered to a 470 Ohm resistor which is soldered to the Din of the led strip.
I want to add, for a short test, driving a LED strip with the 6V Rio is probably fine to see your logic work. It does overvolt the LEDs, so you will shorten their life and they will be super bright, but it does function (I’ve run them for around 10 hours). If you do burn up a strip, usually the first LED will be sacrificial, and the rest of the strip will live (one of our mentors sets up Halloween/Christmas decorations outdoors with probably 20k of these).
You do also have to watch your Rio current levels when hooked to the Rio. I think the Rio can do 2.2A on the 6V line. But at 20mA per LED per channel (so showing white is 3 channels totaling 60mA), you might be getting to your current limit. Be careful with your load level.
Also, these converters work well, and pretty easy to use (doesn’t have to be this seller). Use the wiring diagram from Julianvdh. Amazon.com