The Alpha Geek – Geeking Out

DFRobot

Project #30 – UNIHIKER – Ambient Light Sensor – Mk02

——

#DonLucElectronics #DonLuc #UNIHIKER #Display #IoT #Project #Debian #Python #Thonny #Programming #Electronics #Microcontrollers #Consultant

——

Ambient Light Sensor

——

Ambient Light Sensor

——

Ambient Light Sensor

——

UNIHIKER Ambient Light Sensor

A light sensor is a photoelectric device that converts light energy (Photons) detected to electrical energy (Electrons). There is more to a light sensor than just its definition. It comes in different types and is used in various applications. This project provides a foundation for home lighting design, whether adjusting brightness levels in work areas or creating a cozy atmosphere in bedrooms, making it a practical tool. It measures the ambient light level of your surroundings and determines the suitable brightness of your screen.

DL2408Mk05

1 x UNIHIKER
1 x USB Battery Pack
1 x USB 3.1 Cable A to C

DL2408Mk05p

DL2408Mk05p.py

"""
****** Don Luc Electronics © ******
Software Version Information
Project #30 - UNIHIKER - Ambient Light Sensor - Mk02
30-02
DL2408Mk05.py
DL2408Mk05
1 x UNIHIKER
1 x USB Battery Pack
1 x USB 3.1 Cable A to C

-*- coding: utf-8 -*-
"""
# Import the unihiker library
from unihiker import GUI

# Import the time library
import time

# Import the Board module from the pinpong.board package 
from pinpong.board import Board

# Import all modules from the pinpong.extension.unihiker package
from pinpong.extension.unihiker import *

# Initialize the board by selecting the board type and port number;
# if not specified, the program will automatically detect it
Board().begin()

# Instantiate the GUI class and create a gui object
gui = GUI()

# Display the initial background image 'dlemk02'
img = gui.draw_image(x=0, y=0, w=240, h=320, image='DL2408Mk05p.png')

# Ambient Light Sensor
# Display the initial Ambient Light Sensor valueLight
valueLight = gui.draw_text(x=30, y=151, text='0', font_size=18)

while True:
    
    # Ambient Light Sensor
    # Read the light value
    AmbientLightSensor = light.read()
    # Update the displayed light value
    valueLight.config(text=AmbientLightSensor)

    # Delay for 1 second to keep the screen content displayed for a longer time
    time.sleep(1)

——

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

Teacher, Instructor, E-Mentor, R&D and Consulting

  • Programming Language
  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
  • IoT
  • Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
  • Robotics
  • Automation
  • Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
  • Unmanned Vehicles Terrestrial and Marine
  • Machine Learning
  • Artificial Intelligence (AI)
  • RTOS
  • Sensors, eHealth Sensors, Biosensor, and Biometric
  • Research & Development (R & D)
  • Consulting

Follow Us

Luc Paquin – Curriculum Vitae – 2024
https://www.donluc.com/luc/

Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
DFRobot Luc.Paquin: https://edu.dfrobot.com/dashboard/makelogs
Hackster.io: https://www.hackster.io/neosteam-labs
LinkedIn: https://www.linkedin.com/in/jlucpaquin/

Don Luc

Project #29 – DFRobot – MEMS Smoke – Mk26

——

#DonLucElectronics #DonLuc #DFRobot #Smoke #CH4 #VOC #SHTC3 #FireBeetle2ESP32C6 #Display #EEPROM #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

MEMS Smoke

——

MEMS Smoke

——

MEMS Smoke

——

Fermion: MEMS Smoke Gas Detection Sensor

Fermion: MEMS Smoke Gas Detection Sensor employs state-of-the-art microelectromechanical system (MEMS) technology, endowing the sensor with compact dimensions, low power consumption, minimal heat generation, short preheating time, and swift response recovery. The sensor can measure smoke concentration qualitatively and is suitable for smoke alarm and other application scenarios. Kindly remove the protective film before usage. It is advisable to preheat the module for at least 24 hours. Detection range: 10-1000 ppm.

DL2408Mk04

1 x FireBeetle 2 ESP32-C6
1 x Fermion: MEMS Smoke Gas Detection Sensor
1 x Fermion: MEMS Methane CH4 Gas Detection Sensor
1 x Fermion: MEMS VOC Gas Detection Sensor
1 x Fermion: SHTC3 Temperature and Humidity Sensor
1 x Fermion: 2.0″ 320×240 IPS TFT LCD
1 x MicroSD 2 GB
1 x GDL Line 10 CM
1 x 1 x Lithium Ion Battery – 1000mAh
1 x USB 3.1 Cable A to C

FireBeetle 2 ESP32-C6

VOC – 2
CH4 – 3
SMO – 4
SCK – 23
MOSI – 22
MISO – 21
CS – 18
SCL – 20
SDA – 19
DC – 8
CS – 1
RST – 14
VIN – +3.3V
GND – GND

——

DL2408Mk04p.ino

/****** Don Luc Electronics © ******
Software Version Information
Project #29 - DFRobot - MEMS Smoke - Mk26
29-26
DL2408Mk04p.ino
DL2408Mk04
1 x FireBeetle 2 ESP32-C6
1 x Fermion: MEMS Smoke Gas Detection Sensor
1 x Fermion: MEMS Methane CH4 Gas Detection Sensor
1 x Fermion: MEMS VOC Gas Detection Sensor
1 x Fermion: SHTC3 Temperature and Humidity Sensor
1 x Fermion: 2.0" 320x240 IPS TFT LCD
1 x MicroSD 2 GB
1 x GDL Line 10 CM
1 x 1 x Lithium Ion Battery - 1000mAh
1 x USB 3.1 Cable A to C
*/

// Include the Library Code
// EEPROM Library to Read and Write EEPROM
// with Unique ID for Unit
#include "EEPROM.h"
// DFRobot Display GDL API
#include <DFRobot_GDL.h>
// Arduino
#include <Arduino.h>
// Wire
#include <Wire.h>
// SHTC3 Temperature and Humidity Sensor
#include "SHTSensor.h"
// SD Card
#include "FS.h"
#include "SD.h"
#include "SPI.h"

// MEMS Smoke Gas
int iSensorSmoke = 4;
int iSensorValueSmoke = 0;
int z = 0;

// MEMS CH4 Gas
int iSensorCH4 = 3;
int iSensorValueCH4 = 0;
int y = 0;

// MEMS VOC Gas
int iSensorVOC = 2;
int iSensorValueVOC = 0;
int x = 0;

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

// SHTC3 Temperature and Humidity Sensor
SHTSensor sht;
// Temperature
float T;
// Humidity
float H;

// Defined ESP32
#define TFT_DC 8
#define TFT_CS 1
#define TFT_RST 14

/*dc=*/ /*cs=*/ /*rst=*/
// DFRobot Display 240x320
DFRobot_ST7789_240x320_HW_SPI screen(TFT_DC, TFT_CS, TFT_RST);

// LED Green
int iLEDGreen = 15;

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

// Software Version Information
String sver = "29-26";

void loop() {

  // MEMS Smoke Gas
  isSmoke();
  
  // MEMS CH4 Gas
  isCH4();
  
  // MEMS VOC Gas
  isVOC();
  
  // SHTC3 Temperature and Humidity Sensor
  isSHTC3();

  // DFRobot Display 240x320 - Temperature and Humidity, VOC, CH4, Smoke
  isDisplayTH();

  // MicroSD Card
  isSD();

  // Delay 5 Second
  delay( 5000 );

}

getCH4.ino

// MEMS CH4 Gas
// is CH4
void isCH4(){

  // MEMS CH4 Gas
  y = analogRead( iSensorCH4 );
  iSensorValueCH4 = map(y, 1, 4095, 1, 10000);
  
}

getDisplay.ino

// DFRobot Display 240x320
// DFRobot Display 240x320 - UID
void isDisplayUID() {

    // DFRobot Display 240x320
    // Text Display
    // Text Wrap
    screen.setTextWrap(false);
    // Rotation
    screen.setRotation(3);
    // Fill Screen => black
    screen.fillScreen(0x0000);
    // Text Color => white
    screen.setTextColor(0xffff);
    // Font => Free Mono 9pt
    screen.setFont(&FreeMono9pt7b);
    // TextSize => 1.5
    screen.setTextSize(1.5);
    // DFRobot Display
    screen.setCursor(0, 30);
    screen.println("DFRobot Display");
    // Don Luc Electronics
    screen.setCursor(0, 60);
    screen.println("Don Luc Electronics");
    // Version
    screen.setCursor(0, 90);
    screen.println("Version");
    screen.setCursor(0, 120);
    screen.println( sver );
    // EEPROM
    screen.setCursor(0, 150);
    screen.println("EEPROM");
    screen.setCursor(0, 180);
    screen.println( uid );

}
// DFRobot Display 240x320 - Temperature and Humidity, VOC, CH4, Smoke
void isDisplayTH() {
  
    // DFRobot Display 240x320
    // Text Display
    // Text Wrap
    screen.setTextWrap(false);
    // Rotation
    screen.setRotation(3);
    // Fill Screen => black
    screen.fillScreen(0x0000);
    // Text Color => white
    screen.setTextColor(0xffff);
    // Font => Free Mono 9pt
    screen.setFont(&FreeMono9pt7b);
    // TextSize => 1.5
    screen.setTextSize(1.5);
    // Don Luc Electronics
    screen.setCursor(0, 30);
    screen.println("Don Luc Electronics");
    // Version
    screen.setCursor(0, 60);
    screen.println( sver );
    // Temperature
    screen.setCursor(0, 90);
    screen.println( "Temp: " );
    screen.setCursor(60, 90);
    screen.println( T );
    screen.setCursor(130, 90);
    screen.println("Celsius");
    // Humidity
    screen.setCursor(0, 120);
    screen.println("Humi: ");
    screen.setCursor(60, 120);
    screen.println( H );
    screen.setCursor(130, 120);
    screen.println("% RH");
    // MEMS VOC Gas
    screen.setCursor(0, 150);
    screen.println( "VOC: " );
    screen.setCursor(60, 150);
    screen.println( iSensorValueVOC );
    screen.setCursor(130, 150);
    screen.println("ppm");
    // MEMS CH4 Gas
    screen.setCursor(0, 180);
    screen.println( "CH4: " );
    screen.setCursor(60, 180);
    screen.println( iSensorValueCH4 );
    screen.setCursor(130, 180);
    screen.println("ppm");
    // MEMS Smoke Gas
    screen.setCursor(0, 210);
    screen.println( "SMO: " );
    screen.setCursor(60, 210);
    screen.println( iSensorValueSmoke );
    screen.setCursor(130, 210);
    screen.println("ppm");

}

