Adding More Buttons To Arduboy Clones?

I really want to make an Arduboy clone, except give it some interesting form factor. Sorry if someone has already answered this, but is it possible to add more buttons to the unit? What would be the limit?

1 Like

Unused pins available on pads on the back of the Arduboy circuit board are:


However, A4 is used to pick up electrical noise as a floating pin, for the initRandomSeed() function. If you connect it to something, initRandomSeed() won’t produce a random value.


There are several ways to add more buttons. When using a Arduino Micro you could use the most spare GPIO pins to hook buttons to. If you want to add a lot of buttons you could also make a matrix with the existing buttons.
How many buttons do you want to add?

That’s enough to hook up a shift register or a multiplexor IC. Using D0-D3 for address and A5 for input, that’s 16 extra buttons.

1 Like

You could also use D2 and D3 in I2C mode to add an I/O expander, such as this 16 bit one from SparkFun. You could even use this for a matrix to provide a full keyboard :wink:

1 Like

I came up with the following idea for 6 extra buttons and using existion GPIO.

The standard buttons are not connected to ground but to OLED CS with diodes in series (cathode at OLED CS side) the extra 6 buttons are connected to the 6 standard button inputs and the other end connected to OLED DC with diodes in series (cathode at OLED DC).

OLED CS is normally always low and OLED DC is normally high (only made low to send a command then made high again) so by default (and in existing sketches) the standard buttons are read by the buttonsState()) function.

The extra buttons can be read out with a minimum overhead as following:

  • LCDCommandMode()
  • buttonsState()
  • LCDDataMode()


Diodes are added to each button to prevent the ghosting effect when multiple buttons are pressed.

If you don’t care about the ghosting effect or it is not relevant because the extra buttons are more like menu or select buttons (no action buttons) you can cheap out on the diodes by just using two as shown in the image below:
Simplified schematic using just two diodes with no ghosting protection.

If just one or two extra buttons are needed and an Leonardo/Micro is used. I’d recommend to use Analog pins A2 (PORTF2) and A3 (PORT F3) then the buttonsState() can be adjusted without too much code overhead

uint8_t Arduboy2Core::buttonsState()
buttons = ((~PINF) & B11110000); // up, right, left, down
if ((PINE & _BV(6)) == 0) {buttons |= A_BUTTON;}
if ((PINB & _BV(4)) == 0) {buttons |= B_BUTTON;}
//extra button code
if ((PINF & _BV(3)) == 0) {buttons |= C_BUTTON;}
if ((PINF & _BV(2)) == 0) {buttons |= D_BUTTON;}
  return buttons;

Or you could just add this to your sketch:

buttons = arduboy2.buttonsState();
if ((PINF & _BV(3)) == 0) {buttons |= C_BUTTON;}
if ((PINF & _BV(2)) == 0) {buttons |= D_BUTTON;}