Tuesday, January 26, 2016

Added GPS to bot

I got the GPS positioning up and running!

I received the Adafruit GPS Hat I ordered, which is this https://www.adafruit.com/products/2324.

I also ordered the stackable header  https://www.adafruit.com/products/2223, so that I can plug the ribbon into the HAT board now, instead of the Pi.

I ordered the SMA to uFL adapter:
https://www.adafruit.com/products/851,

the external GPS antenna:
https://www.adafruit.com/products/960,

the coin cell battery:
https://www.adafruit.com/products/380,

the standoffs https://www.adafruit.com/products/2336

I soldered the stackable header, installed the board with no issues.  I installed the gpsd daemon that Adafruit detailed in the nice online guide, and I used the python code from Dan Mandle's blog here:
 http://www.danmandle.com/blog/getting-gpsd-to-work-with-python/.

In order to bring the data into Codesys, I wanted to pass the data values into the Codesys Pi's Modbus server, so I installed the pymodbus library from here:
 https://github.com/bashwork/pymodbus

Using the library's payload builder and client's write registers function, I was able to successfully get the data from the GPS into the Codesys.

This is the same method I will eventually use for the Phidget modules I will need as well eventually, since there is a ton of python code out there for that as well.  I could end up compiling and running it in C, but I like the simplicity of using the Python, and speed in this case isn't an issue.  We'll see what works out better later.

Here are some pictures...

Adafruit Hat GPS plugged into Pi




Screenshot of GPS Data












No comments: