The Alpha Geek – Geeking Out

Projects

Project #19: Time – Qwiic Connect System – Mk08

—–

#DonLucElectronics #DonLuc #Time #RTC #Display #Adalogger #MicroSD #GPSReceiver #CCS811 #BME280 #Arduino #ESP32 #SparkFunESP32WROOM #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog #VideoBlog

——

Qwiic Connect System

——

Qwiic Connect System

——

Qwiic Connect System

——

Qwiic Connect System

Prototyping with I2C has never been easier. SparkFun’s Qwiic Connect System uses 4-pin JST connectors to quickly interface development boards with sensors, LCDs, relays and more.

DL2108Mk09

1 x SparkFun Thing Plus – ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x Adalogger FeatherWing – RTC + SD
1 x SparkFun Environmental Combo CCS811/BME280 (Qwiic)
1 x CR1220 3V Lithium Coin Cell Battery
1 x 32Gb microSD Card
1 x LED Green
1 x Rocker Switch – SPST (Round)
1 x Terminal Block Breakout FeatherWing
1 x Lithium Ion Battery – 850mAh
1 x GPS Receiver – GP-20U7
1 x Rotary Switch – 10 Position
1 x SparkFun Rotary Switch – 10 Position
1 x Black Knob
2 x Spring Terminals – PCB Mount (6-Pin)
2 x Breadboard Solderable
12 x 1K Ohm
1 x FeatherWing Proto
1 x Acrylic Orange 5.75 inches x 3.75 inches x 1/8 inch
1 x Acrylic Black 5.75 inches x 3.75 inches x 1/8 inch
52 x Screw – 4-40
18 x Standoff – Metal 4-40 – 3/8″
8 x Standoff – Metal 4-40 – 1″
1 x SparkFun Cerberus USB Cable

SparkFun Thing Plus – ESP32 WROOM

SCK – Digital 13
MSI – Digital 12
SS0 – Digital 27
GRX – Digital 16
GTX – Digital 17
SDA – Digital 23
SDL – Digital 22
SCK – Digital 5
MSO – Digital 19
MSI – Digital 18
SS1 – Digital 33
LEG – Digital 21
SW0 – Digital 32
ROT – Analog A0
VIN – +3.3V
GND – GND

DL2108Mk09p.ino