getEEPROM.ino

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

getSD.ino

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

    // 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 = "";

  //DFR|EEPROM Unique ID|Version|
  //Temperature C|% RH|VOC|CH4|Smoke|*\r
  zzzzzz = "DFR|" + uid + "|" + sver + "|"
  + String( T ) + "|" + String( H ) + "|"
  + String( iSensorValueVOC ) + "|" + String( iSensorValueCH4 ) + "|"
  + String( iSensorValueSmoke ) + "|*\r";;

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

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

  // Append File
  appendFile(SD, "/dfrdata.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();
    
}

getSHTC3.ino

// SHTC3 Temperature and Humidity Sensor
// SHTC3
void isSHTC3(){

  // SHTC3 Temperature and Humidity Sensor
  if (sht.readSample()) {
     
     // Temperature
     T = sht.getTemperature();
     // Humidity
     H = sht.getHumidity();

  }

}

getSmoke.ino

// Smoke
// isSmoke
void isSmoke(){

  // MEMS Smoke Gas
  z = analogRead( iSensorSmoke );
  iSensorValueSmoke = map(x, 1, 4095, 1, 1000);
  
}

getVOC.ino

// MEMS VOC Gas
// is VOC
void isVOC(){

  // MEMS VOC Gas
  x = analogRead( iSensorVOC );
  iSensorValueVOC = map(x, 1, 4095, 1, 500);
  
}

setup.ino

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

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

  // Wire
  Wire.begin();

  // Delay
  delay( 100 );

  // SHTC3 Temperature and Humidity Sensor
  sht.init();
  // SHT3x
  sht.setAccuracy(SHTSensor::SHT_ACCURACY_MEDIUM);

  // Delay
  delay( 100 );
  
  // DFRobot Display 240x320
  screen.begin();

  // Delay
  delay(100);

  // MicroSD Card
  isSetupSD();

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

  // iLEDGreen HIGH
  digitalWrite(iLEDGreen, HIGH );

  // DFRobot Display 240x320 - UID
  // Don Luc Electronics
  // Version
  // EEPROM
  isDisplayUID();

  // Delay 5 Second
  delay( 5000 );

}

——

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

Teacher, Instructor, E-Mentor, R&D and Consulting

  • Programming Language
  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
  • IoT
  • Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
  • Robotics
  • Automation
  • Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
  • Unmanned Vehicles Terrestrial and Marine
  • Machine Learning
  • Artificial Intelligence (AI)
  • RTOS
  • Sensors, eHealth Sensors, Biosensor, and Biometric
  • Research & Development (R & D)
  • Consulting

Follow Us

Luc Paquin – Curriculum Vitae – 2024
https://www.donluc.com/luc/

Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
DFRobot Luc.Paquin: https://edu.dfrobot.com/dashboard/makelogs
Hackster.io: https://www.hackster.io/neosteam-labs
LinkedIn: https://www.linkedin.com/in/jlucpaquin/

Don Luc

Project #29 – DFRobot – MEMS CH4 – Mk25

——

#DonLucElectronics #DonLuc #DFRobot #CH4 #VOC #SHTC3 #FireBeetle2ESP32C6 #Display #EEPROM #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

MEMS CH4

——

MEMS CH4

——

MEMS CH4

——

Fermion: MEMS Methane CH4 Gas Detection Sensor

Fermion: MEMS Methane CH4 Gas Detection Sensor employs state-of-the-art micro-electromechanical system (MEMS) technology, endowing the sensor with compact dimensions, low power consumption, minimal heat generation, short preheating time, and swift response recovery. The sensor can qualitatively measure methane gas concentration and is suitable for combustible gas leakage monitoring devices, gas leak detectors, fire/safety detection systems and other applications. Detection range: 1-10000 ppm. It is advisable to preheat the module for at least 24 hours.

DL2408Mk02

1 x FireBeetle 2 ESP32-C6
1 x Fermion: MEMS Methane CH4 Gas Detection Sensor
1 x Fermion: MEMS VOC Gas Detection Sensor
1 x Fermion: SHTC3 Temperature and Humidity Sensor
1 x Fermion: 2.0″ 320×240 IPS TFT LCD
1 x MicroSD 2 GB
1 x GDL Line 10 CM
1 x 1 x Lithium Ion Battery – 1000mAh
1 x USB 3.1 Cable A to C

FireBeetle 2 ESP32-C6

VOC – 2
CH4 – 3
SCK – 23
MOSI – 22
MISO – 21
CS – 18
SCL – 20
SDA – 19
DC – 8
CS – 1
RST – 14
VIN – +3.3V
GND – GND

——

DL2408Mk02p.ino

/****** Don Luc Electronics © ******
Software Version Information
Project #29 - DFRobot - MEMS CH4 - Mk25
29-25
DL2408Mk02p.ino
DL2408Mk02
1 x FireBeetle 2 ESP32-C6
1 x Fermion: MEMS Methane CH4 Gas Detection Sensor
1 x Fermion: MEMS VOC Gas Detection Sensor
1 x Fermion: SHTC3 Temperature and Humidity Sensor
1 x Fermion: 2.0" 320x240 IPS TFT LCD
1 x MicroSD 2 GB
1 x GDL Line 10 CM
1 x 1 x Lithium Ion Battery - 1000mAh
1 x USB 3.1 Cable A to C
*/

// Include the Library Code
// EEPROM Library to Read and Write EEPROM
// with Unique ID for Unit
#include "EEPROM.h"
// DFRobot Display GDL API
#include <DFRobot_GDL.h>
// Arduino
#include <Arduino.h>
// Wire
#include <Wire.h>
// SHTC3 Temperature and Humidity Sensor
#include "SHTSensor.h"
// SD Card
#include "FS.h"
#include "SD.h"
#include "SPI.h"

// MEMS CH4 Gas
int iSensorCH4 = 3;
int iSensorValueCH4 = 0;
int y = 0;

// MEMS VOC Gas
int iSensorVOC = 2;
int iSensorValueVOC = 0;
int x = 0;

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

// SHTC3 Temperature and Humidity Sensor
SHTSensor sht;
// Temperature
float T;
// Humidity
float H;

// Defined ESP32
#define TFT_DC 8
#define TFT_CS 1
#define TFT_RST 14

/*dc=*/ /*cs=*/ /*rst=*/
// DFRobot Display 240x320
DFRobot_ST7789_240x320_HW_SPI screen(TFT_DC, TFT_CS, TFT_RST);

// LED Green
int iLEDGreen = 15;

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

// Software Version Information
String sver = "29-25";

void loop() {

  // MEMS CH4 Gas
  isCH4();
  
  // MEMS VOC Gas
  isVOC();
  
  // SHTC3 Temperature and Humidity Sensor
  isSHTC3();

  // DFRobot Display 240x320 - Temperature and Humidity, VOC, CH4
  isDisplayTH();

  // MicroSD Card
  isSD();

  // Delay 5 Second
  delay( 5000 );

}

getCH4.ino

// MEMS CH4 Gas
// is CH4
void isCH4(){

  // MEMS CH4 Gas
  y = analogRead( iSensorCH4 );
  iSensorValueCH4 = map(y, 1, 4095, 1, 10000);
  
}

getDisplay.ino

// DFRobot Display 240x320
// DFRobot Display 240x320 - UID
void isDisplayUID() {

    // DFRobot Display 240x320
    // Text Display
    // Text Wrap
    screen.setTextWrap(false);
    // Rotation
    screen.setRotation(3);
    // Fill Screen => black
    screen.fillScreen(0x0000);
    // Text Color => white
    screen.setTextColor(0xffff);
    // Font => Free Mono 9pt
    screen.setFont(&FreeMono9pt7b);
    // TextSize => 1.5
    screen.setTextSize(1.5);
    // DFRobot Display
    screen.setCursor(0, 30);
    screen.println("DFRobot Display");
    // Don Luc Electronics
    screen.setCursor(0, 60);
    screen.println("Don Luc Electronics");
    // Version
    screen.setCursor(0, 90);
    screen.println("Version");
    screen.setCursor(0, 120);
    screen.println( sver );
    // EEPROM
    screen.setCursor(0, 150);
    screen.println("EEPROM");
    screen.setCursor(0, 180);
    screen.println( uid );

}
// DFRobot Display 240x320 - Temperature and Humidity, VOC, CH4
void isDisplayTH() {
  
    // DFRobot Display 240x320
    // Text Display
    // Text Wrap
    screen.setTextWrap(false);
    // Rotation
    screen.setRotation(3);
    // Fill Screen => black
    screen.fillScreen(0x0000);
    // Text Color => white
    screen.setTextColor(0xffff);
    // Font => Free Mono 9pt
    screen.setFont(&FreeMono9pt7b);
    // TextSize => 1.5
    screen.setTextSize(1.5);
    // Don Luc Electronics
    screen.setCursor(0, 30);
    screen.println("Don Luc Electronics");
    // Version
    screen.setCursor(0, 60);
    screen.println( sver );
    // Temperature
    screen.setCursor(0, 90);
    screen.println( "Temp: " );
    screen.setCursor(60, 90);
    screen.println( T );
    screen.setCursor(130, 90);
    screen.println("Celsius");
    // Humidity
    screen.setCursor(0, 120);
    screen.println("Humi: ");
    screen.setCursor(60, 120);
    screen.println( H );
    screen.setCursor(130, 120);
    screen.println("% RH");
    // MEMS VOC Gas
    screen.setCursor(0, 150);
    screen.println( "VOC: " );
    screen.setCursor(60, 150);
    screen.println( iSensorValueVOC );
    screen.setCursor(130, 150);
    screen.println("ppm");
    // MEMS CH4 Gas
    screen.setCursor(0, 180);
    screen.println( "CH4: " );
    screen.setCursor(60, 180);
    screen.println( iSensorValueCH4 );
    screen.setCursor(130, 180);
    screen.println("ppm");

}

