Arduino “Make Your Uno” Synth – 3 – Adding GPIO

As you might have read, one of the main criticisms I had with the Synth Shield was that it didn’t include an obvious way to get access to the unused GPIO pins on the Arduino.  This is a great oversight in my view as the whole point of using Arduino is its hardware interfacing opportunities!

So this post looks at some possible ways around that.

But if you haven’t built your own Synth Shield yet – then I strongly recommend using extended pin headers like I did to give you easy access to the GPIO pins!

The full index of projects and my personal build notes can be found here: Arduino “Make Your Uno” Synth.

This post contains the following experiments:

  • Adding LEDs to the tone sequencer.
  • Tone button keyboard.

Warning! I strongly recommend using old or second hand equipment for your experiments.  I am not responsible for any damage to expensive instruments!

These are the key Arduino tutorials for the main concepts used in this project:

If you are new to Arduino, see the Getting Started pages.

Parts list

  • Arduino “Make Your Uno” Kit
  • Extended pin headers
  • Optional: range of prototyping boards, shields or stripboard.
  • USB-C programming lead
  • Solderless breadboard and jumper wires
  • Additional components as described in each experiment!

Accessing GPIO

Just to re-iterate, if you’ve not already built your Synth Shield, then a set of these will make things a whole lot easier.

IMG_6726

If you’ve already built your Synth Shield then here are some alternative ideas that might get you access to the GPIO pins you want to use.

Use of Protoboard shields

There are a range of prototyping shields available.  Here is a cheap board-only PCB you can buy online and a more sophisticated one from Adafruit.  The idea here is to use one of these “sandwiched between” the Arduino and the Synth Shield but with jumper cables soldered onto the IO pins you want to use.  To do this though, you’d need a version with no additional solderless breadboard installed – just the bare PCB.

Stripboard or Protoboard Extenders

Another options might be to use some pieces of stripboard or protoboard soldered onto the underside of the Synth Shield.

You’d have to check that the pins are still long enough to plug into your Arduino if you do this though – they might not be.

You also need to watch out for the fact that the two long sets of header pins on an Arduino are separated by a non-standard spacing so you’d need two bits of board that side.

For the 6 and 8-way sets of headers that align, you could have a single board across the whole Arduino, but if using stripboard it is crucial that you break the tracks somewhere so that you don’t end up connecting D0-D5 across the board to A5 to A0!  The board on the right is an example home-made board that sits across both sets of headers.

Solder Leads On Top

At a pinch you could solder some jumper wires to the top of the pins on your Synth Shield (for that matter you could also do this on the underside of the Arduino Uno itself, but I’d not recommend that).

IMG_6743

Off-the Shelf Breakout Board

There are some off-the-shelf breakout style boards that expands the GPIO “outside” of the Arduino’s footprint. But the only ones I’ve really found that do this tend to come with screw-terminals, but that might be ok for you.

This one from Adafruit for example would be ideal: https://www.adafruit.com/product/196.  This could go between the Uno and the Synth Shield and give you full access to all GPIO pins

Adafruit-Wingshield

Custom PCB

If you really want to go for it, you could make your own custom PCB.

V3 of my own Arduino MIDI Proto Shield has an option to include additional IO headers (pins, sockets, right-angles, or just bare soldered wires) to breakout the spare IO “outside” of the Arduino shield’s usual footprint.

Free GPIO Pins

So you can see why I opted to use extended pin headers!

So which GPIO pins are actually usable then?  Here is a guide.

Arduino Synth Shield - GPIO

The Synth Shield uses A0 to A4 and D9 (purple above).  This leads D0 to D8, D10 to D13 and A5 (green above) free for other uses.  The power (orange, red) and GND (black) pins are also highlighted.

Experiment 1 – Add LEDS!

The first experiment returns to the official tutorial’s tone example, which (if you’ve read my critique of the kit will know) includes code to drive some LEDs!

Additional Parts:

  • 4x 220Ω resistors
  • 4x LEDs

Using a 220Ω resistor gives a lot of headroom for a range of colours of LED whilst still keeping the Arduino’s current below 20mA, so feel free to use an online LED resistor calculator to get a more optimal resistor value or to check if the values you already have are suitable.

The LEDS are assumed to be connected to D4 to D7 in the original code, so this is the circuit to build.  Recall that the sound output will come via D9 and the Synth Shield, and the potentiometers on the shield control the pitch for each step and the tempo.

MakeYourUno-ToneSeqLEDs_bb

Download and run the original test sketch from the Make Your Uno Synth Shield page.  Here it is in action.

Experiment 2 – Button Keyboard

There are 14 digital IO pins on the Arduino Uno and only one of them is used by the Synth Shield – D9 for the audio output. This means that the rest can be used as digital inputs to monitor 13 switches.  Which gives us an octave worth of switches – C to C.

Additional Parts:

  • 13x push switches

MakeYourUno-ToneButtons_bb

The audio output will be via the Synth Shield of course.  Now whilst I’ve built solderless breadboard button keyboards like this before, the buttons often don’t stay in place for very long, so today I’ve cheated. I’ve pulled out a stripboard version that I made before.

In previous projects I’ve included resistors to “pull down” the switch links to GND when not being pressed.  This makes for simple code as the switch is HIGH when pressed and LOW when not.  But that requires one resistor per button.  The Arduino has “built in” resistors for inputs, but the are default “pull up” resistors.  When these are enabled, no external resistors are needed, but the code has to reverse the logic.  Switches are LOW when pressed and HIGH when not.

An alternative would be to use my Touch Keyboard PCB in “stylus” mode (with the stylus connected to GND).

The absolutely “bare bones” alternative would be a jumper wire connected to GND used to touch each of the D0 to D9, D10 to D13 pins – that would work too!

IMG_6746

The observant among you may notice a minor issue here though – I only have 12 notes, which gives me C to B not C to C.  I can live with that 🙂

There is a detailed discussion about how it works here (albeit these are in “external resistor” mode):

Note that the potentiometers on the shield are note required for this experiment.

Download the code from GitHub here.

Closing Thoughts

Here are a couple of relatively straight forward add-on projects to try once you have access to GPIO.  There are many more, and I’ll to explore one or two in future posts.

Kevin

Leave a comment