ultimate GPS to track sea turtle

General project help for Adafruit customers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
User avatar
albertoabreu
 
Posts: 14
Joined: Thu Jul 25, 2013 12:10 am

Re: ultimate GPS to track sea turtle

Post by albertoabreu »

As I said, the FLORA alternative is appealing but I need to first try to get the most out of what we already bought. Thus I want to compare battery runtime using the internal FLASH versus logging to the SD card. However, I tried a number of the LOCUS sketches Adafruit has kindly made available, and I can't get them to work. Could you verify they do on an Arduino UNO?

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: ultimate GPS to track sea turtle

Post by adafruit_support_rick »

The LOCUS sketches all work on a Uno. What kind of problems are you having?

User avatar
albertoabreu
 
Posts: 14
Joined: Thu Jul 25, 2013 12:10 am

Re: ultimate GPS to track sea turtle

Post by albertoabreu »

A silly mistake on my part. The pin numbers in the original locus_ sketches need changing for use in Arduino UNO, they should be
SoftwareSerial mySerial(8, 7);

with this edit, the sketches work as they were intended.

Except that from running locus_dumpbasic one gets a hexadecimal dump such as this:
$PMTKLOX,1,1,8DD68053,045B77B9,4101DAD4,C20E009B,9CD68053,045B77B9,4100DAD4,C20F008A,ABD68053,045E77B9,4100DAD4,C20D00BA,BAD68053,046977B9,4101DAD4,C20C009C,C9D68053,046977B9,4100DAD4,C20C00EE,D8D68053,045677B9,41FBD9D4,C20D0039*24

which evidently is the packet format in the LOCUS memory. Isn't there a parser that translates the LOCUS dump into meaningful data?

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: ultimate GPS to track sea turtle

Post by adafruit_support_rick »

We have a locus parser here:
https://learn.adafruit.com/custom/ultimate-gps-parser

If I recall correctly, there is a problem with this parser where it fails if your locus data ends with a bunch of empty lines. That is, where the data is all FFFFFFFFF. Don't include those lines when you paste your data into the parser.

User avatar
albertoabreu
 
Posts: 14
Joined: Thu Jul 25, 2013 12:10 am

Re: ultimate GPS to track sea turtle

Post by albertoabreu »

Yup, that does it! Thanks.

However, in our project we will be away from civilization (and the Internet) when we'd be downloading data that we'd want to analyze in the field. Is there a downloadable version of this parser we could use offline?

By the way, I've put together the ultimate GPS/ArduinoUNO with an 8-battery pack of AA NiMH batteries and it has been on for 30 hours so far and continues. Seems that our extended fix cycle of 10 seconds on / 590 seconds sleep is doing very well. This bodes well for our application where we will be operating under unobstructed skies and following turtles moving at relatively slow speeds!

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: ultimate GPS to track sea turtle

Post by adafruit_support_rick »

I don't know of any offline version. The webpage is probably a Java script, so maybe if you clone the entire page, it would work offline. Most web browsers have some way to copy an entire page. You could try it.

User avatar
albertoabreu
 
Posts: 14
Joined: Thu Jul 25, 2013 12:10 am

Re: ultimate GPS to track sea turtle

Post by albertoabreu »

Rick, I am happy to say that we managed to get 39 hours battery time with a 10 seconds on / 590 seconds off periodic mode on the GPS. This certainly attains one of our objectives. However, there is a downside, and that is that we needed 8 AA batteries which weigh in at 544g (including Arduino and GPS shield). As we are dealing with small turtles, that payload is considered too much...

So, I've been thinking of an alternative that I would appreciate if you could tell me if it is viable. As far as I can tell, once the GPS module is configured, it will operate on its own, without the Arduino. Now that I have learnt how to use the LOCUS system in the GPS, we could dispense with the use of the SD logger on the Arduino... So, isn't it possible to use the Arduino for all of the programming and data downloading, then remove the GPS shield and use it independently with a direct battery feed? If this is viable, what are my alternatives? Although we may go for LiPo batteries, at the moment we are using 1.2V NiMH rechargeables. Considering the weight problem, a pack of 4 batteries would be OK, but that would produce 4.8V. I understand the GPS module works with 3.3V but can manage up to 5V, so can I feed it with these 4.8V through it 5V pin? Or would I be obligated to instead use 3 AA batteries for 3.6V and feed through the 3.3 pin?

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: ultimate GPS to track sea turtle

Post by adafruit_support_rick »

You can give it 4.8V at the 5V pin (VIN). The voltage regulator has a 450mV dropout, so you can't quite get away with 3.6V. A LiPo would work, however, since they range from 3.7V to 4.4V.

And yes, if you're using LOCUS logging, you can do away with the Arduino and SD

docmojoman
 
Posts: 11
Joined: Mon Jun 09, 2014 12:26 am

Re: ultimate GPS to track sea turtle

Post by docmojoman »

How about a small solar panel to keep the battery topped up?

User avatar
HeliosPrime
 
Posts: 38
Joined: Mon Mar 02, 2015 12:28 am

Re: ultimate GPS to track sea turtle

Post by HeliosPrime »

adafruit_support_rick wrote:OK, I've got a version of the parsing sketch and a version of the shield_sdlog sketch.

