User Tools

Site Tools


2022_leds

This is an old revision of the document!


LED's

2x Strips of RGB Addressable LED's
The silicone protective layer started to flake off, however didn't affect the performance of the LED's

Github
LED.java

Cool Wave!

 public void wave(HSVPreset color, double time) {
    for (var i = 0; i < buffer.getLength(); i++) {
      double v = 140 + Math.sin((i - pixelOffset) / (double) buffer.getLength() * Math.PI * 2) * 115;
      buffer.setHSV(i, color.h, color.v, (int) v);
    }
 
    if (timer.get() < time) {
      if (pixelOffset == buffer.getLength() - 1) {
        pixelOffset = 0;
      }
    } else {
      pixelOffset += 1;
      timer.reset();
    }
 
    led.setData(buffer);
    led.start();
  } 

LED States

Purple Top-Bottom Animation: Indicates the shooter RPM's, solid purple when up to speed
Purple Wave Animation: Indicates that the climber is active and is moving up or down
Solid Alliance Color: The default state of the LED's, no balls detected and no climbing
Half Green: Indicates that a ball is in the top position of the tower
Full Green: Indicates that two balls are in their positions in the tower

LED Wiring

These LED strips have three wires:

  • +5v Power
  • Data stream (controls the colors)
  • Ground - common return for data and power

The data stream comes from a RoboRIO PWM output, as described here https://docs.wpilib.org/en/stable/docs/software/hardware-apis/misc/addressable-leds.html

RIO PWM outputs have power, but is not the right power: PWMs have 6 volt power, intended for servo motors. It might not kill the LEDs immediately, but might reduce their lifetime a lot. And the RoboRIO can't supply enough current for a long string of LEDs anyway.

So, we need to split the wiring. Power comes in on two wires, red for power and black for ground. and we use a seperate scrap of a PWM cable for data. The center red wire of the PWM cable is not used, only black (ground) and white (data).

Here's a sketch of which wires go where:

and here's a picture of one assembled:

LED Test Board

We had a short piece of LED strip left over, so we built a little test board. With only two LEDs, the 5v power can come from a RoboRIO DIO terminal. So this board can plug directly into a RoboRIO for software testing.

2022_leds.1675829065.txt.gz · Last modified: 2023/02/07 23:04 by tell