Pada malam ini adalah malam penuh kebimbangan dan sakit yang begitu mendalam, tapi tak mengapa semuanya kan baik2 saja. Kali ini saya akan menjelaskan mengenai bagaimana cara membuat alat blood shaker menggunakan beberapa komponen utama yaitu motor stepper, load cell dan solenoid valve, jadi prinsip kerjanya yaitu alat akan nge-shake selama nilai berat belum terpenuhi, tapi jika nilai berat sudah terpenuhi maka alat akan berhenti dan membunyikan alarm.
a. Minimum System dan Skema
b. Driver Stepper
c. Load Cell + Amplifier INA114
d. Solenoid Valve
e. Program Bascom AVR
$regfile = "m16def.dat"
$crystal = 12000000
Config Lcdpin = Pin , Rs = Portc.2 , E = Portc.3 , Db4 = Portc.4
Config Lcdpin = Pin , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = Portc.7
Config Lcd = 16 * 2
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Ddrb = &B11111111
'relay
Ddrc.1 = 1
'led
Ddrd.0 = 1
Ddrd.1 = 1
Ddrd.2 = 1
'buzzer
Ddrd.3 = 1
'button
Ddrd.7 = 0
Ddrd.4 = 0
Ddrd.5 = 0
Set Portd.7
Set Portd.4
Set Portd.5
Cls
Cursor Off
Dim Dataadc As Word
Dim A As Integer
A = 0
Start Adc
Menu:
Portd.3 = 1
Wait 3
Portd.3 = 0
Do
Portc.1 = 1
Portd.0 = 1
Portd.1 = 1
Portd.2 = 1
Upperline
Lcd "PILIH MENU"
If Pind.4 = 0 Then
Upperline
Lcd "Dipilih Shake "
Lowerline
Lcd "Sampai 250 ml"
Wait 3
Goto Shake250
Elseif Pind.7 = 0 Then
Upperline
Lcd "Dipilih Shake "
Lowerline
Lcd "Sampai 350 ml"
Wait 3
Goto Shake350
Elseif Pind.5 = 0 Then
Upperline
Lcd "Dipilih Shake "
Lowerline
Lcd "Sampai 450 ml"
Wait 3
Goto Shake450
End If
Loop
Shake250:
Cls
Portd.0 = 0
Portd.1 = 1
Portd.2 = 1
Portc.1 = 0
Do
Dataadc = Getadc(7)
Locate 1 , 1
Lcd Dataadc
Portb = &B00000001
Waitms 15
Portb = &B00000010
Waitms 15
Portb = &B00000100
Waitms 15
Portb = &B00001000
Waitms 15
Loop Until Dataadc >= 400 And Dataadc <= 415
Goto Menu
Return
Shake350:
Cls
Portd.0 = 1
Portd.1 = 0
Portd.2 = 1
Portc.1 = 0
Do
Dataadc = Getadc(7)
Locate 1 , 1
Lcd Dataadc
Portb = &B00000001
Waitms 15
Portb = &B00000010
Waitms 15
Portb = &B00000100
Waitms 15
Portb = &B00001000
Waitms 15
Loop Until Dataadc >= 380 And Dataadc <= 395
Goto Menu
Return
Shake450:
Cls
Portd.0 = 1
Portd.1 = 1
Portd.2 = 0
Portc.1 = 0
Do
Dataadc = Getadc(7)
Locate 1 , 1
Lcd Dataadc
Portb = &B00000001
Waitms 15
Portb = &B00000010
Waitms 15
Portb = &B00000100
Waitms 15
Portb = &B00001000
Waitms 15
Loop Until Dataadc >= 370 And Dataadc <= 380
Goto Menu
$crystal = 12000000
Config Lcdpin = Pin , Rs = Portc.2 , E = Portc.3 , Db4 = Portc.4
Config Lcdpin = Pin , Db5 = Portc.5 , Db6 = Portc.6 , Db7 = Portc.7
Config Lcd = 16 * 2
Config Adc = Single , Prescaler = Auto , Reference = Avcc
Ddrb = &B11111111
'relay
Ddrc.1 = 1
'led
Ddrd.0 = 1
Ddrd.1 = 1
Ddrd.2 = 1
'buzzer
Ddrd.3 = 1
'button
Ddrd.7 = 0
Ddrd.4 = 0
Ddrd.5 = 0
Set Portd.7
Set Portd.4
Set Portd.5
Cls
Cursor Off
Dim Dataadc As Word
Dim A As Integer
A = 0
Start Adc
Menu:
Portd.3 = 1
Wait 3
Portd.3 = 0
Do
Portc.1 = 1
Portd.0 = 1
Portd.1 = 1
Portd.2 = 1
Upperline
Lcd "PILIH MENU"
If Pind.4 = 0 Then
Upperline
Lcd "Dipilih Shake "
Lowerline
Lcd "Sampai 250 ml"
Wait 3
Goto Shake250
Elseif Pind.7 = 0 Then
Upperline
Lcd "Dipilih Shake "
Lowerline
Lcd "Sampai 350 ml"
Wait 3
Goto Shake350
Elseif Pind.5 = 0 Then
Upperline
Lcd "Dipilih Shake "
Lowerline
Lcd "Sampai 450 ml"
Wait 3
Goto Shake450
End If
Loop
Shake250:
Cls
Portd.0 = 0
Portd.1 = 1
Portd.2 = 1
Portc.1 = 0
Do
Dataadc = Getadc(7)
Locate 1 , 1
Lcd Dataadc
Portb = &B00000001
Waitms 15
Portb = &B00000010
Waitms 15
Portb = &B00000100
Waitms 15
Portb = &B00001000
Waitms 15
Loop Until Dataadc >= 400 And Dataadc <= 415
Goto Menu
Return
Shake350:
Cls
Portd.0 = 1
Portd.1 = 0
Portd.2 = 1
Portc.1 = 0
Do
Dataadc = Getadc(7)
Locate 1 , 1
Lcd Dataadc
Portb = &B00000001
Waitms 15
Portb = &B00000010
Waitms 15
Portb = &B00000100
Waitms 15
Portb = &B00001000
Waitms 15
Loop Until Dataadc >= 380 And Dataadc <= 395
Goto Menu
Return
Shake450:
Cls
Portd.0 = 1
Portd.1 = 1
Portd.2 = 0
Portc.1 = 0
Do
Dataadc = Getadc(7)
Locate 1 , 1
Lcd Dataadc
Portb = &B00000001
Waitms 15
Portb = &B00000010
Waitms 15
Portb = &B00000100
Waitms 15
Portb = &B00001000
Waitms 15
Loop Until Dataadc >= 370 And Dataadc <= 380
Goto Menu
Return
f. VIDEO HASILNYA
No comments:
Post a Comment