3 Different way of connecting a push button​ to Arduino

INTRODUCTION

In this chapter, we are going to learn the three different ways of connecting a push-button with an Arduino microcontroller.

Hardware Required

ComponentsAmazon.inamazonAmazon.comamazonBanggoodbanggoodAliExpressali expressUtsource
utsource
Arduino Nanocart iconcart iconcart iconcart iconcart icon
Push Buttoncart iconcart iconcart iconcart iconcart icon

Three Ways

  • Internal pull-up resistor
  • External pull-up resistor
  • External pull-down resistor

Internal pull-up resistor

  • Connect the push button with Arduino as shown in the circut ie,
  • Connect one terminal of the push button to any digital pin of Arduino in my case I’m using digital pin  D5
  • Then connect the other terminal of the push button to the ground of Arduino.
  • Now upload the below code.

Code

Result

  • By default, the pin state will be HIGH.
  • When we press the push button the pin state will change to LOW.

External pull-up resistor

  • Connect one of the terminal of the push button to any digital pin of Arduino, in my case I have used digital pin 5.
  • Connect the other terminal of the push button to the ground of Arduino.
  • Then connect a resistor of value 10 Kohms from the digital pin which you have connected the push button to the 5v of Arduino, in my case I have connected the resistor form digital pin 5 to 5v.
  • Now upload the below program.

Code

Result

  • By default, the pin state will be HIGH
  • When I press the push button the state will change to LOW.

External pull-down resistor

  • Connect one of the terminal of the push button to any digital pin of Arduino, in my case I have used digital pin 5.
  • Then connect the other terminal to the 5v of Arduino.
  • Then connect a resistor of value 10 Kohms from the digital pin which you have connected the push button to the ground of Arduino, in my case I have connected the resistor form digital pin 5 to ground.
  • Now upload the below code.

Code

Result

  • By default, the pin state will be LOW
  • When we press the push button the state will change to HIGH from LOW

Video

To buy electronic components order from UTSOURCE

1 thought on “3 Different way of connecting a push button​ to Arduino”

  1. This article provides clear and concise instructions for connecting push buttons to Arduino. Understanding the fundamentals of connecting push buttons to Arduino can lead to more advanced projects. The pull-down resistor method can be a useful alternative for connecting push buttons. The examples provided in this article can help beginners understand push button connections to Arduino.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top