An example of a control panel which has 8 buttons but only uses 4 pins on the Arduino.

The LS148 is a 8 to 3 line encoder, meaning that it will produce a binary value based on which one of the 8 input lines are high. Normally the LS148 truth table calls for several inputs to be high in order to produce a value, so by connecting the buttons in a one-way flow using diodes we can produce a unique identifier for each button. The Arduino then checks the input pins and compares which ones are HIGH and which are LOW and based on that determines which one of the buttons has been pressed.

This circuit also takes all of the output lines of the LS148 and sends the signal to a single LED that acts as a feedback light when ever a button is pressed without using another output pin on the Arduino.


Components list:

1 x Arduino Board (or ATmega you can setup)

1 x LS148 IC (Datasheet: Download)

8 x 1KΩ Resistor

1 x 330Ω Resistor

12 x 1N4148 (in the video I used 1N4005)

8 x Button

1 x LED

Source Code:

Arduino source: Download

C# source: Download


Video demonstration:


Breadboard layout: A8BCP_bb1.png