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 <https://www.google.com/maps/search/9G8F%2B6W%20Z%C3%BCrich>


On Tue, 26 Feb 2019 at 08:56, Cesar Jung-Harada <cont...@cesarharada.com>
wrote:

> // 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
>> <https://www.microchip.com/wwwproducts/en/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:
>>
>> [image: 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 <https://www.google.com/maps/search/9G8F%2B6W%20Z%C3%BCrich>
>>
>>
>> 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+unsubscr...@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
>>> <https://groups.google.com/d/msgid/open-location-code/5e36b7a3-57d3-4e32-bd57-c63af2538924%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to open-location-code@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/23468708-6eb3-4624-8399-91439f6e12a5%40googlegroups.com
> <https://groups.google.com/d/msgid/open-location-code/23468708-6eb3-4624-8399-91439f6e12a5%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send an email to open-location-code@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/CAGFr2LLA0nDf%3DP1pZs1d5LroUk7qXhRUXS8_8wewn519app%2BvQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Attachment: gps_pluscode.ino
Description: Binary data

Reply via email to