Building a GPS/GNSS Receiver Using MosaicHAT and Arduino
Introduction: Building a GPS/GNSS Receiver Using MosaicHAT and Arduino
Throughout the following steps, we'll see how to build a GPS/GNSS receiver using Arduino and mosaicHAT. mosaicHAT is a Raspberry Pi compatible GNSS board based on Septentrio module, mosaic-X5, the centimeter-level multi-band, multi-constellation GPS/GNSS receiver.
The compact mosaicHAT make it incredibly handy to provide IoT and robotics applications with highly accurate and precise positioning. mosaicHAT ­­project is open-source, fully documented on Github and can be easily manufactured or integrated into different designs:
https://github.com/septentrio-gnss/mosaicHAT
Step 1: Components
To build this project, we need the following components:
* Arduino UNO (or any Arduino type actually)
* mosaicHAT
* GNSS antenna
* 16*2 LCD screen (12C)
* Breadboard
* 2* 9V batteries
* 2* battery connector
* Pushbutton
* Wires
Step 2: Schematic
Arduino:
* Arduino VIN > Batteries +9V
* Arduino GND > Batteries GND
mosaicHAT:
* mosaicHAT TX > Arduino D10
* mosaicHAT RX > Arduino D11
* mosaicHAT +5V > Batteries +9V
* mosaicHAT GND > GND
LCD display:
* Screen SDA > Arduino A4
* Screen SCL > Arduino A5
* Screen VCC > Arduino +5V
* Screen GND > GND
Pushbutton:
* Pushbutton pin > Arduino D2
* Pushbutton pin > GND
The schematic was designed using the open-source software Fritzing. You can download mosaicHAT's Fritzing part from here.
Step 3: Connections
* I've used one +9V battery and later added another one in parallel to supply a higher current (We'll need to power the antenna as well!). Actually, using other power sources such as lithium batteries could be a smarter idea.
* Screen brightness could be optimized using the variable resistor on its back.
* Pushbutton connection is active LOW.
Step 4: Mosaic-X5 Configuration
We need mosaicHAT to output an NMEA stream through COM2 every time it boots up (in mosaicHAT, COM1 is connected to Raspberry Pi UART pins while COM2 is exposed for different FTDI connections). 769
Arduino will read the messages and output readings on the LCD display.
Configuring mosaicHAT could be easily done using Septentrio web interface of mosaic-X5. Connect mosaicHAT to your PC through USB and open the webUI on its default address "<IP_ADDRESS>". Next:
* Go to the Communication tab and choose Serial.
* Change the baud rate of COM2 to 9600.
* Click Ok for changes to take effect.
* Go to NMEA/SBF Out and choose New NMEA Stream.
* Select Serial connection type then COM2 as connection/port.
* Keep the default interval (1 sec) and select GGA as a message to output.
* Click Ok for changes to take effect.
* Now a popup message will ask if you would like to save the current configuration as a boot configuration. Choose Save.
Congratulations! mosaicHAT is ready. Time to play with Arduino.
Step 5: Arduino Code
The following is the ArduinoC code of the receiver, alongside comments. Mainly, the code does the following:
* Sets up the I2C LCD display and software serial for the mosaicHAT (as we don't want to use the USB serial of Arduino, keeping it for computer communication)
* Reads the NMEA GGA messages coming from mosaicHAT and parses them into the readings of our interest.
* Shows the readings on the display pages and navigate on pushbutton clicks, as following:
1- Quality and SVs number
2- Latitude and Longitude
3- Height and Geoidal Separation
The code is also uploaded to this github repo.
#include <SoftwareSerial.h>
#include <Wire.h>
#include <LiquidCrystal_I2C. 991