/* 
***** Don Luc Electronics © *****
Software Version Information
Project #19: Time - Qwiic Connect System - Mk08
08-08
DL2108Mk09p.ino
1 x SparkFun Thing Plus - ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x Adalogger FeatherWing - RTC + SD
1 x SparkFun Environmental Combo CCS811/BME280 (Qwiic)
1 x CR1220 3V Lithium Coin Cell Battery
1 x 32Gb microSD Card
1 x LED Green
1 x Rocker Switch - SPST (Round)
1 x Terminal Block Breakout FeatherWing
1 x Lithium Ion Battery - 850mAh
1 x GPS Receiver - GP-20U7
1 x Rotary Switch - 10 Position
1 x SparkFun Rotary Switch – 10 Position
1 x Black Knob
2 x Spring Terminals - PCB Mount (6-Pin)
2 x Breadboard Solderable
12 x 1K Ohm
1 x FeatherWing Proto
1 x Acrylic Orange 5.75 inches x 3.75 inches x 1/8 inch
1 x Acrylic Black 5.75 inches x 3.75 inches x 1/8 inch
52 x Screw - 4-40
18 x Standoff - Metal 4-40 - 3/8"
8 x Standoff - Metal 4-40 - 1"
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code
// EEPROM Library to Read and Write EEPROM with Unique ID for Unit
#include "EEPROM.h"
// Wire
#include <Wire.h>
// SHARP Memory Display
#include <Adafruit_SharpMem.h>
#include <Adafruit_GFX.h>
// Date and time RTC
#include "RTClib.h"
// GPS Receiver
#include <TinyGPS++.h>
// ESP32 Hardware Serial
#include <HardwareSerial.h>
// SD Card
#include "FS.h"
#include "SD.h"
#include "SPI.h"
// SparkFun CCS811 - eCO2 & tVOC
#include <SparkFunCCS811.h>
// SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure
#include <SparkFunBME280.h>

// SHARP Memory Display
#define SHARP_SCK  13
#define SHARP_MOSI 12
#define SHARP_SS   27
// 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.
#define BLACK 0
#define WHITE 1

// Date and Time
// PCF8523 Precision RTC 
RTC_PCF8523 rtc;
// Date
String dateRTC = "";
// Time
String timeRTC = "";

// ESP32 HardwareSerial
HardwareSerial tGPS(2);

// GPS Receiver
#define gpsRXPIN 16
// This one is unused and doesnt have a conection
#define gpsTXPIN 17
// The TinyGPS++ object
TinyGPSPlus gps;
// Latitude
float TargetLat;
// Longitude
float TargetLon;
// GPS Date, Time, Speed, Altitude
// GPS Date
String TargetDat;
// GPS Time
String TargetTim;
// GPS Speeds M/S
String TargetSMS;
// GPS Speeds Km/h
String TargetSKH;
// GPS Altitude Meters
String TargetALT;
// GPS Status
String GPSSt = "";

// Rotary Switch - 10 Position
// Number 1 => 10
int iRotNum = A0;
// iRotVal - Value 
int iRotVal = 0;
// Number
int z = 0;

// MicroSD Card
const int chipSelect = 33;
String zzzzzz = "";

// LED Green
int iLEDGreen = 21;

// Rocker Switch - SPST (Round)
int iSS1 = 32;
// State
int iSS1State = 0;

// SparkFun CCS811 - eCO2 & tVOC
// Default I2C Address
#define CCS811_ADDR 0x5B 
CCS811 myCCS811(CCS811_ADDR);
// eCO2
float CCS811CO2 = 0;
// TVOC
float CCS811TVOC = 0;

// SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure
BME280 myBME280;
// Temperature Celsius
float BMEtempC = 0;
// Humidity
float BMEhumid = 0;
// Altitude Meters
float BMEaltitudeM = 0;
// Barometric Pressure
float BMEpressure = 0;

// Software Version Information
// EEPROM Unique ID Information
#define EEPROM_SIZE 64
String uid = "";
// Version
String sver = "19-08";

void loop()
{
     
  // Dates and Time
  isRTC();

  // isGPS
  isGPS();

  // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure
  isBME280();

  // SparkFun CCS811 - eCO2 & tVOC
  isCCS811();

  // Rotary Switch
  isRot();

  // Slide Switch
  // Read the state of the iSS1 value
  iSS1State = digitalRead(iSS1);
  
  // If it is the Slide Switch State is HIGH
  if (iSS1State == HIGH) {

    // iLEDGreen HIGH
    digitalWrite(iLEDGreen,  HIGH );
    
    // MicroSD Card
    isSD();

  } else {

    // iLEDGreen LOW
    digitalWrite(iLEDGreen,  LOW );
  
  }

  delay( 1000 );
 
}

getBME280.ino

// SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure
// isBME280 - Humidity, Temperature, Altitude and Barometric Pressure
void isBME280(){

  // Temperature Celsius
  BMEtempC = myBME280.readTempC();
  // Humidity
  BMEhumid = myBME280.readFloatHumidity();
  // Altitude Meters
  BMEaltitudeM = (myBME280.readFloatAltitudeMeters(), 2);
  // Barometric Pressure
  BMEpressure = myBME280.readFloatPressure();
  
}

getCCS811.ino

// CCS811 - eCO2 & tVOC
// isCCS811 - eCO2 & tVOC
void isCCS811(){

  // This sends the temperature & humidity data to the CCS811
  myCCS811.setEnvironmentalData(BMEhumid, BMEtempC);

  // Calling this function updates the global tVOC and eCO2 variables
  myCCS811.readAlgorithmResults();

  // eCO2 Concentration
  CCS811CO2 = myCCS811.getCO2();
  
  // tVOC Concentration
  CCS811TVOC = myCCS811.getTVOC();
  
}

getDisplay.ino

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

    // Text Display 
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(3);
    display.setTextColor(BLACK);
    // Don Luc Electronics
    display.setCursor(0,10);
    display.println( "Don Luc" );
    display.setTextSize(2);
    display.setCursor(0,40);
    display.println( "Electronics" );
    // Version
    //display.setTextSize(3);
    display.setCursor(0,70);
    display.println( "Version" );
    //display.setTextSize(2);
    display.setCursor(0,95);   
    display.println( sver );
    // EEPROM
    display.setCursor(0,120);
    display.println( "EEPROM" );
    display.setCursor(0,140);   
    display.println( uid );
    // Refresh
    display.refresh();
    delay( 100 );
    
}
// Display Date
void isDisplayDate() {

    // Text Display Date
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // Date
    display.setCursor(0,5);
    display.println( "Date" );
    display.setCursor(0,30);
    display.println( dateRTC );
    // Time
    display.setCursor(0,55);
    display.println( "Time" );
    display.setCursor(0,75);
    display.println( timeRTC );
    // Refresh
    display.refresh();
    delay( 100 );

}
// Display GPS
void isDisplayGPS() {

    // Text Display Date
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // GPS Status
    display.setCursor(0,5);
    display.print( "GPS: " );
    display.println( GPSSt );
    // Target Latitude
    display.setCursor(0,25);
    display.println( "Latitude" );
    display.setCursor(0,45);
    display.println( TargetLat );
    // Target Longitude
    display.setCursor(0,65);
    display.println( "Longitude" );
    display.setCursor(0,90);
    display.println( TargetLon );
    // Refresh
    display.refresh();
    delay( 100 );

}
// GPS Date, Time, Speed, Altitude
void isDisplayGPSDate() {

    // Text Display Date
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // GPS
    display.setCursor(0,5);
    display.println( "GPS" );
    // Date
    display.setCursor(0,30);
    display.println( TargetDat );
    // Time
    display.setCursor(0,55);
    display.println( TargetTim );
    // Speed
    display.setCursor(0,75);
    display.print( "M/S: " );
    display.println( TargetSMS );
    display.setCursor(0,95);
    display.print( "Km/h: " );
    display.println( TargetSKH );
    display.setCursor(0,115);
    display.print( "Alt: " );
    display.println( TargetALT );
    // Refresh
    display.refresh();
    delay( 100 );

}
// Display BME280 - Humidity, Temperature, Altitude and Barometric Pressure
void isDisplayBME280() {

     // Text Display BME280
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // Temperature Celsius
    display.setCursor(0,10);
    display.println( "Temperature" );
    display.setCursor(0,30);
    display.print( BMEtempC );
    display.println( " C" );
    // Humidity
    display.setCursor(0,50);
    display.println( "Humidity" );
    display.setCursor(0,70);
    display.print( BMEhumid );
    display.println( "%" );
    // Altitude Meters
    display.setCursor(0,90);
    display.println( "Altitude M" );
    display.setCursor(0,110);
    display.print( BMEaltitudeM );
    display.println( " m" );
    // Pressure
    display.setCursor(0,130);    
    display.println( "Barometric" );
    display.setCursor(0,150);
    display.print( BMEpressure );
    display.println( "Pa" );
    // Refresh
    display.refresh();
    delay( 100 );

}
// Display CCS811 - eCO2 & tVOC
void isDisplayCCS811() {

    // Text Display CCS811
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // eCO2 Concentration
    display.setCursor(0,10);
    display.println( "eCO2" );
    display.setCursor(0,30);
    display.print( CCS811CO2 );
    display.println( " ppm" );
    // tVOC Concentration
    display.setCursor(0,60);
    display.println( "tVOC" );
    display.setCursor(0,80);
    display.print( CCS811TVOC );
    display.println( " ppb" );
    // Refresh
    display.refresh();
    delay( 100 );

}
// Display Z
void isDisplayZ() {
    // Text Display Z
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(3);
    display.setTextColor(BLACK);
    // Z
    display.setCursor(0,10);
    display.print( "Z: " );
    display.println( z );
    // Refresh
    display.refresh();
    delay( 100 );
}

getEEPROM.ino

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

getGPS.ino

// GPS Receiver
// Setup GPS
void setupGPS() {

  // Setup GPS
  tGPS.begin(  9600 , SERIAL_8N1 , gpsRXPIN , gpsTXPIN );
  
}
// isGPS
void isGPS(){

  // Receives NEMA data from GPS receiver
  // This sketch displays information every time a new sentence is correctly encoded
  while ( tGPS.available() > 0)
    
    if (gps.encode( tGPS.read() ))
    {
     
       // GPS Vector Pointer Target
       displayInfo();
       // GPS Date, Time, Speed, Altitude
       displayDTS();
       
    }
  
  if (millis() > 5000 && gps.charsProcessed() < 10)
  {
   
     while(true);
    
  }

}
// GPS Vector Pointer Target
void displayInfo(){

  // Location
  if (gps.location.isValid())
  {
    
     // Latitude
     TargetLat = gps.location.lat();
     // Longitude
     TargetLon = gps.location.lng();
     // GPS Status 2
     GPSSt = "Yes";
    
  }
  else
  {

     // GPS Status 0
     GPSSt = "No";
    
  }

}
// GPS Date, Time, Speed, Altitude
void displayDTS(){

  // Date
  TargetDat = ""; 
  if (gps.date.isValid())
  {
    
     // Date
     // Year
     TargetDat += String(gps.date.year(), DEC);
     TargetDat += "/";
     // Month
     TargetDat += String(gps.date.month(), DEC);
     TargetDat += "/";
     // Day
     TargetDat += String(gps.date.day(), DEC);
    
  }

  // Time
  TargetTim = "";
  if (gps.time.isValid())
  {
    
     // Time
     // Hour
     TargetTim += String(gps.time.hour(), DEC);
     TargetTim += ":";
     // Minute
     TargetTim += String(gps.time.minute(), DEC);
     TargetTim += ":";
     // Secound
     TargetTim += String(gps.time.second(), DEC);
    
  }

  // Speed
  TargetSMS = "";
  TargetSKH = "";
  if (gps.speed.isValid())
  {
    
     // Speed
     // M/S
     int x = gps.speed.mps();
     TargetSMS = String( x, DEC);
     // Km/h
     int y = gps.speed.kmph();
     TargetSKH = String( y, DEC);

  }

  // Altitude
  TargetALT = "";
  if (gps.altitude.isValid())
  {
    
     // Altitude
     // Meters
     int z = gps.altitude.meters();
     TargetALT = String( z, DEC);

  }
  
}

getRTC.ino

// Date & Time
// PCF8523 Precision RTC
void setupRTC() {

  // Date & Time
  // pcf8523 Precision RTC   
  if (! rtc.begin()) {
    while (1);
  }  
  
  if (! rtc.initialized()) {
    
    // Following line sets the RTC to the date & time this sketch was compiled
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date & time, for example to set
    // January 21, 2014 at 3am you would call:
    // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
    // rtc.adjust(DateTime(2021, 8, 18, 8, 48, 0));
    
  }
  
}
// Date and Time RTC PCF8523
void isRTC () {

  // Date and Time
  dateRTC = "";
  timeRTC = "";
  DateTime now = rtc.now();
  
  // Date
  // Year
  dateRTC = now.year(), DEC; 
  dateRTC = dateRTC + "/";
  // Month
  dateRTC = dateRTC + now.month(), DEC;
  dateRTC = dateRTC + "/";
  // Day
  dateRTC = dateRTC + now.day(), DEC;
  
  // Time
  // Hour
  timeRTC = now.hour(), DEC;
  timeRTC = timeRTC + ":";
  // Minute
  timeRTC = timeRTC + now.minute(), DEC;
  timeRTC = timeRTC + ":";
  // Second
  timeRTC = timeRTC + now.second(), DEC;
  
}

getRot.ino

// Rotary Switch
// isRot - iRotVal - Value
void isRot() {
  
  // Rotary Switch
  z = analogRead( iRotNum );
  
  // Rotary Switch - 10 Position
  // Number 1 => 10
  if ( z >= 3600 ) {

    // Z
    iRotVal = 10;
    
  } else if ( z >= 3200 ) {

    // Z
    iRotVal = 9;
    
  } else if ( z >= 2700 ) {

    // Z
    iRotVal = 8;
    
  } else if ( z >= 2400 ) {

    // Z
    iRotVal = 7;
    
  } else if ( z >= 2000 ) {

    // Z
    iRotVal = 6;
    
  } else if ( z >= 1600 ) {

    // Z
    iRotVal = 5;
    
  } else if ( z >= 1200 ) {

    // Z
    iRotVal = 4;
    
  } else if ( z >= 900 ) {

    // Z
    iRotVal = 3;
    
  } else if ( z >= 500 ) {

    // Z
    iRotVal = 2;
    
  } else {

    // Z
    iRotVal = 1;
    
  }

  // Range Value
  switch ( iRotVal ) {
    case 1:

      // Display Date, Time
      isDisplayDate();
       
      break;
    case 2:

      // Display GPS
      isDisplayGPS();
         
      break;
    case 3:

      // GPS Date, Time, Speed, Altitude
      //isDisplayGPSDate();
      
      break;  
    case 4:
      
      // GPS Display Date, Time, Speed
      isDisplayGPSDate();
      
      break;
    case 5:
      
      // Display BME280
      isDisplayBME280();
      
      break;
    case 6:
      
      // Display CCS811 - eCO2 & tVOC
      isDisplayCCS811();
      
      break;       
    case 7:

      // Z
      isDisplayZ();
      
      break; 
    case 8:
         
      // Z
      isDisplayZ();
      
      break; 
    case 9:
      
      // Z
      isDisplayZ();
      
      break;
    case 10:

      // Z
      isDisplayZ();
      
      break;
  }
  
}

getSD.ino

// MicroSD Card
// MicroSD Setup
void setupSD() {

    // MicroSD Card
    pinMode( chipSelect , OUTPUT );
    if(!SD.begin( chipSelect )){
        ;  
        return;
    }
    
    uint8_t cardType = SD.cardType();

    // CARD NONE
    if(cardType == CARD_NONE){
        ; 
        return;
    }

    // SD Card Type
    if(cardType == CARD_MMC){
        ; 
    } else if(cardType == CARD_SD){
        ; 
    } else if(cardType == CARD_SDHC){
        ; 
    } else {
        ; 
    } 

    // Size
    uint64_t cardSize = SD.cardSize() / (1024 * 1024);
 
}
// MicroSD Card
void isSD() {

  zzzzzz = "";

  // EEPROM Unique ID|Version|Date|Time|GPS Status|Target Latitude|Target Longitude|GPS Date|GPS Time|GPS Speed M/S|GPS Speed Km/h|GPS Altitude|Temperature Celsius|Humidity|Altitude Meters|Barometric Pressure|eCO2 Concentration|tVOC Concentration|\r
  zzzzzz = uid + "|" + sver + "|" + dateRTC + "|" + timeRTC + "|" + GPSSt + "|" + TargetLat + "|" + TargetLon + "|" + TargetDat + "|" + TargetTim + "|" + TargetSMS + "|" + TargetSKH + "|" + TargetALT  + "|" + BMEtempC + "|" + BMEhumid + "|" + BMEaltitudeM + "|" + BMEpressure + "|" + CCS811CO2 + "|" + CCS811TVOC +  + "|\r";

  // msg + 1
  char msg[zzzzzz.length() + 1];

  zzzzzz.toCharArray(msg, zzzzzz.length() + 1);

  // Append File
  appendFile(SD, "/espdata.txt", msg );
  
}
// List Dir
void listDir(fs::FS &fs, const char * dirname, uint8_t levels){
    
    // List Dir
    dirname;
    
    File root = fs.open(dirname);
    
    if(!root){
        return;
    }
    
    if(!root.isDirectory()){
        return;
    }

    File file = root.openNextFile();
    
    while(file){
        if(file.isDirectory()){
            file.name();
            if(levels){
                listDir(fs, file.name(), levels -1);
            }
        } else {
            file.name();
            file.size();
        }
        file = root.openNextFile();
    }
    
}
// Write File
void writeFile(fs::FS &fs, const char * path, const char * message){
    
    // Write File
    path;
    
    File file = fs.open(path, FILE_WRITE);
    
    if(!file){
        return;
    }
    
    if(file.print(message)){
        ;  
    } else {
        ;  
    }
    
    file.close();
    
}
// Append File
void appendFile(fs::FS &fs, const char * path, const char * message){
    
    // Append File
    path;
    
    File file = fs.open(path, FILE_APPEND);
    
    if(!file){
        return;
    }
    
    if(file.print(message)){
        ;  
    } else {
        ;  
    }
    
    file.close();
    
}

setup.ino

// Setup
void setup()
{
  
  // EEPROM Size
  EEPROM.begin(EEPROM_SIZE);
  
  // EEPROM Unique ID
  isUID();
  
  // GPS Receiver
  // Setup GPS
  setupGPS();

  // Set up I2C bus
  Wire.begin();

  // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure
  myBME280.begin();
  
  // CCS811 - eCO2 & tVOC
  myCCS811.begin();
  
  // SHARP Display Start & Clear the Display
  display.begin();
  // Clear Display
  display.clearDisplay();

  // Date & Time RTC
  // PCF8523 Precision RTC
  isDisplayUID();
  
  // Setup RTC
  setupRTC();

  //MicroSD Card
  setupSD();

  // Initialize the LED Green
  pinMode(iLEDGreen, OUTPUT);

  // Slide Switch
  pinMode(iSS1, INPUT);

  delay( 5000 );
  
}

——

People can contact us: https://www.donluc.com/?page_id=1927

Technology Experience

  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
  • IoT
  • Robotics
  • Research & Development (R & D)
  • Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
  • Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
  • Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
  • Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
  • Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
  • Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
  • eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)

Instructor

  • PIC Microcontrollers
  • Arduino
  • Raspberry Pi
  • Espressif
  • Robotics
  • DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
  • Linux-Apache-PHP-MySQL

Follow Us

J. Luc Paquin – Curriculum Vitae – 2021 English & Español
https://www.jlpconsultants.com/CV/LucPaquinCVEngMk2021c.pdf
https://www.jlpconsultants.com/CV/LucPaquinCVEspMk2021c.pdf

Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Web: https://www.donluc.com/DLE/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: https://zoom.us/
Patreon: https://www.patreon.com/DonLucElectronics
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/

Don Luc

Project #19: Time – Terminal Block Breakout FeatherWing – Mk07

——

#DonLucElectronics #DonLuc #Time #RTC #Display #Adalogger #MicroSD #GPSReceiver #CCS811 #BME280 #Arduino #ESP32 #SparkFunESP32WROOM #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog

——

Terminal Block Breakout FeatherWing

——

Terminal Block Breakout FeatherWing

——

Terminal Block Breakout FeatherWing

——

Terminal Block Breakout FeatherWing

——

Terminal Block Breakout FeatherWing

The Terminal Block Breakout FeatherWing kit is like the of prototyping FeatherWings. To start, you get a nice prototyping area underneath your Feather, with extra pads for ground, 3.3V and SDA/SCL. There’s also four mounting holes so you can attach the breakout to your enclosure or project.

This product works with all our Feathers. The terminal blocks allow you to connect to any of the external Feather pins, great for wiring temporary or permanent installations. We also give you a few extra terminal block pins for ground and 3.3V connections since those are so useful.

FeatherWing Proto

This is the FeatherWing Proto – a prototyping add-on for all Feather boards. This has a duplicate breakout for each pin on a Feather, as well as a bunch of plain grid proto holes. For GND and 3.3V, we give you a strip of connected pads. There’s plenty of room for buttons, indicator LEDs, or anything for your portable project. The FeatherWing Proto makes an ideal partner for any of our Feather boards.

DL2108Mk08

1 x SparkFun Thing Plus – ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x Adalogger FeatherWing – RTC + SD
1 x SparkFun Environmental Combo CCS811/BME280 (Qwiic)
1 x Qwiic Cable – 100mm
1 x CR1220 3V Lithium Coin Cell Battery
1 x 32Gb microSD Card
1 x LED Green
1 x Rocker Switch – SPST (Round)
1 x Terminal Block Breakout FeatherWing
1 x Lithium Ion Battery – 850mAh
1 x GPS Receiver – GP-20U7
1 x Rotary Switch – 10 Position
1 x SparkFun Rotary Switch – 10 Position
1 x Black Knob
2 x Spring Terminals – PCB Mount (6-Pin)
2 x Breadboard Solderable
12 x 1K Ohm
1 x FeatherWing Proto
1 x Acrylic Orange 5.75 inches x 3.75 inches x 1/8 inch
1 x Acrylic Black 5.75 inches x 3.75 inches x 1/8 inch
52 x Screw – 4-40
18 x Standoff – Metal 4-40 – 3/8″
8 x Standoff – Metal 4-40 – 1″
1 x SparkFun Cerberus USB Cable

SparkFun Thing Plus – ESP32 WROOM

Qwiic – 0x77
Qwiic – 0x5B
SCK – Digital 13
MSI – Digital 12
SS0 – Digital 27
GRX – Digital 16
GTX – Digital 17
SDA – Digital 23
SDL – Digital 22
SCK – Digital 5
MSO – Digital 19
MSI – Digital 18
SS1 – Digital 33
LEG – Digital 21
SW0 – Digital 32
ROT – Analog A0
VIN – +3.3V
GND – GND

——

DL2108Mk08p.ino

/* 
***** Don Luc Electronics © *****
Software Version Information
Project #19: Time - Terminal Block Breakout FeatherWing - Mk07
08-07
DL2108Mk07p.ino
1 x SparkFun Thing Plus - ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x Adalogger FeatherWing - RTC + SD
1 x SparkFun Environmental Combo CCS811/BME280 (Qwiic)
1 x CR1220 3V Lithium Coin Cell Battery
1 x 32Gb microSD Card
1 x LED Green
1 x Rocker Switch - SPST (Round)
1 x Terminal Block Breakout FeatherWing
1 x Lithium Ion Battery - 850mAh
1 x GPS Receiver - GP-20U7
1 x Rotary Switch - 10 Position
1 x SparkFun Rotary Switch – 10 Position
1 x Black Knob
2 x Spring Terminals - PCB Mount (6-Pin)
2 x Breadboard Solderable
12 x 1K Ohm
1 x FeatherWing Proto
1 x Acrylic Orange 5.75 inches x 3.75 inches x 1/8 inch
1 x Acrylic Black 5.75 inches x 3.75 inches x 1/8 inch
52 x Screw - 4-40
18 x Standoff - Metal 4-40 - 3/8"
8 x Standoff - Metal 4-40 - 1"
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code
// EEPROM Library to Read and Write EEPROM with Unique ID for Unit
#include "EEPROM.h"
// Wire
#include <Wire.h>
// SHARP Memory Display
#include <Adafruit_SharpMem.h>
#include <Adafruit_GFX.h>
// Date and time RTC
#include "RTClib.h"
// GPS Receiver
#include <TinyGPS++.h>
// ESP32 Hardware Serial
#include <HardwareSerial.h>
// SD Card
#include "FS.h"
#include "SD.h"
#include "SPI.h"
// SparkFun CCS811 - eCO2 & tVOC
#include <SparkFunCCS811.h>
// SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure
#include <SparkFunBME280.h>

// SHARP Memory Display
#define SHARP_SCK  13
#define SHARP_MOSI 12
#define SHARP_SS   27
// 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.
#define BLACK 0
#define WHITE 1

// Date and Time
// PCF8523 Precision RTC 
RTC_PCF8523 rtc;
// Date
String dateRTC = "";
// Time
String timeRTC = "";

// ESP32 HardwareSerial
HardwareSerial tGPS(2);

// GPS Receiver
#define gpsRXPIN 16
// This one is unused and doesnt have a conection
#define gpsTXPIN 17
// The TinyGPS++ object
TinyGPSPlus gps;
// Latitude
float TargetLat;
// Longitude
float TargetLon;
// GPS Date, Time, Speed, Altitude
// GPS Date
String TargetDat;
// GPS Time
String TargetTim;
// GPS Speeds M/S
String TargetSMS;
// GPS Speeds Km/h
String TargetSKH;
// GPS Altitude Meters
String TargetALT;
// GPS Status
String GPSSt = "";

// Rotary Switch - 10 Position
// Number 1 => 10
int iRotNum = A0;
// iRotVal - Value 
int iRotVal = 0;
// Number
int z = 0;

// MicroSD Card
const int chipSelect = 33;
String zzzzzz = "";

// LED Green
int iLEDGreen = 21;

// Rocker Switch - SPST (Round)
int iSS1 = 32;
// State
int iSS1State = 0;

// SparkFun CCS811 - eCO2 & tVOC
// Default I2C Address
#define CCS811_ADDR 0x5B 
CCS811 myCCS811(CCS811_ADDR);
// eCO2
float CCS811CO2 = 0;
// TVOC
float CCS811TVOC = 0;

// SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure
BME280 myBME280;
// Temperature Celsius
float BMEtempC = 0;
// Humidity
float BMEhumid = 0;
// Altitude Meters
float BMEaltitudeM = 0;
// Barometric Pressure
float BMEpressure = 0;

// Software Version Information
// EEPROM Unique ID Information
#define EEPROM_SIZE 64
String uid = "";
// Version
String sver = "19-07";

void loop()
{
     
  // Dates and Time
  isRTC();

  // isGPS
  isGPS();

  // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure
  isBME280();

  // SparkFun CCS811 - eCO2 & tVOC
  isCCS811();

  // Rotary Switch
  isRot();

  // Slide Switch
  // Read the state of the iSS1 value
  iSS1State = digitalRead(iSS1);
  
  // If it is the Slide Switch State is HIGH
  if (iSS1State == HIGH) {

    // iLEDGreen HIGH
    digitalWrite(iLEDGreen,  HIGH );
    
    // MicroSD Card
    isSD();

  } else {

    // iLEDGreen LOW
    digitalWrite(iLEDGreen,  LOW );
  
  }

  delay( 1000 );
 
}

getBME280.ino

// SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure
// isBME280 - Humidity, Temperature, Altitude and Barometric Pressure
void isBME280(){

  // Temperature Celsius
  BMEtempC = myBME280.readTempC();
  // Humidity
  BMEhumid = myBME280.readFloatHumidity();
  // Altitude Meters
  BMEaltitudeM = (myBME280.readFloatAltitudeMeters(), 2);
  // Barometric Pressure
  BMEpressure = myBME280.readFloatPressure();
  
}

getCCS811.ino

// CCS811 - eCO2 & tVOC
// isCCS811 - eCO2 & tVOC
void isCCS811(){

  // This sends the temperature & humidity data to the CCS811
  myCCS811.setEnvironmentalData(BMEhumid, BMEtempC);

  // Calling this function updates the global tVOC and eCO2 variables
  myCCS811.readAlgorithmResults();

  // eCO2 Concentration
  CCS811CO2 = myCCS811.getCO2();
  
  // tVOC Concentration
  CCS811TVOC = myCCS811.getTVOC();
  
}

getDisplay.ino

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

    // Text Display 
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(3);
    display.setTextColor(BLACK);
    // Don Luc Electronics
    display.setCursor(0,10);
    display.println( "Don Luc" );
    display.setTextSize(2);
    display.setCursor(0,40);
    display.println( "Electronics" );
    // Version
    //display.setTextSize(3);
    display.setCursor(0,70);
    display.println( "Version" );
    //display.setTextSize(2);
    display.setCursor(0,95);   
    display.println( sver );
    // EEPROM
    display.setCursor(0,120);
    display.println( "EEPROM" );
    display.setCursor(0,140);   
    display.println( uid );
    // Refresh
    display.refresh();
    delay( 100 );
    
}
// Display Date
void isDisplayDate() {

    // Text Display Date
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // Date
    display.setCursor(0,5);
    display.println( "Date" );
    display.setCursor(0,30);
    display.println( dateRTC );
    // Time
    display.setCursor(0,55);
    display.println( "Time" );
    display.setCursor(0,75);
    display.println( timeRTC );
    // Refresh
    display.refresh();
    delay( 100 );

}
// Display GPS
void isDisplayGPS() {

    // Text Display Date
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // GPS Status
    display.setCursor(0,5);
    display.print( "GPS: " );
    display.println( GPSSt );
    // Target Latitude
    display.setCursor(0,25);
    display.println( "Latitude" );
    display.setCursor(0,45);
    display.println( TargetLat );
    // Target Longitude
    display.setCursor(0,65);
    display.println( "Longitude" );
    display.setCursor(0,90);
    display.println( TargetLon );
    // Refresh
    display.refresh();
    delay( 100 );

}
// GPS Date, Time, Speed, Altitude
void isDisplayGPSDate() {

    // Text Display Date
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // GPS
    display.setCursor(0,5);
    display.println( "GPS" );
    // Date
    display.setCursor(0,30);
    display.println( TargetDat );
    // Time
    display.setCursor(0,55);
    display.println( TargetTim );
    // Speed
    display.setCursor(0,75);
    display.print( "M/S: " );
    display.println( TargetSMS );
    display.setCursor(0,95);
    display.print( "Km/h: " );
    display.println( TargetSKH );
    display.setCursor(0,115);
    display.print( "Alt: " );
    display.println( TargetALT );
    // Refresh
    display.refresh();
    delay( 100 );

}
// Display BME280 - Humidity, Temperature, Altitude and Barometric Pressure
void isDisplayBME280() {

     // Text Display BME280
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // Temperature Celsius
    display.setCursor(0,10);
    display.println( "Temperature" );
    display.setCursor(0,30);
    display.print( BMEtempC );
    display.println( " C" );
    // Humidity
    display.setCursor(0,50);
    display.println( "Humidity" );
    display.setCursor(0,70);
    display.print( BMEhumid );
    display.println( "%" );
    // Altitude Meters
    display.setCursor(0,90);
    display.println( "Altitude M" );
    display.setCursor(0,110);
    display.print( BMEaltitudeM );
    display.println( " m" );
    // Pressure
    display.setCursor(0,130);    
    display.println( "Barometric" );
    display.setCursor(0,150);
    display.print( BMEpressure );
    display.println( "Pa" );
    // Refresh
    display.refresh();
    delay( 100 );

}
// Display CCS811 - eCO2 & tVOC
void isDisplayCCS811() {

    // Text Display CCS811
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // eCO2 Concentration
    display.setCursor(0,10);
    display.println( "eCO2" );
    display.setCursor(0,30);
    display.print( CCS811CO2 );
    display.println( " ppm" );
    // tVOC Concentration
    display.setCursor(0,60);
    display.println( "tVOC" );
    display.setCursor(0,80);
    display.print( CCS811TVOC );
    display.println( " ppb" );
    // Refresh
    display.refresh();
    delay( 100 );

}
// Display Z
void isDisplayZ() {
    // Text Display Z
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(3);
    display.setTextColor(BLACK);
    // Z
    display.setCursor(0,10);
    display.print( "Z: " );
    display.println( z );
    // Refresh
    display.refresh();
    delay( 100 );
}

getEEPROM.ino

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

getGPS.ino

// GPS Receiver
// Setup GPS
void setupGPS() {

  // Setup GPS
  tGPS.begin(  9600 , SERIAL_8N1 , gpsRXPIN , gpsTXPIN );
  
}
// isGPS
void isGPS(){

  // Receives NEMA data from GPS receiver
  // This sketch displays information every time a new sentence is correctly encoded
  while ( tGPS.available() > 0)
    
    if (gps.encode( tGPS.read() ))
    {
     
       // GPS Vector Pointer Target
       displayInfo();
       // GPS Date, Time, Speed, Altitude
       displayDTS();
       
    }
  
  if (millis() > 5000 && gps.charsProcessed() < 10)
  {
   
     while(true);
    
  }

}
// GPS Vector Pointer Target
void displayInfo(){

  // Location
  if (gps.location.isValid())
  {
    
     // Latitude
     TargetLat = gps.location.lat();
     // Longitude
     TargetLon = gps.location.lng();
     // GPS Status 2
     GPSSt = "Yes";
    
  }
  else
  {

     // GPS Status 0
     GPSSt = "No";
    
  }

}
// GPS Date, Time, Speed, Altitude
void displayDTS(){

  // Date
  TargetDat = ""; 
  if (gps.date.isValid())
  {
    
     // Date
     // Year
     TargetDat += String(gps.date.year(), DEC);
     TargetDat += "/";
     // Month
     TargetDat += String(gps.date.month(), DEC);
     TargetDat += "/";
     // Day
     TargetDat += String(gps.date.day(), DEC);
    
  }

  // Time
  TargetTim = "";
  if (gps.time.isValid())
  {
    
     // Time
     // Hour
     TargetTim += String(gps.time.hour(), DEC);
     TargetTim += ":";
     // Minute
     TargetTim += String(gps.time.minute(), DEC);
     TargetTim += ":";
     // Secound
     TargetTim += String(gps.time.second(), DEC);
    
  }

  // Speed
  TargetSMS = "";
  TargetSKH = "";
  if (gps.speed.isValid())
  {
    
     // Speed
     // M/S
     int x = gps.speed.mps();
     TargetSMS = String( x, DEC);
     // Km/h
     int y = gps.speed.kmph();
     TargetSKH = String( y, DEC);

  }

  // Altitude
  TargetALT = "";
  if (gps.altitude.isValid())
  {
    
     // Altitude
     // Meters
     int z = gps.altitude.meters();
     TargetALT = String( z, DEC);

  }
  
}

getRTC.ino

// Date & Time
// PCF8523 Precision RTC
void setupRTC() {

  // Date & Time
  // pcf8523 Precision RTC   
  if (! rtc.begin()) {
    while (1);
  }  
  
  if (! rtc.initialized()) {
    
    // Following line sets the RTC to the date & time this sketch was compiled
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date & time, for example to set
    // January 21, 2014 at 3am you would call:
    // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
    // rtc.adjust(DateTime(2021, 8, 18, 8, 48, 0));
    
  }
  
}
// Date and Time RTC PCF8523
void isRTC () {

  // Date and Time
  dateRTC = "";
  timeRTC = "";
  DateTime now = rtc.now();
  
  // Date
  // Year
  dateRTC = now.year(), DEC; 
  dateRTC = dateRTC + "/";
  // Month
  dateRTC = dateRTC + now.month(), DEC;
  dateRTC = dateRTC + "/";
  // Day
  dateRTC = dateRTC + now.day(), DEC;
  
  // Time
  // Hour
  timeRTC = now.hour(), DEC;
  timeRTC = timeRTC + ":";
  // Minute
  timeRTC = timeRTC + now.minute(), DEC;
  timeRTC = timeRTC + ":";
  // Second
  timeRTC = timeRTC + now.second(), DEC;
  
}

getRot.ino

// Rotary Switch
// isRot - iRotVal - Value
void isRot() {
  
  // Rotary Switch
  z = analogRead( iRotNum );
  
  // Rotary Switch - 10 Position
  // Number 1 => 10
  if ( z >= 3600 ) {

    // Z
    iRotVal = 10;
    
  } else if ( z >= 3200 ) {

    // Z
    iRotVal = 9;
    
  } else if ( z >= 2700 ) {

    // Z
    iRotVal = 8;
    
  } else if ( z >= 2400 ) {

    // Z
    iRotVal = 7;
    
  } else if ( z >= 2000 ) {

    // Z
    iRotVal = 6;
    
  } else if ( z >= 1600 ) {

    // Z
    iRotVal = 5;
    
  } else if ( z >= 1200 ) {

    // Z
    iRotVal = 4;
    
  } else if ( z >= 900 ) {

    // Z
    iRotVal = 3;
    
  } else if ( z >= 500 ) {

    // Z
    iRotVal = 2;
    
  } else {

    // Z
    iRotVal = 1;
    
  }

  // Range Value
  switch ( iRotVal ) {
    case 1:

      // Display Date, Time
      isDisplayDate();
       
      break;
    case 2:

      // Display GPS
      isDisplayGPS();
         
      break;
    case 3:

      // GPS Date, Time, Speed, Altitude
      //isDisplayGPSDate();
      
      break;  
    case 4:
      
      // GPS Display Date, Time, Speed
      isDisplayGPSDate();
      
      break;
    case 5:
      
      // Display BME280
      isDisplayBME280();
      
      break;
    case 6:
      
      // Display CCS811 - eCO2 & tVOC
      isDisplayCCS811();
      
      break;       
    case 7:

      // Z
      isDisplayZ();
      
      break; 
    case 8:
         
      // Z
      isDisplayZ();
      
      break; 
    case 9:
      
      // Z
      isDisplayZ();
      
      break;
    case 10:

      // Z
      isDisplayZ();
      
      break;
  }
  
}

getSD.ino

// MicroSD Card
// MicroSD Setup
void setupSD() {

    // MicroSD Card
    pinMode( chipSelect , OUTPUT );
    if(!SD.begin( chipSelect )){
        ;  
        return;
    }
    
    uint8_t cardType = SD.cardType();

    // CARD NONE
    if(cardType == CARD_NONE){
        ; 
        return;
    }

    // SD Card Type
    if(cardType == CARD_MMC){
        ; 
    } else if(cardType == CARD_SD){
        ; 
    } else if(cardType == CARD_SDHC){
        ; 
    } else {
        ; 
    } 

    // Size
    uint64_t cardSize = SD.cardSize() / (1024 * 1024);
 
}
// MicroSD Card
void isSD() {

  zzzzzz = "";

  // EEPROM Unique ID|Version|Date|Time|GPS Status|Target Latitude|Target Longitude|GPS Date|GPS Time|GPS Speed M/S|GPS Speed Km/h|GPS Altitude|Temperature Celsius|Humidity|Altitude Meters|Barometric Pressure|eCO2 Concentration|tVOC Concentration|\r
  zzzzzz = uid + "|" + sver + "|" + dateRTC + "|" + timeRTC + "|" + GPSSt + "|" + TargetLat + "|" + TargetLon + "|" + TargetDat + "|" + TargetTim + "|" + TargetSMS + "|" + TargetSKH + "|" + TargetALT  + "|" + BMEtempC + "|" + BMEhumid + "|" + BMEaltitudeM + "|" + BMEpressure + "|" + CCS811CO2 + "|" + CCS811TVOC +  + "|\r";

  // msg + 1
  char msg[zzzzzz.length() + 1];

  zzzzzz.toCharArray(msg, zzzzzz.length() + 1);

  // Append File
  appendFile(SD, "/espdata.txt", msg );
  
}
// List Dir
void listDir(fs::FS &fs, const char * dirname, uint8_t levels){
    
    // List Dir
    dirname;
    
    File root = fs.open(dirname);
    
    if(!root){
        return;
    }
    
    if(!root.isDirectory()){
        return;
    }

    File file = root.openNextFile();
    
    while(file){
        if(file.isDirectory()){
            file.name();
            if(levels){
                listDir(fs, file.name(), levels -1);
            }
        } else {
            file.name();
            file.size();
        }
        file = root.openNextFile();
    }
    
}
// Write File
void writeFile(fs::FS &fs, const char * path, const char * message){
    
    // Write File
    path;
    
    File file = fs.open(path, FILE_WRITE);
    
    if(!file){
        return;
    }
    
    if(file.print(message)){
        ;  
    } else {
        ;  
    }
    
    file.close();
    
}
// Append File
void appendFile(fs::FS &fs, const char * path, const char * message){
    
    // Append File
    path;
    
    File file = fs.open(path, FILE_APPEND);
    
    if(!file){
        return;
    }
    
    if(file.print(message)){
        ;  
    } else {
        ;  
    }
    
    file.close();
    
}

setup.ino

// Setup
void setup()
{
  
  // EEPROM Size
  EEPROM.begin(EEPROM_SIZE);
  
  // EEPROM Unique ID
  isUID();
  
  // GPS Receiver
  // Setup GPS
  setupGPS();

  // Set up I2C bus
  Wire.begin();

  // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure
  myBME280.begin();
  
  // CCS811 - eCO2 & tVOC
  myCCS811.begin();
  
  // SHARP Display Start & Clear the Display
  display.begin();
  // Clear Display
  display.clearDisplay();

  // Date & Time RTC
  // PCF8523 Precision RTC
  isDisplayUID();
  
  // Setup RTC
  setupRTC();

  //MicroSD Card
  setupSD();

  // Initialize the LED Green
  pinMode(iLEDGreen, OUTPUT);

  // Slide Switch
  pinMode(iSS1, INPUT);

  delay( 5000 );
  
}

——

People can contact us: https://www.donluc.com/?page_id=1927

Technology Experience

  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
  • IoT
  • Robotics
  • Research & Development (R & D)
  • Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
  • Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
  • Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
  • Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
  • Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
  • Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
  • eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)

Instructor

  • PIC Microcontrollers
  • Arduino
  • Raspberry Pi
  • Espressif
  • Robotics
  • DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
  • Linux-Apache-PHP-MySQL

Follow Us

J. Luc Paquin – Curriculum Vitae – 2021 English & Español
https://www.jlpconsultants.com/CV/LucPaquinCVEngMk2021c.pdf
https://www.jlpconsultants.com/CV/LucPaquinCVEspMk2021c.pdf

Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Web: https://www.donluc.com/DLE/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: https://zoom.us/
Patreon: https://www.patreon.com/DonLucElectronics
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/

Don Luc

Project #19: Time – SparkFun Environmental Combo CCS811/BME280 – Mk06

——

#DonLucElectronics #DonLuc #Time #RTC #Display #Adalogger #MicroSD #GPSReceiver #CCS811 #BME280 #Arduino #ESP32 #SparkFunESP32WROOM #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog

——

SparkFun Environmental Combo CCS811/BME280

——

SparkFun Environmental Combo CCS811/BME280

——

SparkFun Environmental Combo CCS811/BME280

——

SparkFun Environmental Combo CCS811/BME280

——

SparkFun Environmental Combo Breakout – CCS811/BME280 (Qwiic)

The SparkFun CCS811/BME280 Environmental Combo Breakout takes care of all your atmospheric-quality sensing needs with the popular CCS811 and BME280 ICs. This unique breakout provides a variety of environmental data, including barometric pressure, humidity, temperature, TVOCs and equivalent eCO2 levels. To make it even easier to use this breakout, all communication is enacted exclusively via I2C, utilizing our handy Qwiic system. However, we still have broken out 0.1″ spaced pins in case you prefer to use a breadboard.

Bosch Sensortec BME280

The BME280 is as combined digital humidity, pressure and temperature sensor based on proven sensing principles. Its small dimensions and its low power consumption allow the implementation in battery driven devices such as handsets, GPS modules or watches. The BME280 achieves high performance in all applications requiring humidity and pressure measurement. These emerging applications of home automation control, indoor navigation, health care as well as GPS refinement require a high accuracy and a low TCO at the same time. The humidity sensor provides an extremely fast response time for fast context awareness applications and high overall accuracy over a wide temperature range. The pressure sensor is an absolute barometric pressure sensor with extremely high accuracy and resolution.

Typical Application

-Context awareness, e.g. skin detection, room change detection
-Health monitoring / well-being
-Warning regarding dehydration or heat stroke
-Spirometry (measurement of lung volume and air flow)
-Home automation control
-Control heating, venting, air conditioning (HVAC)
-Internet of Things
-GPS enhancement (e.g. time-to-first-fix improvement, dead reckoning, slope detection)
-Indoor navigation (change of floor detection, elevator detection)
-Outdoor navigation, leisure and sports applications
-Weather forecast
-Vertical velocity indication (rise/sink speed)

Target devices

-Handsets such as mobile phones, tablet PCs, GPS devices
-Navigation systems
-Gaming, e.g flying toys
-Camera (DSC, video)
-Portable health care devices
-Home weather stations
-Flying toys
-Watches

ams AG CCS811

The CCS811 is an exceedingly popular sensor, providing readings for equivalent eCO2 in the PPM and total volatile organic compounds in the PPB. The CCS811 is an ultra-low power digital gas sensor solution which integrates a metal oxide (MOX) gas sensor to detect a wide range of Volatile Organic Compounds (VOCs) for indoor air quality monitoring with a microcontroller unit (MCU), which includes an Analog-to-Digital converter (ADC), and an I²C interface.

DL2108Mk07

1 x SparkFun Thing Plus – ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x Adalogger FeatherWing – RTC + SD
1 x SparkFun Environmental Combo CCS811/BME280 (Qwiic)
1 x Qwiic Cable – 100mm
1 x CR1220 3V Lithium Coin Cell Battery
1 x 32Gb microSD Card
1 x LED Green
1 x Rocker Switch – SPST (Round)
1 x Terminal Block Breakout FeatherWing
1 x Lithium Ion Battery – 850mAh
1 x GPS Receiver – GP-20U7
1 x Rotary Switch – 10 Position
1 x SparkFun Rotary Switch – 10 Position
1 x Black Knob
2 x Spring Terminals – PCB Mount (6-Pin)
2 x Breadboard Solderable
12 x 1K Ohm
1 x FeatherWing Proto
1 x SparkFun Cerberus USB Cable

SparkFun Thing Plus – ESP32 WROOM

Qwiic – 0x77
Qwiic – 0x5B
SCK – Digital 13
MSI – Digital 12
SS0 – Digital 27
GRX – Digital 16
GTX – Digital 17
SDA – Digital 23
SDL – Digital 22
SCK – Digital 5
MSO – Digital 19
MSI – Digital 18
SS1 – Digital 33
LEG – Digital 21
SW0 – Digital 32
ROT – Analog A0
VIN – +3.3V
GND – GND

——

DL2108Mk07p.ino

/* 
***** Don Luc Electronics © *****
Software Version Information
Project #19: Time - SparkFun Environmental Combo CCS811/BME280 - Mk06
08-07
DL2108Mk07p.ino
1 x SparkFun Thing Plus - ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x Adalogger FeatherWing - RTC + SD
1 x SparkFun Environmental Combo CCS811/BME280 (Qwiic)
1 x CR1220 3V Lithium Coin Cell Battery
1 x 32Gb microSD Card
1 x LED Green
1 x Rocker Switch - SPST (Round)
1 x Terminal Block Breakout FeatherWing
1 x Lithium Ion Battery - 850mAh
1 x GPS Receiver - GP-20U7
1 x Rotary Switch - 10 Position
1 x SparkFun Rotary Switch – 10 Position
1 x Black Knob
2 x Spring Terminals - PCB Mount (6-Pin)
2 x Breadboard Solderable
12 x 1K Ohm
1 x FeatherWing Proto
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code
// EEPROM Library to Read and Write EEPROM with Unique ID for Unit
#include "EEPROM.h"
// Wire
#include <Wire.h>
// SHARP Memory Display
#include <Adafruit_SharpMem.h>
#include <Adafruit_GFX.h>
// Date and time RTC
#include "RTClib.h"
// GPS Receiver
#include <TinyGPS++.h>
// ESP32 Hardware Serial
#include <HardwareSerial.h>
// SD Card
#include "FS.h"
#include "SD.h"
#include "SPI.h"
// SparkFun CCS811 - eCO2 & tVOC
#include <SparkFunCCS811.h>
// SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure
#include <SparkFunBME280.h>

// SHARP Memory Display
#define SHARP_SCK  13
#define SHARP_MOSI 12
#define SHARP_SS   27
// 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.
#define BLACK 0
#define WHITE 1

// Date and Time
// PCF8523 Precision RTC 
RTC_PCF8523 rtc;
// Date
String dateRTC = "";
// Time
String timeRTC = "";

// ESP32 HardwareSerial
HardwareSerial tGPS(2);

// GPS Receiver
#define gpsRXPIN 16
// This one is unused and doesnt have a conection
#define gpsTXPIN 17
// The TinyGPS++ object
TinyGPSPlus gps;
// Latitude
float TargetLat;
// Longitude
float TargetLon;
// GPS Date, Time, Speed, Altitude
// GPS Date
String TargetDat;
// GPS Time
String TargetTim;
// GPS Speeds M/S
String TargetSMS;
// GPS Speeds Km/h
String TargetSKH;
// GPS Altitude Meters
String TargetALT;
// GPS Status
String GPSSt = "";

// Rotary Switch - 10 Position
// Number 1 => 10
int iRotNum = A0;
// iRotVal - Value 
int iRotVal = 0;
// Number
int z = 0;

// MicroSD Card
const int chipSelect = 33;
String zzzzzz = "";

// LED Green
int iLEDGreen = 21;

// Rocker Switch - SPST (Round)
int iSS1 = 32;
// State
int iSS1State = 0;

// SparkFun CCS811 - eCO2 & tVOC
// Default I2C Address
#define CCS811_ADDR 0x5B 
CCS811 myCCS811(CCS811_ADDR);
// eCO2
float CCS811CO2 = 0;
// TVOC
float CCS811TVOC = 0;

// SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure
BME280 myBME280;
// Temperature Celsius
float BMEtempC = 0;
// Humidity
float BMEhumid = 0;
// Altitude Meters
float BMEaltitudeM = 0;
// Barometric Pressure
float BMEpressure = 0;

// Software Version Information
// EEPROM Unique ID Information
#define EEPROM_SIZE 64
String uid = "";
// Version
String sver = "19-06";

void loop()
{
     
  // Dates and Time
  isRTC();

  // isGPS
  isGPS();

  // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure
  isBME280();

  // SparkFun CCS811 - eCO2 & tVOC
  isCCS811();

  // Rotary Switch
  isRot();

  // Slide Switch
  // Read the state of the iSS1 value
  iSS1State = digitalRead(iSS1);
  
  // If it is the Slide Switch State is HIGH
  if (iSS1State == HIGH) {

    // iLEDGreen HIGH
    digitalWrite(iLEDGreen,  HIGH );
    
    // MicroSD Card
    isSD();

  } else {

    // iLEDGreen LOW
    digitalWrite(iLEDGreen,  LOW );
  
  }

  delay( 1000 );
 
}

getBME280.ino

// SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure
// isBME280 - Humidity, Temperature, Altitude and Barometric Pressure
void isBME280(){

  // Temperature Celsius
  BMEtempC = myBME280.readTempC();
  // Humidity
  BMEhumid = myBME280.readFloatHumidity();
  // Altitude Meters
  BMEaltitudeM = (myBME280.readFloatAltitudeMeters(), 2);
  // Barometric Pressure
  BMEpressure = myBME280.readFloatPressure();
  
}

getCCS811.ino

// CCS811 - eCO2 & tVOC
// isCCS811 - eCO2 & tVOC
void isCCS811(){

  // This sends the temperature & humidity data to the CCS811
  myCCS811.setEnvironmentalData(BMEhumid, BMEtempC);

  // Calling this function updates the global tVOC and eCO2 variables
  myCCS811.readAlgorithmResults();

  // eCO2 Concentration
  CCS811CO2 = myCCS811.getCO2();
  
  // tVOC Concentration
  CCS811TVOC = myCCS811.getTVOC();
  
}

getDisplay.ino

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

    // Text Display 
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(3);
    display.setTextColor(BLACK);
    // Don Luc Electronics
    display.setCursor(0,10);
    display.println( "Don Luc" );
    display.setTextSize(2);
    display.setCursor(0,40);
    display.println( "Electronics" );
    // Version
    //display.setTextSize(3);
    display.setCursor(0,70);
    display.println( "Version" );
    //display.setTextSize(2);
    display.setCursor(0,95);   
    display.println( sver );
    // EEPROM
    display.setCursor(0,120);
    display.println( "EEPROM" );
    display.setCursor(0,140);   
    display.println( uid );
    // Refresh
    display.refresh();
    delay( 100 );
    
}
// Display Date
void isDisplayDate() {

    // Text Display Date
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // Date
    display.setCursor(0,5);
    display.println( "Date" );
    display.setCursor(0,30);
    display.println( dateRTC );
    // Time
    display.setCursor(0,55);
    display.println( "Time" );
    display.setCursor(0,75);
    display.println( timeRTC );
    // Refresh
    display.refresh();
    delay( 100 );

}
// Display GPS
void isDisplayGPS() {

    // Text Display Date
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // GPS Status
    display.setCursor(0,5);
    display.print( "GPS: " );
    display.println( GPSSt );
    // Target Latitude
    display.setCursor(0,25);
    display.println( "Latitude" );
    display.setCursor(0,45);
    display.println( TargetLat );
    // Target Longitude
    display.setCursor(0,65);
    display.println( "Longitude" );
    display.setCursor(0,90);
    display.println( TargetLon );
    // Refresh
    display.refresh();
    delay( 100 );

}
// GPS Date, Time, Speed, Altitude
void isDisplayGPSDate() {

    // Text Display Date
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // GPS
    display.setCursor(0,5);
    display.println( "GPS" );
    // Date
    display.setCursor(0,30);
    display.println( TargetDat );
    // Time
    display.setCursor(0,55);
    display.println( TargetTim );
    // Speed
    display.setCursor(0,75);
    display.print( "M/S: " );
    display.println( TargetSMS );
    display.setCursor(0,95);
    display.print( "Km/h: " );
    display.println( TargetSKH );
    display.setCursor(0,115);
    display.print( "Alt: " );
    display.println( TargetALT );
    // Refresh
    display.refresh();
    delay( 100 );

}
// Display BME280 - Humidity, Temperature, Altitude and Barometric Pressure
void isDisplayBME280() {

     // Text Display BME280
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // Temperature Celsius
    display.setCursor(0,10);
    display.println( "Temperature" );
    display.setCursor(0,30);
    display.print( BMEtempC );
    display.println( " C" );
    // Humidity
    display.setCursor(0,50);
    display.println( "Humidity" );
    display.setCursor(0,70);
    display.print( BMEhumid );
    display.println( "%" );
    // Altitude Meters
    display.setCursor(0,90);
    display.println( "Altitude M" );
    display.setCursor(0,110);
    display.print( BMEaltitudeM );
    display.println( " m" );
    // Pressure
    display.setCursor(0,130);    
    display.println( "Barometric" );
    display.setCursor(0,150);
    display.print( BMEpressure );
    display.println( "Pa" );
    // Refresh
    display.refresh();
    delay( 100 );

}
// Display CCS811 - eCO2 & tVOC
void isDisplayCCS811() {

    // Text Display CCS811
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // eCO2 Concentration
    display.setCursor(0,10);
    display.println( "eCO2" );
    display.setCursor(0,30);
    display.print( CCS811CO2 );
    display.println( " ppm" );
    // tVOC Concentration
    display.setCursor(0,60);
    display.println( "tVOC" );
    display.setCursor(0,80);
    display.print( CCS811TVOC );
    display.println( " ppb" );
    // Refresh
    display.refresh();
    delay( 100 );

}
// Display Z
void isDisplayZ() {
    // Text Display Z
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(3);
    display.setTextColor(BLACK);
    // Z
    display.setCursor(0,10);
    display.print( "Z: " );
    display.println( z );
    // Refresh
    display.refresh();
    delay( 100 );
}

getEEPROM.ino

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

getGPS.ino

// GPS Receiver
// Setup GPS
void setupGPS() {

  // Setup GPS
  tGPS.begin(  9600 , SERIAL_8N1 , gpsRXPIN , gpsTXPIN );
  
}
// isGPS
void isGPS(){

  // Receives NEMA data from GPS receiver
  // This sketch displays information every time a new sentence is correctly encoded
  while ( tGPS.available() > 0)
    
    if (gps.encode( tGPS.read() ))
    {
     
       // GPS Vector Pointer Target
       displayInfo();
       // GPS Date, Time, Speed, Altitude
       displayDTS();
       
    }
  
  if (millis() > 5000 && gps.charsProcessed() < 10)
  {
   
     while(true);
    
  }

}
// GPS Vector Pointer Target
void displayInfo(){

  // Location
  if (gps.location.isValid())
  {
    
     // Latitude
     TargetLat = gps.location.lat();
     // Longitude
     TargetLon = gps.location.lng();
     // GPS Status 2
     GPSSt = "Yes";
    
  }
  else
  {

     // GPS Status 0
     GPSSt = "No";
    
  }

}
// GPS Date, Time, Speed, Altitude
void displayDTS(){

  // Date
  TargetDat = ""; 
  if (gps.date.isValid())
  {
    
     // Date
     // Year
     TargetDat += String(gps.date.year(), DEC);
     TargetDat += "/";
     // Month
     TargetDat += String(gps.date.month(), DEC);
     TargetDat += "/";
     // Day
     TargetDat += String(gps.date.day(), DEC);
    
  }

  // Time
  TargetTim = "";
  if (gps.time.isValid())
  {
    
     // Time
     // Hour
     TargetTim += String(gps.time.hour(), DEC);
     TargetTim += ":";
     // Minute
     TargetTim += String(gps.time.minute(), DEC);
     TargetTim += ":";
     // Secound
     TargetTim += String(gps.time.second(), DEC);
    
  }

  // Speed
  TargetSMS = "";
  TargetSKH = "";
  if (gps.speed.isValid())
  {
    
     // Speed
     // M/S
     int x = gps.speed.mps();
     TargetSMS = String( x, DEC);
     // Km/h
     int y = gps.speed.kmph();
     TargetSKH = String( y, DEC);

  }

  // Altitude
  TargetALT = "";
  if (gps.altitude.isValid())
  {
    
     // Altitude
     // Meters
     int z = gps.altitude.meters();
     TargetALT = String( z, DEC);

  }
  
}

getRTC.ino

// Date & Time
// PCF8523 Precision RTC
void setupRTC() {

  // Date & Time
  // pcf8523 Precision RTC   
  if (! rtc.begin()) {
    while (1);
  }  
  
  if (! rtc.initialized()) {
    
    // Following line sets the RTC to the date & time this sketch was compiled
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date & time, for example to set
    // January 21, 2014 at 3am you would call:
    // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
    // rtc.adjust(DateTime(2021, 8, 18, 8, 48, 0));
    
  }
  
}
// Date and Time RTC PCF8523
void isRTC () {

  // Date and Time
  dateRTC = "";
  timeRTC = "";
  DateTime now = rtc.now();
  
  // Date
  // Year
  dateRTC = now.year(), DEC; 
  dateRTC = dateRTC + "/";
  // Month
  dateRTC = dateRTC + now.month(), DEC;
  dateRTC = dateRTC + "/";
  // Day
  dateRTC = dateRTC + now.day(), DEC;
  
  // Time
  // Hour
  timeRTC = now.hour(), DEC;
  timeRTC = timeRTC + ":";
  // Minute
  timeRTC = timeRTC + now.minute(), DEC;
  timeRTC = timeRTC + ":";
  // Second
  timeRTC = timeRTC + now.second(), DEC;
  
}

getRot.ino

// Rotary Switch
// isRot - iRotVal - Value
void isRot() {
  
  // Rotary Switch
  z = analogRead( iRotNum );
  
  // Rotary Switch - 10 Position
  // Number 1 => 10
  if ( z >= 3600 ) {

    // Z
    iRotVal = 10;
    
  } else if ( z >= 3200 ) {

    // Z
    iRotVal = 9;
    
  } else if ( z >= 2700 ) {

    // Z
    iRotVal = 8;
    
  } else if ( z >= 2400 ) {

    // Z
    iRotVal = 7;
    
  } else if ( z >= 2000 ) {

    // Z
    iRotVal = 6;
    
  } else if ( z >= 1600 ) {

    // Z
    iRotVal = 5;
    
  } else if ( z >= 1200 ) {

    // Z
    iRotVal = 4;
    
  } else if ( z >= 900 ) {

    // Z
    iRotVal = 3;
    
  } else if ( z >= 500 ) {

    // Z
    iRotVal = 2;
    
  } else {

    // Z
    iRotVal = 1;
    
  }

  // Range Value
  switch ( iRotVal ) {
    case 1:

      // Display Date, Time
      isDisplayDate();
       
      break;
    case 2:

      // Display GPS
      isDisplayGPS();
         
      break;
    case 3:

      // GPS Date, Time, Speed, Altitude
      //isDisplayGPSDate();
      
      break;  
    case 4:
      
      // GPS Display Date, Time, Speed
      isDisplayGPSDate();
      
      break;
    case 5:
      
      // Display BME280
      isDisplayBME280();
      
      break;
    case 6:
      
      // Display CCS811 - eCO2 & tVOC
      isDisplayCCS811();
      
      break;       
    case 7:

      // Z
      isDisplayZ();
      
      break; 
    case 8:
         
      // Z
      isDisplayZ();
      
      break; 
    case 9:
      
      // Z
      isDisplayZ();
      
      break;
    case 10:

      // Z
      isDisplayZ();
      
      break;
  }
  
}

getSD.ino

// MicroSD Card
// MicroSD Setup
void setupSD() {

    // MicroSD Card
    pinMode( chipSelect , OUTPUT );
    if(!SD.begin( chipSelect )){
        ;  
        return;
    }
    
    uint8_t cardType = SD.cardType();

    // CARD NONE
    if(cardType == CARD_NONE){
        ; 
        return;
    }

    // SD Card Type
    if(cardType == CARD_MMC){
        ; 
    } else if(cardType == CARD_SD){
        ; 
    } else if(cardType == CARD_SDHC){
        ; 
    } else {
        ; 
    } 

    // Size
    uint64_t cardSize = SD.cardSize() / (1024 * 1024);
 
}
// MicroSD Card
void isSD() {

  zzzzzz = "";

  // EEPROM Unique ID|Version|Date|Time|GPS Status|Target Latitude|Target Longitude|GPS Date|GPS Time|GPS Speed M/S|GPS Speed Km/h|GPS Altitude|Temperature Celsius|Humidity|Altitude Meters|Barometric Pressure|eCO2 Concentration|tVOC Concentration|\r
  zzzzzz = uid + "|" + sver + "|" + dateRTC + "|" + timeRTC + "|" + GPSSt + "|" + TargetLat + "|" + TargetLon + "|" + TargetDat + "|" + TargetTim + "|" + TargetSMS + "|" + TargetSKH + "|" + TargetALT  + "|" + BMEtempC + "|" + BMEhumid + "|" + BMEaltitudeM + "|" + BMEpressure + "|" + CCS811CO2 + "|" + CCS811TVOC +  + "|\r";

  // msg + 1
  char msg[zzzzzz.length() + 1];

  zzzzzz.toCharArray(msg, zzzzzz.length() + 1);

  // Append File
  appendFile(SD, "/espdata.txt", msg );
  
}
// List Dir
void listDir(fs::FS &fs, const char * dirname, uint8_t levels){
    
    // List Dir
    dirname;
    
    File root = fs.open(dirname);
    
    if(!root){
        return;
    }
    
    if(!root.isDirectory()){
        return;
    }

    File file = root.openNextFile();
    
    while(file){
        if(file.isDirectory()){
            file.name();
            if(levels){
                listDir(fs, file.name(), levels -1);
            }
        } else {
            file.name();
            file.size();
        }
        file = root.openNextFile();
    }
    
}
// Write File
void writeFile(fs::FS &fs, const char * path, const char * message){
    
    // Write File
    path;
    
    File file = fs.open(path, FILE_WRITE);
    
    if(!file){
        return;
    }
    
    if(file.print(message)){
        ;  
    } else {
        ;  
    }
    
    file.close();
    
}
// Append File
void appendFile(fs::FS &fs, const char * path, const char * message){
    
    // Append File
    path;
    
    File file = fs.open(path, FILE_APPEND);
    
    if(!file){
        return;
    }
    
    if(file.print(message)){
        ;  
    } else {
        ;  
    }
    
    file.close();
    
}

setup.ino

// Setup
void setup()
{
  
  // EEPROM Size
  EEPROM.begin(EEPROM_SIZE);
  
  // EEPROM Unique ID
  isUID();
  
  // GPS Receiver
  // Setup GPS
  setupGPS();

  // Set up I2C bus
  Wire.begin();

  // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure
  myBME280.begin();
  
  // CCS811 - eCO2 & tVOC
  myCCS811.begin();
  
  // SHARP Display Start & Clear the Display
  display.begin();
  // Clear Display
  display.clearDisplay();

  // Date & Time RTC
  // PCF8523 Precision RTC
  isDisplayUID();
  
  // Setup RTC
  setupRTC();

  //MicroSD Card
  setupSD();

  // Initialize the LED Green
  pinMode(iLEDGreen, OUTPUT);

  // Slide Switch
  pinMode(iSS1, INPUT);

  delay( 5000 );
  
}

People can contact us: https://www.donluc.com/?page_id=1927

Technology Experience

  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
  • IoT
  • Robotics
  • Research & Development (R & D)
  • Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
  • Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
  • Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
  • Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
  • Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
  • Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
  • eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)

Instructor

  • PIC Microcontrollers
  • Arduino
  • Raspberry Pi
  • Espressif
  • Robotics
  • DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
  • Linux-Apache-PHP-MySQL

Follow Us

J. Luc Paquin – Curriculum Vitae – 2021 English & Español
https://www.jlpconsultants.com/CV/LucPaquinCVEngMk2021c.pdf
https://www.jlpconsultants.com/CV/LucPaquinCVEspMk2021c.pdf

Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Web: https://www.donluc.com/DLE/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: https://zoom.us/
Patreon: https://www.patreon.com/DonLucElectronics
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/

Don Luc

Project #19: Time – Adalogger FeatherWing – RTC + SD – Mk05

——

#DonLucElectronics #DonLuc #Time #RTC #Display #Adalogger #MicroSD #GPSReceiver #Arduino #ESP32 #SparkFunESP32WROOM #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog

——

Adalogger FeatherWing

——

Adalogger FeatherWing

——

Adalogger FeatherWing

——

Adalogger FeatherWing

——

Adalogger FeatherWing – RTC + SD

A Feather board without ambition is a Feather board without FeatherWings. This is the Adalogger FeatherWing: it adds both a battery-backed Real Time Clock and MicroSD card storage to any Feather main board. This FeatherWing will make it real easy to add datalogging to any of our existing Feathers. You get both an I2C Real Time Clock (PCF8523) with 32KHz crystal and battery backup, and a MicroSD socket that connects to the SPI port pins.

MicroSD Card

If you have a project with any audio, video, graphics, data logging, etc in it, you’ll find that having a removable storage option is essential. Most microcontrollers have extremely limited built-in storage. If you’re doing any sort of data logging, graphics or audio, you’ll need at least a megabyte of storage, and 64M is probably the minimum.

MicroSD cards are ‘raw’ storage. They’re just sectors in a flash chip, there’s no structure that you have to use. That means you could format an SD card to be a Linux filesystem, a FAT (DOS) filesystem or a Mac filesystem. You could also not have any filesystem at all. However, 99% of computers, cameras, MP3 players, GPS loggers, etc require FAT16 or FAT32 for the filesystem. The tradeoff here is that for smaller microcontrollers the addition of the complex file format handling can take a lot of flash storage and RAM.

DL2108Mk06

1 x SparkFun Thing Plus – ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x Adalogger FeatherWing – RTC + SD
1 x CR1220 3V Lithium Coin Cell Battery
1 x 32Gb microSD Card
1 x LED Green
1 x Rocker Switch – SPST (Round)
1 x Terminal Block Breakout FeatherWing
1 x Lithium Ion Battery – 850mAh
1 x GPS Receiver – GP-20U7
1 x Rotary Switch – 10 Position
1 x SparkFun Rotary Switch – 10 Position
1 x Black Knob
1 x Breadboard Solderable
12 x 1K Ohm
1 x Half-Size Breadboard
1 x SparkFun Cerberus USB Cable

SparkFun Thing Plus – ESP32 WROOM

SCK – Digital 13
MSI – Digital 12
SS0 – Digital 27
GRX – Digital 16
GTX – Digital 17
SDA – Digital 23
SDL – Digital 22
SCK – Digital 5
MSO – Digital 19
MSI – Digital 18
SS1 – Digital 33
LEG – Digital 21
SW0 – Digital 32
ROT – Analog A0
VIN – +3.3V
GND – GND

DL2108Mk06p.ino

/* 
***** Don Luc Electronics © *****
Software Version Information
Project #19: Time - Adalogger FeatherWing - RTC + SD - Mk05
08-06
DL2108Mk06p.ino
1 x SparkFun Thing Plus - ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x Adalogger FeatherWing - RTC + SD
1 x CR1220 3V Lithium Coin Cell Battery
1 x 32Gb microSD Card
1 x LED Green
1 x Rocker Switch - SPST (Round)
1 x Terminal Block Breakout FeatherWing
1 x Lithium Ion Battery - 850mAh
1 x GPS Receiver - GP-20U7
1 x Rotary Switch - 10 Position
1 x SparkFun Rotary Switch – 10 Position
1 x Black Knob
1 x Breadboard Solderable
12 x 1K Ohm
1 x Half-Size Breadboard
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code
// EEPROM Library to Read and Write EEPROM with Unique ID for Unit
#include "EEPROM.h"
// Wire
// #include <Wire.h>
// SHARP Memory Display
#include <Adafruit_SharpMem.h>
#include <Adafruit_GFX.h>
// Date and time RTC
#include "RTClib.h"
// GPS Receiver
#include <TinyGPS++.h>
// ESP32 Hardware Serial
#include <HardwareSerial.h>
// SD Card
#include "FS.h"
#include "SD.h"
#include "SPI.h"

// SHARP Memory Display
#define SHARP_SCK  13
#define SHARP_MOSI 12
#define SHARP_SS   27
// 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.
#define BLACK 0
#define WHITE 1

// Date and Time
// PCF8523 Precision RTC 
RTC_PCF8523 rtc;
// Date
String dateRTC = "";
// Time
String timeRTC = "";

// ESP32 HardwareSerial
HardwareSerial tGPS(2);

// GPS Receiver
#define gpsRXPIN 16
// This one is unused and doesnt have a conection
#define gpsTXPIN 17
// The TinyGPS++ object
TinyGPSPlus gps;
// Latitude
float TargetLat;
// Longitude
float TargetLon;
// GPS Date, Time, Speed, Altitude
// GPS Date
String TargetDat;
// GPS Time
String TargetTim;
// GPS Speeds M/S
String TargetSMS;
// GPS Speeds Km/h
String TargetSKH;
// GPS Altitude Meters
String TargetALT;
// GPS Status
String GPSSt = "";

// Rotary Switch - 10 Position
// Number 1 => 10
int iRotNum = A0;
// iRotVal - Value 
int iRotVal = 0;
// Number
int z = 0;

// MicroSD Card
const int chipSelect = 33;
String zzzzzz = "";

// LED Green
int iLEDGreen = 21;

// Rocker Switch - SPST (Round)
int iSS1 = 32;
// State
int iSS1State = 0;

// Software Version Information
// EEPROM Unique ID Information
#define EEPROM_SIZE 64
String uid = "";
// Version
String sver = "19-05";

void loop()
{
     
  // Dates and Time
  isRTC();

  // isGPS
  isGPS();

  // Rotary Switch
  isRot();

  // Slide Switch
  // Read the state of the iSS1 value
  iSS1State = digitalRead(iSS1);
  
  // If it is the Slide Switch State is HIGH
  if (iSS1State == HIGH) {

    // iLEDGreen HIGH
    digitalWrite(iLEDGreen,  HIGH );
    
    // MicroSD Card
    isSD();

  } else {

    // iLEDGreen LOW
    digitalWrite(iLEDGreen,  LOW );
  
  }

  delay( 1000 );
 
}

getDisplay.ino

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

    // Text Display 
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(3);
    display.setTextColor(BLACK);
    // Don Luc Electronics
    display.setCursor(0,10);
    display.println( "Don Luc" );
    display.setTextSize(2);
    display.setCursor(0,40);
    display.println( "Electronics" );
    // Version
    //display.setTextSize(3);
    display.setCursor(0,70);
    display.println( "Version" );
    //display.setTextSize(2);
    display.setCursor(0,95);   
    display.println( sver );
    // EEPROM
    display.setCursor(0,120);
    display.println( "EEPROM" );
    display.setCursor(0,140);   
    display.println( uid );
    // Refresh
    display.refresh();
    delay( 100 );
    
}
// Display Date
void isDisplayDate() {

    // Text Display Date
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // Date
    display.setCursor(0,5);
    display.println( "Date" );
    display.setCursor(0,30);
    display.println( dateRTC );
    // Time
    display.setCursor(0,55);
    display.println( "Time" );
    display.setCursor(0,75);
    display.println( timeRTC );
    // Refresh
    display.refresh();
    delay( 100 );

}
// Display GPS
void isDisplayGPS() {

    // Text Display Date
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // GPS Status
    display.setCursor(0,5);
    display.print( "GPS: " );
    display.println( GPSSt );
    // Target Latitude
    display.setCursor(0,25);
    display.println( "Latitude" );
    display.setCursor(0,45);
    display.println( TargetLat );
    // Target Longitude
    display.setCursor(0,65);
    display.println( "Longitude" );
    display.setCursor(0,90);
    display.println( TargetLon );
    // Refresh
    display.refresh();
    delay( 100 );

}
// GPS Date, Time, Speed, Altitude
void isDisplayGPSDate() {

    // Text Display Date
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // GPS
    display.setCursor(0,5);
    display.println( "GPS" );
    // Date
    display.setCursor(0,30);
    display.println( TargetDat );
    // Time
    display.setCursor(0,55);
    display.println( TargetTim );
    // Speed
    display.setCursor(0,75);
    display.print( "M/S: " );
    display.println( TargetSMS );
    display.setCursor(0,95);
    display.print( "Km/h: " );
    display.println( TargetSKH );
    display.setCursor(0,115);
    display.print( "Alt: " );
    display.println( TargetALT );
    // Refresh
    display.refresh();
    delay( 100 );

}
// Display Z
void isDisplayZ() {
    // Text Display Z
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(3);
    display.setTextColor(BLACK);
    // Z
    display.setCursor(0,10);
    display.print( "Z: " );
    display.println( z );
    // Refresh
    display.refresh();
    delay( 100 );
}

getEEPROM.ino

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

getGPS.ino

// GPS Receiver
// Setup GPS
void setupGPS() {

  // Setup GPS
  tGPS.begin(  9600 , SERIAL_8N1 , gpsRXPIN , gpsTXPIN );
  
}
// isGPS
void isGPS(){

  // Receives NEMA data from GPS receiver
  // This sketch displays information every time a new sentence is correctly encoded
  while ( tGPS.available() > 0)
    
    if (gps.encode( tGPS.read() ))
    {
     
       // GPS Vector Pointer Target
       displayInfo();
       // GPS Date, Time, Speed, Altitude
       displayDTS();
       
    }
  
  if (millis() > 5000 && gps.charsProcessed() < 10)
  {
   
     while(true);
    
  }

}
// GPS Vector Pointer Target
void displayInfo(){

  // Location
  if (gps.location.isValid())
  {
    
     // Latitude
     TargetLat = gps.location.lat();
     // Longitude
     TargetLon = gps.location.lng();
     // GPS Status 2
     GPSSt = "Yes";
    
  }
  else
  {

     // GPS Status 0
     GPSSt = "No";
    
  }

}
// GPS Date, Time, Speed, Altitude
void displayDTS(){

  // Date
  TargetDat = ""; 
  if (gps.date.isValid())
  {
    
     // Date
     // Year
     TargetDat += String(gps.date.year(), DEC);
     TargetDat += "/";
     // Month
     TargetDat += String(gps.date.month(), DEC);
     TargetDat += "/";
     // Day
     TargetDat += String(gps.date.day(), DEC);
    
  }

  // Time
  TargetTim = "";
  if (gps.time.isValid())
  {
    
     // Time
     // Hour
     TargetTim += String(gps.time.hour(), DEC);
     TargetTim += ":";
     // Minute
     TargetTim += String(gps.time.minute(), DEC);
     TargetTim += ":";
     // Secound
     TargetTim += String(gps.time.second(), DEC);
    
  }

  // Speed
  TargetSMS = "";
  TargetSKH = "";
  if (gps.speed.isValid())
  {
    
     // Speed
     // M/S
     int x = gps.speed.mps();
     TargetSMS = String( x, DEC);
     // Km/h
     int y = gps.speed.kmph();
     TargetSKH = String( y, DEC);

  }

  // Altitude
  TargetALT = "";
  if (gps.altitude.isValid())
  {
    
     // Altitude
     // Meters
     int z = gps.altitude.meters();
     TargetALT = String( z, DEC);

  }
  
}

getRTC.ino

// Date & Time
// PCF8523 Precision RTC
void setupRTC() {

  // Date & Time
  // pcf8523 Precision RTC   
  if (! rtc.begin()) {
    while (1);
  }  
  
  if (! rtc.initialized()) {
    
    // Following line sets the RTC to the date & time this sketch was compiled
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date & time, for example to set
    // January 21, 2014 at 3am you would call:
    // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
    // rtc.adjust(DateTime(2021, 8, 16, 12, 27, 0));
    
  }
  
}
// Date and Time RTC PCF8523
void isRTC () {

  // Date and Time
  dateRTC = "";
  timeRTC = "";
  DateTime now = rtc.now();
  
  // Date
  // Year
  dateRTC = now.year(), DEC; 
  dateRTC = dateRTC + "/";
  // Month
  dateRTC = dateRTC + now.month(), DEC;
  dateRTC = dateRTC + "/";
  // Day
  dateRTC = dateRTC + now.day(), DEC;
  
  // Time
  // Hour
  timeRTC = now.hour(), DEC;
  timeRTC = timeRTC + ":";
  // Minute
  timeRTC = timeRTC + now.minute(), DEC;
  timeRTC = timeRTC + ":";
  // Second
  timeRTC = timeRTC + now.second(), DEC;
  
}

getRot.ino

// Rotary Switch
// isRot - iRotVal - Value
void isRot() {
  
  // Rotary Switch
  z = analogRead( iRotNum );
  
  // Rotary Switch - 10 Position
  // Number 1 => 10
  if ( z >= 3500 ) {

    // Z
    iRotVal = 10;
    
  } else if ( z >= 3000 ) {

    // Z
    iRotVal = 9;
    
  } else if ( z >= 2600 ) {

    // Z
    iRotVal = 8;
    
  } else if ( z >= 2300 ) {

    // Z
    iRotVal = 7;
    
  } else if ( z >= 1900 ) {

    // Z
    iRotVal = 6;
    
  } else if ( z >= 1500 ) {

    // Z
    iRotVal = 5;
    
  } else if ( z >= 1200 ) {

    // Z
    iRotVal = 4;
    
  } else if ( z >= 800 ) {

    // Z
    iRotVal = 3;
    
  } else if ( z >= 400 ) {

    // Z
    iRotVal = 2;
    
  } else {

    // Z
    iRotVal = 1;
    
  }

  // Range Value
  switch ( iRotVal ) {
    case 1:

      // Display Date, Time
      isDisplayDate();
       
      break;
    case 2:

      // Display GPS
      isDisplayGPS();
         
      break;
    case 3:

      // GPS Date, Time, Speed, Altitude
      //isDisplayGPSDate();
      
      break;  
    case 4:
      
      // GPS Display Date, Time, Speed
      isDisplayGPSDate();
      
      break;
    case 5:
      
      // Z
      isDisplayZ();
      
      break;
    case 6:
      
      // Z
      isDisplayZ();
      
      break;       
    case 7:

      // Z
      isDisplayZ();
      
      break; 
    case 8:
         
      // Z
      isDisplayZ();
      
      break; 
    case 9:
      
      // Z
      isDisplayZ();
      
      break;
    case 10:

      // Z
      isDisplayZ();
      
      break;
  }
  
}

getSD.ino

// MicroSD Card
// MicroSD Setup
void setupSD() {

    // MicroSD Card
    pinMode( chipSelect , OUTPUT );
    if(!SD.begin( chipSelect )){
        ;  
        return;
    }
    
    uint8_t cardType = SD.cardType();

    // CARD NONE
    if(cardType == CARD_NONE){
        ; 
        return;
    }

    // SD Card Type
    if(cardType == CARD_MMC){
        ; 
    } else if(cardType == CARD_SD){
        ; 
    } else if(cardType == CARD_SDHC){
        ; 
    } else {
        ; 
    } 

    // Size
    uint64_t cardSize = SD.cardSize() / (1024 * 1024);
 
}
// MicroSD Card
void isSD() {

  zzzzzz = "";

  // EEPROM Unique ID|Version|Date|Time|GPS Status|Target Latitude|Target Longitude|GPS Date|GPS Time|GPS Speed M/S|GPS Speed Km/h|GPS Altitude|\r
  zzzzzz = uid + "|" + sver + "|" + dateRTC + "|" + timeRTC + "|" + GPSSt + "|" + TargetLat + "|" + TargetLon + "|" + TargetDat + "|" + TargetTim + "|" + TargetSMS + "|" + TargetSKH + "|" + TargetALT + "|\r";

  // msg + 1
  char msg[zzzzzz.length() + 1];

  zzzzzz.toCharArray(msg, zzzzzz.length() + 1);

  // Append File
  appendFile(SD, "/espdata.txt", msg );
  
}
// List Dir
void listDir(fs::FS &fs, const char * dirname, uint8_t levels){
    
    // List Dir
    dirname;
    
    File root = fs.open(dirname);
    
    if(!root){
        return;
    }
    
    if(!root.isDirectory()){
        return;
    }

    File file = root.openNextFile();
    
    while(file){
        if(file.isDirectory()){
            file.name();
            if(levels){
                listDir(fs, file.name(), levels -1);
            }
        } else {
            file.name();
            file.size();
        }
        file = root.openNextFile();
    }
    
}
// Write File
void writeFile(fs::FS &fs, const char * path, const char * message){
    
    // Write File
    path;
    
    File file = fs.open(path, FILE_WRITE);
    
    if(!file){
        return;
    }
    
    if(file.print(message)){
        ;  
    } else {
        ;  
    }
    
    file.close();
    
}
// Append File
void appendFile(fs::FS &fs, const char * path, const char * message){
    
    // Append File
    path;
    
    File file = fs.open(path, FILE_APPEND);
    
    if(!file){
        return;
    }
    
    if(file.print(message)){
        ;  
    } else {
        ;  
    }
    
    file.close();
    
}

setup.ino

// Setup
void setup()
{
  
  // EEPROM Size
  EEPROM.begin(EEPROM_SIZE);
  
  // EEPROM Unique ID
  isUID();
  
  // GPS Receiver
  // Setup GPS
  setupGPS();

  // Set up I2C bus
  // Wire.begin();

  // SHARP Display Start & Clear the Display
  display.begin();
  // Clear Display
  display.clearDisplay();

  // Date & Time RTC
  // PCF8523 Precision RTC
  isDisplayUID();
  
  // Setup RTC
  setupRTC();

  //MicroSD Card
  setupSD();

  // Initialize the LED Green
  pinMode(iLEDGreen, OUTPUT);

  // Slide Switch
  pinMode(iSS1, INPUT);

  delay( 5000 );
  
}

——

People can contact us: https://www.donluc.com/?page_id=1927

Technology Experience

  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
  • IoT
  • Robotics
  • Research & Development (R & D)
  • Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
  • Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
  • Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
  • Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
  • Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
  • Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
  • eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)

Instructor

  • PIC Microcontrollers
  • Arduino
  • Raspberry Pi
  • Espressif
  • Robotics
  • DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
  • Linux-Apache-PHP-MySQL

Follow Us

J. Luc Paquin – Curriculum Vitae – 2021 English & Español
https://www.jlpconsultants.com/CV/LucPaquinCVEngMk2021c.pdf
https://www.jlpconsultants.com/CV/LucPaquinCVEspMk2021c.pdf

Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Web: https://www.donluc.com/DLE/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: https://zoom.us/
Patreon: https://www.patreon.com/DonLucElectronics
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/

Don Luc

Project #19: Time – Global Positioning System – Mk04

——

#DonLucElectronics #DonLuc #Time #DS3231PrecisionRTC #SHARPMemoryDisplay #GPSReceiver #Arduino #ESP32 #SparkFunThingPlusESP32WROOM #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog

——

Global Positioning System

——

Global Positioning System

——

Global Positioning System

——

Global Positioning System

——

Global Positioning System (GPS)

The Global Positioning System (GPS) is a satellite-based radionavigation system owned by the United States government and operated by the United States Space Force. It is one of the global navigation satellite systems (GNSS) that provides geolocation and time information to a GPS receiver anywhere on or near the Earth where there is an unobstructed line of sight to four or more GPS satellites. Obstacles such as mountains and buildings block the relatively weak GPS signals.

A satellite navigation device, colloquially called a GPS receiver, or simply a GPS, is a device that is capable of receiving information from GNSS satellites and then calculate the device’s geographical position. Using suitable software, the device may display the position on a map, and it may offer routing directions. The Global Positioning System (GPS) is one of a handful of global navigation satellite systems (GNSS) made up of a network of a minimum of 24, but currently 30, satellites placed into orbit by the U.S. Department of Defense.

A satellite navigation device can retrieve (from one or more satellite systems) location and time information in all weather conditions, anywhere on or near the Earth. GPS reception requires an unobstructed line of sight to four or more GPS satellites, and is subject to poor satellite signal conditions. Today, most standalone GPS receivers are used in automobiles. The GPS capability of smartphones may use assisted GPS (A-GPS) technology, which can use the base station or cell towers to provide a faster Time to First Fix (TTFF), especially when GPS signals are poor or unavailable. However, the mobile network part of the A-GPS technology would not be available when the smartphone is outside the range of the mobile reception network, while the GPS aspect would otherwise continue to be available.

DL2108Mk05

1 x SparkFun Thing Plus – ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x DS3231 Precision RTC FeatherWing
1 x CR1220 3V Lithium Coin Cell Battery
1 x Terminal Block Breakout FeatherWing
1 x Lithium Ion Battery – 850mAh
1 x GPS Receiver – GP-20U7
1 x Mountable Slide Switch
1 x SparkFun Rotary Switch – 10 Position
1 x Black Knob
1 x Breadboard Solderable
11 x 1K Ohm
1 x Half-Size Breadboard
1 x SparkFun Cerberus USB Cable

SparkFun Thing Plus – ESP32 WROOM

SCK – Digital 13
MSI – Digital 12
SS0 – Digital 27
GRX – Digital 16
GTX – Digital 17
SDA – Digital 23
SDL – Digital 22
ROT – Analog A0
VIN – +3.3V
GND – GND

DL2108Mk05p.ino

/* 
***** Don Luc Electronics © *****
Software Version Information
Project #19: Time - Global Positioning System - Mk04
08-05
DL2108Mk05p.ino
1 x SparkFun Thing Plus - ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x DS3231 Precision RTC FeatherWing
1 x CR1220 3V Lithium Coin Cell Battery
1 x Terminal Block Breakout FeatherWing
1 x Lithium Ion Battery - 850mAh
1 x GPS Receiver - GP-20U7
1 x Mountable Slide Switch
1 x SparkFun Rotary Switch – 10 Position
1 x Black Knob
1 x Breadboard Solderable
11 x 1K Ohm
1 x Half-Size Breadboard
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code
// Wire
// #include <Wire.h>
// SHARP Memory Display
#include <Adafruit_SharpMem.h>
#include <Adafruit_GFX.h>
// Date and time DS3231 RTC
#include <RTClib.h>
// GPS Receiver
#include <TinyGPS++.h>
// ESP32 Hardware Serial
#include <HardwareSerial.h>

// SHARP Memory Display
#define SHARP_SCK  13
#define SHARP_MOSI 12
#define SHARP_SS   27
// 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.
#define BLACK 0
#define WHITE 1

// Date and time functions using a DS3231 RTC
RTC_DS3231 RTC;
// Date
String sDate;
// Time
String sTime;

// ESP32 HardwareSerial
HardwareSerial tGPS(2);

// GPS Receiver
#define gpsRXPIN 16
// This one is unused and doesnt have a conection
#define gpsTXPIN 17
// The TinyGPS++ object
TinyGPSPlus gps;
// Latitude
float TargetLat;
// Longitude
float TargetLon;
// GPS Date, Time, Speed, Altitude
// GPS Date
String TargetDat;
// GPS Time
String TargetTim;
// GPS Speeds M/S
String TargetSMS;
// GPS Speeds Km/h
String TargetSKH;
// GPS Altitude Meters
String TargetALT;
// GPS Status
String GPSSt = "";

// Rotary Switch - 10 Position
// Number 1 => 10
int iRotNum = A0;
// iRotVal - Value 
int iRotVal = 0;
// Number
int z = 0;

// Software Version Information
// Version
String sver = "19-04";

void loop()
{
     
  // Dates and Time
  timeRTC();

  // isGPS
  isGPS();

  // Rotary Switch
  isRot();

  delay( 1000 );
 
}

getDisplay.ino

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

    // Text Display 
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(3);
    display.setTextColor(BLACK);
    // Don Luc Electronics
    display.setCursor(0,10);
    display.println( "Don Luc" );
    display.setTextSize(2);
    display.setCursor(0,40);
    display.println( "Electronics" );
    // Version
    display.setTextSize(3);
    display.setCursor(0,70);
    display.println( "Version" );
    display.setTextSize(2);
    display.setCursor(0,100);   
    display.println( sver );
    // Refresh
    display.refresh();
    delay( 100 );
    
}
// Display Date
void isDisplayDate() {

    // Text Display Date
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // Date
    display.setCursor(0,5);
    display.println( "Date" );
    display.setCursor(0,30);
    display.println( sDate );
    // Time
    display.setCursor(0,55);
    display.println( "Time" );
    display.setCursor(0,75);
    display.println( sTime );
    // Refresh
    display.refresh();
    delay( 100 );

}
// Display GPS
void isDisplayGPS() {

    // Text Display Date
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // GPS Status
    display.setCursor(0,5);
    display.print( "GPS: " );
    display.println( GPSSt );
    // Target Latitude
    display.setCursor(0,25);
    display.println( "Latitude" );
    display.setCursor(0,45);
    display.println( TargetLat );
    // Target Longitude
    display.setCursor(0,65);
    display.println( "Longitude" );
    display.setCursor(0,90);
    display.println( TargetLon );
    // Refresh
    display.refresh();
    delay( 100 );

}
// GPS Date, Time, Speed, Altitude
void isDisplayGPSDate() {

    // Text Display Date
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // GPS
    display.setCursor(0,5);
    display.println( "GPS" );
    // Date
    display.setCursor(0,30);
    display.println( TargetDat );
    // Time
    display.setCursor(0,55);
    display.println( TargetTim );
    // Speed
    display.setCursor(0,75);
    display.print( "M/S: " );
    display.println( TargetSMS );
    display.setCursor(0,95);
    display.print( "Km/h: " );
    display.println( TargetSKH );
    display.setCursor(0,115);
    display.print( "Alt: " );
    display.println( TargetALT );
    // Refresh
    display.refresh();
    delay( 100 );

}
// Display Z
void isDisplayZ() {
    // Text Display Z
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(3);
    display.setTextColor(BLACK);
    // Z
    display.setCursor(0,10);
    display.print( "Z: " );
    display.println( z );
    // Refresh
    display.refresh();
    delay( 100 );
}

getGPS.ino

// GPS Receiver
// Setup GPS
void setupGPS() {

  // Setup GPS
  tGPS.begin(  9600 , SERIAL_8N1 , gpsRXPIN , gpsTXPIN );
  
}
// isGPS
void isGPS(){

  // Receives NEMA data from GPS receiver
  // This sketch displays information every time a new sentence is correctly encoded
  while ( tGPS.available() > 0)
    
    if (gps.encode( tGPS.read() ))
    {
     
       // GPS Vector Pointer Target
       displayInfo();
       // GPS Date, Time, Speed, Altitude
       displayDTS();
       
    }
  
  if (millis() > 5000 && gps.charsProcessed() < 10)
  {
   
     while(true);
    
  }

}
// GPS Vector Pointer Target
void displayInfo(){

  // Location
  if (gps.location.isValid())
  {
    
     // Latitude
     TargetLat = gps.location.lat();
     // Longitude
     TargetLon = gps.location.lng();
     // GPS Status 2
     GPSSt = "Yes";
    
  }
  else
  {

     // GPS Status 0
     GPSSt = "No";
    
  }

}
// GPS Date, Time, Speed, Altitude
void displayDTS(){

  // Date
  TargetDat = ""; 
  if (gps.date.isValid())
  {
    
     // Date
     // Year
     TargetDat += String(gps.date.year(), DEC);
     TargetDat += "/";
     // Month
     TargetDat += String(gps.date.month(), DEC);
     TargetDat += "/";
     // Day
     TargetDat += String(gps.date.day(), DEC);
    
  }

  // Time
  TargetTim = "";
  if (gps.time.isValid())
  {
    
     // Time
     // Hour
     TargetTim += String(gps.time.hour(), DEC);
     TargetTim += ":";
     // Minute
     TargetTim += String(gps.time.minute(), DEC);
     TargetTim += ":";
     // Secound
     TargetTim += String(gps.time.second(), DEC);
    
  }

  // Speed
  TargetSMS = "";
  TargetSKH = "";
  if (gps.speed.isValid())
  {
    
     // Speed
     // M/S
     int x = gps.speed.mps();
     TargetSMS = String( x, DEC);
     // Km/h
     int y = gps.speed.kmph();
     TargetSKH = String( y, DEC);

  }

  // Altitude
  TargetALT = "";
  if (gps.altitude.isValid())
  {
    
     // Altitude
     // Meters
     int z = gps.altitude.meters();
     TargetALT = String( z, DEC);

  }
  
}

getRTCDS3231.ino

// DS3231 Precision RTC
// Setup RTC
void setupRTC() {

  // DS3231 Precision RTC   
  RTC.begin();
  if (! RTC.begin()) {
    while (1);
  }
  
  // Date Time
  DateTime now = RTC.now();

  if (RTC.lostPower()) {
    
    // Following line sets the RTC to the date & time this sketch was compiled
    RTC.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date & time, for example to set
    // August 2, 2021 at 13:53:0 you would call:
    // RTC.adjust(DateTime(2021, 8, 2, 14, 11, 0));
    
  }
  
}
// timeRTC
void timeRTC() {

    // DS3231 Precision RTC
    sDate = "";
    sTime = "";
    // Date Time
    DateTime now = RTC.now();

    // sData
    sDate += String(now.year(), DEC);
    sDate += "/";
    sDate += String(now.month(), DEC);
    sDate += "/";
    sDate += String(now.day(), DEC);
  
    // sTime
    sTime += String(now.hour(), DEC);
    sTime += ":";
    sTime += String(now.minute(), DEC);
    sTime += ":";
    sTime += String(now.second(), DEC);

}

getRot.ino

// Rotary Switch
// isRot - iRotVal - Value
void isRot() {
  
  // Rotary Switch
  z = analogRead( iRotNum );
  
  // Rotary Switch - 10 Position
  // Number 1 => 10
  if ( z >= 3500 ) {

    // Z
    iRotVal = 10;
    
  } else if ( z >= 3000 ) {

    // Z
    iRotVal = 9;
    
  } else if ( z >= 2600 ) {

    // Z
    iRotVal = 8;
    
  } else if ( z >= 2300 ) {

    // Z
    iRotVal = 7;
    
  } else if ( z >= 1900 ) {

    // Z
    iRotVal = 6;
    
  } else if ( z >= 1500 ) {

    // Z
    iRotVal = 5;
    
  } else if ( z >= 1200 ) {

    // Z
    iRotVal = 4;
    
  } else if ( z >= 800 ) {

    // Z
    iRotVal = 3;
    
  } else if ( z >= 400 ) {

    // Z
    iRotVal = 2;
    
  } else {

    // Z
    iRotVal = 1;
    
  }

  // Range Value
  switch ( iRotVal ) {
    case 1:

      // Display Date, Time
      isDisplayDate();
       
      break;
    case 2:

      // Display GPS
      isDisplayGPS();
         
      break;
    case 3:

      // GPS Date, Time, Speed, Altitude
      //isDisplayGPSDate();
      
      break;  
    case 4:
      
      // GPS Display Date, Time, Speed
      isDisplayGPSDate();
      
      break;
    case 5:
      
      // Z
      isDisplayZ();
      
      break;
    case 6:
      
      // Z
      isDisplayZ();
      
      break;       
    case 7:
      
      // Z
      isDisplayZ();
      
      break; 
    case 8:
         
      // Z
      isDisplayZ();
      
      break; 
    case 9:
      
      // Z
      isDisplayZ();
      
      break;
    case 10:

      // Z
      isDisplayZ();
      
      break;
  }
  
}

setup.ino

// Setup
void setup()
{
  
  // GPS Receiver
  // Setup GPS
  setupGPS();

  // Set up I2C bus
  // Wire.begin();

  // SHARP Display Start & Clear the Display
  display.begin();
  // Clear Display
  display.clearDisplay();

  // Display UID
  isDisplayUID();
  
  // Setup RTC
  setupRTC();

  delay( 5000 );
  
}

——

People can contact us: https://www.donluc.com/?page_id=1927

Technology Experience

  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
  • IoT
  • Robotics
  • Research & Development (R & D)
  • Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
  • Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
  • Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
  • Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
  • Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
  • Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
  • eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)

Instructor

  • PIC Microcontrollers
  • Arduino
  • Raspberry Pi
  • Espressif
  • Robotics
  • DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
  • Linux-Apache-PHP-MySQL

Follow Us

J. Luc Paquin – Curriculum Vitae – 2021 English & Español
https://www.jlpconsultants.com/CV/LucPaquinCVEngMk2021c.pdf
https://www.jlpconsultants.com/CV/LucPaquinCVEspMk2021c.pdf

Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Web: https://www.donluc.com/DLE/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: https://zoom.us/
Patreon: https://www.patreon.com/DonLucElectronics
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/

Don Luc

Project #19: Time – GPS Receiver – GP-20U7 – Mk03

——

#DonLucElectronics #DonLuc #Time #DS3231PrecisionRTC #SHARPMemoryDisplay #GPSReceiver #Arduino #ESP32 #SparkFunThingPlusESP32WROOM #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog

——

GPS Receiver

——

GPS Receiver

——

GPS Receiver

——

GPS Receiver

——

GPS Receiver

——

GPS Receiver – GP-20U7

The GP-20U7 is a compact GPS receiver with a built-in high performances all-in-one GPS chipset. The GP-20U7 accurately provides position, velocity, and time readings as well possessing high sensitivity and tracking capabilities. Thanks to the low power consumption this receiver requires, the GP-20U7 is ideal for portable applications such as tablet PCs, smart phones, and other devices requiring positioning capability.

This 56-channel GPS module, that supports a standard NMEA-0183 and uBlox 7 protocol, has low power consumption of 40mA@3.3V (max), an antenna on board, and -162dBm tracking sensitivity. With 56 channels in search mode and 22 channels “all-in-view” tracking, the GP-20U7 is quite the work horse for its size.

This one is unused and doesnt have a conection TX pin.

NMEA V3.01 Protocol

  • Its output signal level is TTL: 9600bps (default), 8 bit data, 1 stop bit and no parity
  • It supports the following NMEA-0183
  • Messages: GGA, GLL, GSA, GSV, RMC and VTG

NMEA-0183 Output Messages

  • NMEA: Record Description
  • GGA: Global positoning system fixed data
  • GLL: Geogrphic position – latitude / longitude
  • GSA: GNSS DOP and active satellites
  • GSV: GNSS satellites in view
  • RMC: Recommended minimum specific GNSS data
  • VTG: Course over ground and ground speed

DL2108Mk03

1 x SparkFun Thing Plus – ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x DS3231 Precision RTC FeatherWing
1 x CR1220 3V Lithium Coin Cell Battery
1 x Terminal Block Breakout FeatherWing
1 x Lithium Ion Battery – 850mAh
1 x GPS Receiver – GP-20U7
1 x Half-Size Breadboard
1 x SparkFun Cerberus USB Cable

SparkFun Thing Plus – ESP32 WROOM

SCK – Digital 13
MSI – Digital 12
SS0 – Digital 27
GRX – Digital 16
GTX – Digital 17
SDA – Digital 23
SDL – Digital 22
VIN – +3.3V
GND – GND

DL2108Mk03p.ino

/* 
***** Don Luc Electronics © *****
Software Version Information
Project #19: Time -GPS Receiver - GP-20U7 - Mk03
08-03
DL2108Mk03p.ino
1 x SparkFun Thing Plus - ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x DS3231 Precision RTC FeatherWing
1 x CR1220 3V Lithium Coin Cell Battery
1 x Terminal Block Breakout FeatherWing
1 x Lithium Ion Battery - 850mAh
1 x GPS Receiver - GP-20U7
1 x Half-Size Breadboard
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code
// Wire
// #include <Wire.h>
// SHARP Memory Display
#include <Adafruit_SharpMem.h>
#include <Adafruit_GFX.h>
// Date and time DS3231 RTC
#include <RTClib.h>
// GPS Receiver
#include <TinyGPS++.h>
// ESP32 Hardware Serial
#include <HardwareSerial.h>

// SHARP Memory Display
#define SHARP_SCK  13
#define SHARP_MOSI 12
#define SHARP_SS   27
// 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.
#define BLACK 0
#define WHITE 1

// Date and time functions using a DS3231 RTC
RTC_DS3231 RTC;
String sDate;
String sTime;

// ESP32 HardwareSerial
HardwareSerial tGPS(2);

// GPS Receiver
#define gpsRXPIN 16
// This one is unused and doesnt have a conection
#define gpsTXPIN 17
// The TinyGPS++ object
TinyGPSPlus gps;
float TargetLat;
float TargetLon;
int GPSStatus = 0;
String GPSSt = "";

// Software Version Information
// Version
String sver = "19-03";

void loop()
{
     
  // Dates and Time
  timeRTC();

  // isGPS
  isGPS();

  // Display Date, Time, GPS
  isDisplayDate();

  delay( 1000 );
 
}

getDisplay.ino

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

    // Text Display 
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(3);
    display.setTextColor(BLACK);
    // Don Luc Electronics
    display.setCursor(0,10);
    display.println( "Don Luc" );
    display.setTextSize(2);
    display.setCursor(0,40);
    display.println( "Electronics" );
    // Version
    display.setTextSize(3);
    display.setCursor(0,70);
    display.println( "Version" );
    display.setTextSize(2);
    display.setCursor(0,100);   
    display.println( sver );
    // Refresh
    display.refresh();
    delay( 100 );
    
}
// Display Date
void isDisplayDate() {

    // Text Display Date
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // Date
    display.setCursor(0,5);
    display.println( sDate );
    // Time
    display.setCursor(0,30);
    display.println( sTime );
    // GPS Status
    display.setCursor(0,55);
    display.print( "GPS: " );
    display.println( GPSSt );
    // Target Latitude
    display.setCursor(0,75);
    display.println( "Latitude" );
    display.setCursor(0,100);
    display.println( TargetLat );
    // Target Longitude
    display.setCursor(0,120);
    display.println( "Longitude" );
    display.setCursor(0,145);
    display.println( TargetLon );
    // Refresh
    display.refresh();
    delay( 100 );

}

getGPS.ino

// GPS Receiver
// Setup GPS
void setupGPS() {

  // Setup GPS
  tGPS.begin(  9600 , SERIAL_8N1 , gpsRXPIN , gpsTXPIN );
  
}
// isGPS
void isGPS(){

  // Receives NEMA data from GPS receiver
  // This sketch displays information every time a new sentence is correctly encoded
  while ( tGPS.available() > 0)
    
    if (gps.encode( tGPS.read() ))
    {
     
       // GPS Vector Pointer Target
       displayInfo();
      
    }
  
  if (millis() > 5000 && gps.charsProcessed() < 10)
  {
   
     while(true);
    
  }

}
// GPS Vector Pointer Target
void displayInfo(){

  // Location
  if (gps.location.isValid())
  {
    
     // Latitude
     TargetLat = gps.location.lat();
     // Longitude
     TargetLon = gps.location.lng();
     // GPS Status 2
     GPSStatus = 2;
     GPSSt = "Yes";
    
  }
  else
  {

     // GPS Status 0
     GPSStatus = 0;
     GPSSt = "No";
    
  }

}

getRTCDS3231.ino

// DS3231 Precision RTC
// Setup RTC
void setupRTC() {

  // DS3231 Precision RTC   
  RTC.begin();
  if (! RTC.begin()) {
    while (1);
  }
  
  // Date Time
  DateTime now = RTC.now();

  if (RTC.lostPower()) {
    
    // Following line sets the RTC to the date & time this sketch was compiled
    RTC.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date & time, for example to set
    // August 2, 2021 at 13:53:0 you would call:
    // RTC.adjust(DateTime(2021, 8, 2, 14, 11, 0));
    
  }
  
}
// timeRTC
void timeRTC() {

    // DS3231 Precision RTC
    sDate = "";
    sTime = "";
    // Date Time
    DateTime now = RTC.now();

    // sData
    sDate += String(now.year(), DEC);
    sDate += "/";
    sDate += String(now.month(), DEC);
    sDate += "/";
    sDate += String(now.day(), DEC);
  
    // sTime
    sTime += String(now.hour(), DEC);
    sTime += ":";
    sTime += String(now.minute(), DEC);
    sTime += ":";
    sTime += String(now.second(), DEC);

}

setup.ino

// Setup
void setup()
{
  
  // GPS Receiver
  // Setup GPS
  setupGPS();

  // Set up I2C bus
  // Wire.begin();

  // SHARP Display Start & Clear the Display
  display.begin();
  // Clear Display
  display.clearDisplay();

  // Display UID
  isDisplayUID();
  
  // Setup RTC
  setupRTC();

  delay( 5000 );
  
}

——

People can contact us: https://www.donluc.com/?page_id=1927

Technology Experience

  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
  • IoT
  • Robotics
  • Research & Development (R & D)
  • Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
  • Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
  • Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
  • Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
  • Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
  • Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
  • eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)

Instructor

  • PIC Microcontrollers
  • Arduino
  • Raspberry Pi
  • Espressif
  • Robotics
  • DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
  • Linux-Apache-PHP-MySQL

Follow Us

J. Luc Paquin – Curriculum Vitae – 2021 English & Español
https://www.jlpconsultants.com/CV/LucPaquinCVEngMk2021c.pdf
https://www.jlpconsultants.com/CV/LucPaquinCVEspMk2021c.pdf

Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Web: https://www.donluc.com/DLE/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: https://zoom.us/
Patreon: https://www.patreon.com/DonLucElectronics
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/

Don Luc

Project #19: Time – SHARP Memory Display – Mk02

——

#DonLucElectronics #DonLuc #Time #DS3231PrecisionRTC #SHARPMemoryDisplay #Arduino #ESP32 #SparkFunThingPlusESP32WROOM #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog

——

SHARP Memory Display

——

SHARP Memory Display

——

SHARP Memory Display

——

SHARP Memory Display

——

Adafruit SHARP Memory Display Breakout – 1.3 Inches – 168 Pixels x 144 Pixels Monochrome

The 1.3 inches 168 pixels x 144 pixels SHARP Memory LCD display is a cross between an eInk display and an LCD. It has the ultra-low power usage of eInk and the fast-refresh rates of an LCD. This model has a gray background, and pixels show up as black-on-gray for a nice e-reader type display. It does not have a backlight, but it is daylight readable. For dark/night reading you may need to illuminate the LCD area with external LEDs.

The display is write only which means that it only needs 3 pins to send data. However, the downside of a write-only display is that the entire 168×144 bits must be buffered by the microcontroller driver. That means you cannot use this with an ATmega328 or ATmega32u4. You must use a high-RAM chip such as ATSAMD21, Teensy 3, ESP8266, ESP32, etc. On those chips, this display works great and looks wonderful.

DL2108Mk02

1 x SparkFun Thing Plus – ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x DS3231 Precision RTC FeatherWing
1 x CR1220 3V Lithium Coin Cell Battery
1 x Terminal Block Breakout FeatherWing
1 x Lithium Ion Battery – 850mAh
1 x Half-Size Breadboard
1 x SparkFun Cerberus USB Cable

SparkFun Thing Plus – ESP32 WROOM

SCK – Digital 13
MSI – Digital 12
SS0 – Digital 27
SDA – Digital 23
SDL – Digital 22
VIN – +3.3V
GND – GND

DL2108Mk02p.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #19: Time -SHARP Memory Display - Mk02
08-02
DL2108Mk02p.ino
1 x SparkFun Thing Plus - ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x DS3231 Precision RTC FeatherWing
1 x CR1220 3V Lithium Coin Cell Battery
1 x Terminal Block Breakout FeatherWing
1 x Qwiic Cable - 50mm
1 x Lithium Ion Battery - 850mAh
1 x Half-Size Breadboard
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code
#include <Wire.h>
// SHARP Memory Display
#include <Adafruit_SharpMem.h>
#include <Adafruit_GFX.h>
// Date and time DS3231 RTC
#include <RTClib.h>

// SHARP Memory Display
#define SHARP_SCK  13
#define SHARP_MOSI 12
#define SHARP_SS   27
// 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.
#define BLACK 0
#define WHITE 1

// Set this to 1000 to get _about_ 1 second timing
const int CLOCK_SPEED = 1000;
// Last Draw
unsigned long lastDraw = 0;

// Date and time functions using a DS3231 RTC
RTC_DS3231 RTC;
String sDate;
String sTime;

// Software Version Information
// Version
String sver = "19-02";

void loop()
{
  
  // Check if we need to update date, time
  if (lastDraw + CLOCK_SPEED < millis())
  {
    
    // Last Draw
    lastDraw = millis();
    
    // Dates and Time
    timeRTC();

    // is OLED
    //isOLED();
    isDisplayDate();
    
  }
  
}

getDisplay.ino

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

    // Text Display 
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(3);
    display.setTextColor(BLACK);
    // Don Luc Electronics
    display.setCursor(0,10);
    display.println( "Don Luc" );
    display.setTextSize(2);
    display.setCursor(0,40);
    display.println( "Electronics" );
    // Version
    display.setTextSize(3);
    display.setCursor(0,70);
    display.println( "Version" );
    display.setTextSize(2);
    display.setCursor(0,100);   
    display.println( sver );
    // Refresh
    display.refresh();
    delay( 100 );
    
}
// Display Date
void isDisplayDate() {

    // Text Display Date
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // Date
    display.setCursor(0,5);
    display.println( sDate );
    // Time
    display.setCursor(0,30);
    display.println( sTime );
    // Refresh
    display.refresh();
    delay( 100 );

}

getRTCDS3231.ino

// DS3231 Precision RTC
// Setup RTC
void setupRTC() {

  // DS3231 Precision RTC   
  RTC.begin();
  if (! RTC.begin()) {
    while (1);
  }
  
  DateTime now = RTC.now();

  if (RTC.lostPower()) {
    
    // Following line sets the RTC to the date & time this sketch was compiled
    RTC.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date & time, for example to set
    // August 2, 2021 at 13:53:0 you would call:
    // RTC.adjust(DateTime(2021, 8, 2, 14, 11, 0));
    
  }
  
}
// timeRTC
void timeRTC() {

    // DS3231 Precision RTC
    sDate = "";
    sTime = "";
    // Date Time
    DateTime now = RTC.now();

    // sData
    sDate += String(now.year(), DEC);
    sDate += "/";
    sDate += String(now.month(), DEC);
    sDate += "/";
    sDate += String(now.day(), DEC);
  
    // sTime
    sTime += String(now.hour(), DEC);
    sTime += ":";
    sTime += String(now.minute(), DEC);
    sTime += ":";
    sTime += String(now.second(), DEC);

}

setup.ino

// Setup
void setup()
{
  
  // Give display time to power on
  delay(100);

  // Set up I2C bus
  Wire.begin();

  // SHARP Display Start & Clear the Display
  display.begin();
  // Clear Display
  display.clearDisplay();

  // Display UID
  isDisplayUID();
  
  // Setup RTC
  setupRTC();

  delay( 5000 );
  
}

People can contact us: https://www.donluc.com/?page_id=1927

Technology Experience

  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
  • IoT
  • Robotics
  • Research & Development (R & D)
  • Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
  • Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
  • Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
  • Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
  • Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
  • Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
  • eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)

Instructor

  • PIC Microcontrollers
  • Arduino
  • Raspberry Pi
  • Espressif
  • Robotics
  • DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
  • Linux-Apache-PHP-MySQL

Follow Us

J. Luc Paquin – Curriculum Vitae – 2021 English & Español
https://www.jlpconsultants.com/CV/LucPaquinCVEngMk2021c.pdf
https://www.jlpconsultants.com/CV/LucPaquinCVEspMk2021c.pdf

Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Web: https://www.donluc.com/DLE/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: https://zoom.us/
Patreon: https://www.patreon.com/DonLucElectronics
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/

Don Luc

Project #19: Time – DS3231 Precision RTC – Mk01

——

#DonLucElectronics #DonLuc #Time #DS3231PrecisionRTC #Arduino #ESP32 #SparkFunThingPlusESP32WROOM #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog

——

Time

——

Time

——

Time

——

Time

——

DS3231 Precision RTC FeatherWing

A Feather board without ambition is a Feather board without FeatherWings. This is the DS3231 Precision RTC FeatherWing: it adds an extremely accurate I2C-integrated Real Time Clock (RTC) with a Temperature Compensated Crystal Oscillator (TCXO) to any Feather main board. This RTC is the most precise you can get in a small, low power package. Most RTCs use an external 32kHz timing crystal that is used to keep time with low current draw. And that’s all well and good, but those crystals have slight drift, particularly when the temperature changes. This RTC is in a beefy package because the crystal is inside the chip. And right next to the integrated crystal is a temperature sensor. That sensor compensates for the frequency changes by adding or removing clock ticks so that the timekeeping stays on schedule.

SparkFun Micro OLED Breakout (Qwiic)

The SparkFun Qwiic Micro OLED Breakout is a Qwiic-enabled version of our popular Micro OLED display. The small monochrome, blue-on-black OLED screen presents incredibly clear images for your viewing pleasure. The OLED display is crisp, and you can fit a deceivingly large amount of graphics on there. This breakout is perfect for adding graphics to your next project and displaying diagnostic information without resorting to a serial output, all with the ease of use of our own Qwiic Connect System.

DL2108Mk01

1 x SparkFun Thing Plus – ESP32 WROOM
1 x SparkFun Micro OLED Breakout (Qwiic)
1 x DS3231 Precision RTC FeatherWing
1 x CR1220 3V Lithium Coin Cell Battery
1 x Terminal Block Breakout FeatherWing
1 x Qwiic Cable – 50mm
1 x Lithium Ion Battery – 850mAh
1 x Half-Size Breadboard
1 x SparkFun Cerberus USB Cable

SparkFun Thing Plus – ESP32 WROOM

DIS – Qwiic
SDA – Digital 23
SDL – Digital 22
VIN – +3.3V
GND – GND

DL2108Mk01p.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #19: Time - DS3231 Precision RTC - Mk01
08-01
DL2108Mk01p.ino
1 x SparkFun Thing Plus - ESP32 WROOM
1 x SparkFun Micro OLED Breakout (Qwiic)
1 x DS3231 Precision RTC FeatherWing
1 x CR1220 3V Lithium Coin Cell Battery
1 x Terminal Block Breakout FeatherWing
1 x Qwiic Cable - 50mm
1 x Lithium Ion Battery - 850mAh
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code
#include <Wire.h>
// OLED
#include <SFE_MicroOLED.h>
// Date and time DS3231 RTC
#include <RTClib.h>

// OLED
// DC Jumper
#define DC_JUMPER 1
// Optional - Connect RST on display to pin 9 on Arduino
#define PIN_RESET 9
MicroOLED oled(PIN_RESET, DC_JUMPER);

// Set this to 1000 to get _about_ 1 second timing
const int CLOCK_SPEED = 1000;
// Last Draw
unsigned long lastDraw = 0;

// Date and time functions using a DS3231 RTC
RTC_DS3231 RTC;
String sDate;
String sTime;

// Software Version Information
// Version
String sver = "19-01";

void loop()
{
  // Check if we need to update date, time
  if (lastDraw + CLOCK_SPEED < millis())
  {
    
    // Last Draw
    lastDraw = millis();
    
    // Dates and Time
    timeRTC();

    // is OLED
    isOLED();
    
  }
  
}

getOLED.ino

// OLED
// Setup OLED
void setupOLED(){

  // Initialize the OLED
  oled.begin();
  // Clear the display's internal memory
  oled.clear(PAGE);
  // Clear the library's display buffer
  oled.clear(ALL);
  // Display what's in the buffer
  oled.display();
  
}
// isOLED
void isOLED(){

    // Clear the buffer
    oled.clear(PAGE);
    // Set font to type 0
    oled.setFontType(0);
    
    // Date
    // Set cursor to top-left
    oled.setCursor(0, 18);
    oled.print( sDate );
    
    // Time
    // Set cursor to top-left
    oled.setCursor(0, 32);
    oled.print( sTime );
    
    // Draw the memory buffer
    oled.display();
  
}

getRTCDS3231.ino

// DS3231 Precision RTC
// Setup RTC
void setupRTC() {

  // DS3231 Precision RTC   
  RTC.begin();
  if (! RTC.begin()) {
    while (1);
  }
  
  DateTime now = RTC.now();

  if (RTC.lostPower()) {
    
    // Following line sets the RTC to the date & time this sketch was compiled
    RTC.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date & time, for example to set
    // August 2, 2021 at 13:53:0 you would call:
    // RTC.adjust(DateTime(2021, 8, 2, 14, 11, 0));
    
  }
  
}
// timeRTC
void timeRTC() {

    // DS3231 Precision RTC
    sDate = "";
    sTime = "";
    // Date Time
    DateTime now = RTC.now();

    // sData
    sDate += String(now.year(), DEC);
    sDate += "/";
    sDate += String(now.month(), DEC);
    sDate += "/";
    sDate += String(now.day(), DEC);
  
    // sTime
    sTime += String(now.hour(), DEC);
    sTime += ":";
    sTime += String(now.minute(), DEC);
    sTime += ":";
    sTime += String(now.second(), DEC);

}

setup.ino

// Setup
void setup()
{
  
  // Give display time to power on
  delay(100);

  // Set up I2C bus
  Wire.begin();

  // Initialize the OLED
  setupOLED();

  // Setup RTC
  setupRTC();
  
}

——

People can contact us: https://www.donluc.com/?page_id=1927

Technology Experience

  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
  • IoT
  • Robotics
  • Research & Development (R & D)
  • Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
  • Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
  • Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
  • Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
  • Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
  • Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
  • eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)

Instructor

  • PIC Microcontrollers
  • Arduino
  • Raspberry Pi
  • Espressif
  • Robotics
  • DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
  • Linux-Apache-PHP-MySQL

Follow Us

J. Luc Paquin – Curriculum Vitae – 2021 English & Español
https://www.jlpconsultants.com/CV/LucPaquinCVEngMk2021c.pdf
https://www.jlpconsultants.com/CV/LucPaquinCVEspMk2021c.pdf

Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Web: https://www.donluc.com/DLE/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: https://zoom.us/
Patreon: https://www.patreon.com/DonLucElectronics
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/

Don Luc

Project #12: Robotics – XBee S1 – Transmitter – Mk13

——

#DonLucElectronics #DonLuc #Robotics #Arduino #Fio #FioV3ATmega32U4 #XBeeS1 #Transmitter #ThumbJoystick #SlidePot #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog

——

Fio v3 - ATmega32U4

——

Fio v3 - ATmega32U4

——

Fio v3 - ATmega32U4

——

Fio v3 - ATmega32U4

——

Fio v3 – ATmega32U4

The Fio v3 is a new spin on the Arduino Fio hardware powered by the ATmega32U4.Not only is it small and LiPo-ready, it’s a very capable XBee-ready development board. The JST-connector and 3.3v system voltage make this a great development tool for portable devices, simply plug in a Li-Poly battery and you’re ready to go. Wireless sensor networks and communication are made easy by the on-board XBee socket.

The ATmega32U4, running at 8MHz, makes it possible for you to use the on-board USB jack not only to charge a connected Li-Poly battery but to actually program the device. Because this board uses a similar bootloader to the one on the Pro Micro, you will need to download and install the special software driver below. There’s also a board definition add-on for the Arduino IDE which will add support for this board.

Transmitter

XBee S1: Transmitter

CH Channel: C
PAN Id: 3333
SH Serial Number: 13A200
SL Serial Number: 40717A1F
CE Coordinator: Coordinator
BD: 9600

DL2107Mk03

1 x Fio v3 – ATmega32U4
1 x XBee S1
1 x Lithium Ion Battery – 850mAh
1 x Thumb Joystick
1 x SparkFun Thumb Joystick Breakout
1 x Slide Pot (Small)
1 x Slide Potentiometer Knob
1 x Acrylic Red 5.75in x 3.75in x 1/8in
24 x Screw – 4-40
12 x Standoff – Metal 4-40 – 3/8″
8 x Wire Solid Core – 22 AWG
1 x DIGI XCTU Software
1 x Steren Solderable Breadboard 45mm x 45mm
1 x SparkFun Solderable Breadboard
1 x SparkFun Cerberus USB Cable

Fio v3 – ATmega32U4

RX0 – Digital 0
TX0 – Digital 1
PO0 – Analog A0
JY0 – Analog A1
JY1 – Analog A2
SE0 – Digital 16
VIN – +3.3V
GND – GND

DL2107Mk03p.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #12: Robotics - XBee S1 - Transmitter - Mk13
07-03
DL2107Mk03p.ino
1 x Fio v3 - ATmega32U4
1 x XBee S1
1 x Lithium Ion Battery - 850mAh
1 x Thumb Joystick
1 x SparkFun Thumb Joystick Breakout
1 x Slide Pot (Small)
1 x Slide Potentiometer Knob
1 x Acrylic Red 5.75in x 3.75in x 1/8in
24 x Screw - 4-40
12 x Standoff - Metal 4-40 - 3/8"
8 x Wire Solid Core - 22 AWG
1 x DIGI XCTU Software
1 x Steren Solderable Breadboard 45mm x 45mm
1 x SparkFun Solderable Breadboard
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code
// EEPROM library to read and write EEPROM with unique ID for unit
#include <EEPROM.h>

// Communication
unsigned long dTime = 50;

// Slide Pot (Small)
// Select the input pin for the slide pot
// Power
const int iSP1 = A0;
// Power to store the value
int iPower = 0;

// Connections to joystick
// Vertical
const int VERT = A1;
// Horizontal
const int HORIZ = A2;
// Pushbutton
const int SEL = 16;
// Initialize variables for analog and digital values
int vertical;
int horizontal;
int select;

// Software Version Information
// Version
String sver = "12-13";
// Unit ID Information
// UID
String uid = "";

void loop()
{

  // Thumb Joystick
  isThumbJoystick();
    
  // Process Message
  isProcessMessage();

  delay( dTime );
  
}

getEEPROM.ino

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

getProcessMessage.ino

// Process Message
// isProcessMessage
void isProcessMessage() {
  
   // Loop through serial buffer
   while ( Serial.available() ) 
   {

      // Print = "<" + vertical + "|" + horizontal + "|" + select + "|" + iValue + "|" + sver + "|" + uid + "*"
      
      Serial.print( '<'  );
      Serial.print( vertical );
      Serial.print( '|' );
      Serial.print( horizontal );
      Serial.print( '|' );
      Serial.print( select );
      Serial.print( '|' );
      Serial.print( iPower );
      Serial.print( '|' );
      Serial.print( sver );
      Serial.print( '|' );
      Serial.print( uid );
      Serial.println( '*' );
         
   }
     
}

getThumbJoystick.ino

// Thumb Joystick
void isThumbJoystick() {

  // Read all values from the joystick
  // Joystick was sitting around 520 for the vertical and horizontal values
  // Will be 0-1023
  vertical = analogRead(VERT);
  // Will be 0-1023
  horizontal = analogRead(HORIZ);
  // Will be HIGH (1) if not pressed, and LOW (0) if pressed
  select = digitalRead(SEL);
  // Read the value
  // Power be 0-1023
  iPower = analogRead( iSP1 );
 
}

setup.ino

// Setup
void setup()
{

  // EEPROM Unit ID
  isUID();
  
  // Pause
  delay(5);
  
  // Make the SEL line an input
  pinMode(SEL, INPUT_PULLUP);
  
  // Open serial port at 9600 baud
  Serial.begin( 9600 );

  // Pause
  delay(5);

}

——

People can contact us: https://www.donluc.com/?page_id=1927

Technology Experience

  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
  • Robotics
  • Research & Development (R & D)
  • Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
  • Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
  • Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
  • Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
  • Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
  • Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
  • eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)

Instructor

  • PIC Microcontrollers
  • Arduino
  • Raspberry Pi
  • Espressif
  • Robotics
  • DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
  • Linux-Apache-PHP-MySQL

Follow Us

J. Luc Paquin – Curriculum Vitae – 2021 English & Español
https://www.jlpconsultants.com/CV/LucPaquinCVEngMk2021c.pdf
https://www.jlpconsultants.com/CV/LucPaquinCVEspMk2021c.pdf

Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Web: https://www.donluc.com/DLE/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: https://zoom.us/
Patreon: https://www.patreon.com/DonLucElectronics
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/

Don Luc

Project #16: Sound – Dayton Audio RS75T-8 – Mk20

——

#DonLucElectronics #DonLuc #Sound #Arduino #ESP32 #SparkFunThingPlusESP32WROOM #SparkFunQwiicMP3 #DaytonAudioRS75T #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog

——

Dayton Audio RS75T-8

——

Dayton Audio RS75T-8

——

Dayton Audio RS75T-8

——

Dayton Audio RS75T-8

——

Dayton Audio RS75T-8 3″ Reference Full-Range Driver Truncated Frame

The Dayton Audio Reference Series sets a new standard of value in high-performance loudspeaker drivers. Incorporating a low-distortion motor system with a copper ring, a copper cap, and an aluminum phase plug, the RS75T-8 can outperform “boutique” drivers that cost several times the price. The driver’s truncated frame makes it ideal for line arrays and ultra-compact MTM designs requiring minimal driver-to-driver spacing. Its low-distortion characteristics and smooth response provide exceptional clarity, detail, and dynamics. Features a black anodized cone, heavy-duty 4-hole cast frame, low-loss rubber surround, and gold terminals.

DL2107Mk02

1 x SparkFun Thing Plus – ESP32 WROOM
1 x SparkFun Qwiic MP3 Trigger
1 x microSD Card – 2GB
1 x Panel Mount 10K potentiometer
1 x Knob
1 x Slide Switch
2 x Rocker Switch – SPST (Round)
1 x Qwiic Cable – 50mm
1 x Dayton Audio Reference 3″ Full-Range Drive
1 x Lithium Ion Battery – 850mAh
1 x JST Jumper 2 Wire Assembly
2 x Screw Terminals 5mm Pitch (2-Pin)
1 x Acrylic Blue 5.75in x 3.75in x 1/8in
1 x Acrylic Purple 5.75in x 3.75in x 1/8in
24 x Screw – 4-40
4 x Nut – Nylon Locknut 4-40
6 x Standoff – Metal 4-40 – 3/8″
8 x Standoff – Metal 4-40 – 1″
18 x Wire Solid Core – 22 AWG
1 x Adafruit Perma-Prote Half-Size Breadboard
1 x SparkFun Cerberus USB Cable

SparkFun Thing Plus – ESP32 WROOM

PO1 – Analog A0
SW0 – Digital 21
SW1 – Digital 17
VIN – +3.3V
GND – GND

DL2107Mk02p.ino

/* ***** Don Luc Electronics © *****
Software Version Information
#16 - Sound - Dayton Audio RS75T-8 - Mk20
07-02
DL2107Mk02p.ino
1 x SparkFun Thing Plus - ESP32 WROOM
1 x SparkFun Qwiic MP3 Trigger
1 x microSD Card - 2GB
1 x Panel Mount 10K potentiometer
1 x Knob
1 x Slide Switch
2 x Rocker Switch - SPST (Round)
1 x Qwiic Cable - 50mm
1 x Dayton Audio Reference 3" Full-Range Drive
1 x Lithium Ion Battery - 850mAh
1 x JST Jumper 2 Wire Assembly
2 x Screw Terminals 5mm Pitch (2-Pin)
1 x Acrylic Blue 5.75in x 3.75in x 1/8in
1 x Acrylic Purple 5.75in x 3.75in x 1/8in
24 x Screw - 4-40
4 x Nut - Nylon Locknut 4-40
6 x Standoff - Metal 4-40 - 3/8"
8 x Standoff - Metal 4-40 - 1"
18 x Wire Solid Core - 22 AWG
1 x Adafruit Perma-Prote Half-Size Breadboard
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code
// Wire communicate with I2C / TWI devices
#include <Wire.h>
// SparkFun MP3 Trigger
#include "SparkFun_Qwiic_MP3_Trigger_Arduino_Library.h"

// SparkFun MP3 Trigger
MP3TRIGGER mp3;

int iSongCount = 0;
int x = 0;

// Volume
int iVolume = A0;
int iVolumeLevel = 0;

// EQ Setting Normal
byte bEQSetting = 0;

// Play Next
const int iPlayNext = 21;
// Variable for reading the iPlayNext status
int iPlayNextState = 0;

// Play Previous
const int iPlayPrevious = 17;
// Variable for reading the iPlayPrevious status
int iPlayPreviousState = 0;

// Software Version Information
String sver = "16-20";

void loop()
{
    
   if (mp3.isPlaying() == false) {

    if ( x > iSongCount ) {

      x = 0;
      
    } else {

      x = x + 1;
      
    }
    
    // Play Track
    mp3.playTrack( x );
    
  } else {

    // Volume
    isVolume();

    // Play Next
    isPlayNext();

    // Play Previous
    isPlayPrevious();

  }

}

getMP3.ino

// MP3
// Setup MP3
void isSetupMP3(){

  // Check to see if Qwiic MP3 is present on the bus
  if (mp3.begin() == false)
  {
    
    // Qwiic MP3 failed to respond. Please check wiring and possibly the I2C address. Freezing...
    while (1);
    
  }

  if (mp3.hasCard() == false)
  {
    
    // Qwiic MP3 is missing its SD card. Freezing...
    while (1);
    
  }

  // Song Count
  iSongCount = mp3.getSongCount();

  // EQ Setting Classic
  bEQSetting = mp3.getEQ();

  // Initialize the iPlayNext
  pinMode( iPlayNext, INPUT);

  // Initialize the iPlayPrevious
  pinMode( iPlayPrevious, INPUT);

}
// Volume
void isVolume() {

  // Volume
  iVolumeLevel = analogRead( iVolume );
  // (0-1023 for 10 bits or 0-4095 for 12 bits)
  iVolumeLevel = map(iVolumeLevel, 0, 4095, 0, 31);

  // Volume can be 0 (off) to 31 (max)
  mp3.setVolume( iVolumeLevel );
  
}
// Play Next
void isPlayNext() {

  // Read the state of the iPlayNext value
  iPlayNextState = digitalRead( iPlayNext );

  if ( iPlayNextState == HIGH ) {

    mp3.stop();
    
    if ( x > iSongCount ) {

      x = 0;
      
    } else {

      x = x + 1;
      
    }
    
    // Play Track
    mp3.playTrack( x );     
    
  } 

}
// Play Previous
void isPlayPrevious() {

  // Read the state of the iPlayPrevious value
  iPlayPreviousState = digitalRead( iPlayPrevious );

  if ( iPlayPreviousState == HIGH ) {

    mp3.stop();
    
    if ( x > iSongCount ) {

      x = 0;
      
    } else {

      x = x - 1;
      
    }
    
    // Play Track
    mp3.playTrack( x );     
    
  } 

}

setup.ino

// Setup
void setup()
{
   
   // Wire communicate with I2C / TWI devices
   Wire.begin();

   // SparkFun MP3 Trigger Setup
   isSetupMP3();

}

——

People can contact us: https://www.donluc.com/?page_id=1927

Technology Experience

  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
  • Robotics
  • Research & Development (R & D)
  • Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
  • Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
  • Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
  • Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
  • Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
  • Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
  • eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)

Instructor

  • PIC Microcontrollers
  • Arduino
  • Raspberry Pi
  • Espressif
  • Robotics
  • DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
  • Linux-Apache-PHP-MySQL

Follow Us

J. Luc Paquin – Curriculum Vitae – 2021 English & Español
https://www.jlpconsultants.com/CV/LucPaquinCVEngMk2021c.pdf
https://www.jlpconsultants.com/CV/LucPaquinCVEspMk2021c.pdf

Web: https://www.donluc.com/
Web: http://www.jlpconsultants.com/
Web: https://www.donluc.com/DLE/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: https://zoom.us/
Patreon: https://www.patreon.com/DonLucElectronics
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/

Don Luc

Categories
Archives