Introduction

Raspberry Pi Zero & SparkFun SAM-M8Q

Currently, with the continuous development of science and technology, all daily activities are automated, robots gradually take over many positions in our daily lives. In order for automation devices to work correctly and efficiently, sensors are one of the important components. GPS is the main data we need to track here. We are going to use all popular Hardware like SparkFun SAM-M8Q and Raspberry Pi Zero. I will explain its working, pinout, protocol and interfacing with other microcontrollers in detail. I will also post some tutorial links where I have interfaced SparkFun SAM-M8Q with other microcontrollers. If you have any queries about it, ask in the comments and I will resolve it.

This article uses Platformio as ide and Python for programming.

Hardware Introduction

RASPBERRY PI ZERO

Raspberry Pi Zero 2 W is the latest product in our most affordable range of single-board computers. The successor to the breakthrough Raspberry Pi Zero W, Raspberry Pi Zero 2 W is a form factor–compatible drop-in replacement for the original board.

The board incorporates a quad-core 64-bit Arm Cortex-A53 CPU, clocked at 1GHz. At its heart is a Raspberry Pi RP3A0 system-in-package (SiP), integrating a Broadcom BCM2710A1 die with 512MB of LPDDR2 SDRAM. The upgraded processor provides Raspberry Pi Zero 2 W with 40% more single-threaded performance, and five times more multi-threaded performance, than the original single-core Raspberry Pi Zero. Raspberry Pi Zero 2 W offers 2.4GHz 802.11 b/g/n wireless LAN and Bluetooth 4.2, along with support for Bluetooth Low Energy (BLE), and modular compliance certification. The board has a microSD card slot, a CSI-2 camera connector, a USB On-The-Go (OTG) port, and an unpopulated footprint for a HAT-compatible 40-pin GPIO header. It is powered via a micro USB socket. Video output is via a mini HDMI port; composite video output can easily be made available via test points if needed.

Sharing the same form factor as the original Raspberry Pi Zero, Raspberry Pi Zero 2 W fits inside most existing Raspberry Pi Zero cases.

Raspberry Pi Zero Pinouts

Features

Processor

Broadcom BCM2710A1, quad-core 64-bit SoC

(Arm Cortex-A53 @ 1GHz)

Memory

512MB LPDDR2

Power

5V DC 2.5A

Sensor

sparkfun-GPS-sam-mq8
sparkfun-GPS-sam-mq8

SparkFun SAM-M8Q(Sensor Description)

The u-blox concurrent SAM-M8Q GNSS patch antenna module benefits from the exceptional performance of the u-blox M8 multi-GNSS engine. The SAM-M8Q module offers high sensitivity and minimal acquisition times in an ultra-compact form factor.

The SAM-M8Q module utilizes concurrent reception of up to three GNSS systems (GPS, Galileo and GLONASS), recognizes multiple constellations simultaneously and provides outstanding positioning accuracy in scenarios where urban canyon or weak signals are involved. For even better and faster positioning improvement, SAM-M8Q supports augmentation of QZSS, GAGAN and IMES together with WAAS, EGNOS, and MSAS. SAM-M8Q also supports message integrity protection, geofencing, and spoofing detection with configurable interface settings to easily fit to customer applications.

The SAM-M8Q GNSS patch antenna module is designed to receive and track the L1C/A signals provided at 1575.42 MHz by the Global Positioning System (GPS).

Sensor Specifications:

Category 

  • Standard Precision GNSS High Precision GNSS Dead Reckoning Timing 
  • GPS / QZSS GLONASS Galileo BeiDou 
  • 3 Number of concurrent GNSS 

Power SUPPLY-2.7 V – 3.6 V

Interfaces

  • UART
  • USB
  • SPI DDC (I2C compliant)

FEATURES

  • Programmable (flash)
  • Data logging
  • Additional SAW
  • Additional LNA
  • RTC crystal Oscillator
  • Built-in antenna
  • Built-in antenna supply and supervisor timepulse

GRADE

  • Standard
  • Professional
  • Automotive

Sensor Operating Description:

PINOUTS:

Schematic Diagram:

Pin Connection Table

Source Code

Source Code
import time
import board
import busio
import RPi.GPIO as GPIO
from ublox_gps import UbloxGps
i2c = board.I2C()
gps = UbloxGps(i2c, debug=False)
def run():

    try:
        print("Listening for UBX Messages")
        while True:
            try:
                geo = gps.geo_coords()
                print("Longitude: ", geo.lon) 
                print("Latitude: ", geo.lat)
                print("Heading of Motion: ", geo.headMot)
            except (ValueError, IOError) as err:
                print(err)

    finally:
        port.close()


if __name__ == '__main__':
    run()

Code Explanation

import time
import board
import busio
from ublox_gps import UbloxGps
i2c = board.I2C()
gps = UbloxGps(i2c, debug=False)

Import the libraries time, board, busio and from the library ublox_gps import the element named UbloxGps. Declare the default I2C pins in the board.

def run():

    try:
        print("Listening for UBX Messages")
        while True:
            try:
                geo = gps.geo_coords()
                print("Longitude: ", geo.lon) 
                print("Latitude: ", geo.lat)
                print("Heading of Motion: ", geo.headMot)
            except (ValueError, IOError) as err:
                print(err)

    finally:
        port.close()


if __name__ == '__main__':
    run()

Define a function named ‘run’ which is made to run again and again. Print the message 

Listening for UBX Messages

When the data is received then print the geo coordinates i.e, Latitude, Longitude and also the Heading Direction. And keep the loop run again and again so that the location can be displayed at the shortest interval possible.

GITHUB LINK

https://github.com/iottrends/iottrends/tree/main/SparkFun%20SAM-M8Q

0 0 votes
Article Rating
Previous articleGetting Started with Mqtt on ESP8266 | MicroPython
Next articleHow to Interface ESP8266 with NRF24L01
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments