Project tutorial
Arduino Basic Project-#5

Arduino Basic Project-#5 © MIT

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

  • 15 views
  • 0 comments
  • 1 respect

Components and supplies

Apps and online services

About this project

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)
  • Mini Breadboard (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.

Demonstration Video

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

Tinkercad Project Link:https://www.tinkercad.com/things/0oDg1iKjL1o

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() {
  
 potValue = analogRead(potPin);
 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-#3-fritzing-file
arduino-basic-project-5-fritzinf-file_bta3uGVOE0.fzz

Schematics

Arduino-Basic-Project-#5-circuit-diagram
Arduino basic project 5 circuit diagram f3dzwvbbxr

Comments

Similar projects you might like

Basic Arduino + JavaScript (Workshop)

by Alex Glow

  • 21,873 views
  • 1 comment
  • 32 respects

MOSMusic

Project tutorial by EdOliver and Victor Altamirano

  • 6,669 views
  • 11 comments
  • 21 respects

Basic Ultrasonic Tutorial

by Damien Murtagh

  • 14,368 views
  • 8 comments
  • 44 respects

Arduino Bluetooth Robot for Android Device

Project showcase by aip06

  • 8,659 views
  • 2 comments
  • 24 respects

LED Cube

Project tutorial by Praditha Alwis

  • 27,560 views
  • 2 comments
  • 33 respects

LED Color Sequencer

Project tutorial by Team thefantasticode.Group

  • 17,224 views
  • 17 comments
  • 43 respects
Add projectSign up / Login