Push Button LED Control Project Using Arduino for Beginners
Push Button LED Control Project Using Arduino
Push Button LED Control Project is one of the best beginner-friendly Arduino projects to understand digital input and output. In this project, we will use a push button to control an LED with Arduino. When the button is pressed, the LED turns ON, and when the button is released, the LED turns OFF.
This simple project helps beginners learn how Arduino reads button input and controls an output device like an LED.

What is a Push Button LED Control Project?
A Push Button LED Control Project is a basic electronics project where a push button works as an input switch and an LED works as an output device. Arduino reads the state of the push button and controls the LED according to the button condition.
This project is useful for understanding:
- Digital input pins
- Digital output pins
- Button interfacing with Arduino
- Basic LED control
- Pull-down resistor concept
Components Required
| Component | Quantity |
|---|---|
| Arduino UNO | 1 |
| LED | 1 |
| Push Button | 1 |
| 220Ω Resistor | 1 |
| 10kΩ Resistor | 1 |
| Breadboard | 1 |
| Jumper Wires | As required |
| USB Cable | 1 |
Push Button LED Control Circuit Diagram
The circuit is very simple. The LED is connected to Arduino digital pin 13 through a 220Ω resistor. The push button is connected to digital pin 2. A 10kΩ resistor is used as a pull-down resistor to keep the input stable when the button is not pressed.

Arduino Push Button LED Wiring
LED Connection
- Connect the longer leg of LED to Arduino digital pin 13 through a 220Ω resistor.
- Connect the shorter leg of LED to Arduino GND.
Push Button Connection
- Connect one side of the push button to Arduino 5V.
- Connect the other side of the push button to Arduino digital pin 2.
- Connect a 10kΩ resistor between digital pin 2 and GND.
Arduino Code for Push Button LED Control
Upload the following code to your Arduino UNO using Arduino IDE.
int buttonPin = 2;
int ledPin = 13;
int buttonState = 0;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT);
}
void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
digitalWrite(ledPin, HIGH);
} else {
digitalWrite(ledPin, LOW);
}
}
How the Code Works
In this code, Arduino pin 2 is used as an input pin for reading the push button state, and pin 13 is used as an output pin for controlling the LED.
pinMode(buttonPin, INPUT);sets the push button pin as input.pinMode(ledPin, OUTPUT);sets the LED pin as output.digitalRead(buttonPin);reads whether the button is pressed or not.- If the button state is
HIGH, the LED turns ON. - If the button state is
LOW, the LED turns OFF.
Working of Push Button LED Control Project
When the push button is not pressed, the Arduino input pin remains LOW because of the 10kΩ pull-down resistor. In this condition, the LED remains OFF.
When the push button is pressed, 5V is applied to Arduino digital pin 2. Arduino reads this as HIGH and turns ON the LED connected to pin 13.
Why Use a Pull-Down Resistor?
A pull-down resistor is used to keep the Arduino input pin stable when the button is not pressed. Without this resistor, the input pin may receive random signals, and the LED may turn ON or OFF unexpectedly.
In this project, the 10kΩ resistor connects the input pin to GND, so Arduino reads a clear LOW signal when the button is open.
Alternative Code Using Internal Pull-Up Resistor
Arduino also has an internal pull-up resistor. With this method, you do not need an external 10kΩ resistor. However, the logic becomes reversed.
int buttonPin = 2;
int ledPin = 13;
int buttonState = 0;
void setup() {
pinMode(ledPin, OUTPUT);
pinMode(buttonPin, INPUT_PULLUP);
}
void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState == LOW) {
digitalWrite(ledPin, HIGH);
} else {
digitalWrite(ledPin, LOW);
}
}
In this version, the LED turns ON when the button state becomes LOW because the button connects the input pin to GND when pressed.
Common Problems and Solutions
| Problem | Possible Reason | Solution |
|---|---|---|
| LED not turning ON | Wrong LED polarity | Connect the longer LED leg to positive side |
| LED always ON | Button wiring mistake | Check push button pins carefully |
| LED flickering | Floating input pin | Use 10kΩ pull-down resistor |
| Arduino code not uploading | Wrong board or port selected | Select correct Arduino board and COM port |
| LED is too bright | Low resistor value | Use 220Ω or 330Ω resistor |
Applications of Push Button LED Control
- Basic switch control circuits
- Doorbell projects
- Arduino input testing
- Smart home button control
- Digital electronics learning
- Control panels and indicators
- Mini automation projects
Safety Tips
- Always use a resistor with the LED.
- Do not connect LED directly to Arduino pin without resistance.
- Check push button connections before powering the circuit.
- Use low voltage only for beginner projects.
- Disconnect USB cable before changing wiring.
Project Upgrade Ideas
After completing this basic project, you can upgrade it in different ways:
- Control multiple LEDs with multiple buttons
- Create a toggle ON/OFF LED switch
- Add a buzzer with the push button
- Use RGB LED instead of single LED
- Make a mini traffic light control system
- Use the button as input for home automation projects
FAQs About Push Button LED Control Project
What is the use of a push button in Arduino?
A push button is used as a digital input device. It allows the user to send HIGH or LOW signals to Arduino.
Why is a resistor used with the LED?
A resistor limits current flow through the LED and protects it from damage.
Can I use any Arduino board for this project?
Yes, you can use Arduino UNO, Nano, Mega, or other compatible Arduino boards.
What value resistor should I use for the LED?
A 220Ω or 330Ω resistor is commonly used with LEDs in Arduino projects.
Can I make the LED stay ON after pressing the button once?
Yes, you can modify the code to work as a toggle switch, where one press turns the LED ON and the next press turns it OFF.
Conclusion
The Push Button LED Control Project is a simple but very important Arduino project for beginners. It teaches how to read digital input from a push button and control an output device like an LED. This project is a strong foundation for learning advanced Arduino projects such as smart switches, control panels, automation systems, and sensor-based circuits.
If you are new to Arduino, this project is a perfect starting point to understand how input and output pins work in real circuits.
Suggested Internal Links: