If you have trouble finding the keypad or pin less arduino if added keypad, well here's an easy way to make a replacement keypad with potentiometer. Potensio meter is used to designate the desired set point value and then the setting button is used to determine the set point value. The display is displayed on the LCD.
Hardware Requirement
- Potentiometer
- Arduino Uno
- Push Button
- Power supply +5 Volt
- Jumper
Potentiometer | Source
Block Diagram
Schematic
Arduino - LCD Wiring
Arduino - Potentiometer Wiring
Arduino - Button Wiring
Source Code/Sketch
#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
int adc,nilai, pos;
long setpoint;
const int tombolSET = 8;
void setup(){
pinMode(8,LOW);
digitalWrite(8, HIGH);
lcd.begin(16, 2);
lcd.print("Seting Nilai");
lcd.setCursor(0,1);
lcd.print("Tanpa Keypad");
delay(2000);
lcd.clear();
lcd.print("Nilai=");
lcd.setCursor(0,1);
lcd.print("SP=");
lcd.blink();
pos=3;
}
void loop(){
adc = analogRead(0);
nilai=map(adc,0,1000,0,9);
lcd.setCursor(6,0);
lcd.print(nilai);
lcd.setCursor(pos,1);
if(digitalRead(tombolSET)==LOW){
setpoint=setpoint*10+nilai;
lcd.setCursor(3,1);
lcd.print(setpoint);
pos++;
delay(200);
}
delay(200);
}
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
int adc,nilai, pos;
long setpoint;
const int tombolSET = 8;
void setup(){
pinMode(8,LOW);
digitalWrite(8, HIGH);
lcd.begin(16, 2);
lcd.print("Seting Nilai");
lcd.setCursor(0,1);
lcd.print("Tanpa Keypad");
delay(2000);
lcd.clear();
lcd.print("Nilai=");
lcd.setCursor(0,1);
lcd.print("SP=");
lcd.blink();
pos=3;
}
void loop(){
adc = analogRead(0);
nilai=map(adc,0,1000,0,9);
lcd.setCursor(6,0);
lcd.print(nilai);
lcd.setCursor(pos,1);
if(digitalRead(tombolSET)==LOW){
setpoint=setpoint*10+nilai;
lcd.setCursor(3,1);
lcd.print(setpoint);
pos++;
delay(200);
}
delay(200);
}
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
5. After 2 seconds the above display is removed, then replaced with normal view that displays the
value to be inserted in set point
6. Press the Set button to adjust the set point by rotate potentiometer
Video for Project V - 16. Setting Set Point Value Without Keypad Input (Arduino Based)
Required File
No comments:
Post a Comment