getEEPROM.ino

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

getSD.ino

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

    // 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 = "";

  //DFR|EEPROM Unique ID|Version|
  //Temperature C|% RH|VOC|CH4|*\r
  zzzzzz = "DFR|" + uid + "|" + sver + "|"
  + String( T ) + "|" + String( H ) + "|"
  + String( iSensorValueVOC ) + "|" + String( iSensorValueCH4 ) + "|*\r";

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

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

  // Append File
  appendFile(SD, "/dfrdata.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();
    
}

getSHTC3.ino

// SHTC3 Temperature and Humidity Sensor
// SHTC3
void isSHTC3(){

  // SHTC3 Temperature and Humidity Sensor
  if (sht.readSample()) {
     
     // Temperature
     T = sht.getTemperature();
     // Humidity
     H = sht.getHumidity();

  }

}

getVOC.ino

// MEMS VOC Gas
// is VOC
void isVOC(){

  // MEMS VOC Gas
  x = analogRead( iSensorVOC );
  iSensorValueVOC = map(x, 1, 4095, 1, 500);
  
}

setup.ino

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

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

  // Wire
  Wire.begin();

  // Delay
  delay( 100 );

  // SHTC3 Temperature and Humidity Sensor
  sht.init();
  // SHT3x
  sht.setAccuracy(SHTSensor::SHT_ACCURACY_MEDIUM);

  // Delay
  delay( 100 );
  
  // DFRobot Display 240x320
  screen.begin();

  // Delay
  delay(100);

  // MicroSD Card
  isSetupSD();

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

  // iLEDGreen HIGH
  digitalWrite(iLEDGreen, HIGH );

  // DFRobot Display 240x320 - UID
  // Don Luc Electronics
  // Version
  // EEPROM
  isDisplayUID();

  // Delay 5 Second
  delay( 5000 );

}

——

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

Teacher, Instructor, E-Mentor, R&D and Consulting

  • Programming Language
  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
  • IoT
  • Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
  • Robotics
  • Automation
  • Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
  • Unmanned Vehicles Terrestrial and Marine
  • Machine Learning
  • Artificial Intelligence (AI)
  • RTOS
  • Sensors, eHealth Sensors, Biosensor, and Biometric
  • Research & Development (R & D)
  • Consulting

Follow Us

Luc Paquin – Curriculum Vitae – 2024
https://www.donluc.com/luc/

Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
DFRobot Luc.Paquin: https://edu.dfrobot.com/dashboard/makelogs
Hackster.io: https://www.hackster.io/neosteam-labs
LinkedIn: https://www.linkedin.com/in/jlucpaquin/

Don Luc

Project #29 – DFRobot – UNIHIKER – Mk24

——

#DonLucElectronics #DonLuc #DFRobot #UNIHIKER #Display #IoT #Project #Programming #Electronics #Microcontrollers #Consultant

——

UNIHIKER

——

UNIHIKER

——

UNIHIKER

——

UNIHIKER

UNIHIKER is a single-board computer that brings you brand new experience. It features a 2.8-inch touchscreen, Wi-Fi and Bluetooth. It is equipped with light sensor, accelerometer, gyroscope and microphone. With built-in co-processor, it is able to communicate with various analog/digital/I2C/UART/SPI sensors and acuators.

UNIHIKER brings a whole new experience for developers with its pre-installed software, allowing for an incredibly fast and easy start. Featuring a built-in developers can program the single board computer using a smartphone or tablet. Of course, just like other single board computers, UNIHIKER supports Mu Editor, Jupyter Notebook, VS Code, VIM, and Thonny. The integrated PinPong control library allows developers to directly control UNIHIKER’s built-in sensors and hundreds of connected sensors and actuators using Python.

The built-in SIoT service on UNIHIKER allows users to store data through the MQTT protocol and provides real-time web data access. The best part is that all data is stored within the device itself. Compact, feature-rich, and user-friendly, UNIHIKER offers an innovative development experience for learning, coding, and creating. Unleash your imagination and embark on a new journey with UNIHIKER.

DL2408Mk01

1 x UNIHIKER
1 x USB 3.1 Cable A to C

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

Teacher, Instructor, E-Mentor, R&D and Consulting

  • Programming Language
  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
  • IoT
  • Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
  • Robotics
  • Automation
  • Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
  • Unmanned Vehicles Terrestrial and Marine
  • Machine Learning
  • Artificial Intelligence (AI)
  • RTOS
  • Sensors, eHealth Sensors, Biosensor, and Biometric
  • Research & Development (R & D)
  • Consulting

Follow Us

Luc Paquin – Curriculum Vitae – 2024
https://www.donluc.com/luc/

Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
LinkedIn: https://www.linkedin.com/in/jlucpaquin/

Don Luc

Project #29 – DFRobot – MEMS VOC – Mk23

——

#DonLucElectronics #DonLuc #DFRobot #VOC #SHTC3 #FireBeetle2ESP32C6 #Display #EEPROM #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

MEMS VOC

——

MEMS VOC

——

MEMS VOC

——

Fermion: MEMS Volatile Organic Compounds VOC Gas Detection Sensor

Fermion: MEMS Volatile Organic Compounds VOC Gas Sensor employs state-of-the-art microelectromechanical system (MEMS) technology, endowing the sensor with compact dimensions, low power consumption, minimal heat generation, short preheating time, and swift response recovery. The sensor can qualitatively measure VOC gas concentration and is suitable for indoor air quality detection, fresh air system, air purifier and other application scenarios. Kindly remove the protective film before usage. Gas detected: ethanol, formaldehyde, toluene, etc. Detection range: 1-500 ppm. It is advisable to preheat the module for at least 24 hours.

DL2407Mk07

1 x FireBeetle 2 ESP32-C6
1 x Fermion: MEMS VOC Gas Detection Sensor
1 x Fermion: SHTC3 Temperature and Humidity Sensor
1 x Fermion: 2.0″ 320×240 IPS TFT LCD
1 x MicroSD 2 GB
1 x GDL Line 10 CM
1 x 1 x Lithium Ion Battery – 1000mAh
1 x USB 3.1 Cable A to C

FireBeetle 2 ESP32-C6

VOC – 2
SCK – 23
MOSI – 22
MISO – 21
CS – 18
SCL – 20
SDA – 19
DC – 8
CS – 1
RST – 14
VIN – +3.3V
GND – GND

——

DL2407Mk07p.ino

/****** Don Luc Electronics © ******
Software Version Information
Project #29 - DFRobot - MEMS VOC - Mk23
29-23
DL2407Mk07p.ino
DL2407Mk07
1 x FireBeetle 2 ESP32-C6
1 x Fermion: MEMS VOC Gas Detection Sensor
1 x Fermion: SHTC3 Temperature and Humidity Sensor
1 x Fermion: 2.0" 320x240 IPS TFT LCD
1 x MicroSD 2 GB
1 x GDL Line 10 CM
1 x 1 x Lithium Ion Battery - 1000mAh
1 x USB 3.1 Cable A to C
*/

// Include the Library Code
// EEPROM Library to Read and Write EEPROM
// with Unique ID for Unit
#include "EEPROM.h"
// DFRobot Display GDL API
#include <DFRobot_GDL.h>
// Arduino
#include <Arduino.h>
// Wire
#include <Wire.h>
// SHTC3 Temperature and Humidity Sensor
#include "SHTSensor.h"
// SD Card
#include "FS.h"
#include "SD.h"
#include "SPI.h"

// MEMS VOC Gas
int iSensorVOC = 2;
int iSensorValueVOC = 0;
int x = 0;

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

// SHTC3 Temperature and Humidity Sensor
SHTSensor sht;
// Temperature
float T;
// Humidity
float H;

// Defined ESP32
#define TFT_DC 8
#define TFT_CS 1
#define TFT_RST 14

/*dc=*/ /*cs=*/ /*rst=*/
// DFRobot Display 240x320
DFRobot_ST7789_240x320_HW_SPI screen(TFT_DC, TFT_CS, TFT_RST);

// LED Green
int iLEDGreen = 15;

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

// Software Version Information
String sver = "29-23";

void loop() {

  // MEMS VOC Gas
  isVOC();
  
  // SHTC3 Temperature and Humidity Sensor
  isSHTC3();

  // DFRobot Display 240x320 - Temperature and Humidity
  isDisplayTH();

  // MicroSD Card
  isSD();

  // Delay 5 Second
  delay( 5000 );

}

getDisplay.ino

