Pada kesempatan kali ini saya akan menjelaskan mengenai bagaimana cara membuat sebuah alat dengan menggunakan GPS Handphone Android sebagai sensor lokasi yang mana ia akan mengirimkan koordinat latitude dan longitude-nya ke mikrokontroller, kemudian di mikrokontroller akan diolah dan ditampilkan ke LCD. media pengiriman dari GPS HP Android ke mikrokontroller adalah melalui bluetooth, sehingga pada mikrokontroller juga harus dilengkapi dengan bluetoooth HC-06 sebagai slave. untuk lebih jelasnya berikut adalah skema dan programnya.
a. Minimum System ATMega
b. Handphone Android dengan fitur GPS
c. Bluetooth HC-05
d. Program Bascom AVR
$regfile = "m16def.dat"
$crystal = 12000000
$baud = 9600
$hwstack = 32
$swstack = 10
$framesize = 40
Config Lcdpin = Pin , Rs = Portd.7 , E = Portd.6 , Db4 = Portc.2
Config Lcdpin = Pin , Db5 = Portc.3 , Db6 = Portc.4 , Db7 = Portc.5
Config Lcd = 16 * 2
Cls
Cursor Off
Main:
On Urxc Getchar
Dim Inchar As String * 50
Enable Interrupts
Enable Urxc
Dim I As Byte
Dim Flagset As Bit
Dim Flagreset As Bit
Dim Line1 As String * 1
Dim Zx As Integer
Dim Datas As String * 50
Dim Id As String * 50
Dim Data1 As String * 50
Dim Data2 As String * 50
Dim Data3 As String * 50
Dim Cmd_pos1 As Byte
Dim Cmd_pos2 As Byte
Dim Datain2 As Single
Dim Datain3 As Single
Datas = ""
Zx = 0
Cls
Do
Upperline
Lcd "LAT= " ; Datain3
Lowerline
Lcd "Long= " ; Datain2
Zx = 0
Loop
Getchar:
Cls
Zx = 1
Datas = ""
Do
Inchar = Inkey()
Datas = Datas + Inchar
Id = Left(datas , 50 )
Incr Zx
Loop Until Zx > 1000
Cmd_pos1 = Instr(id , "A")
If Cmd_pos1 <> 0 Then
Incr Cmd_pos1
Data2 = Mid(id , Cmd_pos1 , 9)
End If
Cmd_pos2 = Instr(id , "B")
If Cmd_pos2 <> 0 Then
Incr Cmd_pos2
Data3 = Mid(id , Cmd_pos2 , 10)
End If
Datain2 = Val(data2)
Datain3 = Val(data3)
Goto Main
Return
$crystal = 12000000
$baud = 9600
$hwstack = 32
$swstack = 10
$framesize = 40
Config Lcdpin = Pin , Rs = Portd.7 , E = Portd.6 , Db4 = Portc.2
Config Lcdpin = Pin , Db5 = Portc.3 , Db6 = Portc.4 , Db7 = Portc.5
Config Lcd = 16 * 2
Cls
Cursor Off
Main:
On Urxc Getchar
Dim Inchar As String * 50
Enable Interrupts
Enable Urxc
Dim I As Byte
Dim Flagset As Bit
Dim Flagreset As Bit
Dim Line1 As String * 1
Dim Zx As Integer
Dim Datas As String * 50
Dim Id As String * 50
Dim Data1 As String * 50
Dim Data2 As String * 50
Dim Data3 As String * 50
Dim Cmd_pos1 As Byte
Dim Cmd_pos2 As Byte
Dim Datain2 As Single
Dim Datain3 As Single
Datas = ""
Zx = 0
Cls
Do
Upperline
Lcd "LAT= " ; Datain3
Lowerline
Lcd "Long= " ; Datain2
Zx = 0
Loop
Getchar:
Cls
Zx = 1
Datas = ""
Do
Inchar = Inkey()
Datas = Datas + Inchar
Id = Left(datas , 50 )
Incr Zx
Loop Until Zx > 1000
Cmd_pos1 = Instr(id , "A")
If Cmd_pos1 <> 0 Then
Incr Cmd_pos1
Data2 = Mid(id , Cmd_pos1 , 9)
End If
Cmd_pos2 = Instr(id , "B")
If Cmd_pos2 <> 0 Then
Incr Cmd_pos2
Data3 = Mid(id , Cmd_pos2 , 10)
End If
Datain2 = Val(data2)
Datain3 = Val(data3)
Goto Main
Return
e. Program Android
f. Gambar Hasilnya
g. Video Hasilnya
No comments:
Post a Comment