Drive 11 RGB LEDs in LabVIEW with CAN communication bus

Hello to all,
Please can we help me to drive 2 functions in Labview, then to communicate with a microcontroller via the CAN bus
Here are the two functions that I would like to develop in LabVIEW and then communicate with the CAN bus:

||FP01 : supply 11 RGB modules with a variable voltage
||FP02 : communicate with the modules via CAN bus|

Thank u!

I’m not sure why you want to provide a variable voltage, usually, one adjusts the brightness of LED’s by backing off the total color (i.e., all off is dark, and they usually support many steps of brightness for each color).

For communicating via CAN, there’s a palette for that:

Can you post the specific led’s you’re wanting to interface with so we can better assist you in figuring out the pieces?

1 Like

I’m not sure CAN is the easiest way to go for communicating with microcontrollers.

You problem is not driving LEDs with the roborio, it’s communicating with the microcontroller

You should be able to use I2C to communicate to the microcontroller. I haven’t done it before, but I know many teams have and it’s gotten better over the years.

I thought I saw somewhere that said you can now also control WS2812 LEDs from the roborio directly, although I haven’t done it before, and I can’t remember where I saw it

Edit: You can do it, and here is an example: allwpilib/wpilibjExamples/src/main/java/edu/wpi/first/wpilibj/examples/addressableled at main · wpilibsuite/allwpilib · GitHub

It’s definitely on the harder side of the available FRC options. I would explore others unless there’s a specific requirement.

We’ve just used plain old PWM in the past. Duty cycle corresponds to pattern or intensity command. One wire, one port on each device, nearly universally supported, no chance of conflicting with other devices.

Downsides: Can’t control it when the robot is disabled (I think?). Finite (~10) ideas which can be communicated reliably.

Can you explain what FP01 and FP02 are? They sound like homework assignments.

1 Like

Thank you all for these answers.

The goal is to develop a HMI in which we can test 11 RGB LEDs (Red Green Blue), and then communicate with a NI card (CAN Bus) to light these RGB LEDs.

Architecture :

Ok. Big piece of context I was missing is that this was not FRC related, and (I assume) does not use a roboRIO.

In which case, mshafer1’s answer is closest to correct, however you’ll need to not be using WPILib-specific blocks. Instead, you’ll need to look up the blocks and drivers specific to your NI card that has the CAN bus you are testing with.

1 Like