Convert GPS Lat, Long into Plus code on arduino

60 views
Skip to first unread message

Cesar Jung-Harada

unread,
Feb 25, 2019, 11:23:40 PM2/25/19
to Plus Codes Community Forum
We are building an arduino-powered diving computer to tag ghost nets, to get them recovered. 
We like plus code because it's easier for divers to write down on their slates. 
Do you have an offline arduino library so we could display the plus code on an offline arduino-powered device?
Thank you!

Doug Rinckes

unread,
Feb 26, 2019, 1:46:31 AM2/26/19
to Cesar Jung-Harada, Plus Codes Community Forum
Hi Cesar,

That sounds like a cool idea, but have you tested GPS reception under water? Or will you use the last surface position?

The C library should work on arduino with only minor changes - this assumes you already have the decimal latitude and longitude from the GPS device, and that you need the full functionality.

A couple of years ago I was experimenting with an ATtiny4313 with attached GPS chip, because I was trying to see what the smallest, lowest power thing was we could run it on. The code reads the NMEA strings directly from the GPS chip and encodes the plus code:

IMG_20140603_094850.jpg

If that would help I'm happy to share it.

Ngā mihi,
Doug Rinckes, Technical Program Manager, Google Switzerland GmbH; 9G8F+6W Zürich


--
Public site: http://www.openlocationcode.com/
Github project: https://github.com/google/open-location-code
Demo site: http://plus.codes/
---
You received this message because you are subscribed to the Google Groups "Plus Codes Community Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to open-location-c...@googlegroups.com.
To post to this group, send email to open-loca...@googlegroups.com.
Visit this group at https://groups.google.com/group/open-location-code.
To view this discussion on the web, visit https://groups.google.com/d/msgid/open-location-code/5e36b7a3-57d3-4e32-bd57-c63af2538924%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Cesar Jung-Harada

unread,
Feb 26, 2019, 2:56:49 AM2/26/19
to Plus Codes Community Forum
// Wow! Thanks for the super fast and awesome answer. 


On Tuesday, February 26, 2019 at 2:46:31 PM UTC+8, Doug Rinckes wrote:
Hi Cesar,

That sounds like a cool idea, but have you tested GPS reception under water? Or will you use the last surface position?

 
// The GPS receiver in on the surface. The divers would spot the net underwater, surface, write on their slate the location of the net. 
 
The C library should work on arduino with only minor changes - this assumes you already have the decimal latitude and longitude from the GPS device, and that you need the full functionality.

A couple of years ago I was experimenting with an ATtiny4313 with attached GPS chip, because I was trying to see what the smallest, lowest power thing was we could run it on. The code reads the NMEA strings directly from the GPS chip and encodes the plus code:

IMG_20140603_094850.jpg

If that would help I'm happy to share it.

// Oh yes! 
That would be fantastic. 
Thank you so much, that would save me a lot of time!

Cesar
 

Ngā mihi,
Doug Rinckes, Technical Program Manager, Google Switzerland GmbH; 9G8F+6W Zürich


On Tue, 26 Feb 2019 at 05:23, Cesar Jung-Harada <con...@cesarharada.com> wrote:
We are building an arduino-powered diving computer to tag ghost nets, to get them recovered. 
We like plus code because it's easier for divers to write down on their slates. 
Do you have an offline arduino library so we could display the plus code on an offline arduino-powered device?
Thank you!

--
Public site: http://www.openlocationcode.com/
Github project: https://github.com/google/open-location-code
Demo site: http://plus.codes/
---
You received this message because you are subscribed to the Google Groups "Plus Codes Community Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to open-location-code+unsub...@googlegroups.com.

Doug Rinckes

unread,
Feb 27, 2019, 6:03:03 AM2/27/19
to Cesar Jung-Harada, Plus Codes Community Forum
Hi Cesar,

I strongly recommend you use something like the Adafruit GPS library to read from the GPS chip. (This will mean you won't have to do all the string parsing yourself.) 

The attached code is a sketch that should work for Arduino (actually tested it using a Teensy) with a GPS attached to RX1/TX1. It will turn on the GPS, get updates at 1Hz, and once it has a fix will convert the lat/lng into a plus code and print it to the serial monitor:

Time: 10:56:5.0
Date: 27/2/2019
Fix: 1 quality: 1
Location: 4721.9287N, 831.4218E
Location (in degrees, works with Google Maps): 47.36547852, 8.52369690
Plus code: 8FVC9G8F+5F
Speed (knots): 9.55
Angle: 256.43
Altitude: 428.00
Satellites: 3
HDOP: 3.01

The only bit of code you should need is the encodePlusCode() function. (This is a new implementation that I like because it's super short.)

Let us know how you get on!

Ngā mihi,
Doug Rinckes, Technical Program Manager, Google Switzerland GmbH; 9G8F+6W Zürich

To unsubscribe from this group and stop receiving emails from it, send an email to open-location-c...@googlegroups.com.

--
Public site: http://www.openlocationcode.com/
Github project: https://github.com/google/open-location-code
Demo site: http://plus.codes/
---
You received this message because you are subscribed to the Google Groups "Plus Codes Community Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to open-location-c...@googlegroups.com.

To post to this group, send email to open-loca...@googlegroups.com.
Visit this group at https://groups.google.com/group/open-location-code.
gps_pluscode.ino
Reply all
Reply to author
Forward
Message has been deleted
0 new messages