Help needed selecting GPS for my project

Hi there!

I'm currently working on a tracking project based on GPS. There's 2 objects whose 3D position I need, the tracked one, and the tracking platform (Which will end up being a flying drone). The idea is to use this data to orientate a gimbal holding a camera from the tracking platform in the direction of the tracked object.

Let's say that my microcontroller (A Multiwii 328P board) has to be mounted onto the gimbal platform and it can not run any wire outside the gimbal (Because it is a 360º rotating gimbal and running wires through would mess that up).

The tracking platform GPS should be mounted on top of the aircraft (thus, separated from gimbal) in order to have an unobstructed view into the sky.

This implies that I need to get my GPS position data from BOTH GPS (tracking one and tracked one) through wireless connection... say... XBee?

Ideally GPS should be 20Hz but I have found almost no PNP solutions on the internet.

If 20Hz is not possible, then I should go with 10Hz at least, and I need to read a couple of GPS NMEA outputs and receive them somehow at my 328P board in I2C format...

Here a number of questions arise:

  • What is the easiest way to make a wireless comunication from 2 different GPS devices to a single receiver?

  • Best way to convert the GPS rx/tx info into I2C to facilitate reading them?

  • If I am using equal GPS receiver models, how do I tell one apart from the other at the receveing board?

  • Are there any commercial GPS that have wireless tech already implemented to skip the XBee boards?

The thing is, I have not yet bought the components because I am trying to identify the way in which I can implement this idea in the most simple and easiest way, and that certainly depends on the components selected.

I am open to suggestions!

Please help me solve this puzzle.
I've been scanning through the internet for days and can't seem to find a viable simple solution for this.

Thanks in advance.

It would be easiest to use something like an Arduino Mega 2560, which has more than one serial port. That way you could read two standard TTL serial data streams (like NMEA sentences) at once.

That adds weight and 'volume' to my project which just isn't an option as I will be very tight in space. :confused:

RC4ever:
That adds weight and 'volume' to my project which just isn't an option as I will be very tight in space.

Any other restrictions you are aware of that you can reveal ?

Bear in mind that just because you want your solution to be very small, if there no practical alternatives but to use a different (larger ?) processor then what was previously not an option becomes the only way to do it.

Unless you have an unlimited financial and time budget of course.

I was just playing with this sort of arrangement on the bench, I was testing my LoRaTracker receiver, It receives LoRa telemetry (stupid long range) from a remote tracker transmitter which has its own GPS.

The receiver (a completely seperate unit) also has its own GPS and using the received telmetry from the remote tracker it calculates the distance and direction between the two.

So in terms of pointing something at the remote device, all that is missing is to use the altitudes and some sums for a true 3D aim and for the device doing the aiming to know its orientation with respect to a level horizion and true North, i.e. it needs a level sensor and compass and code that understands and knows the current magnetic declination, something similar to what cruise missiles do I guess.

The Ublox GPS do have I2C interfaces, but whether you can find the modules that have the built in ceramic antennas and have the I2C connections, I dont know. The serial ones are silly cheap, around $10.

All sound very advanced really.

srnet:
Any other restrictions you are aware of that you can reveal ?

I was restraining myself from posting the whole project here in order not to get lost in the details...

srnet:
Bear in mind that just because you want your solution to be very small, if there no practical alternatives but to use a different (larger ?) processor then what was previously not an option becomes the only way to do it.

Fair point, but the 2560 is kind of bulky and I should try to avoid that. These boards will need to be mounted on the gimbal, which in turn affect the gimbal's performance, thus why I'm trying to keep everything at a minimum...

srnet:
Unless you have an unlimited financial and time budget of course.

I kind of have financial resources but VERY limited time. SO I'm kind of rushing for a viable solution... :o

