Luc Paquin
Published © CC BY-ND

Project #15: Environment - GNSS GPS - Mk34

Project #15: Environment - GNSS GPS - Mk34

IntermediateFull instructions provided1 hour16
Project #15: Environment - GNSS GPS - Mk34

Things used in this project

Hardware components

DFRobot FireBeetle 2 ESP32-P4 AI
×1
Adafruit SHARP Memory Display Breakout - 1.3" 168x144 Monochrome
×1
DFRobot Gravity: GNSS GPS BeiDou Receiver Module
×1
USB Battery Pack
×1
DFRobot USB 3.1 Cable A to C
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Fritzing

Code

DL2510Mk01p.ino

Arduino
/****** Don Luc Electronics © ******
Software Version Information
Project #15: Environment - GNSS GPS - Mk34
15-34
DL2509Mk01p.ino
DL2509Mk01
1 x FireBeetle 2 ESP32-P4 AI
1 x IO Expansion Board
1 x Adafruit SHARP Memory Display Breakout - 1.3" 168x144 Monochrome
1 x Gravity: GNSS GPS BeiDou Receiver Module
1 x USB Battery Pack
1 x USB 3.1 Cable A to C
*/

// Include the Library Code
// EEPROM Library to Read and Write EEPROM
// with Unique ID for Unit
#include "EEPROM.h"
// SHARP Memory Display
#include <Adafruit_SharpMem.h>
#include <Adafruit_GFX.h>
// GNSS
#include "DFRobot_GNSS.h"

// Use I2C for communication, but use the serial port for communication if the line of codes were masked 
#define I2C_COMMUNICATION 

// ESP32 user hardware uart
DFRobot_GNSS_I2C gnss(&Wire ,GNSS_DEVICE_ADDR);
String sDate = "";
String sUTC = "";
String sLat = "";
String sLon = "";


// SHARP Memory Display
// any pins can be used
#define SHARP_SCK  30
#define SHARP_MOSI 29
#define SHARP_SS   28
// Set the size of the display here, e.g. 144x168!
Adafruit_SharpMem display(SHARP_SCK, SHARP_MOSI, SHARP_SS, 144, 168);
// The currently-available SHARP Memory Display (144x168 pixels)
// requires > 4K of microcontroller RAM; it WILL NOT WORK on Arduino Uno
// or other <4K "classic" devices!  The original display (96x96 pixels)
// does work there, but is no longer produced.
#define BLACK 0
#define WHITE 1

// EEPROM Unique ID Information
#define EEPROM_SIZE 64
String uid = "";

// Software Version Information
String sver = "15-34";

void loop() {


  // isGNSS
  isGNSS();

  // isGNSS Display
  isDisplayGNSS();

  // Delay 1 Second
  delay( 1000 );

}

getDisplay.ino

Arduino
// SHARP Memory Display
// SHARP Memory Display - UID
void isDisplayUID(){

  // text display
  display.clearDisplay();
  display.setRotation(4);
  display.setTextSize(2);
  display.setTextColor(BLACK);
  display.setCursor(0,0);
  // Don Luc
  display.println( "Don Luc" );
  // EEPROM
  display.setCursor(0,25);
  display.println( "EEPROM" );
  display.setCursor(0,55);
  display.println( uid );
  // Version
  display.setCursor(0,85);
  display.println( "Version" );
  display.setCursor(0,115);
  display.println( sver );
  display.refresh();
  delay( 100 );

}
// isGNSS Display
void isDisplayGNSS(){

  // text display Date and Time
  display.clearDisplay();
  display.setRotation(4);
  display.setTextSize(2);
  display.setTextColor(BLACK);
  display.setCursor(0,0);
  display.print( "Lan: " );
  display.println( sLat );
  display.setCursor(0,25);
  display.print( "Lon: " );
  display.println( sLon );
  display.setCursor(0,55);
  display.println( "UTC" );
  display.setCursor(0,85);
  display.println( sDate );
  display.setCursor(0,115);
  display.println( sUTC );
  display.refresh();
  delay( 100 );
  
}

getEEPROM.ino

Arduino
// EEPROM
// isUID EEPROM Unique ID
void isUID() {
  
  // Is Unit ID
  uid = "";
  for (int x = 0; x < 7; x++)
  {
    uid = uid + char(EEPROM.read(x));
  }

}

getGNSS.ino

Arduino
// GNSS
// isSetupGNSS
void isSetupGNSS(){

  // GNSS
  //while(!gnss.begin()){
    //Serial.println("NO Deivces !");
   // delay(1000);
  //}

  gnss.begin();
  
  // GNSS
  gnss.enablePower();      

/** Set the galaxy to be used
 *   eGPS              USE gps
 *   eBeiDou           USE beidou
 *   eGPS_BeiDou       USE gps + beidou
 *   eGLONASS          USE glonass
 *   eGPS_GLONASS      USE gps + glonass
 *   eBeiDou_GLONASS   USE beidou +glonass
 *   eGPS_BeiDou_GLONASS USE gps + beidou + glonass
 */
  gnss.setGnss(eGPS_BeiDou_GLONASS);

  // GNSS
  // gnss.setRgbOff();
  gnss.setRgbOn();
  
  
}
// isGNSS
void isGNSS(){

  // GNSS
  sTim_t utc = gnss.getUTC();
  sTim_t date = gnss.getDate();
  sLonLat_t lat = gnss.getLat();
  sLonLat_t lon = gnss.getLon();
  
  sDate = "";
  sUTC = "";
  sLat = "";
  sLon = "";

  // Latitude
  sLat = lat.latitudeDegree;
  // Longitude
  sLon = lon.lonitudeDegree;

  // Date
  sDate = date.year;
  sDate = sDate + "/";
  sDate = sDate + date.month;
  sDate = sDate + "/";
  sDate = sDate + date.date;

  // UTC
  sUTC = utc.hour;
  sUTC = sUTC + ":";
  sUTC = sUTC + utc.hour;
  sUTC = sUTC + ":";
  sUTC = sUTC + utc.minute;

}

setup.ino

Arduino
// Setup
void setup()
{
 
  // Delay
  delay( 100 );

  // EEPROM Size
  EEPROM.begin(EEPROM_SIZE);
  
  // EEPROM Unique ID
  isUID();

  // Delay
  delay(100);

  // SHARP Display start & clear the display
  display.begin();
  display.clearDisplay();

  // Delay
  delay(100);

  // isSetupGNSS
  isSetupGNSS();

  // Delay
  delay( 100 );

  // Display - UID
  // Don Luc Electronics
  // Version
  // EEPROM
  isDisplayUID();
    
  // Delay 5 Second
  delay( 5000 );

}

Credits

Luc Paquin
44 projects • 4 followers
Teacher, Instructor, E-Mentor, R&D and Consulting -Programming Language -Microcontrollers -IoT -Robotics -Machine Learning -AI -Sensors

Comments