Talking with USB GPS in VB.Net

F

Freddy Coal

Hi, I would like know how make the 'conversation' between VB.Net and Garmin
USB GPS, someone know work that?.

I have a etrex Vista Cx (USB cable connector), I would like make a program
for get the current GPS position, but I don´t understand how send commands
or receive data for this port.

Thanks in advance for any help, I´m very lost.

Freddy Coal
 
D

Dick Grier

Hi,

There is one "standard" GPS protocol, NMEA-0183. This serial protocol is
fairly easy to work with. However, it is even easier if you download
DecodeGPS from my homepage. The DecodeGPS .NET dll is free, and I include
example code. The source code for the dll is in my book (see below), along
with additional information. IMO, you should make sure that your GPS
receiver outputs data using this protocol (commands also may be issued to
the receiver using NMEA-0183, though very few applications require that the
GPS receiver be programmed).

Garmin also has a proprietary binary protocol. It can be used instead of
NMEA-0183. Again, there are very few applications that would require use of
this binary protocol, and it is much more difficult to use than the ASCII
(NMEA-0183) protocol. I suspect that your actual receiver uses the NMEA
protocol by default (and it may not even support the binary one, so that may
not even be an issue).

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.
 
F

Freddy Coal

Thanks Dick, very interesting DLL; I know the NMEA protocol, but I don't
understand how make the communitaction with the USB port.

I download the GPS Decoder example code, but he send errors, because I don´t
have the MapPoint. Your DLL work with USB or only with serial port?.

Thanks in advance.

Freddy Coal
 
D

Dick Grier

Hi,

You can get a demo version of MapPoint Europe, if you want.

I will create a simpler demo tomorrow that simply places the location
(lat/lon) in a textbox. I will let you know when it is available.

What version of Visual Studio are you using? The actual serial port code
depends on this (if VS 2005, you can use the built-in serial port control,
if using 2003, then download DesktopSerialIO.dll from my homepage).

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.
 
F

Freddy Coal

Thanks for your answer Dick, I´m using VS2005, I know how use the serial
port, but I don´t know how get data with the USB port.

My GPS is Garmin etrex Vista Cx - USB connector.

For the MapPoint, maybe you can try with MapWindow (
http://www.mapwindow.org/ ) it's a really excellent tool and it´s free.

Thanks in advance if you can help to get the data using the USB port.

Freddy Coal
 
D

Dick Grier

Hi,

A USB serial adapter (such as is used by your GPS receiver) is just another
serial port. Instead of a hardware UART, it uses a virtual serial port
device driver that emulates the hardware. You treat it like any other
serial device.

I have decided to create a control that encapsulates the serial port class,
GPS receiver detection, and GPS (NMEA-0183) decoding. All that you will
have to do is to drop it on a Winforms application, call the EnableGPS
method, and it will automatically detect your GPS receiver, and start
generating GPSDecode events that you can use to query its built-in
properties for Lan/Lon/Speed/Course/Date&Time, etc. I will post it on my
website on Monday, so look for it then.

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.
 
D

Dick Grier

Freddy,

I have posted the GPSControl that I mentioned to my web site. It requires
only one line of code to strart it up, and as few as two lines of code to
read the decoded GPS location (Lat/Lon). Naturally, there are more "things"
than just location data, if you need them. It does automatic GPS detection,
so you don't have to do anything tricky to use it.

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.
 
D

Dick Grier

Hi,
Maybe this works with a Serial connector, but my GPS have a direct
connection to the USB port; I read in internet that the new Garmin don't
have the NMEA.
<<

If it doesn't output NMEA, then it can only be used with proprietary
software (or you can write your own, if it uses the Garmin "standard" binary
protocol). What documentation do they offer for the protocol that it does
use?

BTW, as I said before... USB GPS receivers ARE serial devices. That is,
they emulate a standard serial port via the device driver that is installed
with the device (look in Device Manager under Control Panel then view Ports.
You should see it listed there).

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.
 
G

Guest

BTW, as I said before... USB GPS receivers ARE serial devices. That
is, they emulate a standard serial port via the device driver that is
installed with the device (look in Device Manager under Control Panel
then view Ports. You should see it listed there).

No not all - some of the newer Garmins (i.e. NUVI) show up as mass storage
devices and have no NEMA serial interfaces :(
 
F

Freddy Coal

Dick, I know the binary protocol, but I don´t understand how make the
connection with the USB GPS with VB.Net; You know how make that?.

My GPS not emulate a serial device, under ports (Device Manager) don't
appear nothing different when I connect the GPS.

Thanks in advance for any help.

Freddy Coal
 
D

Dick Grier

Hi,

You are right, if is isn't designed as a serial device, then there is no
(practical)way to interface with it.

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.
 
D

Dick Grier

Hi,

No. If it is a proprietary interface, then probably they do not intend that
you use it. If you can get programming information from Garmin, then there
may be a way. If not, then it would cost FAR too much to even consider.

Why not just buy a different GPS receiver? You probably can get one for
less than $60.

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.
 
D

Dale Atkin

Have a look at the Garmin SDK. It has lots of documentation for
interfacing with the USB port. I'm wading my way through it right now.
There is also a program out there called "Spanner" (free from Garmin)
which will fake NMEA on a serial port.
 
J

jerico mangunay

Hello. I am a college student here in the Philippines. I have the same
concern as Mr. Freddy. I have this Garmin GPS16LVS which is capable of
transmitting NMEA sentences and I would like to access these sentences
in Visual Basic 6.0 through the USB port. The set-up is like this. I
furnished a DB9 (female) connector for the gps, then I attached a
USB-to-Serial converter so that I could connect it to my laptop(since my
laptop doesn't have a db9 port). I used the garmin sensor configuration
program to verify that it transmits NMEA sentences, and it does.

I tried opening Mr. Dick's codes in VB6 but the file extensions need to
be .vbp not .vbproj. When I opened the .vbp file, the texts are all
colored red. I'm also quite a newbie in VB 6.0 Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top