srnet:
So in terms of pointing something at the remote device, all that is missing is to use the altitudes and some sums for a true 3D aim and for the device doing the aiming to know its orientation with respect to a level horizion and true North, i.e. it needs a level sensor and compass and code that understands and knows the current magnetic declination, something similar to what cruise missiles do I guess.

That part, I have already sorted out (kind of). My board (MWI 328P) has 3-axis accelerometers, gyros, mag and baro, all connected to a I2C bus, and thus I was expecting to find a reasonable solution to read an extra couple of sensors (The 2 GPS) through the I2C bus as well but it's proving trickier than I thought. :o

srnet:
The Ublox GPS do have I2C interfaces, but whether you can find the modules that have the built in ceramic antennas and have the I2C connections, I dont know. The serial ones are silly cheap, around $10.

There's one of the big issues I am crashing with:

I2C is a bidirectional communication bus, so if my sensors are on a different platform, I can't just send their data through telemetry and decode it later but have to 'ask' them thorugh the same data link to show me what do they have in the registers... meaning that instead of using simple 'Series 1' XBee devices I should use Series 2 or above and configure everything myself which seems difficult and time-consuming.

Thus I was eyeing a solution in the likes of typical serial GPS sending their data through XBee (Series 1) and then turn that into I2C on the receveing end of the hardware. But it's not clear to me if the GPS-serial to I2C chips that I see being sold on the net will have different (Configurable maybe?) I2C adresses so that I can access them separately...

Or if there is any issue running two different Xbee sets of Tx/Rx simultaneously...

Or if there is an easy way to rig 2 Xbee Tx modules with a single Rx one...

I don't know if I'm expressing well enough the issue at hand, ask whatever you think that I did not make clear enough.

Thank you for the help!

but VERY limited time. SO I'm kind of rushing for a viable solution

This is not a simple project. The coding and debugging alone will take you weeks to months.

Well, I can rush to a corner of the room and cry or think positively and search for a way to overcome the issues.

There's many projects and libraries by other people that should certainly help. So far I have been more or less successful in getting my board to read and write PWM, configure the integrated sensors through I2C and get and process their data to obtain an estimation on board orientation and heading, so all I am lacking is a way to get those GPS data signals.

I know it's no easy quest (None of the project have been so far) but sure there has to be a shortcut using code already made by other people in similar struggles.

I have less than a month.

LOL, there are many "system" thing that you haven't addressed yet, so this isn't going to appear quickly. It could happen in a month.

One thing that caught my attention: You said "GPS data", but there are really (at least) two things that could mean: raw NMEA or UBX characters (blech), and the parsed, coherent "fix" information that the GPS device is trying to describe to you. The raw data is 10x to 100x more bytes and time-sensitive. A parsed fix structure could contain only the pieces you really need, and could be sent as a binary packet, exactly once per update interval (1Hz, 5Hz, whatever).

As the author of NeoGPS, I can tell you that there are many subtleties to assembling a coherent fix from the typical GPS babble. Most people won't notice the problems, because they don't care if the location from one second is paired with the altitude or speed from a different second. It could matter in your application. NeoGPS is the only library that provides this coherency.

You also mentioned using I2C to obtain the GPS data, but that has its own set of issues. The ublox devices are only I2C slaves, so they have to respond to the master when asked. The GPS data they will provide at that time is a "snapshot" of the current values when the master starts reading. When the master stops reading, those values will start getting replaced with new information. And if the master asks too soon, it may get no data (0xFF bytes). The trick is knowing when to ask for more data. The slave can't announce that, so you have to use the "TX data ready" pin on the ublox device.

Or, if we're talking about a I2C slave Arduino using a serial GPS device, there needs to be some signal for new data to the master.

Although NeoGPS is smaller, faster and more accurate than all other libraries, it can also parse the raw NMEA data during an RX character interrupt. This can save even more processor time. NeoGPS also has the most accurate distance and bearing calculations. At small distances, other libraries can be off by 40%.

