View Full Version : Storing GPS coordinates to memory
01-06-2009, 09:10 AM
Ok guys, I have a question for you. My robot has a gps unit on it, and basically what I want it to do is to roam in a field collecting coordinates as it wanders. It then want to be able to pull those coordinates from it so that I can make a sort of map of its path. How can I get the bot to store the coordinates it reads to some sort of memory? More importantly how can I read back those coordinates from it on a computer? any help is greatly appreciated.
Probably the easiest solution would be to use an SD card or USB stick. There are objects in the obex that you can use to interface with either one of these, and you can simply plug them into your computer to get the data.
01-06-2009, 10:14 AM
Parallax sells a very nice USB Memory Stick Datalogger that would work well for this.· Hitt Consulting sells an SD card datalogger that works well, is small and uses little power.· It is limited in the size of the memory card that it can use and the kinds of file manipulation you can do.· It's really a datalogger.· The Parallax unit is more versatile, bigger and takes more power.
01-06-2009, 10:21 AM
01-06-2009, 11:08 AM
Carl, the protoboard has an extra 32k eeprom. If that is enough, it is already on you robot.
The onboard solution works, but you need some method of getting the data off the board and into your computer. You can have a special program for this, but it's more work. It's also a tradeoff between size ease of use.
01-07-2009, 01:14 AM
Is there an object in the obex that would let me write/read the onboard eeprom? All the ones I have seen seem to interface with a peripheral memory.
01-07-2009, 01:21 AM
The same objects work for the onboard EEPROM as well as EEPROM connected to other I/O pins. Basic_I2C_Driver will work with EEPROM on any pair of I/O pins including pins 28/29 which are used for the onboard EEPROM. The example in the comments at the beginning is for accessing the onboard EEPROM.
01-07-2009, 01:23 AM
Thanks Mike. Didn't see that there.
01-07-2009, 03:00 AM
Mike: Do I need a pull up resistor on either 28 or 29? I believe the program mentions that I do, but I'm not sure if that applies to onboard eeprom. Also, lets say I poll the gps once a second (its fastest update rate) and write the eeprom each time. Am I in any danger of wearing out the eeprom? Can the eeprom keep up?
01-07-2009, 03:33 AM
I have heard about EEPROM wearing out from too many repetitive writes, so what I do is just a simple IF statement comparison.
Something along the lines of:
IF (GPS_LAT <> EEPROM.READ(ADDR)) 'If the EEPROM addresses value is something other than GPS_LAT...
EEPROM.WRITE(GPS_LAT, ADDR) 'Store GPS_LAT to the EEPROM address
Of course I'm assuming much in this little example, like GPS_LAT is a variable holding the last latitude reading from the GPS, and EEPROM is an included object used for reading and writing to the external EEPROM. But this is pretty much what I do to avoid storing a value to the EEPROM that's already there.
Hope this helps,
PS in the example, for some reason it won't show that the EEPROM.WRITE command is indented, but it of course should be to be used by IF
"One must watch out for mechanics. They start out with a sewing machine, and end up with the atomic bomb" - A quote from someone that I saw on Addall.com
"Not only do I see the glass as half empty, I wonder if anyone poisoned the glass with arsenic" - My dad, inside joke haha
Post Edited (Robofreak) : 1/6/2009 7:42:49 PM GMT
01-07-2009, 04:19 AM
IO pins 28 & 29 are pulled up on the proboard.
01-07-2009, 04:29 AM
Thanks John. Also, what address should I use to access the onboard memory?
01-07-2009, 05:02 AM
Here's the program I currently am attempting to run. For some reason it is having issues. Anybody see any problems?
EDIT: I have figured everything out.
Post Edited (Carl Lawhon) : 1/6/2009 9:39:05 PM GMT