Sistem Kerja Alat
Membaca nilai temperatur dengan sensor LM35 kemudian hasilnya ditampilkan dalam bentuk bargraph di LCD 2x16 dengan Arduino UNO sebagai pengolah datanya.
Kebutuhan Hardware
- Arduino UNO Board
- Modul sensor LM35
- Modul LCD 2x16
- Power Supply 7-9 Vdc
Schematic
Source Code/Sketch
#include <LiquidCrystal.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
unsigned int adc,tempLM,a,b,i;
byte bargraph1[8] = {
0b10000,
0b10000,
0b10000,
0b10000,
0b10000,
0b10000,
0b10000,
0b10000
};
byte bargraph2[8] = {
0b11000,
0b11000,
0b11000,
0b11000,
0b11000,
0b11000,
0b11000,
0b11000
};
byte bargraph3[8] = {
0b11100,
0b11100,
0b11100,
0b11100,
0b11100,
0b11100,
0b11100,
0b11100
};
byte bargraph4[8] = {
0b11110,
0b11110,
0b11110,
0b11110,
0b11110,
0b11110,
0b11110,
0b11110
};
byte bargraph5[8] = {
0b11111,
0b11111,
0b11111,
0b11111,
0b11111,
0b11111,
0b11111,
0b11111
};
// suhu : 0 - 100
// bar : 15x5 = 50
//============================================
void setup(void) {
lcd.begin(16, 2);
lcd.createChar(1, bargraph1);
lcd.createChar(2, bargraph2);
lcd.createChar(3, bargraph3);
lcd.createChar(4, bargraph4);
lcd.createChar(5, bargraph5);
lcd.print("Digital Therm");
lcd.setCursor(0,1);
lcd.write(byte(1));
delay(1000);
lcd.clear();
lcd.print("Dig Thermo 0-75C");
}
//===========================================
void loop(void) {
adc = analogRead(0);
tempLM=(adc*5)/10;
lcd.setCursor(0,1);
if(tempLM>5){
a=tempLM/5;
b=tempLM%5;
for(i=0;i<a;i++){
lcd.write(5);
}
if(b==1){
lcd.write(1);
}
else if(b==2){
lcd.write(2);
}
else if(b==3){
lcd.write(3);
}
else if(b==4){
lcd.write(4);
}
}
delay(2000);
}
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
unsigned int adc,tempLM,a,b,i;
byte bargraph1[8] = {
0b10000,
0b10000,
0b10000,
0b10000,
0b10000,
0b10000,
0b10000,
0b10000
};
byte bargraph2[8] = {
0b11000,
0b11000,
0b11000,
0b11000,
0b11000,
0b11000,
0b11000,
0b11000
};
byte bargraph3[8] = {
0b11100,
0b11100,
0b11100,
0b11100,
0b11100,
0b11100,
0b11100,
0b11100
};
byte bargraph4[8] = {
0b11110,
0b11110,
0b11110,
0b11110,
0b11110,
0b11110,
0b11110,
0b11110
};
byte bargraph5[8] = {
0b11111,
0b11111,
0b11111,
0b11111,
0b11111,
0b11111,
0b11111,
0b11111
};
// suhu : 0 - 100
// bar : 15x5 = 50
//============================================
void setup(void) {
lcd.begin(16, 2);
lcd.createChar(1, bargraph1);
lcd.createChar(2, bargraph2);
lcd.createChar(3, bargraph3);
lcd.createChar(4, bargraph4);
lcd.createChar(5, bargraph5);
lcd.print("Digital Therm");
lcd.setCursor(0,1);
lcd.write(byte(1));
delay(1000);
lcd.clear();
lcd.print("Dig Thermo 0-75C");
}
//===========================================
void loop(void) {
adc = analogRead(0);
tempLM=(adc*5)/10;
lcd.setCursor(0,1);
if(tempLM>5){
a=tempLM/5;
b=tempLM%5;
for(i=0;i<a;i++){
lcd.write(5);
}
if(b==1){
lcd.write(1);
}
else if(b==2){
lcd.write(2);
}
else if(b==3){
lcd.write(3);
}
else if(b==4){
lcd.write(4);
}
}
delay(2000);
}
Jalannya Alat
Pada LCD akan tampil nilai temperature yang dibaca oleh Arduino dengan sensor suhu LM35 dengan tampilan bargraph. Jika temperatur berubah, tampilan di LCD (panjang – pendek bargraph) akan mengikutinya. Nilai 1 kolom = 1 0C, jadi jika 1 kotak penuh (5 kolom) berarti 50C.
Video Project II - 17. Thermometer Digital Bar Graph menggunakan LCD berbasis Arduino Uno
KONTAK KAMI 085743320570 (adi sanjaya)
No comments:
Post a Comment