Since you are looking at higher GPS update rates, you should also consider the NeoGPS configuration capabilities. It will give you the smallest, fastest sketch possible.

If you want to try it, NeoGPS is available from the Arduino IDE Library Manager, under the menu Sketch -> Include Library -> Manage Libraries. Even if you don't try it, be sure to read the Troubleshooting page for other tips for GPS sketches. It can help you understand the timing, the usual stumbling block.

Cheers,
/dev

RC4ever:
I know it's no easy quest (None of the project have been so far) but sure there has to be a shortcut using code already made by other people in similar struggles.

I have less than a month.

Why are you sure there is a 'shortcut' using existing code ?

It still all sounds very complex to me.

Hey -dev!

Thank you for dropping by!

I take more or less what you are saying but that's a 'second derivative' of my current problem at hand which is actually trying to read 2 GPS simultaneously in a wireless fashion... any tip on that?

One thing I was considering is to use NMEA GPS (Not I2C ones) to be able to 'cast' the NMEA strings through XBee and then (maybe?) translate them into I2C using hardware like this:

https://www.amazon.co.uk/d/Toys-Games/iParaAiluRy-MultiWii-I2C-GPS-Module-Navigation/B00O7JJ3J4/ref=sr_1_1?s=kids&ie=UTF8&qid=1494102815&sr=1-1&keywords=i2c+gps

Apparently a gadget like this should be able to turn the NMEA strings into byte registers easily accessible through I2C...