// DFRobot Display 240x320
// DFRobot Display 240x320 - UID
void isDisplayUID() {

    // DFRobot Display 240x320
    // Text Display
    // Text Wrap
    screen.setTextWrap(false);
    // Rotation
    screen.setRotation(3);
    // Fill Screen => black
    screen.fillScreen(0x0000);
    // Text Color => white
    screen.setTextColor(0xffff);
    // Font => Free Mono 9pt
    screen.setFont(&FreeMono9pt7b);
    // TextSize => 1.5
    screen.setTextSize(1.5);
    // DFRobot Display
    screen.setCursor(0, 30);
    screen.println("DFRobot Display");
    // Don Luc Electronics
    screen.setCursor(0, 60);
    screen.println("Don Luc Electronics");
    // Version
    screen.setCursor(0, 90);
    screen.println("Version");
    screen.setCursor(0, 120);
    screen.println( sver );
    // EEPROM
    screen.setCursor(0, 150);
    screen.println("EEPROM");
    screen.setCursor(0, 180);
    screen.println( uid );

}
// DFRobot Display 240x320 - Temperature and Humidity
void isDisplayTH() {
  
    // DFRobot Display 240x320
    // Text Display
    // Text Wrap
    screen.setTextWrap(false);
    // Rotation
    screen.setRotation(3);
    // Fill Screen => black
    screen.fillScreen(0x0000);
    // Text Color => white
    screen.setTextColor(0xffff);
    // Font => Free Mono 9pt
    screen.setFont(&FreeMono9pt7b);
    // TextSize => 1.5
    screen.setTextSize(1.5);
    // Don Luc Electronics
    screen.setCursor(0, 30);
    screen.println("Don Luc Electronics");
    // Version
    screen.setCursor(0, 60);
    screen.println( sver );
    // Temperature
    screen.setCursor(0, 90);
    screen.println( "Temp: " );
    screen.setCursor(60, 90);
    screen.println( T );
    screen.setCursor(125, 90);
    screen.println("Celsius");
    // Humidity
    screen.setCursor(0, 120);
    screen.println("Humi: ");
    screen.setCursor(60, 120);
    screen.println( H );
    screen.setCursor(125, 120);
    screen.println("% RH");
    // MEMS VOC Gas
    screen.setCursor(0, 150);
    screen.println( "VOC: " );
    screen.setCursor(60, 150);
    screen.println( iSensorValueVOC );
    screen.setCursor(125, 150);
    screen.println("ppm");

}

getEEPROM.ino

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

getSD.ino

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

    // 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 = "";

  //DFR|EEPROM Unique ID|Version|
  //Temperature C|% RH|VOC|*\r
  zzzzzz = "DFR|" + uid + "|" + sver + "|"
  + String( T ) + "|" + String( H ) + "|"
  + String( iSensorValueVOC ) + "|*\r";

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

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

  // Append File
  appendFile(SD, "/dfrdata.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();
    
}

getSHTC3.ino

// SHTC3 Temperature and Humidity Sensor
// SHTC3
void isSHTC3(){

  // SHTC3 Temperature and Humidity Sensor
  if (sht.readSample()) {
     
     // Temperature
     T = sht.getTemperature();
     // Humidity
     H = sht.getHumidity();

  }

}

getVOC.ino

// MEMS VOC Gas
// is VOC
void isVOC(){

  // MEMS VOC Gas
  x = analogRead( iSensorVOC );
  iSensorValueVOC = map(x, 1, 4095, 1, 500);
  
}

setup.ino

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

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

  // Wire
  Wire.begin();

  // Delay
  delay( 100 );

  // SHTC3 Temperature and Humidity Sensor
  sht.init();
  // SHT3x
  sht.setAccuracy(SHTSensor::SHT_ACCURACY_MEDIUM);

  // Delay
  delay( 100 );
  
  // DFRobot Display 240x320
  screen.begin();

  // Delay
  delay(100);

  // MicroSD Card
  isSetupSD();

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

  // iLEDGreen HIGH
  digitalWrite(iLEDGreen, HIGH );

  // DFRobot Display 240x320 - UID
  // Don Luc Electronics
  // Version
  // EEPROM
  isDisplayUID();

  // Delay 5 Second
  delay( 5000 );

}

——

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

Teacher, Instructor, E-Mentor, R&D and Consulting

  • Programming Language
  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
  • IoT
  • Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
  • Robotics
  • Automation
  • Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
  • Unmanned Vehicles Terrestrial and Marine
  • Machine Learning
  • Artificial Intelligence (AI)
  • RTOS
  • Sensors, eHealth Sensors, Biosensor, and Biometric
  • Research & Development (R & D)
  • Consulting

Follow Us

Luc Paquin – Curriculum Vitae – 2024
https://www.donluc.com/luc/

Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
LinkedIn: https://www.linkedin.com/in/jlucpaquin/

Don Luc

Project #29 – DFRobot – SD Card – Mk22

——

#DonLucElectronics #DonLuc #DFRobot #SHTC3 #FireBeetle2ESP32C6 #Display #EEPROM #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

SD Card

——

SD Card

——

SD Card

——

SD Card

Secure Digital, officially abbreviated as SD, is a proprietary, non-volatile, flash memory card format the SD Association (SDA) developed for use in portable devices. Because of their small physical dimensions, SD cards became widely used in many consumer electronic devices, such as Arduino, digital cameras, camcorders, video game consoles, mobile phones, action cameras such as the GoPro Hero series, and camera drones.

DL2407Mk06

1 x FireBeetle 2 ESP32-C6
1 x Fermion: SHTC3 Temperature and Humidity Sensor
1 x Fermion: 2.0″ 320×240 IPS TFT LCD
1 x MicroSD 2 GB
1 x GDL Line 10 CM
1 x 1 x Lithium Ion Battery – 1000mAh
1 x USB 3.1 Cable A to C

FireBeetle 2 ESP32-C6

SCK – 23
MOSI – 22
MISO – 21
CS – 18
SCL – 20
SDA – 19
DC – 8
CS – 1
RST – 14
VIN – +3.3V
GND – GND

——

DL2407Mk06p.ino

/****** Don Luc Electronics © ******
Software Version Information
Project #29 - DFRobot - SD Card - Mk22
29-22
DL2407Mk06p.ino
DL2407Mk06
1 x FireBeetle 2 ESP32-C6
1 x Fermion: SHTC3 Temperature and Humidity Sensor
1 x Fermion: 2.0" 320x240 IPS TFT LCD
1 x MicroSD 2 GB
1 x GDL Line 10 CM
1 x 1 x Lithium Ion Battery - 1000mAh
1 x USB 3.1 Cable A to C
*/

// Include the Library Code
// EEPROM Library to Read and Write EEPROM
// with Unique ID for Unit
#include "EEPROM.h"
// DFRobot Display GDL API
#include <DFRobot_GDL.h>
// Arduino
#include <Arduino.h>
// Wire
#include <Wire.h>
// SHTC3 Temperature and Humidity Sensor
#include "SHTSensor.h"
// SD Card
#include "FS.h"
#include "SD.h"
#include "SPI.h"

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

// SHTC3 Temperature and Humidity Sensor
SHTSensor sht;
// Temperature
float T;
// Humidity
float H;

// Defined ESP32
#define TFT_DC 8
#define TFT_CS 1
#define TFT_RST 14

/*dc=*/ /*cs=*/ /*rst=*/
// DFRobot Display 240x320
DFRobot_ST7789_240x320_HW_SPI screen(TFT_DC, TFT_CS, TFT_RST);

// LED Green
int iLEDGreen = 15;

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

// Software Version Information
String sver = "29-22";

void loop() {

  // SHTC3 Temperature and Humidity Sensor
  isSHTC3();

  // DFRobot Display 240x320 - Temperature and Humidity
  isDisplayTH();

  // MicroSD Card
  isSD();

  // Delay 5 Second
  delay( 5000 );

}

getDisplay.ino

// DFRobot Display 240x320
// DFRobot Display 240x320 - UID
void isDisplayUID() {

    // DFRobot Display 240x320
    // Text Display
    // Text Wrap
    screen.setTextWrap(false);
    // Rotation
    screen.setRotation(3);
    // Fill Screen => black
    screen.fillScreen(0x0000);
    // Text Color => white
    screen.setTextColor(0xffff);
    // Font => Free Mono 9pt
    screen.setFont(&FreeMono9pt7b);
    // TextSize => 1.5
    screen.setTextSize(1.5);
    // DFRobot Display
    screen.setCursor(0, 30);
    screen.println("DFRobot Display");
    // Don Luc Electronics
    screen.setCursor(0, 60);
    screen.println("Don Luc Electronics");
    // Version
    screen.setCursor(0, 90);
    screen.println("Version");
    screen.setCursor(0, 120);
    screen.println( sver );
    // EEPROM
    screen.setCursor(0, 150);
    screen.println("EEPROM");
    screen.setCursor(0, 180);
    screen.println( uid );

}
// DFRobot Display 240x320 - Temperature and Humidity
void isDisplayTH() {
  
    // DFRobot Display 240x320
    // Text Display
    // Text Wrap
    screen.setTextWrap(false);
    // Rotation
    screen.setRotation(3);
    // Fill Screen => black
    screen.fillScreen(0x0000);
    // Text Color => white
    screen.setTextColor(0xffff);
    // Font => Free Mono 9pt
    screen.setFont(&FreeMono9pt7b);
    // TextSize => 1.5
    screen.setTextSize(1.5);
    // Don Luc Electronics
    screen.setCursor(0, 30);
    screen.println("Don Luc Electronics");
    // Version
    screen.setCursor(0, 60);
    screen.println( sver );
    // Temperature
    // Text Color => red
    screen.setTextColor(0xf800);
    screen.setCursor(0, 90);
    screen.println( "Temperature" );
    screen.setCursor(0, 120);
    screen.println( T );
    screen.setCursor(100, 120);
    screen.println("Celsius");
    // Humidity
    // Text Color => blue
    screen.setTextColor(0x001f);
    screen.setCursor(0, 150);
    screen.println("Humidity");
    screen.setCursor(0, 180);
    screen.println( H );
    screen.setCursor(100, 180);
    screen.println("% RH");

}

getEEPROM.ino

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

getSD.ino

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

    // 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 = "";

  //DFR|EEPROM Unique ID|Version|
  //Temperature C|% RH|*\r
  zzzzzz = "DFR|" + uid + "|" + sver + "|"
  + String( T ) + "|" + String( H ) + "|*\r";

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

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

  // Append File
  appendFile(SD, "/dfrdata.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();
    
}

getSHTC3.ino

