[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GPS data from multiple android GPS sources over UDP

From: Debashisha Mishra
Subject: Re: GPS data from multiple android GPS sources over UDP
Date: Thu, 20 Apr 2023 10:10:57 +0200 (CEST)

Hi Gary,

Thank you. I appreciate it a lot. I attempted what you advised. To transmit GPS data to the host computer, I utilized two mobile devices running the GPSD Forwarder program. The first phone's GPS forwarding port number was 12345, while for the second phone's was 12346. Using gpspipe and the following instructions, I was able to collect GPS data from many ports on the host machine and organize it in a way that made sense.

gpsd -Nn udp://*:12345 udp://*:12346

and then using gpspipe command as follows to filter out NMEA sentences from two different phones.

gpspipe -r localhost:2947:udp://*:12345
gpspipe -r localhost:2947:udp://*:12346

I wanted to bring another fact which I noticed in the data which I collected. I used a sample c++ program (attached to this email and also available on Internet) to understand the latitude and longitude which I receive from these two different device. I put the two devices close to each other (~1 meter apart). I believe the GPSD in the host computer is presenting the GPS fix information (latitude and longitude) by intelligently multiplexing them even if one of the phone does not report any GPS data intermittently. The screenshot "gpsd-two-phones.png" is attached to the email to show this. Each row shows the <time stamp, latitude, longitude and the device path>. The data were very identical from two devices. I would NOT expect them to be exactly identical to 8 decimal digits for both latitude and longitude.

Am I missing something here while capturing them in the c++ program? Please suggest. 

Have a nice day!
Best Regards,

----- On Apr 18, 2023, at 11:35 PM, Gary E. Miller <> wrote:
Yo Debashisha!

On Tue, 18 Apr 2023 08:56:13 +0200 (CEST)
Debashisha Mishra <> wrote:

> Thank you for this nice tool. I came across this tool while
> investigating a need to send the GPS data from an android phone to
> the host computer over WiFi network.

I assume you mean the gpsd tools.

> The corresponding steps are
> similar to ones [
> | described here ] .

Not ours, but looks OK.  A bit out of date.  I know people that have
done similar.  I would recommend not running gpsd under systemd(umb), or
ever using sudo.

> Now, my setup include one android phone with [
> |
> GPSd Forwarder ] app that streams the GPS data to the host computer
> IP and port. The command I use on the host computer is " gpsd -N
> udp://*:12345 ". Everything works fine and I could see the GPS data
> in the host computer using gpsmon.

You should prolly use the "-n" option to keep the connection alive, and
avoid gpsmon, it is an old, unmaintained, deprecated debug tool, it does
not tell you what gpsd is seeing.  It bypasses gpsd.

> My question is the following. I want to send the GPS data from
> multiple android phones to the host computer in the same way I
> explained earlier.

Easy, many do similar, just put all the udp:// conenctions on the
gpsd command line.  As many as you need. Like this:

    gpsd -Nn udp://<phone-ip1>:12345 udp://<phone-ip2>:12346 \
             udp://<phone-ip3>:12347 udp://<phone-ip4>:12348

I used different UDP ports, that may not be required.

> I used the above method and install the GPS
> forwarder android app on two phones. However, I could not know which
> GPS data is coming from which android phone and how can I segregate
> the GPS sources (the android phones) in the host computer.

cgps will mush all the data together, but if you use gpspipe, then
each message is tagged with the device it came from.

> I tried with " gpsd -N udp://<phone-ip>:12345 " command on the host
> computer to listen from the particular phone IP. I could NOT make it
> work. Sorry.

Did you confirm the phone was sending with the netcat (nc) tests that
guide suggested?

You forgot the "-n" option, and you only had one udp:// do you will only
get one feed, and only when a gpsd client is running.

Adding some logging "-D 4", and sending us the log lets us see what
you see.

Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703  Tel:+1 541 382 8588

            Veritas liberabit vos. -- Quid est veritas?
    "If you can't measure it, you can't improve it." - Lord Kelvin

Attachment: gpsd-two-phones.png
Description: PNG image

Attachment: gpsd-example.cpp
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]