Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
com]
Kebutuhan Hardware :
Sensor LM35
Modul LCD 2x16
Modul Relay 5Vdc
Heater
Keypad 3x4
Modul Arduino UNO
Power supply +9Volt
INKUBATEK
INKUBATEK
Sensor LM35
Modul 1 Relay
Element
Heater
INKUBATEK
INKUBATEK
2A1D3CB
Keypad 3x4
Diagram Blok:
2 Inkubatek [supported by : www.tokotronik.com]
LM 35 LCD 2x16
Arduino UNO
Keypad 3x 4 Rly 1 Heater
Schematics
INKUBATEK
2 RS
3 EN
4 D4
5 D5
6 D6
7 D7
1 Pin A1
2 Pin A2
3 Pin A3
A Pin 9
B Pin 10
C Pin 11
D Pin 12
1 (VCC) VCC
2 (OUTPUT) PIN A0
3 (GND) GND
Koneksi Relay:
Relay Pin ARDUINO
1 Pin 8
Source Code/Sketch :
/*************************************
* Program : Project 120. Thermostat seting dg keypad
* 125 Proyek Arduino Inkubatek
* www.inkubator-teknologi.com
* www.tokotronik.com
* ***********************************/
#include <LiquidCrystal.h>
#include <Keypad.h>
LiquidCrystal lcd(2, 3, 4, 5, 6, 7);
byte derajat[8] = {
0b01100,
0b10010,
0b10010,
0b01100,
0b00000,
4 Inkubatek [supported by : www.tokotronik.com]
0b00000,
0b00000,
0b00000
};
char key;
byte SPkeypad;
byte T,setPoint;
byte setSP, f_awal;
void setup(){
pinMode(8,OUTPUT);
lcd.createChar(1, derajat);
lcd.begin(16, 2);
lcd.print(" Thermostat ");
lcd.setCursor(0, 1);
lcd.print("ARDUINO dg LM35");
delay(2000);
lcd.clear();
setPoint=40;
}
void loop(){
lcd.setCursor(0,0);
lcd.print("SP=");
lcd.print(setPoint);
lcd.write(1);
lcd.print("C ");
T=(analogRead(0)*5)/10;
lcd.setCursor(8, 0);
lcd.print("T=");
lcd.print(T);
5 Inkubatek [supported by : www.tokotronik.com]
lcd.write(1);
lcd.print("C ");
if(T<(setPoint-1) || f_awal==0){
lcd.setCursor(0,1);
lcd.print("Set=* Heater ON ");
digitalWrite(8,HIGH);
f_awal=1;
}
else if(T>=setPoint){
lcd.setCursor(0,1);
lcd.print("Set=* Heater OFF");
digitalWrite(8,LOW);
}
delay(100);
bacaKeypad();
}
void bacaKeypad(){
key=keypad.getKey();
if(key != NO_KEY){
if (key=='*'){
lcd.clear();
lcd.print("Seting Set Point");
delay(1000);
lcd.clear();
lcd.print("SP= ");
lcd.write(1);
lcd.print("C ");
lcd.blink();
lcd.setCursor(3,0);
byte kursor=3;
byte selesai=1;
do{
key=keypad.getKey();
if(key != NO_KEY){
if (key!='*' && key!='#' && kursor<5){
lcd.print(key);
key=key-48;
SPkeypad=SPkeypad*10;
SPkeypad=SPkeypad+key;
kursor++;
lcd.setCursor(kursor,0);
}
else if (key=='#' && kursor==5){
6 Inkubatek [supported by : www.tokotronik.com]
selesai=0;
}
}
if(kursor==5){
lcd.noBlink();
lcd.setCursor(0,1);
lcd.print("Save tekan #");
}
}
while(selesai);
setPoint = SPkeypad;
SPkeypad = 0;
f_awal=0;
lcd.clear();
lcd.print("Set point OK!");
delay(1000);
lcd.clear();
}
}
}
Jalannya Alat :
1. Untuk mendapatkan suhu yang stabil Anda bisa buat tegangan supply tersendiri pada
sensor LM35 dengan supply tegangan dari 5Vdc s/d 15Vdc. Semakin besar supply LM35
maka hasilnya semakin bagus asal tidak lebih dari 15Vdc. Atau jika Anda menggunakan
produk Mastermikro Arduino pada modul kontrol dan display lepaskan koneksi power
CN1 (+ dan GND) dari board Arduino kemudian Anda beri supply +5V 2A dari adaptor
luar (tidak menggunakan power dari Arduino).
2. Upload program diatas.
3. Tampilan awal:
Thermostat
ARDUINO dg LM35
4. Setelah 2 detik tampilan diatas dihapus, kemudian diganti dengan tampilan normal:
SP=400C T=410C
Set=* Heater OFF
7. Heater akan menyala lagi setelah suhu berkurang 20C dibawah set point.
8. Seting setpoint dengan menekan tombol Set:
SP= 0C
10. Tekan tombol angka pada keypad misal set point yang akan dimasukkan 38 0C, maka
tekan tombol 3 kemudian delapan.
SP=380C
Save tekan #
SP=380C T=310C
Set=* Heater ON
8 Inkubatek [supported by : www.tokotronik.com]
Ke Heater