Introduction: Old Man and the Arduino GPS
So this Lazy Old Geek (L.O.G.) hasn’t been able to do an Instructable for a few years. At 70 years old, the brain doesn’t work as well as it used to and it’s hard to focus on big projects let alone try to write about them.
(I am entering Arduino Contest.)
But with the help of my loving dog, Sadie and my CPAP machine, I’m going to give it a try. Sadie is my anti-depressant, keeps my spirits up and we walk every morning. My CPAP helps me sleep better and therefore, think a little better.
GPS: Well, I’ve always been interested in GPS. Most commercial GPS can only pinpoint down to 2-3 meters. My cousin, who’s a big time farmer says his equipment can do a lot better. I know one of the local farmers uses his John Deere tractors to plant crops in furrows using custom GPS.
I spend a lot of time surfing the Internet and have been reading about reasonably priced GPSs that can measure down to centimeters! Incredible. On the practical side, I don’t really need that. When I go for walks I don’t really need to know exactly where I am. Even on road trips, I use my smartphone with Android Auto to let me know where I am.
But I’m also a technogeek, so I started looking at GPSs for hobbyists. One of the most popular was Adafruit Ultimate GPS.
Step 1: Adafruit Feather
Well, one of the versions of the Adafruit Ultimate GPS is the Featherwing. Now I’ve never heard of the Adafruit Feather series, so more surfing. Wow, Adafruit and Lady Ada have developed a whole bunch of microcontrollers and accessories based on a small platform called Feather. For Arduinoites, it’s similar to the basic Arduino UNO platform but smaller and more up to date. Adafruit also developed all of the software so they could be compatible with the Arduino software.
I really appreciate the work Adafruit and Lady Ada have done for DIYers and I really liked the Feather M4 Express:
Unlike the standard Arduino with 16mHz clock, it’s superfast with 120mHz clock. It’s 3.3V which is pretty much the new standard for new DIY electronics. It’s compatible with Arduino which I’m pretty familiar with plus it can also be programmed with Circuit Python (Adafruit’s custom version of Python). I am old and have a hard time learning new stuff but this would give me a chance to branch out.
So I ordered a used one on ebay and also ordered one from Mouser. Amazon, Mouser and DigiKey carry some of the Adafruit products. I would’ve liked to buy one directly from Adafruit but at the time, they didn’t have all the FeatherWings I wanted to get. In this case it’s cheaper to order a lot of stuff at one time so you don’t have to pay as much shipping costs. In my case three items cost as much to ship as one.
PROBLEM: JST2.0 battery connector on M4express. A long time ago I bought a bunch of JST2.0 power connectors like the picture. Unfortunately, the red/black is opposite what the M4express uses, and I have a lot of batteries and projects using this polarity.
Oh, well. It’s fairy easy to remove the wires from the connector and switch their positions. So I did this with several batteries and one LiPo charger. I put some red nail polish on them so hopefully won’t get them mixed up.
For the M4express, I elected to use the female headers with long pins. See picture. This allowed FeatherWings like my GPS to plug into the top. Plus the M4express can be plugged into FeatherWings like the 3.5” TFT which I bought.
For this application, the pins aren’t used so I had a small Protoboard and plugged the M4express into this so the pins aren’t exposed and can’t get bent when I carry it around.
Step 2: My GPS FeatherWing
Adafruit Ultimate GPS Featherwing
One of the great things I like about Adafruit is that they heavily document their products, I assume so hobbyists can build their own. Now the M4express has an SMD microcontroller which is too small for an Old man like me to work with so I purchased a couple instead of trying to make one. But the FeatherWing Ultimate GPS is a little better so I decided to try to make my own. So I ordered a MediaTek (GlobalTop) GPS MTK3339 module from Ebay or Aliexpress (can’t remember). Sometimes it’s called LadyBird1.
So using Eagle Cadsoft, (now, Autodesk) software I copied Adafruit’s schematic and modified it. First I can only make single sided PCBs and second I don’t have many SMD components so I simplified it.
So I made the PCB using my toner transfer method:
PROBLEMS: As I sometimes remember, I’m Old and here’s some problems I have. Mostly I can’t see closeup that well, so I use one of these hobbyist tools and a lighted magnifying glass (see pictures) I got from Aliexpress. I use an Aoyue soldering iron so I can control temperature and choose soldering tips.
Even with all this, I had a lot of problems soldering the GPS module pins and the u.fl antenna connector. Also, I use a Dremel-clone tool to drill the holes. I’m never able to drill straight holes but fortunately was able to get everything working.
By the way, I ordered some SMD 0805 ferrite beads but never got them so waiting on some more. Meanwhile I soldered a wire across the contacts to make it work. The ferrite bead is supposed to reduce noise on the voltage pin to the GPS chip.
Step 3: MicroSD Card Reader
Ok, so the GPS worked pretty good but it only worked when it was tied to a computer so you can see what's going on. To be more useful, I need something not tethered to a computer, like a display or a micro SD card. For now I wanted to store GPS information. Adafruit has some FeatherWings with microSD cards, like the 3.5” display and the RTC card. But I didn’t want to stack FeatherWings so I copied the microSD circuitry from the RTC card and made my own.
Since I didn’t want to stack another FeatherWing, I came up with a plan to attach this to my GPS PCB. Since the circuit is pretty simple, I just made it with five pads so I can attach wires to this PCB and to my GPS board.
So to attach this, I placed it underneath my GPS PCB, soldered on some wire-wrap wires and connected them to my GPS PCB. For some I cut out some of the insulation on the header pins, so I could solder the wires without interfering with the PCB fitting onto the M4express. You should be able to see that in picture. Then I used some Gorilla glue to carefully glue the two cards together. Be very careful as Gorilla Glue expands.
PROBLEMS: Well, this is actually with the microSD cards. I ordered some microSD cards on ebay. I found out there is a difference between simple microSD cards and microSDHC cards. First, some of the older adapters like I have (probably) can’t read the HC versions. Second the microSDHC versions are from 4gB to 32gB. There’s another version called microSDXC with 64gB and larger sizes. Well, I received some 64gB cards but couldn’t read them with my adapters. I couldn’t figure out what was wrong. But after finding out about the differences, I thought maybe my adapters couldn’t read the HC version but further research said the HC version is maximum of 32gB and as the picture shows these are labeled microSDHC 64gB. Even tho, it says Kingston these are fakes. I contacted the seller and he promptly refunded my money. You can find a lot on the Internet about fake microSD cards.
Now even though they’re fakes, it doesn’t mean they won’t work. I am awaiting a couple of new adapters that are supposed to be able to read some HC cards, plus I ordered some different HC cards.
Step 4: GPS Antenna
Another Old man disaster. So I ordered an active GPS antenna and an RP-SMA to u.fl adapter from ebay/Aliexpress. By the way, I’d forgotten that I already had one of these adapters. Anyway, I finally got the antenna in and it didn’t fit the adapter. Now, I think many of these Chinese suppliers don’t really understand what they’re selling. E.g., many don’t identify the connectors on antennas and some don’t even show it clearly in the pictures. Well, I think the one I got did show the connector fairly well but didn’t identify it. Well, after some research, I (think) I identified it as an MCX connector. Anyway, I ordered another antenna and finally received it and it didn’t fit either. I think again this is mostly my fault, though there’s a lot of confusion between SMA and RP-SMA male and female and plugs and jacks.
Bottom line is right now I don’t have a separate working antenna.
WARNING: The u.fl connectors on the Adafruit and my GPS board are very fragile and it’s recommended that you physically strain relief the connection.
Step 5: Putting It All Together
Adafruit has some excellent tutorials on how to get the M4express so that it will work with Arduino.
My Arduino sketch is attached:
It does the following:
Writes GPS strings to a file on the microSD card called data.nmea
Once a minute, it also writes some other data like time, #satellites, signal quality, speed to a file called misc.txt. I did some modifications, like roughly converting to Mountain Standard time and knots to mph.
Both files are text files.
By the way, I tried to do some stuff with Circuit Python. I was able to run the examples but seemed to have some trouble with sending commands to the GPS module. May revisit in the future.
Step 6: Usage
GPSs use something called ephemeris data and almanac to calculate location. When first powered up, it takes awhile for this information to be processed. This may take a few minutes. Well the MTK3339 GPS module has a battery back up to store this information. I’m still guessing how this works but what I do is about 5 minutes before our walk, I plug my M4express/GPS into PC without the microSD card. When, I get ready to leave, I unplug it, insert microSD card and power with a battery and take off.
Problem: I think I damaged one of my M4express modules possibly with static electricity. When it’s plugged into a computer the charging status LED is blinking. (The M4express has a LiPo battery charger circuit). Well, I’m guessing the charger circuit isn’t working, though I haven’t checked it out. Anyway, besides the blinking LED it seems to work fine both on the computer and on battery power it doesn't blink so I live with it.
Google Earth Pro
One of the reasons, I made the nmea file is so that I can use it with Google Earth Pro. I remove the microSD card from the GPS module, plug it into one of my adapters and plug it into my computer.
To use, start Google Earth Pro, select (FILE)(OPEN). Next to the File box, there is a selection for types of files. Select (GPS) . Browse to find the data.nmea file and open it.
Another window pops up. I select all Create KML Tracks, Create KML LineStrings, Adjust Altitudes to ground height.
The first example shows a sample. The blue line shooting off is erroneous data, probably noise.
In the second example, there is a big metal barn. The blue tracks normally have arrows showing direction of travel, but around the barn they turn to squares. I assume this is loss of signal as we didn’t walk thru the barn but went along the top of the barn.
The misc.txt can be read by Excel as a comma delimited file (or as a text file). See attached for an example taken in a car while driving.
Things I noticed was that Latitude and Longitude were to many decimal places, don’t know how accurate that is. Speed seems to be working. Usually on my walks, Satellites is around 10, in car it was 7 which make since because of metal roof. HDOP in the car seemed higher in the car. On walks it was more around 1 or below (better).
I don’t understand Angle. For a stretch when Latitude stayed the same I would think angle would be 0, 90, 180, or 270 not 66.
Conclusions: It seems to work pretty good. I think the M4express is so much faster than the Atmega328s that I’m used to. It can probably do some noise filtering to get rid of some of the NMEA track glitches without messing up the one second sample rates. I probably won’t bother. One of my future projects would be to do some ‘surveying’ I live in farm country with a lot of fields. Sometimes I’d like to know how many acres are in a field. I could probably use my GPS with my 3.5” touchscreen for that application.
Also want to see if an external antenna makes much difference. I noticed that some of my NMEA tracks aren’t quite where they should be.
By the way the MTK3339 is not more accurate than other GPSs like the uBlox.
Another project is that I bought some L80 GPS modules which seem to be cheaper than the MTK3339 but are supposed to be basically the same thing. Maybe they’re clones? One big advantage for me is that they have 0.1” spacing on the pins which is a lot easier to work with.
Participated in the
Arduino Contest 2019
2 years ago
I created an account just so I could say how much I liked reading this! It has such a conversational tone and I like how you shared the difficulties you encountered too.
4 years ago
This sounds like it was a fun project to work through!
Reply 4 years ago
It was and is, an ongoing project.