But then again I'm left wondering how to do that as there's no documentation about it (or at the very least I can't seem to be able to find it), anything saying, for example, what would be the I2C register adress that I have to call using something like wire.h...

-dev:
As the author of NeoGPS, I can tell you that there are many subtleties to assembling a coherent fix from the typical GPS babble. Most people won't notice the problems, because they don't care if the location from one second is paired with the altitude or speed from a different second. It could matter in your application. NeoGPS is the only library that provides this

In essence, I just need the 3D positioning. I wonder if it would be that critical that it wasn't paired correctly assuming a refresh rate of 10Hz...

I don't even need this to work 'flawlessly' but just to work at least.

-dev:
You also mentioned using I2C to obtain the GPS data, but that has its own set of issues. The ublox devices are only I2C slaves, so they have to respond to the master when asked. The GPS data they will provide at that time is a "snapshot" of the current values when the master starts reading. When the master stops reading, those values will start getting replaced with new information. And if the master asks too soon, it may get no data (0xFF bytes). The trick is knowing when to ask for more data. The slave can't announce that, so you have to use the "TX data ready" pin on the ublox device.

That presents further complications as if I were using I2C GPS, they wouldn't be directly connected to the I2C bus where other sensors could work as masters. The GPS will be 'isolated' and connected only through XBee or anything alike... So I take it that using NMEA GPS should be easier to get working.

-dev:
If you want to try it, NeoGPS is available from the Arduino IDE Library Manager, under the menu Sketch -> Include Library -> Manage Libraries. Even if you don't try it, be sure to read the Troubleshooting page for other tips for GPS sketches. It can help you understand the timing, the usual stumbling block.

I may try your library, but first of all I need to sort out how to do the connection and select/buy the components. That's the advice I'm looking for right now!

What would you do?

Thanks,
Jandro.

srnet:
Why are you sure there is a 'shortcut' using existing code ?

It still all sounds very complex to me.

Well, it seems reasonable to me that many people around the globe may have already done their own projects hooking up GPS to arduinos in a wireless fashion. If any of those happen to read this post I could do with their help/codes.

I take more or less what you are saying but that's a 'second derivative' of my current problem at hand which i actually trying to read 2 GPS simultaneously in a wireless fashion... any tip on that?

Any tips? Don't do that. You're trying to solve the wrong problem. Instead of doing work in the slave, you're turning it into a wireless wire for the raw data. This makes the master do all the work and makes the communications take 10x-80x longer.

I need to sort out how to do the connection and select/buy the components. That's the advice I'm looking for right now!

Are you sure you shouldn't think a little more before you spend money?

You asked for our input, but I think you want our approval for something you already have in mind. Whatevs.

NeoGPS is the only library that could parse two data streams simultaneously. Not that you should be doing that. -_-

One thing I was considering is to use NMEA GPS (Not I2C ones) to be able to 'cast' the NMEA strings through XBee and then (maybe?) translate them into I2C... That presents further complications as if I were using I2C GPS, they wouldn't be directly connected to the I2C bus where other sensors could work as masters. The GPS will be 'isolated' and connected only through XBee or anything alike... So I take it that using NMEA GPS should be easier to get working.

You a slinging acronyms faster than you understand them.

What would you do?

Start simpler. It's obvious that there are many things you need to learn, and you're not exactly receptive to our advice. You'll have to learn by doing.

Start simpler. It's obvious that there are many things you need to learn, and you're not exactly receptive to our advice. You'll have to learn by doing.

Well said.

My suggestion for a "simpler" project, which is a critical core component of the larger one, is to figure out how to accurately point your gimbal at the sun or a star in the night sky, based on the gimbal's latitude and longitude (which you can type in) and current orientation. Useful example here.

-dev:
Any tips? Don't do that. You're trying to solve the wrong problem. Instead of doing work in the slave, you're turning it into a wireless wire for the raw data. This makes the master do all the work and makes the communications take 10x-80x longer.

You asked for our input, but I think you want our approval for something you already have in mind. Whatevs.

I am indeed reading to your input, regardless of whatever it might look like.

So I don't do that. What do you suggest I do exactly?
What is the right way to set up a GPS wirelessly?
And if I manage to get that working, how should I hook up my second one?

-dev:
Are you sure you shouldn't think a little more before you spend money?

Well, that's EXACTLY what I'm doing!

-dev:
NeoGPS is the only library that could parse two data streams simultaneously. Not that you should be doing that. -_-

Not because it's too difficult or not because it's not going to work at all?

-dev:
Start simpler, It's obvious that there are many things you need to learn, and you're not exactly receptive to our advice. You'll have to learn by doing.

It's not that I am not receptive, it's that I haven't seen a particular proposal in your advice but rather a list of all the wrongs and things that I shouldn't be doing.

What about a list of things I should be doing? :wink:

Thanks again for your time and patience, I DO appreciate it lots :slight_smile:

I haven't seen a particular proposal in your advice but rather a list of all the wrongs

You rejected the simple, straightforward proposal in reply #1 with reasoning that at this point in the project is seriously misguided.

Get something working before worrying about making it small.

Good luck with your project.

Well, thanks.

What if I use an arduino mini to read the GPS serial and convert it to something else?

Just brainstorming right now.
Maybe I could 'locally' decode the GPS serial with the arduino mini (Have one, don't even need to buy) and store the GPS coordinates as a byte, then send them over to the main board with XBee?

RC4ever:
What is the right way to set up a GPS wirelessly?

Many of your questions are worded in a way that implies the solution: reading GPS data over the air. This is called the X-Y Problem. Yes, this happens often enough that it has its own website. :smiley:

From what you've described so far, I think you want a transponder on the aircraft. In order to aim the base station camera at the aircraft, you need to know the base station's position and orientation. Then you can calculate the gimbal angles to aim the camera.

To get the base station's position, you could do (at least) two different things:

* "Survey in" the base station at start-up. Orient some kind of registration marks on the base or aim the camera to to true north. That will establish the base station's orientation. Then hold the aircraft over the base station and use the aircraft's position for the base station's position (push a button on the base?). Or...

* Use a second Arduino at the base to get the position (from a GPS device) and orientation (from a compass) and send it to the master, wirelessly. This is a kind of transponder, but it seems silly to call it that when it's a transponder for "myself" (the master).

The first approach seems easier to me, because you are simply using the aircraft's capabilities. It avoids using a compass, which can be affected by the metal in the base station... or the table it's sitting on. It also avoids a 2nd Arduino, a 2nd wireless link, a GPS module, and the increased possibility of transmission collisions. This would save you a lot of hardware, a lot of software, and a lot of system integration and testing.

Regardless of which approach you choose, you must implement a wireless link to send positions from the aircraft to the station. Here is the difference between "GPS data" and "position". First, here's the raw NMEA data from the GPS module:

    $GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47

That's 65 bytes, and it has to be parsed into 3 numbers by extracting 5 fields, skipping about half the characters. Here is a simple text representation of those 3 numbers:

    48.11730,11.51667,545.5

That's 24 bytes, and the fields have to be converted to numbers for calculations. And finally, here is a binary representation of those 3 numbers:

    1CAE1E086DD4DCBD516

That's only 10 bytes (displayed with 20 hex characters). I think this addresses your latest comment: "store the GPS coordinates as a byte, then send them over to the main board". It's obviously more than a byte...

And when sent as a binary message, no parsing or conversion is required, because it can be directly mapped onto a structure:

struct Position_t
{
    int32_t lat, lon;
    int16_t altitude;
};

void send( Position_t &pos )
{
    radioSend( (uint8_t *) &pos, sizeof(pos) );  // send the 10 binary bytes
}

With the correct configuration, NeoGPS can parse the raw GPS data into this structure for you, exactly one time per second (or whatever update interval you select). When NeoGPS tells you there's another fix structure ready, just read it and send it:

    if (gps.available( gpsPort )) {
      gps_fix fix = gps.read();
      send( fix );

This is more accurate than sending the floating-point lat/lon/alt, and it's easy to use the fix structure on the receiving end to aim the camera:

    if (radio message received) {
      float cameraAzimuth   = baseFix.location.BearingToDegrees( receivedFix.location );
      float distance        = baseFix.location.DistanceToKm( receivedFix.location ) * 1000.0;
      float dAltitude       = baseFix.altitude() - receivedFix.altitude();
      float cameraElevation = someTrig( distance, dAltitude );

As discussed above, the receiving end may or may not have a GPS module for setting the baseFix structure. If the base has a compass module for setting orientation, it would offset the cameraAzimuth (see Azimuth and Elevation).

So far this is completely independent of the wireless module you need to select: Xbee? nRF? LoRA? srnet has lots of experience with LoRA. Robin2 has posted a nice nRF tutorial. There must be a bajillion xBee tutorials.

Thank you so much!

That's very helpful. :smiley:

I think I could try with that first approach you suggested, using a single GPS to tell the base station its own position and work from there with a single GPS and a single radio link. Sounds reasonable.

And it further simplifies my project making the base station 'stationary' which means that it's easier to tell the actual orientation as opposed to doing that on a moving (accelerating) platform.

Let's see if I can sort it out :slight_smile:

-dev:
That's only 10 bytes (displayed with 20 hex characters). I think this addresses your latest comment: "store the GPS coordinates as a byte, then send them over to the main board". It's obviously more than a byte...

And for a long range tracker, thats exactly what you want to do with LoRa. In maximum range mode you might go down to 100bps, and the on-air time then becomes significant. The binary form of the GPS co-ordinate data is 10 bytes so on-air time at that low rate is just over two seconds.

Maximum data rate for LoRa is 37,500bps giving an on-air time for 10 bytes as around 4mS.

If you wanted 10Hz fixes via LoRa remotely, and you allowed for say 20mS to send a 10 byte packet, thats around 12,500bps. The tested LOS range during a balloon flight at that rate was more than 100km at 10mW, with a 5dB gain base station omni at the RX end. So expect around 50km using simple 1/4wave wires at either end (434Mhz).

I'd be happy enough to have a range between 500m and 2km though :slight_smile: