View Feed
group-icon
Coffee Room
Discuss anything here - everything that you wish to discuss with fellow engineers.
12933 Members
Join this group to post and comment.
aswani9874
aswani9874 • Dec 30, 2014

Help to write code for GSM and GPS

can you write code in c language for my circuit which is attached to it(vehicle tracking using GSM and GPS).

vehicle-tracking-system-circuit-diagram
Harshad Italiya
Harshad Italiya • Dec 30, 2014
@aswani9874 will you please share some more information about the GPS and GSM module you are using?
Also have you tried anything for coding for this project? Please share with us.
aswani9874
aswani9874 • Dec 30, 2014
No sir we haven't tried.
Our aim is compare the latitude and longitude coordinates from GPS and send them to GSM when they are matched with the coordinates stored in microcontroller.
Please suggest code on how to match and send to GSM whenever matched.
Harshad Italiya
Harshad Italiya • Dec 31, 2014
aswani9874
No sir we haven't tried.
Our aim is compare the latitude and longitude coordinates from GPS and send them to GSM when they are matched with the coordinates stored in microcontroller.
Please suggest code on how to match and send to GSM whenever matched.
Ok,
Then first of all you have to read the commands for GSM and GPS module.
Then you need to write code for UART. As 89S52 doesn't have two UART you may have to create one Software UART.
Here is the information about Software UART:- https://www.8052.com/faqs.phtml?FAQ=124758
aswani9874
aswani9874 • Dec 31, 2014
Sir can u please send us the code which we can refer. The code related to project "bus position monitoring system" maybe really helpful to us.
Harshad Italiya
Harshad Italiya • Dec 31, 2014
aswani9874
Sir can u please send us the code which we can refer. The code related to project "bus position monitoring system" maybe really helpful to us.
I don't have any ready code that you can use and I suggest you must have to atleast give it a try by yourself.
Here is one example for UART in 8051. I suggest you follow the steps and make your own.
https://www.8051projects.net/keil-c-programming-tutorial/writing-simple-c-program.php
a.alandkar
a.alandkar • Jan 12, 2015
what exactly you want to implement.? Please share the algorithm. May be i can help you out.
aswani9874
aswani9874 • Mar 9, 2015
Sir , How can we transfer data from GSM to PC . Can it be done using a cable ??
Harshad Italiya
Harshad Italiya • Mar 9, 2015
aswani9874
Sir , How can we transfer data from GSM to PC . Can it be done using a cable ??
Do you want to send AT commands via PC to GSM or want to upload some files via GSM to PC?
aswani9874
aswani9874 • Mar 9, 2015
we need to transfer data via GSM to PC
Harshad Italiya
Harshad Italiya • Mar 9, 2015
aswani9874
we need to transfer data via GSM to PC
Then you have to run kind of server on your PC.
For the test purpose you can install Hercules utility on your PC. Download it from here :- https://www.dropbox.com/s/vjxg18ziutqfc01/hercules_3-2-5.exe?dl=0
Then you must need active internet connection on your PC and put one TCP socket in listen mode on hercules.
Then you need to write code on your GSM modem so it opens TCP connection to your IP and sends data to that specific port.
a.alandkar
a.alandkar • Mar 15, 2015
if you just want to send the co ordinates which you get from the GPS then you can implement the things using AT commanads also.
Google for AT comands, if you specify the GSM modem i mean the series then you may get detailed datasheet along with AT commands and their usage also. If you want to use internet connection then Harshad has mentioned the things to be done.
Sir I am using atmega 16 mcu for my project. I want to interface LM35,humidity sensor and MQ4 to sense temperature,humidity and combustible gases, gsm modem to only send the message and gps module to receive longitude and latitude. So how can i do that simultaeously. I want the code for ot and the ckt diagram. Can I connect gps to Rx of atmega and gsm to Tx pin of it?? I want to send info about the longitude,latitude ,gas readings through GSM modem. I want to use GSM only for transmission purpose ,I don't want to use it for receing purpose
Harshad Italiya
Harshad Italiya • Mar 17, 2015
Prathamesh Taware
I want to use GSM only for transmission purpose ,I don't want to use it for receing purpose
Even if you do not want to receive anything from GSM but to you must need RX pin of GSM to your MCU to know the response of AT command you need to send GSM to get register in cellular network, establish GPRS service and pushing data to internet.
So what should I do now. As I have already purchased the Ic and gps
Harshad Italiya
Harshad Italiya • Mar 17, 2015
Prathamesh Taware
So what should I do now. As I have already purchased the Ic and gps
You will need two UART for sure. You can use hardware UART for GSM and for GPS you can try to create a software UART that might solve your issue.
This may help you to get more information and reference example about software UART:- https://github.com/blalor/avr-softuart
If I use ic 4066B cmos quad bilaeral switch for switching purpose between microcontroller and gps,gsm....? As we can get the reading from gps and trasmit the sensor's data & gps reading. What do u say sir ...?
a.alandkar
a.alandkar • Mar 18, 2015
OK. Now i get it. If you guys are using the same hardware you have shared here i.e. specifically the controller from 51 family which does not have 2 UART in that case you may use it. As a hint before starting actual communication with either of the devices use the rx tx pins as general purpose io pins, select the device and then init the communication.

Share this content on your social channels -