Pada kesempatan berbahagia kali ini saya akan menjelaskan mengenai bagaimana cara membuat alat yang berfungsi untuk mendeteksi kadar gas alkohol dengan satuan PPM. alat ini menggunakan sensor TGS2620 dan indikator berupa led dan buzzer. interface yang digunakan adalah LCD 16x2. untuk lebih jelasnya berikut adalah komponen dan programnya.
a. Minimum System ATMega32
b. LCD 16x2
c. Sensor Gas TGS2620
d. Program Bascom AVR
'tutorial kalibrasi cek link ini
'http://kursuselektronikaku.blogspot.com/2014/09/membuat-detektor-gas-lpg-liquified.html
$regfile = "m32def.dat"
$crystal = 11059200
$baud = 9600
Config Lcdpin = Pin , Rs = Portc.0 , E = Portc.1 , Db4 = Portc.2
Config Lcdpin = Pin , Db5 = Portc.3 , Db6 = Portc.4 , Db7 = Portc.5
Config Lcd = 16 * 2
Cursor Off Noblink
Cls
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Dim Dataadc As Word
Dim Gas_ref As Word
Dim Gas As Single
Dim Lpg As String * 5
Dim Vol As String * 5
Dim Tegangan As Single
Dim Teganganx As Single
Dim A As Single
Dim Vo As Single
Dim X As Single
Dim Y As Single
Dim Rs As Single
Dim D As Single
Dim E As Single
Dim Ppm As Single
Dim Ro As Single
Ddrd.7 = 1
Ddrd.4 = 1
Portd.7 = 0
Portd.4 = 0
Ddrb.0 = 1
Ddrb.1 = 1
Start Adc
Do
Gas_ref = Getadc(0) 'Nilai tegangan ADC dr out sensor
Gas = Gas_ref
Ro = 633750 'kadar Rs dalam udara bersih (ADC minimal)
Teganganx = Gas_ref / 1023
Tegangan = Teganganx * 5.15 'untuk Nilai Menampilkan Tegangan
X = 5.15 - Tegangan
Y = X / Tegangan
Rs = Y * 10000 'untuk menemukan nilai Rs
D = Rs / Ro
E = 325.0 / D 'dari grafik excel ditemukan 325.0x^-1.54
Ppm = E ^ 0.649 '1/1.54
Vol = Fusing(tegangan , "#.##")
Locate 1 , 1
Lcd "Vol= " ; Vol ; " "
Locate 2 , 1
Lcd "PPM= " ; Fusing(ppm , "#.##") ; " "
If Ppm > 50 Then
Portb.0 = 0
Portb.1 = 1
'buzzer
Portd.7 = 1
Portd.4 = 0
End If
If Ppm < 50 Then
Portb.0 = 1
Portb.1 = 0
'buzzer
Portd.7 = 0
Portd.4 = 0
End If
Waitms 200
Loop
e. VIDEO HASILNYA
No comments:
Post a Comment