Arduino UNO is used to control the speed of a DC motor using a potentiometer. The potentiometer is connected to pin A0 as the analog data input and the readout is used as the PWM output control on pin 9. The PWM value is also on the LCD.
Hardware Requirement
- Potentiometer 50 K
- 16 x 2 LCD Module
- Motor DC
- Driver Motor DC (L298)
- Power supply +5 Volt
- Jumper
Block Diagram
Schematic
Arduino - LCD Wiring
Arduino - Potentiometer Wiring
Arduino - Driver Motor Wiring
Source Code/Sketch
#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
void setup(){
pinMode(9,OUTPUT);
lcd.begin(16, 2);
lcd.setCursor(0,0);
lcd.print("Kontrol Motor DC");
lcd.setCursor(0,1);
lcd.print("dg Potensio (A0)");
delay(3000);
lcd.clear();
}
void loop(){
int val = analogRead(A0);
byte pwm = map(val, 0, 1023, 0, 255);
analogWrite(9,pwm);
lcd.setCursor(0,0);
lcd.print("PWM:");
lcd.print(pwm);
lcd.print(" ");
delay(100);
}
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
void setup(){
pinMode(9,OUTPUT);
lcd.begin(16, 2);
lcd.setCursor(0,0);
lcd.print("Kontrol Motor DC");
lcd.setCursor(0,1);
lcd.print("dg Potensio (A0)");
delay(3000);
lcd.clear();
}
void loop(){
int val = analogRead(A0);
byte pwm = map(val, 0, 1023, 0, 255);
analogWrite(9,pwm);
lcd.setCursor(0,0);
lcd.print("PWM:");
lcd.print(pwm);
lcd.print(" ");
delay(100);
}
How it Works
1. Connect the Arduino with Peripherals needed
2. Plug in the Power Source on the device
3. Compile and upload the script program above to your arduino
4. First initial LCD display
5. Normal view on the LCD, display the value of PWM
6. Just go ahead and rotate your potento meter. Then the smaller the PWM then the DC motor
rotation faster, and vice versa when the PWM value is greater then the rotation of DC motor is
getting slowed down.
Video for Project V - 22. DC Motor Speed Control using Potensio Meter (Arduino Based)
Required File
No comments:
Post a Comment