It turns out we don't needthe watchdog timer, because we're using SoftwareSerial. SoftwareSerial relies on the hardware pin-change interrupt to work, and the pin-change interrupt will wake the CPU out of power-down mode.

So, what happens is we keep track of the time each character is received from the GPS. When the GPS goes to sleep, we stop receiving characters, and we decide to put the Arduino to sleep if we haven't heard from the GPS for more than 1 second.

When the GPS wakes up, it will start transmitting characters again, which will wake up the Arduino.

Check out the two sketches:
sleep_sketches.zip
This is great! Thanks for that. Makes a huge improvement on the battery.

I was wondering, however, how could I add a watchdog timer to this sketch to reset the device in case of it becoming unresponsive?
Since the arduino sleeps until the GPS wakes up (could be many 10s of seconds between GPS serial reads) any watchdog timer would have already fired (the max is 8 seconds watchdog timeout?). What would be the most reliable/correct way of handling this so that the various interrupts don't interfere with one another?

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: ultimate GPS to track sea turtle

Post by adafruit_support_rick »

Ultimately, you have to trust the hardware in some way. So I think you trust that the GPS will actually wake up the CPU from sleep.

So, what you're really interested in is hangups that occur while the CPU is running the rest of the sketch. In that case, you can use the watchdog timer as you normally would. The only thing special you have to do is to disable the watchdog before you go to sleep, and re-enable it when you wake up.

Code: Select all

void sleepNow() {
    wdt_disable();
    set_sleep_mode(SLEEP_MODE_PWR_DOWN);
    sleep_enable();
    sleep_mode();
    sleep_disable();
    wdt_enable(WDTO_60MS);
}

User avatar
HeliosPrime
 
Posts: 38
Joined: Mon Mar 02, 2015 12:28 am

Re: ultimate GPS to track sea turtle

Post by HeliosPrime »

adafruit_support_rick wrote:Ultimately, you have to trust the hardware in some way. So I think you trust that the GPS will actually wake up the CPU from sleep.

So, what you're really interested in is hangups that occur while the CPU is running the rest of the sketch. In that case, you can use the watchdog timer as you normally would. The only thing special you have to do is to disable the watchdog before you go to sleep, and re-enable it when you wake up.

Code: Select all

void sleepNow() {
    wdt_disable();
    set_sleep_mode(SLEEP_MODE_PWR_DOWN);
    sleep_enable();
    sleep_mode();
    sleep_disable();
    wdt_enable(WDTO_60MS);
}

That is so much cleaner than what I was trying to do with flags and registers... it's a nice way of compartmentalizing the problem. Thanks! I'm using the GPS with the Fona and found that often times Fona hangs when doing HTTP calls. With this addition, the WDT now resets the Trinket regularly and all is well!

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: ultimate GPS to track sea turtle

Post by adafruit_support_rick »

cool!

User avatar
mma
 
Posts: 11
Joined: Sun Nov 15, 2015 8:06 am

Re: ultimate GPS to track sea turtle

Post by mma »

adafruit_support_rick wrote:OK, I've got a version of the parsing sketch and a version of the shield_sdlog sketch.

It turns out we don't needthe watchdog timer, because we're using SoftwareSerial. SoftwareSerial relies on the hardware pin-change interrupt to work, and the pin-change interrupt will wake the CPU out of power-down mode.

So, what happens is we keep track of the time each character is received from the GPS. When the GPS goes to sleep, we stop receiving characters, and we decide to put the Arduino to sleep if we haven't heard from the GPS for more than 1 second.

When the GPS wakes up, it will start transmitting characters again, which will wake up the Arduino.

Check out the two sketches:
sleep_sketches.zip
Hello, thank you so much for the examples. In my case, I tried with the "pasing_sleep" and all works fine. But we need to change the time combination and here is where my problem starts.


In your code, the periodic mode of the GPS is: #define PMTK_PERIODIC_MODE "$PMTK225,2,10000,50000,0,0*2D
This is:
Sleeping: 50 seconds
Working: 10 seconds

In my case, we need the following combination:
Sleeping: 5 minutes = 300 seconds
Working: 10 seconds (for example, although this could be increased to give more time to fix the GPS)
So I updated the checksum and I replaced the sentence for: #define PMTK_PERIODIC_MODE "$PMTK225,2,10000,300000,0,0*1B"

But when I try with this update, my Arduino/GPS has a strange behavior. The system is working continuously without sleep mode.
Also sometimes the red FIX LED in the GPS is fixed (without blinking).
I tried with different time combinations but the result is the same :(
The code only works fine (as expected) with the original example.

Please, does anyone know what could be happening?

THANK YOU SO MUCH

User avatar
adafruit_support_rick
 
Posts: 35092
Joined: Tue Mar 15, 2011 11:42 am

Re: ultimate GPS to track sea turtle

Post by adafruit_support_rick »

I'm completely stumped. According to the GPS datasheet, what you are doing should work. It's as if the GPS is not accepting your command for some reason.

Have a look a the top of page 21 in the datasheet. They are issuing a PMTK223 command as well as a PMTK225. Maybe you need that?
http://www.adafruit.com/datasheets/PMTK_A11.pdf

Also, I don't understand why your FIX LED is on solid. As far as I know, that should never happen.

Locked
Please be positive and constructive with your questions and comments.

Return to “General Project help”