This project combines the Arduino MKR WiFi 1010, Arduino MKR GPS and Adafruit SSD1327 display to show once per second: date/time, GPS latitude, GPS longitude, GPS altitude in feet, GPS ground speed in mph, number of GPS satellites received, external battery voltage, distance traveled in miles, distance traveled in feet and elapsed duration in hours.
The original idea was to explore the capabilities of the MKR GPS as a shield for my existing MKR WiFi 1010 boards. In the process of experimenting I needed a portable, battery-operated, small, high resolution display that would provide enough size and pixels to display all of the GPS and calculated data without scrolling using the I2C port. The MKR GPS is mounted as a shield on the MKR WiFi 1010 and nothing could be mounted above it without blocking the GPS signal. The hardware had to draw as little current as possible for maximum battery life. For a battery I used the Adafruit 3.7 volt, 2500 mAh Lithium Ion Polymer Battery.
I plan to mount the components in a clear acrylic project box with a pigtail cable connected to the MKR WiFi 1010's USB port. This will allow me to download sketches and charge the battery with the MKR's built-in charging circuit. The project box will protect the components from dirt, weather, physical and electrical damage. The Hammond 1591CTCL is the box that I selected.
The Arduino_MKRGPS GPSlocation and Adafruit_SSD1327 ssd1327_test sketches were helpful in creating my sketch. The MKR GPS gets time in Unix Epoch format from the GPS satellites but I wanted to display date and time in human readable form. I first tried using the standard TimeLib.h C library but it conflicted with the Arduino_MKR GPS.h library and would not compile. Then I settled on using the RTCZero.h library since the MKR WiFi 1010 has an internal real time clock. The sketch synchronizes the real time clock's epoch time with the GPS time every time it reads the MKR GPS data.
The MKR GPS provides epoch time, decimal latitude and longitude, GPS derived altitude in meters, ground speed in kph, and number of GPS satellites received. The sketch converts these to mm-dd-yy hh:mm:00 date/time, altitude in feet and ground speed in mph. Once per second the difference between previous lat/lon and current lat/lon is converted to 2D distance using the Haversine Formula. The GPS location and ground speed vary in accuracy so it was necessary to create a filter to reduce the number of false readings. I used experimentally derived thresholds for the change in the Haversine distance and ground speed to filter out much of the false GPS readings. The thresholds are defined as constants and can easily be modified for different locations and environments.
The Adafruit 1327 is a highly capable 128x128 pixel 1.5 inch grayscale display capable of high resolution graphics and text and low current drain. I only used the text feature but there is some special handling needed to make the display perform properly over the I2C port. For example display.display() statements before and after the other display statements are required.
Comments