4-axis robot controller

KB2040 4-Axis Robot Arm Controller

USB controller for a 4-axis robot arm using an Adafruit KB2040 (RP2040). Four potentiometers for axis control plus a button for gripper/trigger — all read over a simple serial protocol.

BOM

PartQty
Adafruit KB20401
10kΩ linear potentiometer4WWZMDiB
Tactile push button (momentary)1US-SKU E429
3D-printed enclosure1
USB-C cable1

Wiring

KB2040Connected to
A0 (GP26)Pot 1 wiper
A1 (GP27)Pot 2 wiper
A2 (GP28)Pot 3 wiper
A3 (GP29)Pot 4 wiper
Pin 9 (GP9)Button (other leg → 3.3V)
3.3VPot 1–4 left leg
GNDPot 1–4 right leg, button pull-down

Potentiometer legs: left → 3.3V, right → GND, wiper (center) → analog pin.

Button is active-high (press sends 3.3V to GP9). The firmware uses the RP2040's internal pulldown so no external resistor is needed.

Firmware

Uses the Earle Philhower RP2040 core. Target board: Adafruit KB2040.

arduino-cli compile --fqbn rp2040:rp2040:adafruit_kb2040 controller/arduino-cli upload --fqbn rp2040:rp2040:adafruit_kb2040 controller/

Analog resolution: 12-bit (0–4095).

Serial protocol (115200 baud)

Send a single character, get CSV back:

CmdResponseExample
ach1,ch2,ch3,ch42048,1023,3072,0
bbutton (0/1)0
ppress edges (0/1)1
rrelease edges (0/1)0
sbutton;ch1,ch2,ch3,ch40;2048,1023,3072,0

Display (optional)

Python tkinter GUI (display.py) shows live pot bars and button state. Requires pyserial.

pip install pyserialpython display.py

STLs

FileDescription
CONTROLLER-BASE.stlEnclosure base — holds KB2040, pots, and button
CONTROLLER-ARM1.stlPotentiometer knob — axis 1
CONTROLLER-ARM2.stlPotentiometer knob — axis 2
CONTROLLER-ARM3.stlPotentiometer knob — axis 3
CONTROLLER-ARM4.stlPotentiometer knob — axis 4
CONTROLLER-CLUTCH.stlClutch/gripper button cap

Designed in Blender — source file: CONTROLLER.blend

Notes

  • Designed for the Earle Philhower RP2040 Arduino core
  • Button uses INPUT_PULLDOWN — no external resistor required
  • All four pots are read continuously; data is returned on request to avoid flooding the serial buffer