GPS with VEX

I am working on school project and i have never worked on any kind of robotics and microcontroller project. for this project i am using VEX Pic microcontroller to drive 2 DC motors using transmitter and receiver. and the project is to send GPS data from robot platform to PC wirelessly. is it possible to do with pic microcontroller to send data to pc using tx/rx ports? and can you programme in C/C++ ?

Any help will be great help

Thanks

The vex micro controller has a serial port Rx/Tx as you said. In order to use this port you have to use MPLAB, Robot C, or Easy C Pro to write your own code. It would be coded in C or C++ (not sure which one?).

I can’t really help you with that part but I am sure the power of google can help you as well as some of the other members that code in MPLAB.

Here is a place to start

https://vexforum.com/t/vex-ttl-port-send-serial-data-through-xbee/16307/1

Now the second problem is transmitting the data from the vex to the pc. The easiest possible method that I can think of its a bluesmirf from sparkfun.

[http://www.sparkfun.com/commerce/product_info.php?products_id=582

Its a little pricey but its well worth it. Connect the Rts & Cts pin together, connect it the 5v of the vex micro controller as well as ground. Then connect the Rx pin to the Tx of the vex and the Rx of the vex to the Tx of the module.

When you turn it on it will show up as a bluetooth device. Get a bluetooth dongle for your pc ($10 or so), scan for it and when it shows up follow the pairing steps. The bluetooth software should then automatically make a virtual serial port that operates like a hardware port. Find out what port number its on and then you can open it in any serial terminal. Now whatever the bluetooth unit receives on its pins will appear in the terminal and whatever you send it comes out the units transmit pin. Very simple yet VERY useful

You could also use an XBee unit for longer range.

Now I don’t know how your GPS unit interfaces…serial? Vex has two serial ports the ttl level one and the rs 232 level one however I don’t know how to access the rs 232 one.


Also does the micro controller have to send the data? Because you could take the bluesmirf and combine it with a gps unit and a battery. No micro controller would be needed and it would be a standalone gps data transmitter that wouldn’t have to be connected to the vex unit in any way (well maybe for power but that’s it if you don’t want a separate battery).](http://www.sparkfun.com/commerce/product_info.php?products_id=582 )

I like your second idea as GPS doesn’t have to be connected to micro-controller, but if i were to do that how hard would it be to read the transmitted data and convert them. and how GPS to bluetooth interface would work?

I was thinking to use Garming 18 OEM GPS

http://www.beachaudio.com/Garmin/010-00321-p-86175.html?utm_source=froogle&utm_medium=cpc&utm_campaign=010-00321-06&utm_content=atr

also how would bluetooth would interface with GPS ?

Thanks for the reply!

There is a simple example using EasyC Pro to send and receive serial here.

Watch out here - the 2nd serial port (the programming port) is NOT RS232 (aka EIA232). If you send RS232-level voltages to this port you are likely to damage the microcontroller. The programming port uses TTL-level signaling just like the Rx/Tx ports, just with a different connector. This FAQ has the official word on the programming port, including the pinout.

[EDIT] I believe you can use the orange programming adapter (minus the USB->DB9 adapter) to convert the Programming port to a proper EIA232 interface if that is what you need. I haven’t personally tried this, so I’m not 100% certain.[/EDIT]

Cheers,

  • Dean

Don’t know if there is any helpful info here, but I found another thread: https://vexforum.com/t/gps-vex/13144/1&highlight=parallel

If you need the second port to connect to RS232 you could use a logic level converter that is sold by Sparkfun. Plus its only a $1.95 (I bought a few a while back because they are useful for 3.3v to 5v serial communication)

I like your second idea as GPS doesn’t have to be connected to micro-controller, but if i were to do that how hard would it be to read the transmitted data and convert them. and how GPS to bluetooth interface would work?

That’s not the kind of GPS unit that I would use for this project.

Something like this would be MUCH better and easier.

For this unit you need to get an antenna that’s like $13. Be warned though the antenna has a long cord (you could just bundle it up) this will give good reception.

Unit

http://www.sparkfun.com/commerce/product_info.php?products_id=9159

Antenna

http://www.sparkfun.com/commerce/product_info.php?products_id=464

And here is a similar unit that has a built in ceramic antenna.

http://www.sparkfun.com/commerce/product_info.php?products_id=8416

I must warn you that sometimes remote areas will not get GPS locks. I would get the one with the external antenna because that will provide better reception.


After you have one of those units above you have to get a wireless unit of some kind and again I would recommend you get the bluesmirf from Sparkfun for its extreme simplicity.

http://www.sparkfun.com/commerce/product_info.php?products_id=582

They also have a version with an antenna connector (its currently in stock) but you will have to get an antenna for it.

Unit

http://www.sparkfun.com/commerce/product_info.php?products_id=158

Antenna

http://www.sparkfun.com/commerce/product_info.php?products_id=145

For these units remember you need to get headers and solder them on because they come with no pins soldered on! Or else you will have to solder wires directly to it.


Now you have the two critical parts to get it working and its time to get into the little stuff.

A power supply will be needed and for this I would use a 3.7v LiPo battery or you can use some other type of battery as long as its above 3.3v preferably 3.7v to 5v.

Example battery (they have many sizes but this will run it for close to 10 hours)

http://www.sparkfun.com/commerce/product_info.php?products_id=339

Charger

http://www.sparkfun.com/commerce/product_info.php?products_id=8293

Charger Power Supply

http://www.sparkfun.com/commerce/product_info.php?products_id=8269

Now if you are tight on money and don’t want to get a LiPo battery you can just as easily get a AA battery holder.

http://www.sparkfun.com/commerce/product_info.php?products_id=552


At this point you’ve got the wireless adapter, GPS unit, and power source. So next you have to regulate that power source (battery) to 3.3v using a simple voltage regulator circuit.

Regulator

http://www.sparkfun.com/commerce/product_info.php?products_id=526

Simple Tutorial

http://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=57

Once you’ve connected this to the battery the output should be 3.3v which will then power the bluetooth unit and GPS unit.


The first step would be to power up the bluetooth unit with the GPS disconnected and then scan for it on your computer in your bluetooth software. Follow the pairing instructions and when its finally connects it will create a virtual serial port. Now turn the unit off and then turn it back on and quickly pair it to the computer (30 seconds or less). Then quickly open a serial terminal and enter programming mode by typing $$$ or —. A red led will flash on the unit and you can now change the settings.

If you are serious about doing this then I can provide the rest of the instructions for configuring the bluetooth unit to work with the GPS unit. Its just simple settings!


Here is an example of what the unit might send back to the computer (it varies a bit).

$GPGGA,123519,4807.038,N,01131.324,E,1,08,0.9,545.4,M,46.9,M,*42

This contains LOTS of stuff but you are only interested in the position so the part you want is this.

4807.038,N,01131.324,E

Translated into something useful this is

48 degrees 07 minutes .038 seconds N

11 degrees 31 minutes .324 seconds E

If you don’t want the degrees/minutes/second format you can convert it to a basic decimal degree.

http://www.ehow.com/how_2363249_form-decimal-degree-dd-form.html

So this will appear on your computer screen in the serial terminal once every second or so.


If you have the programming skills on the computer you could also write an application to receive the serial data, get the values you need and then plot them on a map using google maps.

Here is a little tutorial

http://www.vbdotnetheaven.com/UploadFile/scottlysle/GPSandVBNET09062007021746AM/GPSandVBNET.aspx


What you are asking to do is possible and it will require assembly but its not that hard. On a difficulty scale of 1 to 10 I would rate this at like a 4.

I hope this helps!

EDIT - Here is a simple diagram that I just made that shows the basic setup that I am talking about. This is not the best diagram in the world I just figured I would whip something up before I go to bed it was one of those 5 minute get the point across diagrams. btw I just realized that I spelled regulator wrong (I typed regualtor) lol I was tired

Again I hope this helps!

http://img684.imageshack.us/img684/9172/gpsdiagram.jpg
By robofreak at 2010-02-17

Thanks For alk of your replys, indeed they are great help getting me knowledge about all this, and i did take this upto my advisor of using bluetooth but because of the range issue he said it must be RF module, so the question can i use this module
http://www.robotshop.com/dfrobot-rf-modules-pair-3.html

and use this instead of Bluetooth module?

Robofreak I really thank you for your diagram it did gave me great insight of the connection…will i need to program anything to receive the data from GPS> RF MODULE > TO PC? and i believe i can use the same GPS and i would prefer using AA batteries as cost constraints wouldn’t allow me. your reply really helped me alot and i appreciate your efforts. and diagram( might use it for my report…haha!)

Thanks and hope you had great rest!!

Tushar Patel

Yea range is an issue with bluetooth because it is limited to 350ft for that module from Sparkfun and you will only get about 100 to 150ft because PC USB adapters are not that powerful.

Unless you get this bad boy…I want one really bad (gotta save up)

http://www.aircable.net/host-xr2.html

Now onto the wireless

The GPS unit itself has to be able to talk to the transmitter via serial. Serial communication involves many things like the baud rate, parity ect…

Now there reason I suggested bluetooth is because it is utterly simple, the unit is very versatile and reconfigurable, and it is easy to connect to a computer. Using a simple bluetooth adapter that plugs right into your computer is all you need to receive/transmit stuff. You will find that an RF link requires extra stuff to get the data into the computer which is why I didn’t suggest it.

Those transceivers that you listed transmit at 19200bps (bits per second) while the GPS units communicate at 4800bps for the NMEA protocol and 57600bps for the SiRF protocol. The other things should not be a problem because the serial connection on those units are configured with standard settings like 8 ,1 ,no parity (just settings). I have never messed with these settings even on my wireless equipment so you shouldn’t have to either. The only thing you will have to worry about is the bps or baud rate.

If you tried to hook up those modules to this gps unit the second module would receive data but it would be really messed up with very very weird characters appearing. This is because the GPS would transmit at 4800bps while the module would expect 19200bps and this causes nasty data to be sent.

So the thing is that you need to get a wireless RF module that is capable of running at 4800bps. There are fixed modules that operate only at 4800bps and others (I don’t know how they work exactly) that claim they operate in a range of like 1200bps and up. I only raise a concern about those modules because I don’t know if you have to send settings to change the baud rate or if the modules automatically find out the baud rate.

Here is an example of a very simple ONE way transmitter. This cannot receive because it is not a transceiver so it can send data only. For your application you don’t really need anything more.

http://www.sparkfun.com/commerce/product_info.php?products_id=8946

and the receiver

http://www.sparkfun.com/commerce/product_info.php?products_id=8950

The transmitter operates at 2400bps or 4800bps while the receiver is FIXED at 4800bps.

This simple link would work for something like this GPS unit.

http://www.sparkfun.com/commerce/product_info.php?products_id=8416

Keep in mind the range for such a link would be limited to 500ft LINE OF SIGHT which can become much less if you are near buildings or have a bad antenna. BTW these modules are also sold by robotshop

Here are a set of modules, transmitter and receiver that can be used to send the data as well.

Transmitter

http://www.robotshop.com/parallax-433-mhz-rf-transmitter-3.html

Receiver

http://www.robotshop.com/parallax-433-mhz-rf-receiver-3.html

From what I read the modules should automatically adjust to whatever baud rate is coming in as long as its between 1200bps and 19200bps. This should work fine but I haven’t used them before so I can’t really help you with these modules. Though from what I read its plug and play.

Now the only problem I see with the second set of modules is that they are picky about power and will run only at 5v not 3.3v. So you would have to add a second voltage regulator for 5v to power this module and then connect a logic level converter between the GPS running at 3.3v and the transmitter running at 5v. This simply takes the 3.3v signals and boosts them to 5v (battery must be like 6v, so use 4 x AA’s) for the module.

Here it is

http://www.sparkfun.com/commerce/product_info.php?products_id=8745

Now using the modules would be very similar to the bluetooth module in how it would be connected. Wire up the power and if needed the logic level converter to interface the GPS to the transmitter.

This is the transmitter side and its relatively easy and simple compared to the receiver side that you will need to put on your computer.

Here comes the receiver which requires some external electronics to hook up the RF serial link (ttl level serial) to your computer via (rs232 level serial). Take a regular serial cable and hook up the pins along with some electronics according to this tutorial.

http://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=104

and you can check out my video tutorial on something similar here

[http://www.youtube.com/watch?v=VY0kiJNI5oE

The only important things on the breadboard would be a nice clean 5v power supply (regulated battery? or wall adapter), the 4 x .1uf capacitors, and the max 232 accompanied by all the jumper wires you need to hook it up.

Once you have all of that connected to an RS232 cable you would connect the RF receiver module to the power and the Tx pin to the Rx pin of the max 232 IC. Now plug the serial cable into your computer (if you don’t have a serial port you can get a usb to serial adapter for a few bucks). If its a usb adapter make sure to install the drivers first. Now find out what port its on by typing devmgmt.msc in the windows run box (windows key + r will open it) and look under ports. If its a hardware port it will be like COM1, if its a USB adapter it might be COM3, 4, 5, 6 ect…

Once you know what port its on you can open that port in a serial terminal at the correct baud rate and voila you have a connection to your PC.


You don’t need to know how to program to do something like this you only need common sense, patience, and documentation as well as tutorials. You will be able to view simple data in a serial terminal by the time you are done. It won’t be a fancy talking GPS but it will contain the GPS coordinates of your robot.

I can’t describe every little detail but I think that I have provided a more than adequate amount of information on how you could go about doing it. Any questions that you have along the way can also be posted for me and others to answer.

I hope this helps!](http://www.youtube.com/watch?v=VY0kiJNI5oE)