maybe one of this days am gonna write a code of 30kb on this mircontroller chip, just wanna confirm the max. program memory size....
The featuring mircontroller chip is the pic16f876a, the reason i keep using this chip is because it cost less than $2 and I guess is available in all country...
1st TEST VIDEO
The GPS Tracker is a small gadget that will record exactly where your vehicle, boat or aeroplane has travelled over time. It is intended to be wired into the ignition of your vehicle and then forgotten.
It will record your travels in Google Earth format, GPS Exchange format or as raw NMEA data and using software such as Google Earth you can then see your trips mapped onto the surface of the earth with a resolution of a few meters. Below are my experimental pics, pcb layout, and code....
PROTEUS SIMULATION
SIM908 CONNECTION 1
SIM908 CONNECTION 2
PCB MAKING 1
PCB MAKING 2
PCB AND COMPONENT FIXING
PC GPS SERIAL BOARD QUICK TEST
FIRST TEST ON GET GPS LOCATION WITH SMS COMMAND
COMPLETE PCB LAYOUT AND CODE: http://1drv.ms/1Lof3e1
'GSM AND GPS CONTROLLER
'PROGRAMMER : AYOMIDE
'USER: OPEYEMI
'ACECCT.BLOGSPOT.COM
'PIC16F876A
'2015
DEFINE OSC 4
include "modedefs.bas"
' Define ADCIN parameters
Define ADC_BITS 10 ' Set number of bits in result
Define ADC_CLOCK 3 ' Set clock source (3=rc)
Define ADC_SAMPLEUS 50 ' Set sampling time in uS
'-------------[PORT INITIALIZATION]-----------------
' 76543210
TRISA = %11111111
ADCON1 = 7
PORTB = 000000 'reset portB resigters to zero
TRISB = 000000 'Setting portB as output port
PORTC = 000000 'reset portC resigters to zero
TRISC = %10000000
'--------------[LCD DEFINES]----------------------
DEFINE LCD_DREG PORTB ' LCD Data bits on PORTB
DEFINE LCD_DBIT 4 ' PORTB starting address
DEFINE LCD_RSREG PORTB ' LCD RS bit on PORTB
DEFINE LCD_RSBIT 2 ' LCD RS bit address
DEFINE LCD_EREG PORTB ' LCD E bit on PORTB
DEFINE LCD_EBIT 3 ' LCD E bit address
DEFINE LCD_BITS 4 ' LCD in 4-bit mode
DEFINE LCD_LINES 2 ' DEFINE LCD ROW AS 2
'VARIABLE ------------------------------
LCD_MOVE VAR WORD ' LCD AMINATION
AT_TEST VAR WORD : AT_TEST = 0
OWNER VAR WORD
SENDER VAR BYTE[25] : SENDER = 0
NET2 VAR WORD
A0 VAR WORD : A0 = 0
BUFF160 VAR BIT[160]
ENCODER90 VAR BYTE[90]
LAT20 VAR BYTE[20]
LONG20 VAR BYTE[20]
ENCODER10 VAR BYTE[10]
A2 VAR WORD : A2 = 0
KEY VAR PORTB.0
B0 VAR WORD
LOCATE VAR WORD : LOCATE = 0
'--------- ASCII ---------------
ENTER con 13
CTRLZ CON 26
' ------- COMMUNICATION PORT --------------
REMOTE_RX VAR PORTC.0
GSM_TX VAR PORTC.6
GSM_RX VAR PORTC.7
' ----------- PORT ALIASES -----------------
OWNER_SW VAR PORTA.5
BOOT VAR PORTA.1
DOOR VAR PORTA.2
BONNET VAR PORTA.3
RELAY_RX VAR PORTA.4
SECURED_LED VAR PORTC.0
ENGINE_LED VAR PORTC.1
DOOR_LED VAR PORTC.2
BUZZER VAR PORTC.3
ENGINE_RELAY VAR PORTB.0
DOOR_RELAY VAR PORTB.1
'---------[LCD INITIALIZATION]-----------
LCDOUT $FE,1 ' CLEAR SCREEN
LCDOUT $FE,2
PAUSE 500 ' Wait .5 second for lcd to ready
ON_MODULE: ' ACTIVATE GSM/GPRS/GPS MODULE
low BUZZER: LOW RELAY_RX: LOW ENGINE_RELAY: LOW DOOR_RELAY
HIGH ENGINE_LED : HIGH DOOR_LED : HIGH SECURED_LED : PAUSE 1000
LOW ENGINE_LED : LOW DOOR_LED : LOW SECURED_LED
PAUSE 10: LOW PORTC.5: PAUSE 1000
HIGH PORTC.5: PAUSE 500
high BUZZER : PAUSE 800: low BUZZER: PAUSE 200
LCDOUT "AJAYI OMOYEMI A." : LCDOUT $FE, $C0
LCDOUT " EEE/11/5048 "
PAUSE 2500
LCDOUT $FE,1 ' CLEAR SCREEN
CHECK_GSM:
CLEAR ' CLEAR ALL VARIABLE
'++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
for AT_TEST = 0 to 3
SEROUT2 GSM_TX,84,["AT",$0D,$0A]
LCDOUT $FE, $C0 : LCDOUT " Initialize !!! "
lcdout $fe,$8
pause 500
lcdout $fe,$c
pause 500
next AT_TEST
PAUSE 300
SEROUT2 GSM_TX,84,["AT+CMGF=1",ENTER] : PAUSE 300
SEROUT2 GSM_TX,84,["AT+CMEE=1",ENTER] : PAUSE 300
LCDOUT $FE,1 ' CLEAR SCREEN
FOR NET2 = 0 TO 2 ' GET NETWORK STATUS
PAUSE 100 : LCDOUT "SEARCHING SIM908"
SEROUT2 GSM_TX,84,["AT+CSQ",ENTER]
SERIN2 GSM_RX,84,3000,CHECK_GSM,[WAIT("+CSQ: "), STR ENCODER90\6] : PAUSE 2
LCDOUT $FE, $C0 : LCDOUT " CSQ: ", STR ENCODER90\6 : PAUSE 1500
NEXT NET2
PAUSE 2
SEROUT2 GSM_TX,84,["AT+CSQ",ENTER]
SERIN2 GSM_RX,84,3000,GSM_CHECK_ERR,[WAIT("OK")] : pause 100
LCDOUT $FE, $C0 : LCDOUT "SIM908 CONNECTED" : PAUSE 2500
HIGH BUZZER :PAUSE 500 :LOW BUZZER :PAUSE 200
HIGH BUZZER :PAUSE 500 :LOW BUZZER :PAUSE 2
GOTO SEND_OKGSM
GSM_CHECK_ERR:
LCDOUT $FE, $C0 : LCDOUT " NOT CONNECTED "
PAUSE 1500
'*****************************************************************
SMS_SETUP:
PAUSE 500
SEROUT2 GSM_TX,84,["AT+CMGF=1",ENTER] ' SW TO SMS MODE
PAUSE 500
SEROUT2 GSM_TX,84,["AT+CMGS=",34,"+2348100581270",34,ENTER]
PAUSE 500
RETURN
SEND_SMS:
PAUSE 300
SEROUT2 GSM_TX,84,[CTRLZ]
SEROUT2 GSM_TX,84,[26]
PAUSE 5000
LCDOUT $FE,1 ' CLEAR SCREEN
LCDOUT $FE, $C0 : LCDOUT " MESSAGE SENT "
HIGH BUZZER :PAUSE 500 :LOW BUZZER :PAUSE 3000
LCDOUT $FE,1 ' CLEAR SCREEN
RETURN
'******************************************************************
SEND_OKGSM:
GOSUB SMS_SETUP
SEROUT2 GSM_TX,84,["SIM908 - GSM/GPRS/GPS CONNECTED AND OK, "," NETWORK CSQ: ",STR ENCODER90\6,_
" [ VEHICLE SECURED ]",ENTER] :PAUSE 500
GOSUB SEND_SMS
PAUSE 1000
MAIN_PROGRAM:
LCDOUT $FE,1 ' CLEAR SCREEN
LCDOUT "SIM908 CONNECTED"
LCDOUT $FE, $C0 :LCDOUT "VEHICLE SECURED"
HIGH SECURED_LED :PAUSE 500 :LOW SECURED_LED
PAUSE 700
IF BOOT = 0 OR DOOR = 0 OR BONNET = 0 THEN ' CHECK DOOR
HIGH BUZZER :PAUSE 500 :LOW BUZZER :PAUSE 200
HIGH BUZZER :PAUSE 500 :LOW BUZZER :PAUSE 200
HIGH BUZZER :PAUSE 500 :LOW BUZZER :PAUSE 2
SEROUT2 GSM_TX,84,["AT+CMGD= 1",ENTER]
LCDOUT $FE, $C0 :LCDOUT " VEHICLE OPENED "
PAUSE 2000
GOTO CHECK_OWNER
ENDIF
PAUSE 2000
GOTO MAIN_PROGRAM
CHECK_OWNER:
LCDOUT $FE,1 ' CLEAR SCREEN
PAUSE 2
FOR OWNER = 1 TO 15
LCDOUT " VERIFY OWNER "
LCDOUT $FE, $C0 :LCDOUT " IN 15 SECOND(S)"
PAUSE 1000
IF OWNER_SW = 0 THEN MAIN_PROGRAM
NEXT OWNER
IF OWNER = 15 THEN GOTO SMS_OWNER
SMS_OWNER:
SEROUT2 GSM_TX,84,["AT+CMGD=1",ENTER] : PAUSE 1000 ' DELETE ALL INBOX
GOSUB SMS_SETUP
SEROUT2 GSM_TX,84,["AN INTRUDER DETECTED, REPLY (CMD:ACIVATE_ LOCK (OR) UNLOCK, ALARM (OR)SILENT, GET_LOCATION, OWNER",ENTER] :PAUSE 500
GOSUB SEND_SMS
PAUSE 1000
CLEAR
DECODE_SMS:
LCDOUT $FE,1 ' CLEAR SCREEN
PAUSE 100
LCDOUT "WAITING FOR SMS": PAUSE 500
SEROUT2 GSM_TX,84,["AT+CMGR= 1",ENTER] ' READ INBOX 1
'SERIN2 GSM_RX,84,3000,DECODE_SMS,[WAIT("+CMGR:"),SKIP 0, STR ENCODER90\20] : PAUSE 50
SERIN2 GSM_RX,84,1500,DECODE_SMS,[WAIT(47),SKIP 14, STR ENCODER90\24] : PAUSE 50
LCDOUT $FE, $C0
LCDOUT "SMS 1: ", STR ENCODER90(19)
'for B0=1 to 108 'MOVE LEFT
' lcdout $fe,$1e
pause 3000
'next B0
if (ENCODER90(19)="L") THEN ' ACTIVATE LOCK
HIGH DOOR_RELAY : HIGH DOOR_LED
HIGH ENGINE_RELAY : HIGH ENGINE_LED: PAUSE 5
GOSUB DELETE_SMS
ENDIF
if (ENCODER90(19)="U") THEN ' ACTIVATE UNLOCK
LOW DOOR_RELAY : LOW DOOR_LED
LOW ENGINE_RELAY : LOW ENGINE_LED: PAUSE 5
GOSUB DELETE_SMS
ENDIF
if (ENCODER90(19)="A") THEN ' ACTIVATE ALARM
HIGH BUZZER : PAUSE 5
GOSUB DELETE_SMS
ENDIF
if (ENCODER90(19)="S") THEN ' ACTIVATE SILENT
LOW BUZZER : PAUSE 5
GOSUB DELETE_SMS
ENDIF
if (ENCODER90(19)="G") THEN ' ACTIVATE GET LOCATION
LOW BUZZER : PAUSE 5
gosub GET_LOCATION
GOSUB DELETE_SMS
ENDIF
if (ENCODER90(19)="O") THEN ' ACTIVATE OWNER
LOW BUZZER
LOW DOOR_RELAY : LOW DOOR_LED
LOW ENGINE_RELAY : LOW ENGINE_LED: PAUSE 5
GOSUB DELETE_SMS
LCDOUT $FE,1 ' CLEAR SCREEN
LCDOUT "VEHICLE SECURED" : LCDOUT $FE, $C0
LCDOUT " OWNER VERIFIED "
PAUSE 10000
GOTO MAIN_PROGRAM
ENDIF
GOTO DECODE_SMS
DELETE_SMS:
SEROUT2 GSM_TX,84,["AT+CMGD= 1",ENTER]
PAUSE 1
RETURN
GET_LOCATION:
CLEAR
LCDOUT $FE,1 ' CLEAR SCREEN
PAUSE 50
SEROUT2 GSM_TX,84,["AT+CGPSPWR=1",ENTER] ' POWER ON THE GPS MODULE
PAUSE 500
SEROUT2 GSM_TX,84,["AT+CGPSRST=1",ENTER] ' POWER ON THE GPS MODULE
PAUSE 500
SEROUT2 GSM_TX,84,["AT+CGPSIPR=9600",ENTER] ' POWER ON THE GPS MODULE
PAUSE 500
LOCATION:
for LOCATE = 0 TO 2
SEROUT2 GSM_TX,84,["=AT+CGPSINF=32",ENTER] ' get location
'HSERIN 2000,SETUP,[SKIP 5,WAIT (10),STR BUFF\20\13]
'SERIN2 GSM_RX,84,[WAIT("+CMGR: "),SKIP 45, STR ENCODER90\20] : PAUSE 200
SERIN2 GSM_RX,84, 1000, LOCATION,[WAIT("A,"),STR LAT20\12] : PAUSE 200
PAUSE 500
SEROUT2 GSM_TX,84,["AT+CGPSINF=32",ENTER] ' get location
SERIN2 GSM_RX,84,[WAIT("N,"),SKIP 0, STR LONG20\12] : PAUSE 200
LCDOUT $FE,1 ' CLEAR SCREEN
PAUSE 200
LCDOUT $FE, $C0
LCDOUT "DOWNLOADING....."
PAUSE 1500
NEXT LOCATE
'------- SEND LOCATION TO MOBILE ------------------------
GOSUB SMS_SETUP
SEROUT2 GSM_TX,84,[" CURRENT VEHICLE LOCATION ::: LAT :", STR LAT20\12," ","LON: ", STR LONG20\12 , ENTER]
PAUSE 500
'SEROUT2 GSM_TX,84,["SIM908 - GSM/GPRS/GPS CONNECTED AND OK, "," NETWORK CSQ: ",STR ENCODER90\6,_
'" [ VEHICLE SECURED ]",ENTER] :PAUSE 500
GOSUB SEND_SMS
PAUSE 1000
RETURN
end
If you have any question, feel free to comment on this post and ask me any question.... acecct.18f4550@gmail.com OR call me on : +2348123206299