// SHTC3 Temperature and Humidity Sensor
// SHTC3
void isSHTC3(){

  // SHTC3 Temperature and Humidity Sensor
  if (sht.readSample()) {
     
     // Temperature
     T = sht.getTemperature();
     // Humidity
     H = sht.getHumidity();

  }

}

setup.ino

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

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

  // Wire
  Wire.begin();

  // Delay
  delay( 100 );

  // SHTC3 Temperature and Humidity Sensor
  sht.init();
  // SHT3x
  sht.setAccuracy(SHTSensor::SHT_ACCURACY_MEDIUM);

  // Delay
  delay( 100 );
  
  // DFRobot Display 240x320
  screen.begin();

  // Delay
  delay(100);

  // MicroSD Card
  isSetupSD();

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

  // iLEDGreen HIGH
  digitalWrite(iLEDGreen, HIGH );

  // DFRobot Display 240x320 - UID
  // Don Luc Electronics
  // Version
  // EEPROM
  isDisplayUID();

  // Delay 5 Second
  delay( 5000 );

}

——

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

Teacher, Instructor, E-Mentor, R&D and Consulting

  • Programming Language
  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
  • IoT
  • Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
  • Robotics
  • Automation
  • Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
  • Unmanned Vehicles Terrestrial and Marine
  • Machine Learning
  • Artificial Intelligence (AI)
  • RTOS
  • Sensors, eHealth Sensors, Biosensor, and Biometric
  • Research & Development (R & D)
  • Consulting

Follow Us

Luc Paquin – Curriculum Vitae – 2024
https://www.donluc.com/luc/

Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
LinkedIn: https://www.linkedin.com/in/jlucpaquin/

Don Luc

Project #29 – DFRobot – SHTC3 – Mk21

——

#DonLucElectronics #DonLuc #DFRobot #SHTC3 #FireBeetle2ESP32C6 #Display #EEPROM #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

SHTC3

——

SHTC3

——

SHTC3

——

Fermion: SHTC3 Temperature and Humidity Sensor

The SHTC3 digital humidity sensor from Sensirion builds on the success of the proven SHTC1 sensor and offers consistent high accuracy within the measuring range. The sensor covers a humidity measurement range of 0 to 100% RH and a temperature detection range of -40 Celsius to 125 Celsius with a typical accuracy of ±2% RH and ±0.2 Celsius. The board supply voltage of 3.3 Volt to 5 Volt and a current consumption below 0.15mA in low power mode make the SHTC3 perfectly suitable for mobile or wireless battery-driven applications.

DL2407Mk05

1 x FireBeetle 2 ESP32-C6
1 x Fermion: SHTC3 Temperature and Humidity Sensor
1 x Fermion: 2.0″ 320×240 IPS TFT LCD
1 x GDL Line 10 CM
1 x 1 x Lithium Ion Battery – 1000mAh
1 x USB 3.1 Cable A to C

FireBeetle 2 ESP32-C6

SCL – 20
SDA – 19
DC – 8
CS – 1
RST – 14
VIN – +3.3V
GND – GND

——

DL2407Mk05p.ino

/****** Don Luc Electronics © ******
Software Version Information
Project #29 - DFRobot - SHTC3 - Mk21
29-21
DL2407Mk05p.ino
DL2407Mk05
1 x FireBeetle 2 ESP32-C6
1 x Fermion: SHTC3 Temperature and Humidity Sensor
1 x Fermion: 2.0" 320x240 IPS TFT LCD
1 x GDL Line 10 CM
1 x 1 x Lithium Ion Battery - 1000mAh
1 x USB 3.1 Cable A to C
*/

// Include the Library Code
// EEPROM Library to Read and Write EEPROM
// with Unique ID for Unit
#include "EEPROM.h"
// DFRobot Display GDL API
#include <DFRobot_GDL.h>
// Arduino
#include <Arduino.h>
// Wire
#include <Wire.h>
// SHTC3 Temperature and Humidity Sensor
#include "SHTSensor.h"

// SHTC3 Temperature and Humidity Sensor
SHTSensor sht;
// Temperature
float T;
// Humidity
float H;

// Defined ESP32
#define TFT_DC 8
#define TFT_CS 1
#define TFT_RST 14

/*dc=*/ /*cs=*/ /*rst=*/
// DFRobot Display 240x320
DFRobot_ST7789_240x320_HW_SPI screen(TFT_DC, TFT_CS, TFT_RST);

// LED Green
int iLEDGreen = 15;

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

// Software Version Information
String sver = "29-21";

void loop() {

  // SHTC3 Temperature and Humidity Sensor
  isSHTC3();

  // DFRobot Display 240x320 - Temperature and Humidity
  isDisplayTH();

  // Delay 5 Second
  delay( 5000 );

}

getDisplay.ino

// DFRobot Display 240x320
// DFRobot Display 240x320 - UID
void isDisplayUID() {

    // DFRobot Display 240x320
    // Text Display
    // Text Wrap
    screen.setTextWrap(false);
    // Rotation
    screen.setRotation(3);
    // Fill Screen => black
    screen.fillScreen(0x0000);
    // Text Color => white
    screen.setTextColor(0xffff);
    // Font => Free Mono 9pt
    screen.setFont(&FreeMono9pt7b);
    // TextSize => 1.5
    screen.setTextSize(1.5);
    // DFRobot Display
    screen.setCursor(0, 30);
    screen.println("DFRobot Display");
    // Don Luc Electronics
    screen.setCursor(0, 60);
    screen.println("Don Luc Electronics");
    // Version
    screen.setCursor(0, 90);
    screen.println("Version");
    screen.setCursor(0, 120);
    screen.println( sver );
    // EEPROM
    screen.setCursor(0, 150);
    screen.println("EEPROM");
    screen.setCursor(0, 180);
    screen.println( uid );

}
// DFRobot Display 240x320 - Temperature and Humidity
void isDisplayTH() {
  
    // DFRobot Display 240x320
    // Text Display
    // Text Wrap
    screen.setTextWrap(false);
    // Rotation
    screen.setRotation(3);
    // Fill Screen => black
    screen.fillScreen(0x0000);
    // Text Color => white
    screen.setTextColor(0xffff);
    // Font => Free Mono 9pt
    screen.setFont(&FreeMono9pt7b);
    // TextSize => 1.5
    screen.setTextSize(1.5);
    // Don Luc Electronics
    screen.setCursor(0, 30);
    screen.println("Don Luc Electronics");
    // Version
    screen.setCursor(0, 60);
    screen.println( sver );
    // Temperature
    // Text Color => red
    screen.setTextColor(0xf800);
    screen.setCursor(0, 90);
    screen.println( "Temperature" );
    screen.setCursor(0, 120);
    screen.println( T );
    screen.setCursor(100, 120);
    screen.println("Celsius");
    // Humidity
    // Text Color => blue
    screen.setTextColor(0x001f);
    screen.setCursor(0, 150);
    screen.println("Humidity");
    screen.setCursor(0, 180);
    screen.println( H );
    screen.setCursor(100, 180);
    screen.println("% RH");

}

getEEPROM.ino

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

getSHTC3.ino

// SHTC3 Temperature and Humidity Sensor
// SHTC3
void isSHTC3(){

  // SHTC3 Temperature and Humidity Sensor
  if (sht.readSample()) {
     
     // Temperature
     T = sht.getTemperature();
     // Humidity
     H = sht.getHumidity();

  }

}

setup.ino

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

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

  // Wire
  Wire.begin();

  // Delay
  delay( 100 );

  // SHTC3 Temperature and Humidity Sensor
  sht.init();
  // SHT3x
  sht.setAccuracy(SHTSensor::SHT_ACCURACY_MEDIUM);

  // Delay
  delay( 100 );
  
  // DFRobot Display 240x320
  screen.begin();

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

  // iLEDGreen HIGH
  digitalWrite(iLEDGreen, HIGH );

  // DFRobot Display 240x320 - UID
  // Don Luc Electronics
  // Version
  // EEPROM
  isDisplayUID();

  // Delay 5 Second
  delay( 5000 );

}

——

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

Teacher, Instructor, E-Mentor, R&D and Consulting

  • Programming Language
  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
  • IoT
  • Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
  • Robotics
  • Automation
  • Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
  • Unmanned Vehicles Terrestrial and Marine
  • Machine Learning
  • Artificial Intelligence (AI)
  • RTOS
  • Sensors, eHealth Sensors, Biosensor, and Biometric
  • Research & Development (R & D)
  • Consulting

Follow Us

Luc Paquin – Curriculum Vitae – 2024
https://www.donluc.com/luc/

Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
LinkedIn: https://www.linkedin.com/in/jlucpaquin/

Don Luc

Project #29 – DFRobot – ESP32-C6 and LCD Display – Mk20

——

#DonLucElectronics #DonLuc #DFRobot #FireBeetle2ESP32C6 #Display #EEPROM #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

ESP32-C6 and LCD Display

——

ESP32-C6 and LCD Display

——

ESP32-C6 and LCD Display

——

FireBeetle 2 ESP32-C6

The FireBeetle 2 ESP32-C6 is a versatile low-power IoT controller board designed for Smart Home Automation, control and monitoring system. It features a 160MHz RISC-V 32-bit processor, providing excellent energy efficiency and flexibility for Internet of Things (IoT) projects. The board supports multiple communication protocols, including Wi-Fi 6, Bluetooth 5, Zigbee 3.0, and Thread 1.3, enabling versatile wireless connectivity.

Fermion: 2.0″ 320×240 IPS TFT LCD

This 2.0 inches LCD display adopts ST7789V driver chip and has 320 x 240 color pixels, performing excellently in the angle of view. It supports SPI communication mode and GDI port, plug, and play. The module can be powered by 3.3 Volt ~ 5 Volt, compatible with multiple main-controllers like Arduino UNO, Leonardo, ESP32, ESP8266, FireBeetle M0, and so on. Besides, there is an onboard MicroSD card slot for displaying more pictures.

DL2407Mk04

