Project tutorial

# Arduino Basic Project-#5 © MIT

This is a simple project on Arduino with potentiometer and led.

• 15 views
• 1 respect

## Components and supplies

 Arduino UNO
×1
×1
 Rotary Potentiometer, 10 kohm
×1
 5 mm LED: Red
×1
 Jumper wires (generic)
×5

## Apps and online services

 Arduino IDE

### Introduction

This project is all about the led brightness control by using a potentiometer. Basically I am going to discuss how we can fade in and fade out a led using POT.

### Required Hardware

• Arduino UNO (1)
• 5mm LED (1)
• 10kOhm Potentiometer (1)
• Jumper Wire - Male to male (5)

### Working Principle

In this project we will change the brightness of a LED light using Potentiometer. The task is so simple. LED and potentiometer will attach to the Arduino baord. Potentiometer will be connected with the Analog pin A0. When we rotate the knob of potentiometer, it will change the value of the resistance. So, we know that when the value of resistance is high the LED will give us the low brightness. On the contrary when the value of resistance is low the LED will lit up with high brightness. When we rotate the knob in the anti-clockwise direction the value of resistance will be decreased and the LED will lit up according to the value of resistance. Then when we rotate the knob in the clockwise direction the LED will be dark because of increasing the value of resistance.

### Circuit Analysis

Arduino ---------------------------- POT

+5V ------------------------- Positive Terminal

GND -------------------------- Negative Terminal

Analog Pin A0 ------------ Output Pin

LED Anode Pin to the Arduino Digital Pin 9 and LED's Cathode Pin to the GND pin of Arduino.

### Potentiometer in our project

Potentiometer is a resistance whose resistance can be changed at the turn of a knob or sliding a knob. In this project we have used a 10Kohm potentiometer. That means this POT value will be varied between 1KOhm to 10Kohm. We can change its value from 0.1kohm to 10kohm by rotating the knob. When we decrease the value of resistance the LED will be fade in and on the contrary when we increase the value of resistance the LED will be faded out in our project.

### Procedure

Step-1

Build the circuit from the Schematic section.

Step-2

Open the Arduino IDE in your PC/Laptop and plug the Arduino with your PC/Laptop with USB cable.

Step-3

Write down the code that is provided by the Code section. Then check the board and Port setting from the Arduino IDE.

Step-4

Now upload the code in the Arduino. You are all set to test the project.

## Code

##### Arduino-Basic-Project-#5-codeArduino
```// Date: 18/11/21
// Khaled Md. Saifullah
// KastTech

int potPin= A0;
int LEDPin= 9;
int potValue;
int colorLevel;

void setup() {
pinMode(potPin, INPUT);
pinMode(LEDPin, OUTPUT);
Serial.begin(9600);
}

void loop() {

colorLevel = map(potValue,1,1024,1,255);
analogWrite(LEDPin, colorLevel);
Serial.print("The value of Resistance is: ");
Serial.println(colorLevel);
}
```

## Custom parts and enclosures

arduino-basic-project-5-fritzinf-file_bta3uGVOE0.fzz

## Schematics

• 12 projects
• 23 followers

#### Published on

November 18, 2021

#### Members who respect this project

See similar projects
you might like

• 21,873 views
• 1 comment
• 32 respects

#### MOSMusic

Project tutorial by EdOliver and Victor Altamirano

• 6,669 views
• 21 respects

• 14,368 views
• 44 respects

#### Arduino Bluetooth Robot for Android Device

Project showcase by aip06

• 8,659 views
• 24 respects