/ButtonBox

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

ButtonBox

0

Aim

The aim of this device was to have something that can easily interface with other small projects, such as this Servo Robot Arm.

At its core, a ButtonBox (or 'Job Agnostic Button Box', as it's full title is), is a collection of input and output devices all hooked up to a single microcontroller. The microcontroller has some standard libraries and functions for operating those inputs and outputs, and is easily accessible for extending its software. Connecting the box to other devices can be done via common connectors such as USB or jackplugs.

Down below is described in more detail what this specific box is made of, but in reality these details don't matter too much. The important idea is to have convenient input, output, and extensibility.

Shopping list

Core & Power

Box (100x60x25mm)

Raspberry Pi Pico W

DC power jack

Step-down buck converter

1N4001 rectifier diodes (2)

On front

SPST on-off tilt switch

SPDT on-off-on tilt switches (2)

On top

Mini OLED display 128x64 I2C

Joystick

Rotary encoder KY-040

IO connectors

Mini jack TRRS connectors (2) (with male plugs for the other side)

USB-C connector

Etc

Spacers, screws, (dupont) wires, shrinkwrap, etc.

Building

A few things to keep in mind when building:

  • Plan the joystick connection early on. The Pico has three accessible ADC pins, and the joystick needs two of them (for x and y axis). I didn't realise this early on, and was happily adding two joysticks
  • Other than that, the precise pin-layout of the build isn't too important. I do have this wiring diagram if you're interested. Connect your devices wherever is convenient, and adjust the pins in the corresponding Python modules.
  • A step-down buck converter isn't strictly necessary, as long as you can be sure that you're only ever supplying 5V. In this build, the converter is there as a safety net: I can accidentally attach higher voltages without frying the system.
  • Use diodes to keep the current flowing in one direction only. This is useful for when it's connected to both external power, and via the micro-USB of the Pico.
  • There is also a diode from the buck converter to the USB-C port, since in this build the 5V of the USB-C is only used to power an external device, not to power the Pico.
  • You can see the diodes in this image, they run via the step-down buck converter to the VSYNC of the Pico and the 5V of the USB-C. Shottsky diodes are a little better for this task, but none were on hand.
  • Adjust the rating of the buck converter after attaching the diodes, since they have a little forward voltage drop. Measure from the ground wire to behind the diode, and you can compensate for this.
  • The TRRS mini jack connectors have 3 leads to GPIO, and one lead to ground. I didn't have good experiences with providing power over the same connector (since this shorted my system when repeatedly re-plugging it when powered on), so the jacks don't provide additional power aside from the 3.3V the GPIO does.

Backside

Here you can see the two DC barrel jack, the two mini jack connectors flanking the USB-C, and the micro-USB of the Pico.

Hole

The wires for the joystick and the display run through a hole underneath the display.

Top

The right-most tilt switch is connecting the DC jack to the buck converter. The left-most tilt switch can be used for program / module selection. The two switches on the left can be used for other kinds of selection: allowing 9 options.

Future plans

I plan to use the buttonbox with other electronics projects, such as the aforementioned robot arm. I will update the code accordingly.

The 'main' branch will remain fairy agnostic to what the box is actually doing, but I will update it with useful bits and pieces. Some obvious enhancement will be the inclusion of WiFi and BlueTooth capabilities.

Inspiration

During the build I was deeply inspired by the done manifesto, especially 'perfection is boring, it stops you from getting it done'.

Cult of done