Multiple Buttons With a Single Pin




Hello everyone!

A lot of us happen to end the PIN analog on our board, to avoid this you can create a circuit that depending on the voltage varies Arduino decide which button was pressed.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: The Circuit

First we need to:

- Arduino Uno

- A resistor 4.7 KOhm

- Three resistors 1 Kohm

- Four buttons

- Breadboard

- Wires for links

Mounted the circuit as described in the picture or ".fzz" file.

Step 2: The Sketch

After mounting the circuit we go to the sketch:


// Created by //
// Alessio Bigini 2015 //

// //

void setup()


Serial.begin(9600); //Valore seriale


void loop()


int sensorValue = analogRead(A0); //Lettura Analogica

float voltage = sensorValue * (5.0 / 1023.0); //Conversione in Volt

Serial.println(voltage); //Stampo nel monitor seriale la tensione


Copied and uploaded the sketch on our board, opening the serial monitor, we can see the different voltage values depending on the button pressed.

Step 3: Some Pictures of the Project

For more info visit:

Be the First to Share


    • Made with Math Contest

      Made with Math Contest
    • Multi-Discipline Contest

      Multi-Discipline Contest
    • Robotics Contest

      Robotics Contest

    13 Discussions


    4 years ago

    To get an analog binary readout of the buttons so you can press any combination of buttons start with the lowest possible readable ohm on the resistor of the first button. Double the resistance.on the and so forth. just like with binary values, every bit has the double value of the bit to the right. In theory the total measured resistance can be read as binary flags by converting the sum.of resistance to "binary". i'm sorry for my bad english. hopefully you get.the idea.

    Is it anyway possible to use these buttons?


    4 years ago on Introduction

    is this limited to just the 4 buttons or is there a way to have more..

    this seems simpler than what I was going to do for a keyboard attachment to an arduino.

    so it would be 30 or so keys....

    1 reply

    Reply 4 years ago on Introduction

    ahh found a easier way... use a 10 ohm resistor between each switch and you get 0 - 14 then 16 - 30 etc... up to 1023....

    so the wiring is on + side between each switch is the 10 ohm resistor and the - side is a common wire here is the picture...

    same code as above...


    4 years ago

    We used to see a very similar use in very old VCR units with wired remotes. A common failure was the switches developing contact resistance which would cause the play button to act as stop etc.. This circuit would allow the use of a two wire multi-button remote control.


    4 years ago on Introduction

    I am considering building a collection of instructables on beginning Arduino.

    Do I have your permission to include this instructable?

    2 replies

    It's added to mt collection, I'll let you know when I publish it.

    I thought of doing this one myself, but you beat me to it.


    4 years ago on Introduction

    This is one of those rare ideas that utterly shocked me in its simplicity and usefulness. Great work!


    4 years ago

    That's a brilliant idea. Never would have thought about adjusting voltage to create different buttons. I think this will come very useful as I have an UNO and I was just wondering what I was going to do for a project that I wanted to do but I would be tight on pins. This is amazing.


    4 years ago on Introduction

    Great idea, would it be possible to detect when multiple buttons are pushed simultaneously? I was thinking, if different valued resistors were placed between the buttons then you can determine the correct voltage drop based on the known values of the different resistors. This should enable you to detect which combination of buttons had been pressed simultaneously.


    4 years ago on Introduction

    The idea of using an analog voltage to determin the button pressed is an excellent idea!