Hi! I am trying to create a system where a motor(with an encoder) points to an external object using both of their live gps data together.
Basically, I need to wirelessly receive the positions of two different gps modules on two different arduinos, and then I will use that information to accomplish a task.
However, although it seems relatively easy to extract the gps data from one module, how would I go about communicating between the arduinos / getting the two sets of data together?
If this is not viable, is there another way I can accomplish this task?
I've been able to accomplish communicating GPS data from one Arduino to another in one of my projects using the library SerialTransfer.h. The library is installable through the Arduino IDE's Libraries Manager.
I suggest putting all of your GPS data into a struct and sending the struct via SerialTransfer.h.
chickenriot:
Awesome! So this is wireless and it wouldn't require any other modules or anything like that besides the arduinos themselves? How does that work?
You can use the library to transfer data with the Arduino serial ports hardwired together, or you can use wireless UART radios (i.e. XBees) to wireless connect the Arduinos without having to change the software.
Basically, the software is agnostic to whether the data is being transmitted wired or wireless. That being said, if you want to go wireless - you'll need external UART radios for connection...
Oh, I see. Well, I need it to be wireless, and as for their distance apart, not too far, maybe a couple dozen meters at most. The more distance possible the better though for sure. And for accuracy, once again, the more the better, but being a couple feet off probably wouldn't be the end of the world.
I was considering maybe using bluetooth? Would that be better than a radio?
chickenriot:
and as for their distance apart, not too far, maybe a couple dozen meters at most. The more distance possible the better though for sure. And for accuracy, once again, the more the better, but being a couple feet off probably wouldn't be the end of the world.
So from that the two GPSs are maybe 20M apart and you want sub 1M accuracy ?
Very unlikley to happen, if the GPSs are outdoors with a clear view of the sky you might get an accuracy 5M or so but dont depend on it.
Oh wow ok ... so how do I get more accuracy? I saw something called GPS RTK which is supposed to way more accurate but it's a couple hundred dollars for just one module... any ideas?
chickenriot:
Oh wow ok ... so how do I get more accuracy?
There is GPS RTK and GPS differential. Neither are cheap.
There is, as far as I know, no cunning wheeze way of getting sub 1M accuracy from GPSs on the cheap. If there was then you would expect it to be easy to find and everyone would be doing it.
What are the differences between the suggested: SerialTransfer.h
And normal software (or even hardware serial) approach?
What does this 'transfer' stuff do differently?
Buffer and delimiting characters for packets? (if this just for ease of use or something? as all this can be done in your code? packets/protocols/start or packet-end of packet delimiting characters)
xl97:
What are the differences between the suggested: SerialTransfer.h
And normal software (or even hardware serial) approach?
What does this 'transfer' stuff do differently?
I'm not sure I understand the question, but I'll try to answer as best I can. The basic gist of the library is that it provides a simple and robust interface to packetize and parse data packets. It can work with hardware and software serial ports alike.
If you're curious about the library's features, you can see a list in the readme file:
This library:
can be downloaded via the Arduino IDE's Libraries Manager (search "SerialTransfer.h")
works with "software-serial" libraries
is non blocking
uses packet delimiters
uses consistent overhead byte stuffing
uses CRC-8 (Polynomial 0x9B with lookup table)
allows the use of dynamically sized packets (packets can have payload lengths anywhere from 1 to 255 bytes)
can transfer bytes, ints, floats, and even structs!!