1 x FireBeetle 2 ESP32-C6
1 x Fermion: 2.0″ 320×240 IPS TFT LCD
1 x GDL Line 10 CM
1 x 1 x Lithium Ion Battery – 1000mAh
1 x USB 3.1 Cable A to C

FireBeetle 2 ESP32-C6

DC – 8
CS – 1
RST – 14
VIN – +3.3V
GND – GND

DL2407Mk04p.ino

/****** Don Luc Electronics © ******
Software Version Information
Project #29 - DFRobot - ESP32-C6 and  LCD Display - Mk20
29-20
DL2407Mk04p.ino
DL2407Mk04
1 x FireBeetle 2 ESP32-C6
1 x Fermion: 2.0" 320x240 IPS TFT LCD
1 x GDL Line 10 CM
1 x 1 x Lithium Ion Battery - 1000mAh
1 x USB 3.1 Cable A to C
*/

// Include the Library Code
// EEPROM Library to Read and Write EEPROM
// with Unique ID for Unit
#include "EEPROM.h"
// DFRobot Display GDL API
#include <DFRobot_GDL.h>

// Defined ESP32
#define TFT_DC 8
#define TFT_CS 1
#define TFT_RST 14

/*dc=*/ /*cs=*/ /*rst=*/
// DFRobot Display 240x320
DFRobot_ST7789_240x320_HW_SPI screen(TFT_DC, TFT_CS, TFT_RST);

// VID
int VID = 0;
String zzzzzz = "";

// LED Green
int iLEDGreen = 15;

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

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

void loop() {

  // VID
  VID = VID + 1;

  // DFRobot Display 240x320 - VID
  isDisplayVID();

  // Delay 5 Second
  delay( 5000 );

}

getDisplay.ino

// DFRobot Display 240x320
// DFRobot Display 240x320 - UID
void isDisplayUID() {

    // DFRobot Display 240x320
    // Text Display
    // Text Wrap
    screen.setTextWrap(false);
    // Rotation
    screen.setRotation(3);
    // Fill Screen => ghostwhite
    screen.fillScreen(0xf7bf);
    // Text Color => black
    screen.setTextColor(0x0000);
    // Font => Free Mono 9pt
    screen.setFont(&FreeMono9pt7b);
    // TextSize => 1.5
    screen.setTextSize(1.5);
    // DFRobot Display
    screen.setCursor(0, 30);
    screen.println("DFRobot Display");
    // Don Luc Electronics
    screen.setCursor(0, 60);
    screen.println("Don Luc Electronics");
    // Version
    screen.setCursor(0, 90);
    screen.println("Version");
    screen.setCursor(0, 120);
    screen.println( sver );
    // EEPROM
    screen.setCursor(0, 150);
    screen.println("EEPROM");
    screen.setCursor(0, 180);
    screen.println( uid );

}
// DFRobot Display 240x320 - VID
void isDisplayVID() {

    // zzzzzz = VID
    zzzzzz = String(VID);
    
    // DFRobot Display 240x320
    // Text Display
    // Text Wrap
    screen.setTextWrap(false);
    // Rotation
    screen.setRotation(3);
    // Fill Screen => ghostwhite
    screen.fillScreen(0xf7bf);
    // Text Color => black
    screen.setTextColor(0x0000);
    // Font => Free Mono 9pt
    screen.setFont(&FreeMono9pt7b);
    // TextSize => 1.5
    screen.setTextSize(1.5);
    // DFRobot Display
    screen.setCursor(0, 30);
    screen.println("DFRobot Display");
    // Don Luc Electronics
    screen.setCursor(0, 60);
    screen.println("Don Luc Electronics");
    // Version
    screen.setCursor(0, 90);
    screen.println( sver );
    // EEPROM
    screen.setCursor(0, 120);
    screen.println( uid );
    // Text Color => red
    screen.setTextColor(0xf800);
    // VID
    screen.setCursor(0, 150);
    screen.println("VID");
    screen.setCursor(0, 180);
    screen.println( zzzzzz );

}

getEEPROM.ino

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

setup.ino

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

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

  // Delay
  delay( 100 );

  // DFRobot Display 240x320
  screen.begin();

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

  // iLEDGreen HIGH
  digitalWrite(iLEDGreen, HIGH );

  // DFRobot Display 240x320 - UID
  // Don Luc Electronics
  // Version
  // EEPROM
  isDisplayUID();

  // Delay 5 Second
  delay( 5000 );

}

——

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

Teacher, Instructor, E-Mentor, R&D and Consulting

  • Programming Language
  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
  • IoT
  • Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
  • Robotics
  • Automation
  • Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
  • Unmanned Vehicles Terrestrial and Marine
  • Machine Learning
  • Artificial Intelligence (AI)
  • RTOS
  • Sensors, eHealth Sensors, Biosensor, and Biometric
  • Research & Development (R & D)
  • Consulting

Follow Us

Luc Paquin – Curriculum Vitae – 2024
https://www.donluc.com/luc/

Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
LinkedIn: https://www.linkedin.com/in/jlucpaquin/

Don Luc

Project #29 – DFRobot – AltIMU-10 – Mk19

——

#DonLucElectronics #DonLuc #DFRobot #AltIMU10 #9DOF #GPS #FireBeetle2ESP32E #EEPROM #RTC #SD #Display #Pololu #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

AltIMU-10

——

AltIMU-10

——

AltIMU-10

——

Pololu AltIMU-10 v5 Gyro, Accelerometer, Compass, and Altimeter

The Pololu AltIMU-10 v5 is a compact board that combines ST’s LSM6DS33 3-axis gyroscope and 3-axis accelerometer, LIS3MDL 3-axis magnetometer, and LPS25H digital barometer to form an inertial measurement unit (IMU) and altimeter. These sensors are great ICs, but their small packages make them difficult for the typical student or hobbyist to use. They also operate at voltages below 3.6 Volt, which can make interfacing difficult for microcontrollers operating at 5 Volt. The AltIMU-10 v5 addresses these issues by incorporating additional electronics, including a voltage regulator and a level-shifting circuit, while keeping the overall size as compact as possible. The board ships fully populated with its SMD components, including the LSM6DS33, LIS3MDL, and LPS25H.

Attitude and Heading Reference System (AHRS)

An attitude and heading reference system (AHRS) uses an inertial measurement unit (IMU) consisting of microelectromechanical system (MEMS) inertial sensors to measure the angular rate, acceleration, and Earth’s magnetic field. These measurements can then be used to derive an estimate of the object’s attitude. An AHRS typically includes a 3-axis gyroscope, a 3-axis accelerometer, and a 3-axis magnetometer to determine an estimate of a system’s orientation. Each of these sensors contribute different measurements to the combined system and each exhibit unique limitations.

DL2406Mk06

1 x DFRobot FireBeetle 2 ESP32-E
1 x Adafruit SHARP Memory Display
1 x Adafruit MicroSD card breakout board+
1 x MicroSD 16 GB
1 x Pololu AltIMU-10 v5
1 x GPS Receiver – GP-20U7
2 x Switch
1 x 1K Ohm
1 x 1 x Lithium Ion Battery – 1000mAh
1 x Green LED
1 x USB 3.1 Cable A to C

DFRobot FireBeetle 2 ESP32-E

LED – 2
DSCK – 4
DMOSI – 16
DSS – 17
SCK – 22
MOSI – 23
MISO – 19
CS – 13
GPR – 26
GPT – 25
SCL – 21
SDA – 22
LED – 14
SWI – 3
XAC – A0
YAC – A1
ZAC – A2
VIN – +3.3V
GND – GND

——

DL2406Mk06p.ino

/****** Don Luc Electronics © ******
Software Version Information
Project #29 - DFRobot - AltIMU-10 - Mk19
29-19
DL2406Mk06p.ino
DL2406Mk06
1 x DFRobot FireBeetle 2 ESP32-E
1 x Adafruit SHARP Memory Display
1 x Adafruit MicroSD card breakout board+
1 x MicroSD 16 GB
1 x Pololu AltIMU-10 v5
1 x GPS Receiver - GP-20U7
2 x Switch
1 x 1K Ohm
1 x 1 x Lithium Ion Battery - 1000mAh
1 x Green LED
1 x USB 3.1 Cable A to C
*/

// Include the Library Code
// EEPROM Library to Read and Write EEPROM
// with Unique ID for Unit
#include "EEPROM.h"
// Wire
#include <Wire.h>
// SD Card
#include "FS.h"
#include "SD.h"
#include "SPI.h"
// SHARP Memory Display
#include <Adafruit_SharpMem.h>
#include <Adafruit_GFX.h>
// GPS Receiver
#include <TinyGPS++.h>
// ESP32 Hardware Serial
#include <HardwareSerial.h>
// Includes and variables for IMU integration
// STMicroelectronics LSM6DS33 Gyroscope and Accelerometer
#include <LSM6.h>
// STMicroelectronics LIS3MDL Magnetometer
#include <LIS3MDL.h>
// STMicroelectronics LPS25H digital Barometer
#include <LPS.h>

// Earth's magnetic field varies by location. Add or subtract
// a declination to get a more accurate heading. Calculate
// your's here: http://www.ngdc.noaa.gov/geomag-web/#declination
// Declination (degrees) in Mexicali
#define DECLINATION 10.31

// 9DoF IMU
// STMicroelectronics LSM6DS33 Gyroscope and Accelerometer
LSM6 imu;
// Accelerometer and Gyroscopes
// Accelerometer
int imuAX;
int imuAY;
int imuAZ;
//String FullStringB = "";
// Gyroscopes 
int imuGX;
int imuGY;
int imuGZ;
// STMicroelectronics LIS3MDL magnetometer
LIS3MDL mag;
// Magnetometer
int magX;
int magY;
int magZ;
// STMicroelectronics LPS25H digital barometer
LPS ps;
// Digital Barometer
float pressure;
float altitude;
float temperature;
// Attitude Calculate Pitch, Roll, and Headind
float r;
float p;
float h;

// ESP32 HardwareSerial
HardwareSerial tGPS(2);

