Anything Input HAT for RPi

Writing up some shower thots:

At the end of last year I threw together this MIDI controller using an Arduino and multiplexer, and added some rotary encoders to a Pi, which was loads of fun (also seem to have reinvented “pick up mode”).

On the RPi I would like to do the same, but without baking-in a certain type of interface. The sorts of inputs I’m thinking of are:

  • CV / DC inputs: 5V, 10V, 12V etc
  • Stereo audio source - active or passive
  • Various sensors - Arduino bits
  • A bank of pots / knobs

Since the purpose is for visual synthesis, the inputs would only need to be fast enough to receive on a per frame basis (25/30FPS). So perhaps there is a sweet spot between simplicity while also keeping the RPi safe.

Some questions I have are:

What would be the simplest / safest way to receive 10V/12V sources? Optocouplers, resistors? And how might that relate to the quiet audio source of a headphone jack? Where amplification is possibly needed?

At the moment I’m thinking along the lines:

  • 16 channel multiplexer and ADC connected to a pin header or socket, with little plugs to ground the channels not being used
  • 3.5mm TS / TRS input jacks - switchable to optocoupler or resistors based on type of input
  • Basic push buttons, clicky rotary encoder, or 16 character LCD (in order of complexity, if there are spare GPIO pins)

From here I think it would make it much easier to build out interesting interfaces. A bit like a middle-ground between Arduino HATs and pre-built controllers.

i think @clovis might have some info to share on CV/DC inputs at frame rates for pis?

For the audio input would be nice to use a Codec that is supported natively in the kernel.

Difference seems to be between natively using I2C ADCs or installing drivers for listenable audio (most HATs available seem to be using WM8960). Which for audio-reactivity means either getting audio amplitude or being able to do FFT analysis.

Something like this ADC HAT could be a good starting point (8 17bit inputs): PiSupply ADC Pi HAT

Looking into the Pi Pico and it has 3 ADCs and can be used as a USB device. Could be cool to make something that isn’t even RPi-specific - like a plug’n’play USB device with multiplexed inputs talking over serial.

Also relevant:

Aw heck, ashamed to say I didn’t know about this one yet (sorry @cyberboy666 !)

This is pretty much it - MCP3008 with I2C :muscle:

1 Like

So an initial design for this is coming along, on the lines of having a small USB “brain” into which other things can be attached. Design is:

  • Raspberry Pi Pico
  • left and right 2x5 pin breakouts for 2 x MCP3008 chips (which also carry 5V / GND) - ie. 8 inputs on either side
  • top 3.5mm jack connected to 2 x ADCs for line-level audio input
  • top 3.5mm jack connected to TX and RX for either MIDI or serial
  • middle rotary encoder and button for GUI
  • really tiny 0.49” OLED for visual GUI feedback
  • after-thought bottom 1x5 pin breakout for remaining useful pins (3rd ADC input and I2C)

I’m yet to have any of the parts arrive yet but the Pico looks really promising. MCP3008 is also great because it’s through-hole and DIY friendly and has an ADC built-in.


4 Likes

Circuity arrivals w. cute pick’n’mix bag of small parts that came with the rotary encoders.

Some shout-outs in order to @cyberboy666 who’s designs I picked through for good DIY-able components (and 3D models) - and inspiration from Wolfgang Spahn’s interlockable style of PaperPCB.

Left board will be 2 x Wii joysticks (with springs removed) & 4 x pots and right is 8 x pots - so could also be opto-couplers, buttons etc.