2-way Arduino Joystick/pad communication

I have been throwing this idea around for a number of years and would like to get some traction on it.

Long ago (in FRC terms) we had FIRST code that allowed 2-way communication with a team defined controller (buttons, switches, lights). It used the TI Launchpad a it’s core.

These days with a number of Arduino and Pico alternatives, there has to be a way to replace that functionality with a modern microcontroller.
Not just one-way from the controller to the driver’s station, but two-way. This would allow lights and other data to be communicated. An example would be a light bar that responds to the state of a mechanism on the robot.

I know this is really just some hacking of the HID tables, but I get a headache every time I look at them.

Has anyone done this in a clean well documented way?

Thanks.

Oh man… I remember that thing for button boards… I wanna say there was another board in the KOP at some point… Cypress I think (it had a mostly white board/silk screen iirc)? That’s a memory trip.

1 Like

This thread may be of interest. As I mentioned in a post there, we once did a fancy operator board. It had many switch/button/joystick inputs, and outputs including PWM-able LEDs, a 20x4 line LCD for displaying text, a large RGB LED indicator, etc. The whole thing was based around an Arduino Leonardo plus an Adafruit LED controller and custom I/O. The Leonardo can directly speak USB protocols, so inputs presented as regular joysticks (IIRC, two of them so as to support enough buttons) and a keyboard for the e-stop, and the output was serial-over-USB with a custom protocol we developed. A Python script running on the driver station laptop interfaced between NetworkTables and our custom protocol to drive the outputs.

Both the Python and the Arduino code are in this repository, and there’s a document describing the approach and protocol here, but it has not been used at all since 2020.

It was a fun project but made for a lot of complexity; we only used it at our one event in 2020 (and then the world shut down). We’ve since found that our drive team prefers XBox controllers, so our only custom operator controls are for override switches, which use a simple off-the-shelf arcade controller.

You can do this pretty easily using a Teensy. Arduino compatible 200Mhz arm core, but importantly has incredible library support, and supports simultaneous USB modes. So you can have it act as a HID joystick and a serial device for feedback on the same USB plug with no extra effort.

Getting the joysticks up and running is really straightforward: Teensyduino: Using USB Joystick with Teensy on the Arduino IDE

Serial feedback can be done with a simple parser, state machine, or via more complex command handlers. Lots of examples and templates here depending on your goals.

That said, we’re in the same boat as bbonner; We use Xbox/PS controllers, and we can’t get the drivers to check visual feedback dashboards if we beg. Once the bell rings, all eyes on the bot.