// GPS Receiver
#define gpsRXPIN 26
// This one is unused and doesnt have a conection
#define gpsTXPIN 25
// 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 = "";

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

// SHARP Memory Display
#define SHARP_SCK  4
#define SHARP_MOSI 16
#define SHARP_SS   17
// 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

// LED Green
int iLEDGreen = 2;

// Define LED
int iLED = 14;

// Switch
int iSwitch = 3;
// Variable for reading the Switch status
int iSwitchState = 0;

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

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

void loop() {

  // Accelerometer and Gyroscopes
  isIMU();

  // Magnetometer
  isMag();

  // Barometer
  isBarometer();

  // Attitude Calculate Pitch, Roll, and Heading
  isAttitude(imuAX, imuAY, imuAZ, -imuGY, -imuGX, imuGZ);

  // isGPS
  isGPS();

  // Read the state of the Switch value
  iSwitchState = digitalRead(iSwitch);
  
  // The Switch is HIGH:
  if (iSwitchState == HIGH) {

    // Attitude Calculate Pitch, Roll, and Heading and Barometer
    isDisplayAttitude();
  
  } else {

    // Display GPS
    isDisplayGPS();
    
  }  

  // MicroSD Card
  isSD();

  // iLED HIGH
  digitalWrite(iLED, HIGH );

  // Delay 5 Second
  delay(5000);

}

getAccelGyro.ino

// Accelerometer and Gyroscopes
// Setup IMU
void isSetupIMU() {

  // Setup IMU
  imu.init();
  // Default
  imu.enableDefault();
  
}
// Accelerometer and Gyroscopes
void isIMU() {

  // Accelerometer and Gyroscopes
  imu.read();
  // Accelerometer x, y, z
  imuAX = imu.a.x;
  imuAY = imu.a.y;
  imuAZ = imu.a.z;
  // Gyroscopes x, y, z
  imuGX = imu.g.x;
  imuGY = imu.g.y;
  imuGZ = imu.g.z;

}

getAttitude.ino

// Attitude Calculate Pitch, Roll, and Heading
void isAttitude(float ax, float ay, float az, float mx, float my, float mz) {

  // Attitude Calculate Pitch, Roll, and Heading
  float roll = atan2(ay, az);
  float pitch = atan2(-ax, sqrt(ay * ay + az * az));

  float heading;
  if (my == 0)
    heading = (mx < 0) ? PI : 0;
  else
    heading = atan2(mx, my);

  heading -= DECLINATION * PI / 180;

  if (heading > PI) heading -= (2 * PI);
  else if (heading < -PI) heading += (2 * PI);

  // Convert everything from radians to degrees:
  heading *= 180.0 / PI;
  pitch *= 180.0 / PI;
  roll  *= 180.0 / PI;

  h = heading;
  p = pitch;
  r = roll;
  
}

getBarometer.ino

// STMicroelectronics LPS25H digital barometer
// Setup Barometer
void isSetupBarometer(){

  // Setup Barometer
  ps.init();
  // Default
  ps.enableDefault();
  
}
// Barometer
void isBarometer(){

  // Barometer
  pressure = ps.readPressureMillibars();
  // Altitude Meters
  altitude = ps.pressureToAltitudeMeters(pressure);
  // Temperature Celsius
  temperature = ps.readTemperatureC();

}

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 );
    
}
// Attitude Calculate Pitch, Roll, and Heading
void isDisplayAttitude() {

    // Text Display
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // Pitch
    display.setCursor(0,5);
    display.print( "Pi: " );
    display.println( p );
    // Roll
    display.setCursor(0,25);
    display.print( "Ro: " );
    display.println( r );
    // Heading
    display.setCursor(0,45);
    display.print( "He: " );
    display.println( h );
    // Temperature Celsius
    display.setCursor(0,65);
    display.print( "Te: " );
    display.println( temperature );
    // Barometer
    display.setCursor(0,85);
    display.print( "Ba: " );
    display.println( pressure );
    // Altitude Meters
    display.setCursor(0,105);
    display.print( "Al: " );
    display.println( altitude );
    // 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);
    // Latitude
    display.setCursor(0,5);
    display.print( "Lat: " );
    display.println( TargetLat );
    // Longitude
    display.setCursor(0,30);
    display.print( "Lon: " );
    display.println( TargetLon );
    // GPS Date
    display.setCursor(0,55);
    display.println( TargetDat );
    // GPS Time
    display.setCursor(0,80);
    display.println( TargetTim );
    // GPS Speed M/S
    display.setCursor(0,105);
    display.print( TargetSMS );
    display.println( " M/S" );
    // GPS Altitude Meters
    display.setCursor(0,130);
    display.print( TargetALT );
    display.println( " M" );
    // Refresh
    display.refresh();
    delay( 100 );

}

getEEPROM.ino

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

getGPS.ino

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

  // 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);

  }
  
}

getMagnetometer.ino

// Magnetometer
// Setup Magnetometer
void isSetupMag() {

  // Setup Magnetometer
  mag.init();
  // Default
  mag.enableDefault();
  
}
// Magnetometer
void isMag() {

  // Magnetometer
  mag.read();
  // Magnetometer x, y, z
  magX = mag.m.x;
  magY = mag.m.y;
  magZ = mag.m.z;

}

