Disabling a USB port on the roborio via software?

Is there a way to disable a USB port on the roborio from the driver station? I know that there is a way to create custom buttons in the driver station and would like to know if there is a wpilib function to do so. I am trying to run neopixels on a robot and have power concerns. I would like to be able to kill the arduino remotely if needed. The arduino must use a usb port as it will receive data from the roborio on what pattern to display via serial.

By “disabling”, do you mean stopping the transfer of data, or shutting down the power output from the port (Vbus)?

1 Like

shutting down power output

to kill the arduino and the power sucking neopixels if necessary

AFAIK it’s not possible… And probably shouldn’t be. Shutting down the power supply is not really something that’s in the USB specifications. You should just implement a “shutdown message” that you can send to the Arduino.

2 Likes

If that small amount of current will put your robot over the edge than you may want to re-evaluate some of the electrical system of your robot.

1 Like

Also, I highly highly recommend you do not source power for the LEDs from a USB port. USB ports are not designed to output more than 500mA of current (100mA normally), and even if you have a moderately sized LED strip, they will exceed the limit fast. We have an LED strip as well, and we had to use software dimming, as well as source the power from the VRM instead.

2 Likes

Thanks!

That being said, if you do decide to source power from a better source instead, like the VRM or PDP, the easiest solution would be to add a heavy duty BJT transistor or a MOSFET transistor, and attach the base to a DIO port on the roboRIO. This way you can control the power flow easily. Or even better, get a relay and use that.

1 Like

Thanks but I need the USB port for serial from the arduino :thinking: This is all planning for the worst fyi

How about connecting the USB to the Arduino, and connecting the power for the LEDs to somewhere else instead? This will make the load of the LEDs be shared between the USB and other power source (with more current being sourced from the secondary power source of course), and so the USB port will be fine. As long as both power sources have their ground connected together, your communications will still work.

it was on the vrm but it dimmed the ring light we had for vision

We did something similar here: https://github.com/Arctos6135/BeautifulRobot
The power is sourced though the VRM, but it can still communicate with the RIO since they share a common ground.

Strange. I didn’t encounter this issue with our LED strip. IIRC the LED ring should be 12V and the NeoPixels 5V, so they shouldn’t affect each other, right? Unless you’re putting both on 5V or 12V?

both are neopixels, 5v

Hm. I thought you were using the AndyMark LED rings. Either way you might want to software dim the lights a bit, because even with the VRM, it can still only output 2A.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.