Custom Driver Station

Whats up guys, mepedrol here!

My team and I are looking for the best reliable push buttons to use for the driver station. We are planning on putting aproximately 16 buttons… We are also wondering what controller you guys use on your custom driver stations. We are looking for something that makes the driver station recognizable, as a joystick by the computer. What are you guys’ recomendations? Thanks for the help!

mepedrol out!

3 Likes

Our team uses these buttons, super easy to hook up, they come in a variety of colors. We use this button controller. Lets you plug into your computer and it recognizes it as a controller on the drive station. We get the LED buttons, and connect them to an Arduino to control the LEDs. You will need 1k resistors if you want to use the LEDs, and these connectors. For added functionality, you can write a Python script to run on your drive station that reads network tables from your robot and send data over serial to your Arduino to control LEDs based on the state of your robot/code. This is a nice hat for that Arduino if you go that route.

3 Likes

This is awesome. Do you have any photos of a finished one and maybe one opened up showing how it’s wired? Love the idea of getting feedback from the robot using network tables. I assume you’re using it to light up the buttons that are active?

Could you possible share the arduino and robot code examples?

We already tore apart our old drive station and are currently in the process of rebuilding it, so I don’t have any pictures to share right now. We are hoping to have it finished by Saturday, so I can update this with pictures soon! I can however share some template code for how this works. Here is some example code that turns the button LED on or off based on the currently selected alliance color.

Python Code:

import time
from networktables import NetworkTables
import serial

def valueChanged(table, key, value, isNew):
    print("%s: %s" % (key, value))
    print(type(value))

    if value == "Optional[Blue]":
        arduino.write(b'\x6f\x6e\x0d\x0a')
    else:
        arduino.write(b'\x6f\x66\x66\x0d\x0a')

def connectionListener(connected, info):
    print(info)
    print("Connected: %s" % connected)

ip = "10.15.1.2"
NetworkTables.initialize(server=ip)

NetworkTables.addConnectionListener(connectionListener, immediateNotify=True)

sd = NetworkTables.getTable("SmartDashboard")
sd.addEntryListener(valueChanged, key="Alliance Color")

arduino = serial.Serial('COM4', 9600)

while True:
    time.sleep(1)

Arduino Code:

void setup() {
  Serial.begin(9600);
  pinMode(8, OUTPUT);
}

void loop() {
  while (Serial.available() == 0) {}

  String command = Serial.readStringUntil('\r');

  if (command == "on")
  {
    digitalWrite(8, HIGH);
    //Serial.println("ON!");
  }
  else if (command == "off")
  {
    digitalWrite(8, LOW);
    //Serial.println("OFF!");
  }
  //else
  {
    //Serial.print("command not recognized:");
    //Serial.println(command);
  }
}

You don’t have to do anything special on the robot code side other than sending the data you want to read in your Python code to network tables (We used SmartDashboard in this example).