|
|
View previous topic :: View next topic |
Author |
Message |
Papi
Joined: 08 Dec 2012 Posts: 36
|
Vehicle Tracking using GSM and GPS with PIC16F877A ((SOLVED) |
Posted: Sat Dec 08, 2012 9:56 am |
|
|
Hi all,
I just want advice on what I should do, actual am using PIC16F877A with ccs c compiler with MPLAB, I really like this compiler but this time am not too sure, What I want is am planning to use GSM and GPS but for PIC16F877A there is only one port for RX and TX,
But I have tried to do research and read datasheet for CCS C compiler and they said its possible but how?? I don't know here, so the project is based on car tracking system, so I will use GSM to send message to my mobile number for car location longitude and latitude and GPS to get latitude and longitude,
Also am using LCD 16 x 2 with flex_lcd.c. connected my LCD and tested everything worked fine, I can see something on the LCD
I'm using LCD because after message sent I want to display the location on my LCD......
I have tested my PIC with two LED flashing with 20MHZ everything worked fine... controlling the PIC with 5V
Type of GSM is GSM SIEMENS TC35 (5V)
Type of GPS is GPS 9540 with (5V)
Questions
(1) So for the GPS and GSM do I need to use MAX232 to connect to my PIC?
(2) How am going to use my GSM and GPS with PIC16F877A??Advice here please, between GSM and GPS which one should I use for the RX and TX pins??
(3) Also one of them between GSM and GPS I can connect to Hardware and another one using software, so am not to sure here about software part please
I really need advice please, I have tried to do a lot of research but I haven't got any solution so far
Project Name : Vehicle Tracking System
Thank you
Last edited by Papi on Sun May 12, 2013 3:00 pm; edited 3 times in total |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9270 Location: Greensville,Ontario
|
|
Posted: Sat Dec 08, 2012 11:00 am |
|
|
comments...
re 1) You should read the datasheet for the GSM and GPS. THEY should tell you the requirements.It may be TTL or RS232 compatible,but should be listed along with baudrate,databits,etc.
re 2) Whichever device is to be 'polled' by you ( GPS I'm assuming), I'd attach to the software UART, putting the hardware UART onto the GSM.
re 3) same answer as #2
other comments...
1) consider using another PIC that has 2 UARTS, like the 18F46K22. It has a LOT more code space,timers,and other peripherals. While you may not need them now...you will in the future.I still have some 20 year old 877s but upgraded to the 46k22( 40 pin dip).It's my 'standard' PIC now,big or small ,it'll do 99% of the jobs.It's not worth saving 30 cents for a smaller PIC or pcb when 'headaches' arise due to 'compatabilty' issues.
2) get familiar with the 'search' feature of this forum. Probably 99% of what you need is here but you need to look for it.You're not the first that wants to do this.
3) breakdown your program into 'units'.1st get 'polling the GPS' and display onto LCD. Then send to PC.After that work on the GSM 'unit'. This way you'll have an 'incremental program' wheree you can always 'go back' to a previous version that worked.
4) add comments !!! Sure you know ehat the code is now..but 2 days,3 weeks,a month from now, you'll ask 'WHAT did I do THAT for???'.
5) Use interrupt driven serial routines with buffers. CCS supplies examples of these in their 'examples' folder.
hth
jay |
|
|
Papi
Joined: 08 Dec 2012 Posts: 36
|
|
Posted: Sun Dec 09, 2012 5:33 pm |
|
|
Thank you temtronic,
Ok I have understand your comment and advice as well, so I will answer each part, About GSM and GPS I will have look the datasheet and see, so you said I should have listed with baudrate,databits, so it means if I use this I don't have to use RS232 right?? I just need more explanation here, sorry!!
re 2)Thank you for that I will do that no problem and do you have any simple software code which I might use to test and see if its working or not.....will appreciate, because here the main thing I want is to make sure my GPS is working and I can see something on my LCD then the next part is just GSM....
Thank you a lot for your OTHER COMMENT, number 1 and 2 as well I will have look for that especially number 2, but am new here that's why for a mean time I will need more help,
Really appreciate for number 3 because you gave me hints on what to do, what I was planning to do all of them in the same time which I was I was going to waste a lot of time, appreciate for that.
Also for number 4 I didn't get what you mean can you go more deeply please??then for number 5 you said I have to use interrupt driven serial with buffers... I have checked my example folder so what is the name of the file or is that possible if you could attach the code please...
Also extra question for GSM which pins do you prefer I should use? because for GPS I will use pin 26 and 27 and what about GSM?
I have checked the datasheet for GPS and I have seen this
Serial Data: RXA, RXB, TXA, and TXB
The board supports two full duplex serial channels. All four connections are at TTL levels, all support
variable baud rates, and all can be controlled from the appropriate screens in GPS Monitor software.
(TTL level should be converted to RS-232 level when communicate with PC serial port.)
so it means I have to use RS-232??
Need more help please
Thank you |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Mon Dec 10, 2012 12:26 am |
|
|
Hi,
I hate to discourage you, but I think this is not a good first project for someone with such limited hardware and programming Experience. You are going to find yourself lost each step of the way. Why this project? How about something much simpler?
John |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Mon Dec 10, 2012 1:44 am |
|
|
ezflyr wrote: |
I hate to discourage you, but I think this is not a good first project for someone with such limited hardware and programming Experience. You are going to find yourself lost each step of the way. Why this project? How about something much simpler? |
I have to concur with ezflyer.
I don't mean to be a source of discouragement either, but if you're not sure about basic requirements like RS232 and the fact that you're already got your project off on the wrong foot by using a PIC with a single RS232 port, then I foresee a lot of head-banging against a desk or wall.
CCS does fully support doing software RS232 -- but it comes at a heavy processing price. You state you're not so sure about CCS's compiler because the PIC only has one UART. This displays a serious disconnect in your understand of what the PIC does for you versus the compiler.
Your project would be a breeze with a PIC18F family that supports high priority IRQ's and/or has 2 UART's in a single package. (I use them regularly for GPS type tasks where another serial port is needed for something else.)
(sigh)
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19590
|
|
Posted: Mon Dec 10, 2012 2:22 am |
|
|
Or, look at the thread:
<http://www.ccsinfo.com/forum/viewtopic.php?t=49549>
and use this form of interrupt driven software UART to receive the GPS.
Depending on the available clock speed, the 'first part' is then solved.
Best Wishes |
|
|
Papi
Joined: 08 Dec 2012 Posts: 36
|
|
Posted: Wed Dec 12, 2012 3:43 pm |
|
|
ezflyr wrote: | Hi,
I hate to discourage you, but I think this is not a good first project for someone with such limited hardware and programming Experience. You are going to find yourself lost each step of the way. Why this project? How about something much simpler?
John |
Appreciate for your comment and advice, am accepting any kind of challenges because that's what I want to learn, thank you for that.
I decided to choose this kind of project because I really like and I was ready to fight and came up with final solution how is going yo work.
Any advice? |
|
|
Papi
Joined: 08 Dec 2012 Posts: 36
|
|
Posted: Wed Dec 12, 2012 3:53 pm |
|
|
bkamen wrote: | ezflyr wrote: |
I hate to discourage you, but I think this is not a good first project for someone with such limited hardware and programming Experience. You are going to find yourself lost each step of the way. Why this project? How about something much simpler? |
I have to concur with ezflyer.
I don't mean to be a source of discouragement either, but if you're not sure about basic requirements like RS232 and the fact that you're already got your project off on the wrong foot by using a PIC with a single RS232 port, then I foresee a lot of head-banging against a desk or wall.
CCS does fully support doing software RS232 -- but it comes at a heavy processing price. You state you're not so sure about CCS's compiler because the PIC only has one UART. This displays a serious disconnect in your understand of what the PIC does for you versus the compiler.
Your project would be a breeze with a PIC18F family that supports high priority IRQ's and/or has 2 UART's in a single package. (I use them regularly for GPS type tasks where another serial port is needed for something else.)
(sigh)
-Ben |
Hi Ben,
Thank you for your comment and advice, actual I was planning to use LCD to display results after message sent, so I can see something on the LCD, but do you think I really need to use this LCD??I have everything my PIC and LCD tested worked fine as I mention on my first post.
So I was try to do more research and saw different code they start with
#use rs232 (baud = 9600, xmit=PIN_B0,rcv=PIN_B1,stream=GSM) //For GSM Modem
#use rs232 (baud = 4800, xmit=PIN_A1,rcv=PIN_A0,stream=GPS) //For GPS Receiver
so for that one they didn't use any of the ports, I will be more happy to get advice about this. |
|
|
Papi
Joined: 08 Dec 2012 Posts: 36
|
|
Posted: Wed Dec 12, 2012 4:01 pm |
|
|
Ttelmah wrote: | Or, look at the thread:
<http://www.ccsinfo.com/forum/viewtopic.php?t=49549>
and use this form of interrupt driven software UART to receive the GPS.
Depending on the available clock speed, the 'first part' is then solved.
Best Wishes |
Thank you for that link I will have look, yes my gps is just to receive that's all, I will check that interrupt |
|
|
bkamen
Joined: 07 Jan 2004 Posts: 1615 Location: Central Illinois, USA
|
|
Posted: Wed Dec 12, 2012 4:50 pm |
|
|
Papi wrote: |
Thank you for your comment and advice, actual I was planning to use LCD to display results after message sent, so I can see something on the LCD, but do you think I really need to use this LCD??I have everything my PIC and LCD tested worked fine as I mention on my first post.
|
I don't know if you need to use that LCD (or any LCD) -- this is your project. Being the designer, you get to decide exactly what features go into the project or not.
Quote: |
So I was try to do more research and saw different code they start with
#use rs232 (baud = 9600, xmit=PIN_B0,rcv=PIN_B1,stream=GSM) //For GSM Modem
#use rs232 (baud = 4800, xmit=PIN_A1,rcv=PIN_A0,stream=GPS) //For GPS Receiver
so for that one they didn't use any of the ports, I will be more happy to get advice about this. |
Every project is different. When you look at other people's examples for guidance, it comes with the requirement to know what applies to your project or not.
The code fragments above tell me nothing about the either the project you were looking at for guidance or your project other than there was a GPS set for 4800bps and a GSM modem set for 9600bps.
Every project is different.
-Ben _________________ Dazed and confused? I don't think so. Just "plain lost" will do. :D |
|
|
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Wed Dec 12, 2012 5:11 pm |
|
|
Hi,
In CCS terms do you know the difference between a hardware and a software
serial port? In your serial port defines, you are not using the hardware UART
of your PIC.
Can you provide links for the GPS and GSM modules?
An LCD, or a serial port , is always highly desirable for diagnostics during the
development of a project like this even if you don't use it in the final
implementation.
Can you post a picture of your hardware, and show us the code you've
written so far? This will give us a good idea where you stand...
John |
|
|
Papi
Joined: 08 Dec 2012 Posts: 36
|
|
Posted: Thu Dec 13, 2012 3:24 pm |
|
|
bkamen wrote: | Papi wrote: |
Thank you for your comment and advice, actual I was planning to use LCD to display results after message sent, so I can see something on the LCD, but do you think I really need to use this LCD??I have everything my PIC and LCD tested worked fine as I mention on my first post.
|
I don't know if you need to use that LCD (or any LCD) -- this is your project. Being the designer, you get to decide exactly what features go into the project or not.
Quote: |
So I was try to do more research and saw different code they start with
#use rs232 (baud = 9600, xmit=PIN_B0,rcv=PIN_B1,stream=GSM) //For GSM Modem
#use rs232 (baud = 4800, xmit=PIN_A1,rcv=PIN_A0,stream=GPS) //For GPS Receiver
so for that one they didn't use any of the ports, I will be more happy to get advice about this. |
Every project is different. When you look at other people's examples for guidance, it comes with the requirement to know what applies to your project or not.
The code fragments above tell me nothing about the either the project you were looking at for guidance or your project other than there was a GPS set for 4800bps and a GSM modem set for 9600bps.
Every project is different.
-Ben |
Thank you for your comment, yes I was planning to add LCD as well, so after the message sent can display on the LCD as well, I don't really need this but that's what I was planning to..
Actual for them two lines, I have just done research about this types of project and they use them two line so I was asking my self how and why?
the project am doing is
This tracking system is composed of a GPS receiver, Microcontroller and a GSM Modem. GPS Receiver gets the location information from satellites in the form of latitude and longitude. The Microcontroller processes this information and this processed information is sent to the user/owner using GSM modem. Microcontroller also gets the speed of the vehicle and sends it to user/owner
This system is also provided with emergency switch which can be turned off through an SMS. This switch takes the responsibility to turns OFF the engine and can be turned ON only after receiving a predefined password from the owner of the vehicle.
So far I have done everything and I have got everything working fine even LCD and PIC, but the main thing which I have to do now is just the connection of GPS and GSM that's all and programming......I have got sample code which they use I found online that's where they use them two lines.... |
|
|
Papi
Joined: 08 Dec 2012 Posts: 36
|
|
Posted: Thu Dec 13, 2012 5:04 pm |
|
|
ezflyr wrote: | Hi,
In CCS terms do you know the difference between a hardware and a software
serial port? In your serial port defines, you are not using the hardware UART
of your PIC.
Can you provide links for the GPS and GSM modules?
An LCD, or a serial port , is always highly desirable for diagnostics during the
development of a project like this even if you don't use it in the final
implementation.
Can you post a picture of your hardware, and show us the code you've
written so far? This will give us a good idea where you stand...
John |
Hi John,
Thank you for your explanation, yes I do understand between the two, as you mention before I have to use one module for hardware and another one for software.
Ok I will post image and links as soon as possible appreciate for your help.....
Also will ask few questions as well so I can decide something as soon as possible |
|
|
Papi
Joined: 08 Dec 2012 Posts: 36
|
|
Posted: Thu Dec 13, 2012 6:28 pm |
|
|
GPS link,
GPS is 5V I think
ftp://ftp.leadtek.com.tw/gps/9540/9540Manual_v1.09_20030325.pdf
for GSM you can find the datasheet for GSM SIEMENS TC35 the one am using from here
http://arduino.anunturigr.ro/forum/discutii-libere/vand-gsm-siemens-tc35-sms-wireless-module-uart232-control-board/
scroll down you will see Download documentatie si codul sursa you have to download and unzip the file
you can see the image for gsm here
http://www.amazon.co.uk/SainSmart-Compatible-Siemens-Wireless-Adapter/dp/B006CHEUSI
extra information about GSM is accepting 5V
Features :
1. The SIEMENS TC35 is a standard AT commands Based GSM module, you can easily apply it with your own embedded system to create a GSM wireless based data transfer module .
2. The SIEMENS TC35 Module is AT Command - controlled gsm modem, via Serial Port (RS232/TTL communication).
3. Common applications are (sending/receiving) SMS control, phone calling.
4. Power supply: DC 5V
5. Frequency: 900 1800
Also for programming so far I haven't done anything because I have not yet connect anything GSM or GPS to the PIC, so I haven't done any program yet, but I have got the program used to test blinking LED to see if PIC is working and for LCD as well.....
Anything else I have to provide for further help and advice? |
|
|
Papi
Joined: 08 Dec 2012 Posts: 36
|
|
Posted: Fri Dec 14, 2012 2:23 pm |
|
|
Any advice I will be happy to change my PIC I have searched online and seems to hard not that easy to use this kind of project with 1 UART PIC....am planning to use pic with 2 UART
Any different between PIC16F877A and 18F46K22 in terms of programming?? |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|