Project tutorial

# Arduino Basic Project-#7 © MIT

I am going to share a very interesting project on Arduino. This project is all about the potentiometer controlled led & buzzer.

• 1 view
• 0 comments
• 0 respects

## Components and supplies

 Arduino UNO
×1
 Breadboard (generic)
×1
 Rotary potentiometer (generic)
×1
 Buzzer
×1
 5 mm LED: Red
×2
 Jumper wires (generic)
×10

## Apps and online services

 Arduino IDE

## About this project

### Introduction

In this project I am going to demonstrate how we can control 2 LED lights & one buzzer using potentiometer. This is a very basic project on Arduino UNO. This project will help us to integrate 2 or more components with Arduino.

### Required Components

• Arduino UNO
• Breadboard
• 5mm LED light (2)
• Potentiometer (10kOhm)
• Buzzer
• Jumper Wire (Male to Male)

### Circuit Analysis

1. Arduino Digital Pin 5 to Buzzer Positive Point

2. Arduino Digital Pin 6 to Green LED Anode

3. Arduino Digital Pin 7 to Red LED Anode

4. Arduino Analog Pin A0 to Potentiometer Signal Pin

5. Arduino +5V to Potentiometer Positive Pin

6. Arduino GND Pin to Red & Green LED Anode Pin

7. Arduino GND Pin to Buzzer & Potentiometer Negative Point

### Working Principle

We know that the potentiometer works as variable resistance. That means when we rotate the knob of the potentiometer it changes its resistance. When we rotate the potentiometer in clockwise direction it will increase its resistance. On the other hand when we rotate the potentiometer in the anti-clockwise it decreases its resistance. We will use this mechanism in this project. When we rotate the knob of potentiometer in anti-clockwise it will light up the Green LED. That means it will reminds us that the value of resistance is LOW that is why the current will pass through the Green LED very effectively. But for this project we set a threshold value for the resistance. If the potentiometer crosses the threshold value RED LED and Buzzer will be activated. It reminds us the value of resistance is HIGH now. If we want to stop the Red LED and Buzzer, we need to decrease the value of resistance by rotating the knob of the potentiometer and after decreasing the resistance value under the threshold value the green LED will automatically lit up.

### Procedure

Step-1

First build up the circuit according to the Schematic section. In the schematic section you will find the circuit diagram of this project.

Step-2

After that plug in the Arduino with your PC/Laptop with the data cable.

Step-3

Then Open the Arduino IDE in from your PC/Laptop. Please ensure the Board and Port setting from the Arduino IDE.

Step-4

Write down the code from the code section or you can copy & paste the code from code section. After writing the code upload the code to your Arduino.

Step-5

Finally test the project that actually works or not by rotating the knob of the potentiometer.

### Demonstration Video

Github Project link: https://github.com/KAST-Tech/arduino-basics-projects/tree/main/Project-%237

Tinkercad Project Link: https://www.tinkercad.com/things/hoBPtkwAoOw

## Code

##### Arduino-Basic-Project-#7-CodeArduino
```// Date: 23/11/21
// Khaled Md. Saifullah
// KastTech

int greenLed = 6;
int redLed = 7;
int buzzPin = 5;
int potPin = A0;
int potValue;

void setup() {

pinMode(greenLed, OUTPUT);
pinMode(redLed, OUTPUT);
pinMode(buzzPin, OUTPUT);
pinMode(potPin, INPUT);
Serial.begin(9600);
}

void loop() {

potValue = analogRead(potPin);
Serial.println(potValue);
delay(1000);
if (potValue >= 700) {
digitalWrite(redLed, HIGH);
digitalWrite(buzzPin, HIGH);
digitalWrite(greenLed, LOW);
} else {
digitalWrite(greenLed, HIGH);
digitalWrite(redLed, LOW);
digitalWrite(buzzPin, LOW);
}
}
```

## Custom parts and enclosures

arduino-basic-project-7-fritzing-file_BX6yhWKh7m.fzz

## Comments

• 14 projects
• 24 followers

#### Published on

November 23, 2021
See similar projects
you might like

• 21,879 views
• 1 comment
• 32 respects

#### MOSMusic

Project tutorial by EdOliver and Victor Altamirano

• 6,672 views
• 11 comments
• 21 respects

#### RFID Based Attendance System Using Arduino

Project tutorial by Techatronic

• 3,309 views
• 1 comment
• 10 respects

#### Buzzer Alarm System With Help Of Arduino

by ONYX

• 101,479 views
• 14 comments
• 53 respects

#### Morse Code Communication Using Arduino

Project tutorial by Jalal Mansoori

• 36,820 views
• 22 comments
• 55 respects

#### 4-Stroke Digital Clock With Arduino

Project showcase by LAGSILVA

• 19,095 views
• 15 comments
• 53 respects