getSD.ino

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

    // 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 = "";

  //DFR|EEPROM Unique ID|Version|
  //Accelerometer X|Accelerometer Y|Accelerometer Z|
  //Gyroscope X|Gyroscope Y|Gyroscope Z|
  //Magnetometer X|Magnetometer Y|Magnetometer Z|
  //Pitch|Roll|Heading|
  //Temperature C|Pressure Millibars|Altitude Meters|
  //GPS|Latitude|Longitude|GPS Date|GPS Time|GPS Speed M/S|GPS Altitude|*\r
  zzzzzz = "DFR|" + uid + "|" + sver + "|"
  + String(imuAX) + "|" + String(imuAY) + "|" + String(imuAZ) + "|"
  + String(imuGX) + "|" + String(imuGY) + "|" + String(imuGZ) + "|"
  + String(magX) + "|" + String(magY) + "|" + String(magZ) + "|"
  + String(p) + "|" + String(r) + "|" + String(h) + "|"
  + String(temperature) + "|" + String(pressure) + "|" + String(altitude) + "|"
  + String(GPSSt) + "|" + String(TargetLat) + "|" 
  + String(TargetLon) + "|" + String(TargetDat) + "|" + String(TargetTim) + "|" 
  + String(TargetSMS) + "|" + String(TargetALT)+ "|*\r";

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

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

  // Append File
  appendFile(SD, "/dfrdata.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()
{
  
  // Give display time to power on
  delay(100);

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

  // Give display
  delay(100);

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

  // Give display
  delay(100);

  //MicroSD Card
  isSetupSD();

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

  // Delay
  delay( 100 );

  // GPS Receiver
  // Setup GPS
  isSetupGPS();

  // Delay
  delay( 100 );

  // Setup IMU
  isSetupIMU();

  // Setup Magnetometer
  isSetupMag();

  // Setup Barometer
  isSetupBarometer();

  // Delay
  delay( 100 );

  // Initialize digital pin iLED as an output
  pinMode(iLED, OUTPUT);

  // Outputting high, the LED turns on
  digitalWrite(iLED, HIGH);

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

  // iLEDGreen HIGH
  digitalWrite(iLEDGreen, HIGH );

  // Initialize the Switch
  pinMode(iSwitch, INPUT);

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

}

——

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

Teacher, Instructor, E-Mentor, R&D and Consulting

  • Programming Language
  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
  • IoT
  • Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
  • Robotics
  • Automation
  • Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
  • Unmanned Vehicles Terrestrial and Marine
  • Machine Learning
  • Artificial Intelligence (AI)
  • RTOS
  • Sensors, eHealth Sensors, Biosensor, and Biometric
  • Research & Development (R & D)
  • Consulting

Follow Us

Luc Paquin – Curriculum Vitae – 2024
https://www.donluc.com/luc/

Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
LinkedIn: https://www.linkedin.com/in/jlucpaquin/

Don Luc

Project #29 – DFRobot – L3G4200D – Mk18

——

#DonLucElectronics #DonLuc #DFRobot #L3G4200D #HMC5883L #ADXL335 #GPS #FireBeetle2ESP32E #EEPROM #RTC #SD #Display #SparkFun #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

L3G4200D

——

L3G4200D

——

L3G4200D

——

SparkFun Tri-Axis Gyroscope – L3G4200D

This is a breakout board for the L3G4200D low-power three-axis angular rate sensor. The L3G4200D is a MEMS motion sensor and has a full scale of dps and is capable of measuring rates with a user-selectable bandwidth. These work great in gaming and virtual reality input devices, motion control with MMI, GPS navigation systems, appliances and robotics. The L3G4200D is a low-power three-axis angular rate sensor able to provide unprecedented stablility of zero rate level and sensitivity over temperature and time. It includes a sensing element and an IC interface capable of providing the measured angular rate to the external world through a digital interface.

DL2406Mk05

1 x DFRobot FireBeetle 2 ESP32-E
1 x Adafruit SHARP Memory Display
1 x Adafruit MicroSD card breakout board+
1 x MicroSD 16 GB
1 x SparkFun Triple Axis Accelerometer ADXL335
1 x SparkFun Triple Axis Magnetometer HMC5883L
1 x SparkFun Tri-Axis Gyroscope L3G4200D
1 x GPS Receiver – GP-20U7
2 x Switch
1 x 1K Ohm
1 x 1 x Lithium Ion Battery – 1000mAh
1 x Green LED
1 x USB 3.1 Cable A to C

DFRobot FireBeetle 2 ESP32-E

LED – 2
DSCK – 4
DMOSI – 16
DSS – 17
SCK – 22
MOSI – 23
MISO – 19
CS – 13
GPR – 26
GPT – 25
SCL – 21
SDA – 22
LED – 14
SWI – 3
XAC – A0
YAC – A1
ZAC – A2
VIN – +3.3V
GND – GND

——

DL2406Mk05p.ino

/****** Don Luc Electronics © ******
Software Version Information
Project #29 - DFRobot - L3G4200D - Mk18
29-18
DL2406Mk05p.ino
DL2406Mk05
1 x DFRobot FireBeetle 2 ESP32-E
1 x Adafruit SHARP Memory Display
1 x Adafruit MicroSD card breakout board+
1 x MicroSD 16 GB
1 x SparkFun Triple Axis Magnetometer HMC5883L
1 x SparkFun Triple Axis Accelerometer ADXL335
1 x SparkFun Tri-Axis Gyroscope L3G4200D
1 x GPS Receiver - GP-20U7
2 x Switch
1 x 1K Ohm
1 x 1 x Lithium Ion Battery - 1000mAh
1 x Green LED
1 x USB 3.1 Cable A to C
*/

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

// Gyroscope
L3G4200D gyroscope;
// Timers
unsigned long timer = 0;
float timeStep = 0.01;
// Pitch, Roll and Yaw values
float pitch = 0;
float roll = 0;
float yaw = 0;

// Triple Axis Magnetometer
HMC5883L compass;
// Triple Axis Magnetometer
int mX = 0;
int mY = 0;
int mZ = 0;

// Accelerometer ADXL335
int iX = A0;
int iY = A1;
int iZ = A2;
// Accelerometer
int X = 0;
int Y = 0;
int Z = 0;

// ESP32 HardwareSerial
HardwareSerial tGPS(2);

// GPS Receiver
#define gpsRXPIN 26
// This one is unused and doesnt have a conection
#define gpsTXPIN 25
// 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 = "";

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

// SHARP Memory Display
#define SHARP_SCK  4
#define SHARP_MOSI 16
#define SHARP_SS   17
// 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

// LED Green
int iLEDGreen = 2;

// Define LED
int iLED = 14;

// Switch
int iSwitch = 3;
// Variable for reading the Switch status
int iSwitchState = 0;

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

// Software Version Information
String sver = "29-18";

void loop() {

  // isGPS
  isGPS();

  // Accelerometer ADXL335
  isADXL335();

  // Magnetometer
  isMagnetometer();

  // Gyroscope
  isGyroscope();

  // Read the state of the Switch value
  iSwitchState = digitalRead(iSwitch);
  
  // The Switch is HIGH:
  if (iSwitchState == HIGH) {

    // Display Accelerometer ADXL335
    isDisplayADXL335();
  
  } else {

    // Display GPS
    isDisplayGPS();
    
  }  

  // MicroSD Card
  isSD();

  // iLED HIGH
  digitalWrite(iLED, HIGH );

  // Delay 5 Second
  delay(5000);

}

getAccelerometer.ino

// Accelerometer ADXL335
// ADXL335
void isADXL335() {

  // Accelerometer ADXL335
  // Accelerometer X, Y, Z
  // X
  X = analogRead(iX);
  // Y
  Y = analogRead(iY);
  // Z
  Z = analogRead(iZ);
  
}

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 Accelerometer ADXL335
void isDisplayADXL335() {

    // Text Display
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(1);
    display.setTextColor(BLACK);
    // Accelerometer X
    display.setCursor(0,5);
    display.print( "AX: " );
    display.println( X );
    // Accelerometer Y
    display.setCursor(0,20);
    display.print( "AY: " );
    display.println( Y );
    // Accelerometer Z
    display.setCursor(0,35);
    display.print( "AZ: " );
    display.println( Z );
    // Magnetometer X
    display.setCursor(0,50);
    display.print( "MX: " );
    display.println( mX );
    // Magnetometer Y
    display.setCursor(0,65);
    display.print( "MY: " );
    display.println( mY );
    // Magnetometer Z
    display.setCursor(0,80);
    display.print( "MZ: " );
    display.println( mZ );
    // Gyroscope Pitch
    display.setCursor(0,95);
    display.print( "Pitch: " );
    display.println( pitch );
    // Gyroscope Roll
    display.setCursor(0,110);
    display.print( "Roll: " );
    display.println( roll );
    // Gyroscope Yaw
    display.setCursor(0,125);
    display.print( "Yaw: " );
    display.println( yaw );
    // 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);
    // Latitude
    display.setCursor(0,5);
    display.print( "Lat: " );
    display.println( TargetLat );
    // Longitude
    display.setCursor(0,30);
    display.print( "Lon: " );
    display.println( TargetLon );
    // GPS Date
    display.setCursor(0,55);
    display.println( TargetDat );
    // GPS Time
    display.setCursor(0,80);
    display.println( TargetTim );
    // GPS Speed M/S
    display.setCursor(0,105);
    display.print( TargetSMS );
    display.println( " M/S" );
    // GPS Altitude Meters
    display.setCursor(0,130);
    display.print( TargetALT );
    display.println( " M" );
    // Refresh
    display.refresh();
    delay( 100 );

}

getEEPROM.ino

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

getGPS.ino

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

  // 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);

  }
  
}

getGyroscope.ino

// L3G4200D Triple Axis Gyroscope
// Setup Gyroscope
void isSetupGyroscope() {

  // Setup Gyroscope
  // Set scale 2000 dps and 400HZ Output data rate (cut-off 50)
  while(!gyroscope.begin(L3G4200D_SCALE_2000DPS, L3G4200D_DATARATE_400HZ_50))
  {
    // Could not find a valid L3G4200D sensor, check wiring!
    delay(500);
    
  }

  // Calibrate gyroscope. The calibration must be at rest.
  // If you don't want calibrate, comment this line.
  gyroscope.calibrate(100);
  
}
// L3G4200D Gyroscope
void isGyroscope(){

  // Timer
  timer = millis();

  // Read normalized values
  Vector norm = gyroscope.readNormalize();

  // Calculate Pitch, Roll and Yaw
  pitch = pitch + norm.YAxis * timeStep;
  roll = roll + norm.XAxis * timeStep;
  yaw = yaw + norm.ZAxis * timeStep;

}

getMagnetometer.ino

// Magnetometer
// Setup Magnetometer
void isSetupMagnetometer(){

  // Magnetometer Serial
  // Initialize HMC5883L
  while (!compass.begin())
  {
    delay(500);
  }

  // Set measurement range
  // +/- 1.30 Ga: HMC5883L_RANGE_1_3GA (default)
  compass.setRange(HMC5883L_RANGE_1_3GA);

  // Set measurement mode
  // Continuous-Measurement: HMC5883L_CONTINOUS (default)
  compass.setMeasurementMode(HMC5883L_CONTINOUS);
 
  // Set data rate
  // 15.00Hz: HMC5883L_DATARATE_15HZ (default)
  compass.setDataRate(HMC5883L_DATARATE_15HZ);

  // Set number of samples averaged
  // 1 sample:  HMC5883L_SAMPLES_1 (default)
  compass.setSamples(HMC5883L_SAMPLES_1);
  
}
// Magnetometer
void isMagnetometer(){

  // Magnetometer Vector Norm
  Vector norm = compass.readNormalize();
  // Vector X, Y, Z
  // Magnetometer X Normalize
  mX = norm.XAxis;
  // Magnetometer Y Normalize
  mY = norm.YAxis;
  // Magnetometer Z Normalize
  mZ = norm.ZAxis;

}

getSD.ino

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

    // 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 = "";

  // DFR|EEPROM Unique ID|Version|Date|Time|
  //Accelerometer X|Accelerometer Y|Accelerometer Z
  //Magnetometer X|Magnetometer Y|Magnetometer Z
  //Gyroscope Pitch|Gyroscope Roll|Gyroscope Yaw
  //|GPS|Latitude|Longitude|GPS Date|GPS Time|GPS Speed M/S|GPS Altitude|*\r
  zzzzzz = "DFR|" + uid + "|" + sver + "|"
  + String(X) + "|" + String(Y) + "|" + String(Z) + "|"
  + String(mX) + "|" + String(mY) + "|" + String(mZ) + "|"
  + String(pitch) + "|" + String(roll) + "|" + String(yaw) + "|"
  + String(GPSSt) + "|" + String(TargetLat) + "|" 
  + String(TargetLon) + "|" + String(TargetDat) + "|" + String(TargetTim) + "|" 
  + String(TargetSMS) + "|" + String(TargetALT)+ "|*\r";

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

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

  // Append File
  appendFile(SD, "/dfrdata.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()
{
  
  // Give display time to power on
  delay(100);

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

  // Give display
  delay(100);

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

  // Give display
  delay(100);

  //MicroSD Card
  isSetupSD();

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

  // Delay
  delay( 100 );

  // GPS Receiver
  // Setup GPS
  isSetupGPS();

  // Delay
  delay( 100 );

  // Setup Triple Axis Magnetometer
  isSetupMagnetometer();

  // L3G4200D Gyroscope
  isSetupGyroscope();

  // Delay
  delay( 100 );

  // Initialize digital pin iLED as an output
  pinMode(iLED, OUTPUT);

  // Outputting high, the LED turns on
  digitalWrite(iLED, HIGH);

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

  // iLEDGreen HIGH
  digitalWrite(iLEDGreen, HIGH );

  // Initialize the Switch
  pinMode(iSwitch, INPUT);

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

}

——

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

Teacher, Instructor, E-Mentor, R&D and Consulting

  • Programming Language
  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
  • IoT
  • Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
  • Robotics
  • Automation
  • Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
  • Unmanned Vehicles Terrestrial and Marine
  • Machine Learning
  • Artificial Intelligence (AI)
  • RTOS
  • Sensors, eHealth Sensors, Biosensor, and Biometric
  • Research & Development (R & D)
  • Consulting

Follow Us

Luc Paquin – Curriculum Vitae – 2024
https://www.donluc.com/luc/

Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
LinkedIn: https://www.linkedin.com/in/jlucpaquin/

Don Luc

Categories
Archives