My GPS Plaything
I bought a GPS module for arduino last year planning on making a GPS clock but the real world kept using up my time and never got around to it.
I ended up making this thing instead. It uses a GPS module, Atmega328 (as a barebones arduino Uno, some misc support circuitry and we get this.
It is basically a GPS receiver and decodes the data stream and gets speed, heading, elevation, location, date/time and calculate other stuff from that.
As proof of concept, I started with a spare LCD module and hot melt glued most of the stuff at the back.
A quick test sketch was made to test the proof of concept and this is simply run off a USB powebank 5V supply.
Unfortunately, I was not able to take a pic of it running but you get the idea.
Now for the final version. Here are the main parts and modules to be used. The 16X2 LCD module, 328 breakout board, GPS module, A P channel mosfet switch PCB, and a complete powersupply PCB which contains Li-ion protection, charger and 5V step up converter all in one. It is quite convenient to use.
I started by making the case out of blank PCB material. I was originally contemplating on using acrylic but was too bothered to use CA glue and figured soldering is quicker.
Some parts have the copper foil removed for the GPS antenna to get clear signal.
Mounting spots of the LCD are partially drilled.
A nut is soldered on each partially drilled hole.
Case is complete. Sanded and ready to be painted.
Started by gluing the boards to their places.
Wiring them up.
And keeping the wires in place using hot melt glue.
The powersupply PCB had its LEDs on the PCB but I had to move the light to the front. Used a blob of hot glue as a lightpipe/diffuser.
All wired up ready for testing.
Took it to a north trip and the max recorded speed on the highway!
Tested on the racetrack with lots of twists and turns.
Here is the final iteration with some new additions.
Analog inputs are used to measure charging current and battery voltage.
Closeup of the MOSFET switch PCB. It is originally wired as all four mosfets in parallel driven by a NPN digital transistor, two mosfets are separated as one pair switches the 5V power, the other switches the battery+ for the battery voltage sensing. The 328 drives this sort of like a bootstrap so keeping the pin high maintains supply for everything. Pulling it low turns off power so there is zero power consumption (besides the 5V boost on the PSU board) when off.
The powersupply PCB.
The USB input jack is buried somewhere in that corner.
This is the battery used. It is the newer generation Li-ION which can be charged to 4.35V but as per testing, the PSU board charges to 4.25V, still plenty of life as during testing, the gadget could run 14-15hrs from one full charge.
A5 is connected to the prog pin of the LTC4054 clone charge IC. A0 senses the battery voltage via a voltage divider. The divider calibrations are stored in the Arduino code, edited after testing.
GPS module uses a Ublox Neo 6M module.
I used brass shim to reflect the charger LED and make the front panel indicator a little brighter.
I tacked on a small SMD pot on the back of the LCD as contrast control. Better than wiring it externally and gluing it somewhere.
Back of the buttons. I added 100nF caps to lessen noise interference.
The grey wire taps to the charger IC prog pin which the voltage is directly proportional to charge current.
Bottom cover nut soldered on all four corners.
On the misc page. I studied how to make a custom icon for the battery gauge!
Backlight uses only one LED so I was able to power it directly off one PWM capable GPIO so now I have backlight dimmer control. Settings are also stored to eeprom during power down and loaded at power on. Also, hardware over discharge protection cuts off at 2.5V but I also included software power down at 3.0V which also saves last settings used.
Back corner with the USB charge port.
Tied it on the bike carrier and took it riding the trails.
So now, on with the displayed informations! These are all while inside the house so there is no GPS lock.
Speed and direction page.
I also added an option to switch between metric (km/h and meter) or imperial (mi/h and feet) units but are not shown here.
Altitude, elevation page
Maximum recorded speed and the heading when it was recorded.
distance recorded since turn on/last reset.
Latitude and Longitude page.
Date and time in UTC. I plan to write or find a code I could copy that could automatically add/subtract for the timezone but that is not a priority.
Diagnostics page which shows charger current, battery voltage and satellites in view.
When there is a GPS lock, here is the speed/direction page.
The altitude/Elevation page shows both actual and max readings.
And the locations page.
Date and time.
Then I made a quick edit with the diagnostics page.
When charging, it displays charging current as usual.
When not charging, we get another option. "Normal" means it operates as like the original code.
When the CLR button is pressed, it has a "Power Save" mode where the backlight dims to 0.4% of full brightnes after 15secs when there is no button press, speed is less than 5kph or there is no satellite fix. If any of those is met, backlight returns to preselected brightness setting which can be adjusted by long press of up or down buttons.
This is just a quick project where I started making it two weeks ago, took about a day or two on hardware, and a week or so on code with lots of tweaks in between. A modern smartphone and an app is much easier but where is the fun in that? And you learn stuff this way.
I don't have the code posted but you can contact me if interested, unfortunately, I don't have a schematic as it is basically just wiring modules together.
01 Apr 2017:
I made a new baseplate from 3mm thick aluminum plate.
The middle has a slot machined so that a camera sled attachment could be installed.
Battery is stuck with double adhesive tape.
The attachment that will be used here.
The attachment tightened on the base. I also have a gender changer, basically a cylinder with a hole threaded to accept the standard 1/4 inch tripod bolt.
Added rubber feet to complete the package.
The attachment screws into a clamp which can hold onto the bike handlebar. Now we have a bike GPS!
08 Apr 2017:
First page has been edited to include most of the stats and course in degrees so I don't have to keep on selecting modes when I want to view altitude or speed.
Once it starts moving, course in degrees and compass starts displaying the direction.
Page two is for the max recorded speed and direction.
and after four seconds, it goes to the sub page...
Where it shows the coordinates where that maximum speed was recorded at.
Page three goes to max recorded altitude and it also has the coordinates subpage.
Similar to the previous one. This shows the coordinates where the highest altitude has been recorded.
Page four is the distance traveled. The formula has been improved a bit where it accounts the missing distance traveled while there is no GPS signal, but it is crude and accounts for a loss of data up to an hour and assumes speed has been constant the whole time when the signal has returned. Using it in my daily commute, it seems to work fine and error is not so much on highway routes.
Page five - same coordinates page
Page six - same UTC date and time
With the batt fully charged, the battery icon stays full.
While charging, the icon animates filling up.
With charger unplugged, we get access to selecting normal mode...
...and power save mode which...
dims the backlight when no button is pressed or is not moving more than 5mi/h or 8km/h after 15secs.
16 Sep 2017:
Had the version 1 unit for a while so I decided to make a new version 2 with better layout and adjustable LCD for better viewing in all situations.
I made the wiring neat using wire wrap wire and anchored using hot melt glue.
LCD and battery pack.
Flex cable connector on the main unit side. Anchored with header pins and hot melt glued in place.
Flex cable connector on the LCD side. Same deal with 30ga wire and hot melt glue.
Carved the case using the micro mill from solid blocks of polycarbonate.
Getting ready to assemble the base unit.
V1 beside V2
Completed unit folded up.
LCD can be tilted out for best viewing angle.
Can also be laid flat.
Engraved the button and plug labels with a rotary tool.
Front face when folded up. The LCD PCB and flex cable can be seen.
On the other side, the LCD PCB can also be seen. It was made so that the LCD case could be made as small as possible.
Back of the LCD with direct access of the contrast pot.
Used button head hex screws to attach the arms.
The optimized layout and no metal in the enclosure improved the reception. More satellites locked and lower VDOP and HDOP numbers!
Swapped the DC-DC converter drum inductor into a shielded one.
And a brass foil is also used as a shield to cover the DC-DC converter. But testing seems to show there is little improvement but it still worked better than the V1 so I left it.
Not shown: Max speed, direction and coordinates, max altitude and coordinates, and distance traveled are stored in non volatile memory during powerdown so it is easily recalled on next power up.
15 Nov 2017:
Took it on a tour around Europe last month. Here is a shot of it on the bus.
I don't recall where they are but I took pics of the coordinates when we stopped, check them out on google maps if you're curious.
Here it is on a flight from Munich to Heathrow on an A320 plane. Reception was pretty good as I was seated just behind the wing.
It actually passed through airport security no problems so I was able to use it in flight.
When we landed on Heathrow.
Here is one on an A380 while flying from Heathrow to Hong Kong.
The altitude display blanked out as I had set the upper limit to 10000m but the planes did get well over that.
Reception wasn't as good so I stuck it on the window and it sort of worked. Got a lock here and there but still logged the distance.
Top speed somewhere over Russia.
A quick edit on the sketch and I added duration when the device is moving so I can log how long a trip took (not including stopped in traffic).
Latest code can be found here.
And also the total time and distance travelled.
Page created and copyright R.Quan ©24 Mar 2017.