The Alpha Geek – Geeking Out

SparkFun

SparkFun

Project #15: Environment – Soil Moisture Sensor – Mk20

——

#DonLucElectronics #DonLuc #Arduino #ASM #Project #Patreon #Electronics #Microcontrollers #IoT #Fritzing #Programming #Consultant

——

Soil Moisture Sensor

——

Soil Moisture Sensor

——

Soil Moisture Sensor

——

Soil Moisture Sensor

Soil moisture is the critical parameter in agriculture. If there is a shortage or overabundance of water, plants may die. At the same time, this data depends on many external factors, primarily weather conditions and climate changes. That is why it is so vital to understand the most effective methods for analyzing soil moisture content.

This term refers to the entire quantity of water in the ground’s pores or on its surface. The moisture content of soil depends on such factors as weather, type of land, and plants. The parameter is vital in monitoring soil moisture activities, predicting natural disasters, managing water supply, etc. This data may signal a future flood or water deficit ahead of other indicators.

DL2411Mk03

1 x SparkFun RedBoard Qwiic
1 x Gravity: Analog Soil Moisture Sensor
2 x LED
1 x ProtoScrewShield
1 x USB Battery Pack
1 x USB Micro-B Cable

SparkFun RedBoard Qwiic

ASM – A0
LEDP- 13
LEDG- 12
VIN – +5V
GND – GND

DL2411Mk03p

DL2411Mk03p.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
/****** Don Luc Electronics © ******
Software Version Information
Project #15: Environment – Soil Moisture Sensor – Mk20
15-20
DL2411Mk03p.ino
DL2411Mk03
1 x SparkFun RedBoard Qwiic
1 x Gravity: Analog Soil Moisture Sensor
2 x LED
1 x ProtoScrewShield
1 x USB Battery Pack
1 x USB Micro-B Cable
*/
// Include the Library Code
// Gravity: Analog Soil Moisture Sensor
int iSoilMoisture = A0;
int iSoilMoistureVal = 0;
int zz = 0;
// Change Your Threshold Here
int Threshold = 300;
// LED ProtoScrewShield Yellow
int iLEDProto = 13;
// LED Green
int iLEDGreen = 12;
// Software Version Information
String sver = "15-20";
void loop() {
// Gravity: Analog Soil Moisture Sensor
isSoilMoisture();
// Delay 1 Second
delay( 1000 );
}
/****** Don Luc Electronics © ****** Software Version Information Project #15: Environment – Soil Moisture Sensor – Mk20 15-20 DL2411Mk03p.ino DL2411Mk03 1 x SparkFun RedBoard Qwiic 1 x Gravity: Analog Soil Moisture Sensor 2 x LED 1 x ProtoScrewShield 1 x USB Battery Pack 1 x USB Micro-B Cable */ // Include the Library Code // Gravity: Analog Soil Moisture Sensor int iSoilMoisture = A0; int iSoilMoistureVal = 0; int zz = 0; // Change Your Threshold Here int Threshold = 300; // LED ProtoScrewShield Yellow int iLEDProto = 13; // LED Green int iLEDGreen = 12; // Software Version Information String sver = "15-20"; void loop() { // Gravity: Analog Soil Moisture Sensor isSoilMoisture(); // Delay 1 Second delay( 1000 ); }
/****** Don Luc Electronics © ******
Software Version Information
Project #15: Environment – Soil Moisture Sensor – Mk20
15-20
DL2411Mk03p.ino
DL2411Mk03
1 x SparkFun RedBoard Qwiic
1 x Gravity: Analog Soil Moisture Sensor
2 x LED
1 x ProtoScrewShield
1 x USB Battery Pack
1 x USB Micro-B Cable
*/

// Include the Library Code

// Gravity: Analog Soil Moisture Sensor
int iSoilMoisture = A0;
int iSoilMoistureVal = 0;
int zz = 0;
// Change Your Threshold Here
int Threshold = 300;

// LED ProtoScrewShield Yellow
int iLEDProto = 13;

// LED Green
int iLEDGreen = 12;

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

void loop() {

  // Gravity: Analog Soil Moisture Sensor
  isSoilMoisture();

  // Delay 1 Second
  delay( 1000 );

}

getSoilMoisture.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// Gravity: Analog Soil Moisture Sensor
// Soil Moisture
void isSoilMoisture(){
// Connect Soil Moisture Sensor to Analog 0
zz = analogRead( iSoilMoisture );
// iSoilMoistureVal => 0~900 Soil Moisture
iSoilMoistureVal = map( zz, 0, 715, 0, 900);
// Serial
Serial.print("Moisture Sensor Value: ");
// Threshold
if (iSoilMoistureVal > Threshold) {
// 300~900 - Humid Soil
// LEDProto
digitalWrite(iLEDProto, LOW);
// Serial
Serial.print( "Humid Soil " );
Serial.println( iSoilMoistureVal );
// LEDGreen
digitalWrite(iLEDGreen, HIGH);
}
else {
// 0-300 Dry Soil
// LEDGreen
digitalWrite(iLEDGreen, LOW);
// Serial
Serial.print( "Dry Soil " );
Serial.println( iSoilMoistureVal );
// LEDProto
digitalWrite(iLEDProto, HIGH);
}
}
// Gravity: Analog Soil Moisture Sensor // Soil Moisture void isSoilMoisture(){ // Connect Soil Moisture Sensor to Analog 0 zz = analogRead( iSoilMoisture ); // iSoilMoistureVal => 0~900 Soil Moisture iSoilMoistureVal = map( zz, 0, 715, 0, 900); // Serial Serial.print("Moisture Sensor Value: "); // Threshold if (iSoilMoistureVal > Threshold) { // 300~900 - Humid Soil // LEDProto digitalWrite(iLEDProto, LOW); // Serial Serial.print( "Humid Soil " ); Serial.println( iSoilMoistureVal ); // LEDGreen digitalWrite(iLEDGreen, HIGH); } else { // 0-300 Dry Soil // LEDGreen digitalWrite(iLEDGreen, LOW); // Serial Serial.print( "Dry Soil " ); Serial.println( iSoilMoistureVal ); // LEDProto digitalWrite(iLEDProto, HIGH); } }
// Gravity: Analog Soil Moisture Sensor
// Soil Moisture
void isSoilMoisture(){

  // Connect Soil Moisture Sensor to Analog 0
  zz = analogRead( iSoilMoisture );

  // iSoilMoistureVal => 0~900 Soil Moisture
  iSoilMoistureVal = map( zz, 0, 715, 0, 900);

  // Serial
  Serial.print("Moisture Sensor Value: ");

  // Threshold
  if (iSoilMoistureVal > Threshold) {

    // 300~900 - Humid Soil
    // LEDProto
    digitalWrite(iLEDProto, LOW);
    // Serial
    Serial.print( "Humid Soil " );
    Serial.println( iSoilMoistureVal );
    // LEDGreen
    digitalWrite(iLEDGreen, HIGH);
    
  }
  else {
    
    // 0-300 Dry Soil
    // LEDGreen
    digitalWrite(iLEDGreen, LOW);
    // Serial
    Serial.print( "Dry Soil " );
    Serial.println( iSoilMoistureVal );
    // LEDProto
    digitalWrite(iLEDProto, HIGH);
    
  }

}

setup.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// Setup
void setup()
{
// Delay
delay(100);
// Serial
Serial.begin(57600);
// Initialize the LED iLEDProto
pinMode(iLEDProto, OUTPUT);
// Initialize the LED iLEDGreen
pinMode(iLEDGreen, OUTPUT);
// Delay 1 Second
delay( 1000 );
}
// Setup void setup() { // Delay delay(100); // Serial Serial.begin(57600); // Initialize the LED iLEDProto pinMode(iLEDProto, OUTPUT); // Initialize the LED iLEDGreen pinMode(iLEDGreen, OUTPUT); // Delay 1 Second delay( 1000 ); }
// Setup
void setup()
{
 
  // Delay
  delay(100);

  // Serial
  Serial.begin(57600);

  // Initialize the LED iLEDProto
  pinMode(iLEDProto, OUTPUT);

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

  // Delay 1 Second
  delay( 1000 );

}

——

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

Electronics, IoT, Teacher, Instructor, 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/
Patreon: https://patreon.com/DonLucElectronics59
DFRobot: https://learn.dfrobot.com/user-10186.html
Hackster.io: https://www.hackster.io/neosteam-labs
Elecrow: https://www.elecrow.com/share/sharepj/center/no/760816d385ebb1edc0732fd873bfbf13
TikTok: https://www.tiktok.com/@luc.paquin8
Twitch: https://www.twitch.tv/lucpaquin
LinkedIn: https://www.linkedin.com/in/jlucpaquin/

Don Luc

Patreon: Beginner

——

#DonLucElectronics #DonLuc #Arduino #Project #Patreon #Electronics #Microcontrollers #IoT #Fritzing #Programming #Consultant

——

Patreon: Beginner

——

Patreon: Beginner

——

Patreon: Beginner

——

Patreon: Beginner

Beginner: These beginner-friendly microcontrollers is Arduino Uno are easy to use and program with just a computer or laptop, a USB cable, and some open-source software.

What is Arduino?

Arduino board designs use a variety of microprocessors and controllers. The boards are equipped with sets of digital and analog input/output (I/O) pins that may be interfaced to various expansion boards “Shields” or breadboards and other circuits. The boards feature serial communications interfaces, including Universal Serial Bus (USB) on some models, which are also used for loading programs. Arduino boards are able to read inputs, light on a sensor, a finger on a button, or a Twitter message, and turn it into an output, activating a motor, turning on an LED, publishing something online. You can tell your board what to do by sending a set of instructions to the microcontroller on the board. The microcontrollers can be programmed using the C and C++ programming languages, using a standard API which is also known as the Arduino Programming Language, and the Arduino Software (IDE).

Arduino Software (IDE)

A minimal Arduino C/C++ program consists of only two functions:

setup(): This function is called once when a sketch starts after power-up or reset. It is used to initialize variables, input and output pin modes, and other libraries needed in the sketch.
loop(): After setup() function exits, the loop() function is executed repeatedly in the main program. It controls the board until the board is powered off or is reset. It is analogous to the function while.

DL2412Mk01

1 x SparkFun RedBoard Qwiic
1 x Potentiometer 10K Ohm
1 x ProtoScrewShield
2 x LED
1 x USB Micro-B Cable

SparkFun RedBoard Qwiic

POT – A0
LEDP – 13
LEDG – 12
VIN – +5V
GND – GND

——

DL2412Mk01ppp

DL2412Mk01ppp.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
/****** Don Luc Electronics © ******/
int iPot = A0;
int iPotVal = 0;
int Threshold = 500;
int iLEDProto = 13;
int iLEDGreen = 12;
String sver = "Beginner";
void setup()
{
delay(100);
Serial.begin(57600);
pinMode(iLEDProto, OUTPUT);
pinMode(iLEDGreen, OUTPUT);
delay( 100 );
}
void loop() {
iPotVal = analogRead( iPot );
Serial.print("Potentiometer: ");
if (iPotVal > Threshold) {
digitalWrite(iLEDProto, LOW);
Serial.print( "LED Green " );
Serial.println( iPotVal );
digitalWrite(iLEDGreen, HIGH);
}
else {
digitalWrite(iLEDGreen, LOW);
Serial.print( "LED Proto " );
Serial.println( iPotVal );
digitalWrite(iLEDProto, HIGH);
}
delay( 100 );
}
/****** Don Luc Electronics © ******/ int iPot = A0; int iPotVal = 0; int Threshold = 500; int iLEDProto = 13; int iLEDGreen = 12; String sver = "Beginner"; void setup() { delay(100); Serial.begin(57600); pinMode(iLEDProto, OUTPUT); pinMode(iLEDGreen, OUTPUT); delay( 100 ); } void loop() { iPotVal = analogRead( iPot ); Serial.print("Potentiometer: "); if (iPotVal > Threshold) { digitalWrite(iLEDProto, LOW); Serial.print( "LED Green " ); Serial.println( iPotVal ); digitalWrite(iLEDGreen, HIGH); } else { digitalWrite(iLEDGreen, LOW); Serial.print( "LED Proto " ); Serial.println( iPotVal ); digitalWrite(iLEDProto, HIGH); } delay( 100 ); }
/****** Don Luc Electronics © ******/

int iPot = A0;
int iPotVal = 0;
int Threshold = 500;
int iLEDProto = 13;
int iLEDGreen = 12;
String sver = "Beginner";

void setup()
{

  delay(100);

  Serial.begin(57600);
  pinMode(iLEDProto, OUTPUT);
  pinMode(iLEDGreen, OUTPUT);
  delay( 100 );

}

void loop() {

  iPotVal = analogRead( iPot );
  Serial.print("Potentiometer: ");
  if (iPotVal > Threshold) {

    digitalWrite(iLEDProto, LOW);
    Serial.print( "LED Green " );
    Serial.println( iPotVal );
    digitalWrite(iLEDGreen, HIGH);
    
  }
  else {

    digitalWrite(iLEDGreen, LOW);
    Serial.print( "LED Proto " );
    Serial.println( iPotVal );
    digitalWrite(iLEDProto, HIGH);
    
  }
  delay( 100 );

}

——

DL2412Mk01pp

DL2412Mk01pp.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
/****** Don Luc Electronics © ******
Software Version Information
Patreon: Beginner
Beginner
DL2412Mk01pp.ino
DL2412Mk01
1 x SparkFun RedBoard Qwiic
1 x Potentiometer
1 x ProtoScrewShield
2 x LED
1 x USB Micro-B Cable
*/
// Include the Library Code
// Potentiometer
int iPot = A0;
int iPotVal = 0;
// Change Your Threshold Here
int Threshold = 500;
// LED ProtoScrewShield Yellow
int iLEDProto = 13;
// LED Green
int iLEDGreen = 12;
// Software Version Information
String sver = "Beginner";
// Setup
void setup()
{
// Delay
delay(100);
// Serial
Serial.begin(57600);
// Initialize the LED iLEDProto
pinMode(iLEDProto, OUTPUT);
// Initialize the LED iLEDGreen
pinMode(iLEDGreen, OUTPUT);
// Delay 0.1 Second
delay( 100 );
}
// Loop
void loop() {
// Potentiometer
// Connect Potentiometer to Analog 0
iPotVal = analogRead( iPot );
// Serial
Serial.print("Potentiometer: ");
// Threshold
if (iPotVal > Threshold) {
// LEDProto
digitalWrite(iLEDProto, LOW);
// Serial
Serial.print( "LED Green " );
Serial.println( iPotVal );
// LEDGreen
digitalWrite(iLEDGreen, HIGH);
}
else {
// LEDGreen
digitalWrite(iLEDGreen, LOW);
// Serial
Serial.print( "LED Proto " );
Serial.println( iPotVal );
// LEDProto
digitalWrite(iLEDProto, HIGH);
}
// Delay 0.1 Second
delay( 100 );
}
/****** Don Luc Electronics © ****** Software Version Information Patreon: Beginner Beginner DL2412Mk01pp.ino DL2412Mk01 1 x SparkFun RedBoard Qwiic 1 x Potentiometer 1 x ProtoScrewShield 2 x LED 1 x USB Micro-B Cable */ // Include the Library Code // Potentiometer int iPot = A0; int iPotVal = 0; // Change Your Threshold Here int Threshold = 500; // LED ProtoScrewShield Yellow int iLEDProto = 13; // LED Green int iLEDGreen = 12; // Software Version Information String sver = "Beginner"; // Setup void setup() { // Delay delay(100); // Serial Serial.begin(57600); // Initialize the LED iLEDProto pinMode(iLEDProto, OUTPUT); // Initialize the LED iLEDGreen pinMode(iLEDGreen, OUTPUT); // Delay 0.1 Second delay( 100 ); } // Loop void loop() { // Potentiometer // Connect Potentiometer to Analog 0 iPotVal = analogRead( iPot ); // Serial Serial.print("Potentiometer: "); // Threshold if (iPotVal > Threshold) { // LEDProto digitalWrite(iLEDProto, LOW); // Serial Serial.print( "LED Green " ); Serial.println( iPotVal ); // LEDGreen digitalWrite(iLEDGreen, HIGH); } else { // LEDGreen digitalWrite(iLEDGreen, LOW); // Serial Serial.print( "LED Proto " ); Serial.println( iPotVal ); // LEDProto digitalWrite(iLEDProto, HIGH); } // Delay 0.1 Second delay( 100 ); }
/****** Don Luc Electronics © ******
Software Version Information
Patreon: Beginner
Beginner
DL2412Mk01pp.ino
DL2412Mk01
1 x SparkFun RedBoard Qwiic
1 x Potentiometer
1 x ProtoScrewShield
2 x LED
1 x USB Micro-B Cable
*/

// Include the Library Code

// Potentiometer
int iPot = A0;
int iPotVal = 0;
// Change Your Threshold Here
int Threshold = 500;

// LED ProtoScrewShield Yellow
int iLEDProto = 13;

// LED Green
int iLEDGreen = 12;

// Software Version Information
String sver = "Beginner";

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

  // Serial
  Serial.begin(57600);

  // Initialize the LED iLEDProto
  pinMode(iLEDProto, OUTPUT);

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

  // Delay 0.1 Second
  delay( 100 );

}
// Loop
void loop() {

  // Potentiometer
  // Connect Potentiometer to Analog 0
  iPotVal = analogRead( iPot );

  // Serial
  Serial.print("Potentiometer: ");

  // Threshold
  if (iPotVal > Threshold) {

    // LEDProto
    digitalWrite(iLEDProto, LOW);
    // Serial
    Serial.print( "LED Green " );
    Serial.println( iPotVal );
    // LEDGreen
    digitalWrite(iLEDGreen, HIGH);
    
  }
  else {
    
    // LEDGreen
    digitalWrite(iLEDGreen, LOW);
    // Serial
    Serial.print( "LED Proto " );
    Serial.println( iPotVal );
    // LEDProto
    digitalWrite(iLEDProto, HIGH);
    
  }

  // Delay 0.1 Second
  delay( 100 );

}

——

DL2412Mk01p

DL2412Mk01p.ino
loop()

getPotentiometer.ino
Attaining => get
Combining Form => is

setup.ino
setup()

DL2412Mk01p

DL2411Mk03p.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
/****** Don Luc Electronics © ******
Software Version Information
Patreon: Beginner
Beginner
DL2412Mk01p.ino
DL2412Mk01
1 x SparkFun RedBoard Qwiic
1 x Potentiometer
1 x ProtoScrewShield
2 x LED
1 x USB Micro-B Cable
*/
// Include the Library Code
// Potentiometer
int iPot = A0;
int iPotVal = 0;
// Change Your Threshold Here
int Threshold = 500;
// LED ProtoScrewShield Yellow
int iLEDProto = 13;
// LED Green
int iLEDGreen = 12;
// Software Version Information
String sver = "Beginner";
void loop() {
// Potentiometer
isPotentiometer();
// Delay 0.1 Second
delay( 100 );
}
/****** Don Luc Electronics © ****** Software Version Information Patreon: Beginner Beginner DL2412Mk01p.ino DL2412Mk01 1 x SparkFun RedBoard Qwiic 1 x Potentiometer 1 x ProtoScrewShield 2 x LED 1 x USB Micro-B Cable */ // Include the Library Code // Potentiometer int iPot = A0; int iPotVal = 0; // Change Your Threshold Here int Threshold = 500; // LED ProtoScrewShield Yellow int iLEDProto = 13; // LED Green int iLEDGreen = 12; // Software Version Information String sver = "Beginner"; void loop() { // Potentiometer isPotentiometer(); // Delay 0.1 Second delay( 100 ); }
/****** Don Luc Electronics © ******
Software Version Information
Patreon: Beginner
Beginner
DL2412Mk01p.ino
DL2412Mk01
1 x SparkFun RedBoard Qwiic
1 x Potentiometer
1 x ProtoScrewShield
2 x LED
1 x USB Micro-B Cable
*/

// Include the Library Code

// Potentiometer
int iPot = A0;
int iPotVal = 0;
// Change Your Threshold Here
int Threshold = 500;

// LED ProtoScrewShield Yellow
int iLEDProto = 13;

// LED Green
int iLEDGreen = 12;

// Software Version Information
String sver = "Beginner";

void loop() {

  // Potentiometer
  isPotentiometer();

  // Delay 0.1 Second
  delay( 100 );

}

getPotentiometer.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// Potentiometer
// Potentiometer
void isPotentiometer(){
// Connect Potentiometer to Analog 0
iPotVal = analogRead( iPot );
// Serial
Serial.print("Potentiometer: ");
// Threshold
if (iPotVal > Threshold) {
// LEDProto
digitalWrite(iLEDProto, LOW);
// Serial
Serial.print( "LED Green " );
Serial.println( iPotVal );
// LEDGreen
digitalWrite(iLEDGreen, HIGH);
}
else {
// LEDGreen
digitalWrite(iLEDGreen, LOW);
// Serial
Serial.print( "LED Proto " );
Serial.println( iPotVal );
// LEDProto
digitalWrite(iLEDProto, HIGH);
}
}
// Potentiometer // Potentiometer void isPotentiometer(){ // Connect Potentiometer to Analog 0 iPotVal = analogRead( iPot ); // Serial Serial.print("Potentiometer: "); // Threshold if (iPotVal > Threshold) { // LEDProto digitalWrite(iLEDProto, LOW); // Serial Serial.print( "LED Green " ); Serial.println( iPotVal ); // LEDGreen digitalWrite(iLEDGreen, HIGH); } else { // LEDGreen digitalWrite(iLEDGreen, LOW); // Serial Serial.print( "LED Proto " ); Serial.println( iPotVal ); // LEDProto digitalWrite(iLEDProto, HIGH); } }
// Potentiometer
// Potentiometer
void isPotentiometer(){

  // Connect Potentiometer to Analog 0
  iPotVal = analogRead( iPot );

  // Serial
  Serial.print("Potentiometer: ");

  // Threshold
  if (iPotVal > Threshold) {

    // LEDProto
    digitalWrite(iLEDProto, LOW);
    // Serial
    Serial.print( "LED Green " );
    Serial.println( iPotVal );
    // LEDGreen
    digitalWrite(iLEDGreen, HIGH);
    
  }
  else {
    
    // LEDGreen
    digitalWrite(iLEDGreen, LOW);
    // Serial
    Serial.print( "LED Proto " );
    Serial.println( iPotVal );
    // LEDProto
    digitalWrite(iLEDProto, HIGH);
    
  }

}

setup.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// Setup
void setup()
{
// Delay
delay(100);
// Serial
Serial.begin(57600);
// Initialize the LED iLEDProto
pinMode(iLEDProto, OUTPUT);
// Initialize the LED iLEDGreen
pinMode(iLEDGreen, OUTPUT);
// Delay 0.1 Second
delay( 100 );
}
// Setup void setup() { // Delay delay(100); // Serial Serial.begin(57600); // Initialize the LED iLEDProto pinMode(iLEDProto, OUTPUT); // Initialize the LED iLEDGreen pinMode(iLEDGreen, OUTPUT); // Delay 0.1 Second delay( 100 ); }
// Setup
void setup()
{
 
  // Delay
  delay(100);

  // Serial
  Serial.begin(57600);

  // Initialize the LED iLEDProto
  pinMode(iLEDProto, OUTPUT);

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

  // Delay 0.1 Second
  delay( 100 );

}

——

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

Electronics, IoT, Teacher, Instructor, 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/
Patreon: https://patreon.com/DonLucElectronics59
DFRobot: https://learn.dfrobot.com/user-10186.html
Hackster.io: https://www.hackster.io/neosteam-labs
Elecrow: https://www.elecrow.com/share/sharepj/center/no/760816d385ebb1edc0732fd873bfbf13
TikTok: https://www.tiktok.com/@luc.paquin8
Twitch: https://www.twitch.tv/lucpaquin
LinkedIn: https://www.linkedin.com/in/jlucpaquin/

Don Luc

Project #29 – DFRobot – RTC – Mk31

——

#DonLucElectronics #DonLuc #DFRobot #RTC #SD #ASM #SHTC3 #FireBeetle2ESP32C6 #Display #EEPROM #ESP32 #IoT #SparkFun #Adafruit #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

RTC

——

RTC

——

RTC

——

Real-Time Clock

A Real-Time Clock (RTC) is an electronic device, most often in the form of an integrated circuit, that measures the passage of time. Although the term often refers to the devices in personal computers, servers and embedded systems, RTCs are present in almost any electronic device which needs to keep accurate time of day.

Although keeping time can be done without an RTC, using one has benefits:

  • Reliably maintains and provides current time through disruptive system states such as hangs, sleep, reboots, or if given sufficient backup power, full shutdown and hardware reassembly, without the need to have its time set again.
  • Low power consumption, important when running from alternate power.
  • Frees the main system for time-critical tasks.
  • Sometimes more accurate than other methods.

DL2409Mk08

1 x FireBeetle 2 ESP32-C6
1 x Adalogger FeatherWing – RTC + SD
1 x CR1220 3 Volt Lithium Coin Cell Battery
1 x Fermion: SHTC3 Temperature & Humidity Sensor
1 x Fermion: 2.0″ 320×240 IPS TFT LCD
1 x GDL Line 10 CM
1 x Gravity: Analog Soil Moisture Sensor
1 x 3 AAA Battery Holder with On/Off Switch and 2-Pin JST
3 x AAA Battery
1 x SparkFun Solderable Breadboard – Large
1 x USB 3.1 Cable A to C

FireBeetle 2 ESP32-C6

SCL – 20
SDA – 19
ASM – A1
LED – 15
DC – D2
CS – D6
RST – D3
VIN – +3.3V
GND – GND

DL2409Mk08p

DL2409Mk08p.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
/****** Don Luc Electronics © ******
Software Version Information
Project #29 - DFRobot - RTC - Mk31
29-31
DL2409Mk08p.ino
DL2409Mk08
1 x FireBeetle 2 ESP32-C6
1 x Adalogger FeatherWing - RTC + SD
1 x CR1220 3 Volt Lithium Coin Cell Battery
1 x Fermion: SHTC3 Temperature & Humidity Sensor
1 x Fermion: 2.0" 320x240 IPS TFT LCD
1 x GDL Line 10 CM
1 x Gravity: Analog Soil Moisture Sensor
1 x 3 AAA Battery Holder with On/Off Switch and 2-Pin JST
3 x AAA Battery
1 x SparkFun Solderable Breadboard - Large
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"
// Arduino
#include <Arduino.h>
// Wire
#include <Wire.h>
// DFRobot Display GDL API
#include <DFRobot_GDL.h>
// Fermion: SHTC3 Temperature & Humidity Sensor
#include"DFRobot_SHTC3.h"
// Date and Time Functions PCF8523 RTC
#include <RTClib.h>
// Date and Time PCF8523 RTC
RTC_PCF8523 rtc;
String dateRTC = "";
String timeRTC = "";
// Fermion: SHTC3 Temperature & Humidity Sensor
DFRobot_SHTC3 SHTC3;
uint32_t id = 0;
float temperature;
float humidity;
// Defined ESP32
#define TFT_DC D2
#define TFT_CS D6
#define TFT_RST D3
/*dc=*/ /*cs=*/ /*rst=*/
// DFRobot Display 240x320
DFRobot_ST7789_240x320_HW_SPI screen(TFT_DC, TFT_CS, TFT_RST);
// Gravity: Analog Soil Moisture Sensor
int iSoilMoisture = A1;
int iSoilMoistureVal = 0;
int zz = 0;
// Change Your Threshold Here
int Threshold = 300;
String SM = "";
// LED Green
int iLEDGreen = 15;
// EEPROM Unique ID Information
#define EEPROM_SIZE 64
String uid = "";
// Software Version Information
String sver = "29-31";
void loop() {
// Date and Time PCF8523 RTC
isRTC();
// SHTC3 Temperature and Humidity Sensor
isSHTC3();
// Gravity: Analog Soil Moisture Sensor
isSoilMoisture();
// DFRobot Display 240x320 - ASM - Temperature and Humidity - Date and Time
isDisplayTH();
// Delay 5 Second
delay( 5000 );
}
/****** Don Luc Electronics © ****** Software Version Information Project #29 - DFRobot - RTC - Mk31 29-31 DL2409Mk08p.ino DL2409Mk08 1 x FireBeetle 2 ESP32-C6 1 x Adalogger FeatherWing - RTC + SD 1 x CR1220 3 Volt Lithium Coin Cell Battery 1 x Fermion: SHTC3 Temperature & Humidity Sensor 1 x Fermion: 2.0" 320x240 IPS TFT LCD 1 x GDL Line 10 CM 1 x Gravity: Analog Soil Moisture Sensor 1 x 3 AAA Battery Holder with On/Off Switch and 2-Pin JST 3 x AAA Battery 1 x SparkFun Solderable Breadboard - Large 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" // Arduino #include <Arduino.h> // Wire #include <Wire.h> // DFRobot Display GDL API #include <DFRobot_GDL.h> // Fermion: SHTC3 Temperature & Humidity Sensor #include"DFRobot_SHTC3.h" // Date and Time Functions PCF8523 RTC #include <RTClib.h> // Date and Time PCF8523 RTC RTC_PCF8523 rtc; String dateRTC = ""; String timeRTC = ""; // Fermion: SHTC3 Temperature & Humidity Sensor DFRobot_SHTC3 SHTC3; uint32_t id = 0; float temperature; float humidity; // Defined ESP32 #define TFT_DC D2 #define TFT_CS D6 #define TFT_RST D3 /*dc=*/ /*cs=*/ /*rst=*/ // DFRobot Display 240x320 DFRobot_ST7789_240x320_HW_SPI screen(TFT_DC, TFT_CS, TFT_RST); // Gravity: Analog Soil Moisture Sensor int iSoilMoisture = A1; int iSoilMoistureVal = 0; int zz = 0; // Change Your Threshold Here int Threshold = 300; String SM = ""; // LED Green int iLEDGreen = 15; // EEPROM Unique ID Information #define EEPROM_SIZE 64 String uid = ""; // Software Version Information String sver = "29-31"; void loop() { // Date and Time PCF8523 RTC isRTC(); // SHTC3 Temperature and Humidity Sensor isSHTC3(); // Gravity: Analog Soil Moisture Sensor isSoilMoisture(); // DFRobot Display 240x320 - ASM - Temperature and Humidity - Date and Time isDisplayTH(); // Delay 5 Second delay( 5000 ); }
/****** Don Luc Electronics © ******
Software Version Information
Project #29 - DFRobot - RTC - Mk31
29-31
DL2409Mk08p.ino
DL2409Mk08
1 x FireBeetle 2 ESP32-C6
1 x Adalogger FeatherWing - RTC + SD
1 x CR1220 3 Volt Lithium Coin Cell Battery
1 x Fermion: SHTC3 Temperature & Humidity Sensor
1 x Fermion: 2.0" 320x240 IPS TFT LCD
1 x GDL Line 10 CM
1 x Gravity: Analog Soil Moisture Sensor
1 x 3 AAA Battery Holder with On/Off Switch and 2-Pin JST
3 x AAA Battery
1 x SparkFun Solderable Breadboard - Large
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"
// Arduino
#include <Arduino.h>
// Wire
#include <Wire.h>
// DFRobot Display GDL API
#include <DFRobot_GDL.h>
// Fermion: SHTC3 Temperature & Humidity Sensor
#include"DFRobot_SHTC3.h"
// Date and Time Functions PCF8523 RTC
#include <RTClib.h>

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

// Fermion: SHTC3 Temperature & Humidity Sensor
DFRobot_SHTC3 SHTC3;
uint32_t id = 0;
float temperature;
float humidity;

// Defined ESP32
#define TFT_DC  D2
#define TFT_CS  D6
#define TFT_RST D3

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

// Gravity: Analog Soil Moisture Sensor
int iSoilMoisture = A1;
int iSoilMoistureVal = 0;
int zz = 0;
// Change Your Threshold Here
int Threshold = 300;
String SM = "";

// LED Green
int iLEDGreen = 15;

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

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

void loop() {

  // Date and Time PCF8523 RTC
  isRTC();
  
  // SHTC3 Temperature and Humidity Sensor
  isSHTC3();
  
  // Gravity: Analog Soil Moisture Sensor
  isSoilMoisture();

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

  // Delay 5 Second
  delay( 5000 );

}

getDisplay.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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 - ASM - 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);
// Soil Moisture Sensor
screen.setCursor(0, 30);
screen.println("Soil Moisture Sensor");
// Date and Time
screen.setCursor(0, 60);
screen.println( dateRTC + " - " + timeRTC );
// Gravity: Analog Soil Moisture Sensor
screen.setCursor(0, 90);
screen.println( "ASM: " );
screen.setCursor(60, 90);
screen.println( iSoilMoistureVal );
screen.setCursor(0, 120);
screen.println( SM );
// SHTC3 Temperature
screen.setCursor(0, 150);
screen.println( "Tem: " );
screen.setCursor(60, 150);
screen.println( temperature );
screen.setCursor(120, 150);
screen.println( "C" );
// SHTC3 Humidity
screen.setCursor(0, 180);
screen.println( "Hum: " );
screen.setCursor(60, 180);
screen.println( humidity );
screen.setCursor(120, 180);
screen.println( "%RH" );
}
// 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 - ASM - 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); // Soil Moisture Sensor screen.setCursor(0, 30); screen.println("Soil Moisture Sensor"); // Date and Time screen.setCursor(0, 60); screen.println( dateRTC + " - " + timeRTC ); // Gravity: Analog Soil Moisture Sensor screen.setCursor(0, 90); screen.println( "ASM: " ); screen.setCursor(60, 90); screen.println( iSoilMoistureVal ); screen.setCursor(0, 120); screen.println( SM ); // SHTC3 Temperature screen.setCursor(0, 150); screen.println( "Tem: " ); screen.setCursor(60, 150); screen.println( temperature ); screen.setCursor(120, 150); screen.println( "C" ); // SHTC3 Humidity screen.setCursor(0, 180); screen.println( "Hum: " ); screen.setCursor(60, 180); screen.println( humidity ); screen.setCursor(120, 180); screen.println( "%RH" ); }
// 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 - ASM - 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);
    // Soil Moisture Sensor
    screen.setCursor(0, 30);
    screen.println("Soil Moisture Sensor");
    // Date and Time
    screen.setCursor(0, 60);
    screen.println( dateRTC + " - " + timeRTC );
    // Gravity: Analog Soil Moisture Sensor
    screen.setCursor(0, 90);
    screen.println( "ASM: " );
    screen.setCursor(60, 90);
    screen.println( iSoilMoistureVal );
    screen.setCursor(0, 120);
    screen.println( SM );
    // SHTC3 Temperature
    screen.setCursor(0, 150);
    screen.println( "Tem: " );
    screen.setCursor(60, 150);
    screen.println( temperature );
    screen.setCursor(120, 150);
    screen.println( "C" );
    // SHTC3 Humidity
    screen.setCursor(0, 180);
    screen.println( "Hum: " );
    screen.setCursor(60, 180);
    screen.println( humidity );
    screen.setCursor(120, 180);
    screen.println( "%RH" );

}

getEEPROM.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// EEPROM
// isUID EEPROM Unique ID
void isUID() {
// Is Unit ID
uid = "";
for (int x = 0; x < 7; x++)
{
uid = uid + char(EEPROM.read(x));
}
}
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 7; x++) { uid = uid + char(EEPROM.read(x)); } }
// EEPROM
// isUID EEPROM Unique ID
void isUID() {
  
  // Is Unit ID
  uid = "";
  for (int x = 0; x < 7; x++)
  {
    uid = uid + char(EEPROM.read(x));
  }
  
}

getRTC.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// Date and Time PCF8523 RTC
// Setup Date and Time PCF8523 RTC
void isSetupRTC() {
// Date and Time PCF8523 RTC
if (! rtc.begin()) {
while (1);
}
if (! rtc.initialized()) {
// Following line sets the RTC to the date & time this sketch was compiled
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
// This line sets the RTC with an explicit date & time, for example to set
// January 21, 2014 at 3am you would call:
// rtc.adjust(DateTime(2024, 9, 26, 9, 1, 0));
}
// When the RTC was stopped and stays connected to the battery, it has
// to be restarted by clearing the STOP bit. Let's do this to ensure
// the RTC is running.
rtc.start();
// The PCF8523 can be calibrated for:
// - Aging adjustment
// - Temperature compensation
// - Accuracy tuning
// The offset mode to use, once every two hours or once every minute.
// The offset Offset value from -64 to +63.
// See the Application Note for calculation of offset values.
// https://www.nxp.com/docs/en/application-note/AN11247.pdf
// The deviation in parts per million can be calculated over
// a period of observation. Both the drift (which can be negative)
// and the observation period must be in seconds. For accuracy
// the variation should be observed over about 1 week.
// Note: any previous calibration should cancelled prior to
// any new observation period.
// Seconds plus or minus over oservation period - set to
// 0 to cancel previous calibration.
float drift = 43;
// total obsevation period in seconds (86400 = seconds in 1 day:
// 7 days = (7 * 86400) seconds )
float period_sec = (7 * 86400);
// Deviation in parts per million (μs)
float deviation_ppm = (drift / period_sec * 1000000);
// Use with offset mode PCF8523_TwoHours
float drift_unit = 4.34;
//For corrections every min the drift_unit is 4.069 ppm
// (use with offset mode PCF8523_OneMinute)
// float drift_unit = 4.069;
int offset = round(deviation_ppm / drift_unit);
}
// Date and Time PCF8523 RTC
void isRTC () {
// Date and Time
DateTime now = rtc.now();
// Date
dateRTC = now.year(), DEC;
dateRTC = dateRTC + "/";
dateRTC = dateRTC + now.month(), DEC;
dateRTC = dateRTC + "/";
dateRTC = dateRTC + now.day(), DEC;
// Time
timeRTC = now.hour(), DEC;
timeRTC = timeRTC + ":";
timeRTC = timeRTC + now.minute(), DEC;
timeRTC = timeRTC + ":";
timeRTC = timeRTC + now.second(), DEC;
}
// Date and Time PCF8523 RTC // Setup Date and Time PCF8523 RTC void isSetupRTC() { // Date and Time PCF8523 RTC if (! rtc.begin()) { while (1); } if (! rtc.initialized()) { // Following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: // rtc.adjust(DateTime(2024, 9, 26, 9, 1, 0)); } // When the RTC was stopped and stays connected to the battery, it has // to be restarted by clearing the STOP bit. Let's do this to ensure // the RTC is running. rtc.start(); // The PCF8523 can be calibrated for: // - Aging adjustment // - Temperature compensation // - Accuracy tuning // The offset mode to use, once every two hours or once every minute. // The offset Offset value from -64 to +63. // See the Application Note for calculation of offset values. // https://www.nxp.com/docs/en/application-note/AN11247.pdf // The deviation in parts per million can be calculated over // a period of observation. Both the drift (which can be negative) // and the observation period must be in seconds. For accuracy // the variation should be observed over about 1 week. // Note: any previous calibration should cancelled prior to // any new observation period. // Seconds plus or minus over oservation period - set to // 0 to cancel previous calibration. float drift = 43; // total obsevation period in seconds (86400 = seconds in 1 day: // 7 days = (7 * 86400) seconds ) float period_sec = (7 * 86400); // Deviation in parts per million (μs) float deviation_ppm = (drift / period_sec * 1000000); // Use with offset mode PCF8523_TwoHours float drift_unit = 4.34; //For corrections every min the drift_unit is 4.069 ppm // (use with offset mode PCF8523_OneMinute) // float drift_unit = 4.069; int offset = round(deviation_ppm / drift_unit); } // Date and Time PCF8523 RTC void isRTC () { // Date and Time DateTime now = rtc.now(); // Date dateRTC = now.year(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.month(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.day(), DEC; // Time timeRTC = now.hour(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.minute(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.second(), DEC; }
// Date and Time PCF8523 RTC 
// Setup Date and Time PCF8523 RTC 
void isSetupRTC() {

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

  // When the RTC was stopped and stays connected to the battery, it has
  // to be restarted by clearing the STOP bit. Let's do this to ensure
  // the RTC is running.
  rtc.start();

   // The PCF8523 can be calibrated for:
  //  - Aging adjustment
  //  - Temperature compensation
  //  - Accuracy tuning
  // The offset mode to use, once every two hours or once every minute.
  // The offset Offset value from -64 to +63. 
  // See the Application Note for calculation of offset values.
  // https://www.nxp.com/docs/en/application-note/AN11247.pdf
  // The deviation in parts per million can be calculated over 
  // a period of observation. Both the drift (which can be negative)
  // and the observation period must be in seconds. For accuracy 
  // the variation should be observed over about 1 week.
  // Note: any previous calibration should cancelled prior to 
  // any new observation period.
  // Seconds plus or minus over oservation period - set to 
  // 0 to cancel previous calibration.
  float drift = 43;
  // total obsevation period in seconds (86400 = seconds in 1 day: 
  // 7 days = (7 * 86400) seconds )
  float period_sec = (7 * 86400);
  // Deviation in parts per million (μs)
  float deviation_ppm = (drift / period_sec * 1000000);
  // Use with offset mode PCF8523_TwoHours
  float drift_unit = 4.34;
  //For corrections every min the drift_unit is 4.069 ppm 
  // (use with offset mode PCF8523_OneMinute)
  // float drift_unit = 4.069; 
  int offset = round(deviation_ppm / drift_unit);

}
// Date and Time PCF8523 RTC 
void isRTC () {

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

getSHTC3.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// SHTC3 Temperature and Humidity Sensor
// SHTC3
void isSHTC3(){
// SHTC3 Temperature and Humidity Sensor
/**
* Mode For configuring sensor working mode
* SHTC3:
PRECISION_HIGH_CLKSTRETCH_ON Clock Stretching Enabled
* PRECISION_HIGH_CLKSTRETCH_OFF Clock Stretching Disabled
* PRECISION_LOW_CLKSTRETCH_ON Clock Stretching Enabled & Low Power
* PRECISION_LOW_CLKSTRETCH_OFF Clock Stretching Disabled & Low Power
*/
temperature = SHTC3.getTemperature(PRECISION_HIGH_CLKSTRETCH_ON);
/**
* Mode For configuring sensor working mode
* SHTC3
* PRECISION_HIGH_CLKSTRETCH_ON Clock Stretching Enabled
* PRECISION_HIGH_CLKSTRETCH_OFF Clock Stretching Disabled
* PRECISION_LOW_CLKSTRETCH_ON Clock Stretching Enabled & Low Power
* PRECISION_LOW_CLKSTRETCH_OFF Clock Stretching Disabled & Low Power
*/
humidity = SHTC3.getHumidity(PRECISION_HIGH_CLKSTRETCH_OFF);
}
// SHTC3 Temperature and Humidity Sensor // SHTC3 void isSHTC3(){ // SHTC3 Temperature and Humidity Sensor /** * Mode For configuring sensor working mode * SHTC3: PRECISION_HIGH_CLKSTRETCH_ON Clock Stretching Enabled * PRECISION_HIGH_CLKSTRETCH_OFF Clock Stretching Disabled * PRECISION_LOW_CLKSTRETCH_ON Clock Stretching Enabled & Low Power * PRECISION_LOW_CLKSTRETCH_OFF Clock Stretching Disabled & Low Power */ temperature = SHTC3.getTemperature(PRECISION_HIGH_CLKSTRETCH_ON); /** * Mode For configuring sensor working mode * SHTC3 * PRECISION_HIGH_CLKSTRETCH_ON Clock Stretching Enabled * PRECISION_HIGH_CLKSTRETCH_OFF Clock Stretching Disabled * PRECISION_LOW_CLKSTRETCH_ON Clock Stretching Enabled & Low Power * PRECISION_LOW_CLKSTRETCH_OFF Clock Stretching Disabled & Low Power */ humidity = SHTC3.getHumidity(PRECISION_HIGH_CLKSTRETCH_OFF); }
// SHTC3 Temperature and Humidity Sensor
// SHTC3
void isSHTC3(){

  // SHTC3 Temperature and Humidity Sensor
  /**
   *    Mode  For configuring sensor working mode    
   *    SHTC3:
           PRECISION_HIGH_CLKSTRETCH_ON Clock Stretching Enabled 
   *       PRECISION_HIGH_CLKSTRETCH_OFF Clock Stretching Disabled 
   *       PRECISION_LOW_CLKSTRETCH_ON Clock Stretching Enabled & Low Power
   *       PRECISION_LOW_CLKSTRETCH_OFF Clock Stretching Disabled & Low Power
   */
  temperature = SHTC3.getTemperature(PRECISION_HIGH_CLKSTRETCH_ON);
  /**
   *    Mode  For configuring sensor working mode 
   *    SHTC3
   *       PRECISION_HIGH_CLKSTRETCH_ON Clock Stretching Enabled 
   *       PRECISION_HIGH_CLKSTRETCH_OFF Clock Stretching Disabled 
   *       PRECISION_LOW_CLKSTRETCH_ON Clock Stretching Enabled & Low Power
   *       PRECISION_LOW_CLKSTRETCH_OFF Clock Stretching Disabled & Low Power
   */
  humidity = SHTC3.getHumidity(PRECISION_HIGH_CLKSTRETCH_OFF);

}

getSoilMoisture.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// Gravity: Analog Soil Moisture Sensor
// Soil Moisture
void isSoilMoisture(){
// Connect Soil Moisture Sensor to Analog 0
zz = analogRead( iSoilMoisture );
// iSoilMoistureVal => 0~900 Soil Moisture
iSoilMoistureVal = map( zz, 0, 4095, 0, 900);
// Threshold
if (iSoilMoistureVal > Threshold)
// 300~950 - Humid Soil
SM = "Humid Soil";
else {
// 0-300 Dry Soil
SM = "Dry Soil";
}
}
// Gravity: Analog Soil Moisture Sensor // Soil Moisture void isSoilMoisture(){ // Connect Soil Moisture Sensor to Analog 0 zz = analogRead( iSoilMoisture ); // iSoilMoistureVal => 0~900 Soil Moisture iSoilMoistureVal = map( zz, 0, 4095, 0, 900); // Threshold if (iSoilMoistureVal > Threshold) // 300~950 - Humid Soil SM = "Humid Soil"; else { // 0-300 Dry Soil SM = "Dry Soil"; } }
// Gravity: Analog Soil Moisture Sensor
// Soil Moisture
void isSoilMoisture(){

  // Connect Soil Moisture Sensor to Analog 0
  zz = analogRead( iSoilMoisture );

  // iSoilMoistureVal => 0~900 Soil Moisture
  iSoilMoistureVal = map( zz, 0, 4095, 0, 900);

  // Threshold
  if (iSoilMoistureVal > Threshold)

    // 300~950 - Humid Soil
    SM = "Humid Soil";
    
  else {
    
    // 0-300 Dry Soil
    SM = "Dry Soil";

  }

}

setup.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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 );
// DFRobot Display 240x320
screen.begin();
// Delay
delay(100);
// Fermion: SHTC3 Temperature & Humidity Sensor
SHTC3.begin();
/*SHTC3 is set to sleep mode by default. Please wake it up before use.
Use SHTC3.sleep() to let SHTC3 enter sleep mode; SHTC3
stops working in sleep mode*/
SHTC3.wakeup();
// Delay
delay(100);
// Setup Date and Time PCF8523 RTC
isSetupRTC();
// Date and Time PCF8523 RTC
isRTC();
// Delay
delay(100);
// 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 );
}
// 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 ); // DFRobot Display 240x320 screen.begin(); // Delay delay(100); // Fermion: SHTC3 Temperature & Humidity Sensor SHTC3.begin(); /*SHTC3 is set to sleep mode by default. Please wake it up before use. Use SHTC3.sleep() to let SHTC3 enter sleep mode; SHTC3 stops working in sleep mode*/ SHTC3.wakeup(); // Delay delay(100); // Setup Date and Time PCF8523 RTC isSetupRTC(); // Date and Time PCF8523 RTC isRTC(); // Delay delay(100); // 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 ); }
// 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 );
  
  // DFRobot Display 240x320
  screen.begin();

  // Delay
  delay(100);

  // Fermion: SHTC3 Temperature & Humidity Sensor
  SHTC3.begin();
  /*SHTC3 is set to sleep mode by default. Please wake it up before use. 
  Use SHTC3.sleep() to let SHTC3 enter sleep mode; SHTC3 
  stops working in sleep mode*/
  SHTC3.wakeup();
  
  // Delay
  delay(100);

  // Setup Date and Time PCF8523 RTC 
  isSetupRTC();

  // Date and Time PCF8523 RTC
  isRTC();

  // Delay
  delay(100);

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

Electronics, IoT, Teacher, Instructor, 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
ELECROW: https://www.elecrow.com/share/sharepj/center/no/760816d385ebb1edc0732fd873bfbf13
TikTok: www.tiktok.com/@luc.paquin8
LinkedIn: https://www.linkedin.com/in/jlucpaquin/

Don Luc

Project #29 – DFRobot – SHTC3 – Mk30

——

#DonLucElectronics #DonLuc #DFRobot #ASM #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.

DL2409Mk06

1 x FireBeetle 2 ESP32-C6
1 x Fermion: SHTC3 Temperature & Humidity Sensor
1 x Fermion: 2.0″ 320×240 IPS TFT LCD
1 x GDL Line 10 CM
1 x Gravity: Analog Soil Moisture Sensor
1 x 3 AAA Battery Holder with On/Off Switch and 2-Pin JST
3 x AAA Battery
1 x SparkFun Solderable Breadboard – Large
1 x USB 3.1 Cable A to C

FireBeetle 2 ESP32-C6

SCL – 20
SDA – 19
ASM – A1
LED – 15
DC – D2
CS – D6
RST – D3
VIN – +3.3V
GND – GND

DL2409Mk06p

DL2409Mk06p.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
/****** Don Luc Electronics © ******
Software Version Information
Project #29 - DFRobot - SHTC3 - Mk30
29-30
DL2409Mk06p.ino
DL2409Mk06
1 x FireBeetle 2 ESP32-C6
1 x Fermion: SHTC3 Temperature & Humidity Sensor
1 x Fermion: 2.0" 320x240 IPS TFT LCD
1 x GDL Line 10 CM
1 x Gravity: Analog Soil Moisture Sensor
1 x 3 AAA Battery Holder with On/Off Switch and 2-Pin JST
3 x AAA Battery
1 x SparkFun Solderable Breadboard - Large
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"
// Arduino
#include <Arduino.h>
// Wire
#include <Wire.h>
// DFRobot Display GDL API
#include <DFRobot_GDL.h>
// Fermion: SHTC3 Temperature & Humidity Sensor
#include"DFRobot_SHTC3.h"
// Fermion: SHTC3 Temperature & Humidity Sensor
DFRobot_SHTC3 SHTC3;
uint32_t id = 0;
float temperature;
float humidity;
// Defined ESP32
#define TFT_DC D2
#define TFT_CS D6
#define TFT_RST D3
/*dc=*/ /*cs=*/ /*rst=*/
// DFRobot Display 240x320
DFRobot_ST7789_240x320_HW_SPI screen(TFT_DC, TFT_CS, TFT_RST);
// Gravity: Analog Soil Moisture Sensor
int iSoilMoisture = A1;
int iSoilMoistureVal = 0;
int zz = 0;
// Change Your Threshold Here
int Threshold = 300;
String SM = "";
// LED Green
int iLEDGreen = 15;
// EEPROM Unique ID Information
#define EEPROM_SIZE 64
String uid = "";
// Software Version Information
String sver = "29-30";
void loop() {
// SHTC3 Temperature and Humidity Sensor
isSHTC3();
// Gravity: Analog Soil Moisture Sensor
isSoilMoisture();
// DFRobot Display 240x320 - ASM - Temperature and Humidity
isDisplayTH();
// Delay 5 Second
delay( 5000 );
}
/****** Don Luc Electronics © ****** Software Version Information Project #29 - DFRobot - SHTC3 - Mk30 29-30 DL2409Mk06p.ino DL2409Mk06 1 x FireBeetle 2 ESP32-C6 1 x Fermion: SHTC3 Temperature & Humidity Sensor 1 x Fermion: 2.0" 320x240 IPS TFT LCD 1 x GDL Line 10 CM 1 x Gravity: Analog Soil Moisture Sensor 1 x 3 AAA Battery Holder with On/Off Switch and 2-Pin JST 3 x AAA Battery 1 x SparkFun Solderable Breadboard - Large 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" // Arduino #include <Arduino.h> // Wire #include <Wire.h> // DFRobot Display GDL API #include <DFRobot_GDL.h> // Fermion: SHTC3 Temperature & Humidity Sensor #include"DFRobot_SHTC3.h" // Fermion: SHTC3 Temperature & Humidity Sensor DFRobot_SHTC3 SHTC3; uint32_t id = 0; float temperature; float humidity; // Defined ESP32 #define TFT_DC D2 #define TFT_CS D6 #define TFT_RST D3 /*dc=*/ /*cs=*/ /*rst=*/ // DFRobot Display 240x320 DFRobot_ST7789_240x320_HW_SPI screen(TFT_DC, TFT_CS, TFT_RST); // Gravity: Analog Soil Moisture Sensor int iSoilMoisture = A1; int iSoilMoistureVal = 0; int zz = 0; // Change Your Threshold Here int Threshold = 300; String SM = ""; // LED Green int iLEDGreen = 15; // EEPROM Unique ID Information #define EEPROM_SIZE 64 String uid = ""; // Software Version Information String sver = "29-30"; void loop() { // SHTC3 Temperature and Humidity Sensor isSHTC3(); // Gravity: Analog Soil Moisture Sensor isSoilMoisture(); // DFRobot Display 240x320 - ASM - Temperature and Humidity isDisplayTH(); // Delay 5 Second delay( 5000 ); }
/****** Don Luc Electronics © ******
Software Version Information
Project #29 - DFRobot - SHTC3 - Mk30
29-30
DL2409Mk06p.ino
DL2409Mk06
1 x FireBeetle 2 ESP32-C6
1 x Fermion: SHTC3 Temperature & Humidity Sensor
1 x Fermion: 2.0" 320x240 IPS TFT LCD
1 x GDL Line 10 CM
1 x Gravity: Analog Soil Moisture Sensor
1 x 3 AAA Battery Holder with On/Off Switch and 2-Pin JST
3 x AAA Battery
1 x SparkFun Solderable Breadboard - Large
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"
// Arduino
#include <Arduino.h>
// Wire
#include <Wire.h>
// DFRobot Display GDL API
#include <DFRobot_GDL.h>
// Fermion: SHTC3 Temperature & Humidity Sensor
#include"DFRobot_SHTC3.h"

// Fermion: SHTC3 Temperature & Humidity Sensor
DFRobot_SHTC3 SHTC3;
uint32_t id = 0;
float temperature;
float humidity;

// Defined ESP32
#define TFT_DC  D2
#define TFT_CS  D6
#define TFT_RST D3

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

// Gravity: Analog Soil Moisture Sensor
int iSoilMoisture = A1;
int iSoilMoistureVal = 0;
int zz = 0;
// Change Your Threshold Here
int Threshold = 300;
String SM = "";

// LED Green
int iLEDGreen = 15;

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

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

void loop() {

  // SHTC3 Temperature and Humidity Sensor
  isSHTC3();
  
  // Gravity: Analog Soil Moisture Sensor
  isSoilMoisture();

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

  // Delay 5 Second
  delay( 5000 );

}

getDisplay.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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 - ASM - 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);
// Soil Moisture Sensor
screen.setCursor(0, 30);
screen.println("Soil Moisture Sensor");
// Gravity: Analog Soil Moisture Sensor
screen.setCursor(0, 60);
screen.println( "ASM: " );
screen.setCursor(60, 60);
screen.println( iSoilMoistureVal );
screen.setCursor(0, 90);
screen.println( SM );
// SHTC3 Temperature
screen.setCursor(0, 120);
screen.println( "Tem: " );
screen.setCursor(60, 120);
screen.println( temperature );
screen.setCursor(120, 120);
screen.println( "C" );
// SHTC3 Humidity
screen.setCursor(0, 150);
screen.println( "Hum: " );
screen.setCursor(60, 150);
screen.println( humidity );
screen.setCursor(120, 150);
screen.println( "%RH" );
}
// 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 - ASM - 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); // Soil Moisture Sensor screen.setCursor(0, 30); screen.println("Soil Moisture Sensor"); // Gravity: Analog Soil Moisture Sensor screen.setCursor(0, 60); screen.println( "ASM: " ); screen.setCursor(60, 60); screen.println( iSoilMoistureVal ); screen.setCursor(0, 90); screen.println( SM ); // SHTC3 Temperature screen.setCursor(0, 120); screen.println( "Tem: " ); screen.setCursor(60, 120); screen.println( temperature ); screen.setCursor(120, 120); screen.println( "C" ); // SHTC3 Humidity screen.setCursor(0, 150); screen.println( "Hum: " ); screen.setCursor(60, 150); screen.println( humidity ); screen.setCursor(120, 150); screen.println( "%RH" ); }
// 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 - ASM - 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);
    // Soil Moisture Sensor
    screen.setCursor(0, 30);
    screen.println("Soil Moisture Sensor");
    // Gravity: Analog Soil Moisture Sensor
    screen.setCursor(0, 60);
    screen.println( "ASM: " );
    screen.setCursor(60, 60);
    screen.println( iSoilMoistureVal );
    screen.setCursor(0, 90);
    screen.println( SM );
    // SHTC3 Temperature
    screen.setCursor(0, 120);
    screen.println( "Tem: " );
    screen.setCursor(60, 120);
    screen.println( temperature );
    screen.setCursor(120, 120);
    screen.println( "C" );
    // SHTC3 Humidity
    screen.setCursor(0, 150);
    screen.println( "Hum: " );
    screen.setCursor(60, 150);
    screen.println( humidity );
    screen.setCursor(120, 150);
    screen.println( "%RH" );

}

getEEPROM.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// EEPROM
// isUID EEPROM Unique ID
void isUID() {
// Is Unit ID
uid = "";
for (int x = 0; x < 7; x++)
{
uid = uid + char(EEPROM.read(x));
}
}
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 7; x++) { uid = uid + char(EEPROM.read(x)); } }
// 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// SHTC3 Temperature and Humidity Sensor
// SHTC3
void isSHTC3(){
// SHTC3 Temperature and Humidity Sensor
/**
* Mode For configuring sensor working mode
* SHTC3:
PRECISION_HIGH_CLKSTRETCH_ON Clock Stretching Enabled
* PRECISION_HIGH_CLKSTRETCH_OFF Clock Stretching Disabled
* PRECISION_LOW_CLKSTRETCH_ON Clock Stretching Enabled & Low Power
* PRECISION_LOW_CLKSTRETCH_OFF Clock Stretching Disabled & Low Power
*/
temperature = SHTC3.getTemperature(PRECISION_HIGH_CLKSTRETCH_ON);
/**
* Mode For configuring sensor working mode
* SHTC3
* PRECISION_HIGH_CLKSTRETCH_ON Clock Stretching Enabled
* PRECISION_HIGH_CLKSTRETCH_OFF Clock Stretching Disabled
* PRECISION_LOW_CLKSTRETCH_ON Clock Stretching Enabled & Low Power
* PRECISION_LOW_CLKSTRETCH_OFF Clock Stretching Disabled & Low Power
*/
humidity = SHTC3.getHumidity(PRECISION_HIGH_CLKSTRETCH_OFF);
}
// SHTC3 Temperature and Humidity Sensor // SHTC3 void isSHTC3(){ // SHTC3 Temperature and Humidity Sensor /** * Mode For configuring sensor working mode * SHTC3: PRECISION_HIGH_CLKSTRETCH_ON Clock Stretching Enabled * PRECISION_HIGH_CLKSTRETCH_OFF Clock Stretching Disabled * PRECISION_LOW_CLKSTRETCH_ON Clock Stretching Enabled & Low Power * PRECISION_LOW_CLKSTRETCH_OFF Clock Stretching Disabled & Low Power */ temperature = SHTC3.getTemperature(PRECISION_HIGH_CLKSTRETCH_ON); /** * Mode For configuring sensor working mode * SHTC3 * PRECISION_HIGH_CLKSTRETCH_ON Clock Stretching Enabled * PRECISION_HIGH_CLKSTRETCH_OFF Clock Stretching Disabled * PRECISION_LOW_CLKSTRETCH_ON Clock Stretching Enabled & Low Power * PRECISION_LOW_CLKSTRETCH_OFF Clock Stretching Disabled & Low Power */ humidity = SHTC3.getHumidity(PRECISION_HIGH_CLKSTRETCH_OFF); }
// SHTC3 Temperature and Humidity Sensor
// SHTC3
void isSHTC3(){

  // SHTC3 Temperature and Humidity Sensor
  /**
   *    Mode  For configuring sensor working mode    
   *    SHTC3:
           PRECISION_HIGH_CLKSTRETCH_ON Clock Stretching Enabled 
   *       PRECISION_HIGH_CLKSTRETCH_OFF Clock Stretching Disabled 
   *       PRECISION_LOW_CLKSTRETCH_ON Clock Stretching Enabled & Low Power
   *       PRECISION_LOW_CLKSTRETCH_OFF Clock Stretching Disabled & Low Power
   */
  temperature = SHTC3.getTemperature(PRECISION_HIGH_CLKSTRETCH_ON);
  /**
   *    Mode  For configuring sensor working mode 
   *    SHTC3
   *       PRECISION_HIGH_CLKSTRETCH_ON Clock Stretching Enabled 
   *       PRECISION_HIGH_CLKSTRETCH_OFF Clock Stretching Disabled 
   *       PRECISION_LOW_CLKSTRETCH_ON Clock Stretching Enabled & Low Power
   *       PRECISION_LOW_CLKSTRETCH_OFF Clock Stretching Disabled & Low Power
   */
  humidity = SHTC3.getHumidity(PRECISION_HIGH_CLKSTRETCH_OFF);

}

getSoilMoisture.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// Gravity: Analog Soil Moisture Sensor
// Soil Moisture
void isSoilMoisture(){
// Connect Soil Moisture Sensor to Analog 0
zz = analogRead( iSoilMoisture );
// iSoilMoistureVal => 0~900 Soil Moisture
iSoilMoistureVal = map( zz, 0, 4095, 0, 900);
// Threshold
if (iSoilMoistureVal > Threshold)
// 300~950 - Humid Soil
SM = "Humid Soil";
else {
// 0-300 Dry Soil
SM = "Dry Soil";
}
}
// Gravity: Analog Soil Moisture Sensor // Soil Moisture void isSoilMoisture(){ // Connect Soil Moisture Sensor to Analog 0 zz = analogRead( iSoilMoisture ); // iSoilMoistureVal => 0~900 Soil Moisture iSoilMoistureVal = map( zz, 0, 4095, 0, 900); // Threshold if (iSoilMoistureVal > Threshold) // 300~950 - Humid Soil SM = "Humid Soil"; else { // 0-300 Dry Soil SM = "Dry Soil"; } }
// Gravity: Analog Soil Moisture Sensor
// Soil Moisture
void isSoilMoisture(){

  // Connect Soil Moisture Sensor to Analog 0
  zz = analogRead( iSoilMoisture );

  // iSoilMoistureVal => 0~900 Soil Moisture
  iSoilMoistureVal = map( zz, 0, 4095, 0, 900);

  // Threshold
  if (iSoilMoistureVal > Threshold)

    // 300~950 - Humid Soil
    SM = "Humid Soil";
    
  else {
    
    // 0-300 Dry Soil
    SM = "Dry Soil";

  }

}

setup.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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 );
// DFRobot Display 240x320
screen.begin();
// Delay
delay(100);
// Fermion: SHTC3 Temperature & Humidity Sensor
SHTC3.begin();
/*SHTC3 is set to sleep mode by default. Please wake it up before use.
Use SHTC3.sleep() to let SHTC3 enter sleep mode; SHTC3
stops working in sleep mode*/
SHTC3.wakeup();
// Delay
delay(100);
// 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 );
}
// 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 ); // DFRobot Display 240x320 screen.begin(); // Delay delay(100); // Fermion: SHTC3 Temperature & Humidity Sensor SHTC3.begin(); /*SHTC3 is set to sleep mode by default. Please wake it up before use. Use SHTC3.sleep() to let SHTC3 enter sleep mode; SHTC3 stops working in sleep mode*/ SHTC3.wakeup(); // Delay delay(100); // 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 ); }
// 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 );
  
  // DFRobot Display 240x320
  screen.begin();

  // Delay
  delay(100);

  // Fermion: SHTC3 Temperature & Humidity Sensor
  SHTC3.begin();
  /*SHTC3 is set to sleep mode by default. Please wake it up before use. 
  Use SHTC3.sleep() to let SHTC3 enter sleep mode; SHTC3 
  stops working in sleep mode*/
  SHTC3.wakeup();
  
  // Delay
  delay(100);

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

Electronics, IoT, Teacher, Instructor, 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
ELECROW: https://www.elecrow.com/share/sharepj/center/no/760816d385ebb1edc0732fd873bfbf13
TikTok: www.tiktok.com/@luc.paquin8
LinkedIn: https://www.linkedin.com/in/jlucpaquin/

Don Luc

Project #29 – DFRobot – Soil Moisture – Mk29

——

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

——

Soil Moisture

——

Soil Moisture

——

Soil Moisture

——

Soil Moisture

Soil moisture is the critical parameter in agriculture. If there is a shortage or overabundance of water, plants may die. At the same time, this data depends on many external factors, primarily weather conditions and climate changes. That is why it is so vital to understand the most effective methods for analyzing soil moisture content.

This term refers to the entire quantity of water in the ground’s pores or on its surface. The moisture content of soil depends on such factors as weather, type of land, and plants. The parameter is vital in monitoring soil moisture activities, predicting natural disasters, managing water supply, etc. This data may signal a future flood or water deficit ahead of other indicators.

DL2409Mk04

1 x FireBeetle 2 ESP32-C6
1 x Fermion: 2.0″ 320×240 IPS TFT LCD
1 x GDL Line 10 CM
1 x Gravity: Analog Soil Moisture Sensor
1 x 3 AAA Battery Holder with On/Off Switch and 2-Pin JST
3 x AAA Battery
1 x SparkFun Solderable Breadboard – Large
1 x USB 3.1 Cable A to C

FireBeetle 2 ESP32-C6

ASM – A1
LED – 15
DC – D2
CS – D6
RST – D3
VIN – +3.3V
GND – GND

DL2409Mk04p

DL2409Mk04p.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
/****** Don Luc Electronics © ******
Software Version Information
Project #29 - DFRobot - Soil Moisture - Mk29
29-29
DL2409Mk04p.ino
DL2409Mk04
1 x FireBeetle 2 ESP32-C6
1 x Fermion: 2.0" 320x240 IPS TFT LCD
1 x GDL Line 10 CM
1 x Gravity: Analog Soil Moisture Sensor
1 x 3 AAA Battery Holder with On/Off Switch and 2-Pin JST
3 x AAA Battery
1 x SparkFun Solderable Breadboard - Large
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"
// Arduino
#include <Arduino.h>
// Wire
#include <Wire.h>
// DFRobot Display GDL API
#include <DFRobot_GDL.h>
// Defined ESP32
#define TFT_DC D2
#define TFT_CS D6
#define TFT_RST D3
/*dc=*/ /*cs=*/ /*rst=*/
// DFRobot Display 240x320
DFRobot_ST7789_240x320_HW_SPI screen(TFT_DC, TFT_CS, TFT_RST);
// Gravity: Analog Soil Moisture Sensor
int iSoilMoisture = A1;
int iSoilMoistureVal = 0;
int zz = 0;
// Change Your Threshold Here
int Threshold = 300;
String SM = "";
// LED Green
int iLEDGreen = 15;
// EEPROM Unique ID Information
#define EEPROM_SIZE 64
String uid = "";
// Software Version Information
String sver = "29-29";
void loop() {
// Gravity: Analog Soil Moisture Sensor
isSoilMoisture();
// DFRobot Display 240x320 - ASM
isDisplayTH();
// Delay 5 Second
delay( 5000 );
}
/****** Don Luc Electronics © ****** Software Version Information Project #29 - DFRobot - Soil Moisture - Mk29 29-29 DL2409Mk04p.ino DL2409Mk04 1 x FireBeetle 2 ESP32-C6 1 x Fermion: 2.0" 320x240 IPS TFT LCD 1 x GDL Line 10 CM 1 x Gravity: Analog Soil Moisture Sensor 1 x 3 AAA Battery Holder with On/Off Switch and 2-Pin JST 3 x AAA Battery 1 x SparkFun Solderable Breadboard - Large 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" // Arduino #include <Arduino.h> // Wire #include <Wire.h> // DFRobot Display GDL API #include <DFRobot_GDL.h> // Defined ESP32 #define TFT_DC D2 #define TFT_CS D6 #define TFT_RST D3 /*dc=*/ /*cs=*/ /*rst=*/ // DFRobot Display 240x320 DFRobot_ST7789_240x320_HW_SPI screen(TFT_DC, TFT_CS, TFT_RST); // Gravity: Analog Soil Moisture Sensor int iSoilMoisture = A1; int iSoilMoistureVal = 0; int zz = 0; // Change Your Threshold Here int Threshold = 300; String SM = ""; // LED Green int iLEDGreen = 15; // EEPROM Unique ID Information #define EEPROM_SIZE 64 String uid = ""; // Software Version Information String sver = "29-29"; void loop() { // Gravity: Analog Soil Moisture Sensor isSoilMoisture(); // DFRobot Display 240x320 - ASM isDisplayTH(); // Delay 5 Second delay( 5000 ); }
/****** Don Luc Electronics © ******
Software Version Information
Project #29 - DFRobot - Soil Moisture - Mk29
29-29
DL2409Mk04p.ino
DL2409Mk04
1 x FireBeetle 2 ESP32-C6
1 x Fermion: 2.0" 320x240 IPS TFT LCD
1 x GDL Line 10 CM
1 x Gravity: Analog Soil Moisture Sensor
1 x 3 AAA Battery Holder with On/Off Switch and 2-Pin JST
3 x AAA Battery
1 x SparkFun Solderable Breadboard - Large
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"
// Arduino
#include <Arduino.h>
// Wire
#include <Wire.h>
// DFRobot Display GDL API
#include <DFRobot_GDL.h>

// Defined ESP32
#define TFT_DC  D2
#define TFT_CS  D6
#define TFT_RST D3

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

// Gravity: Analog Soil Moisture Sensor
int iSoilMoisture = A1;
int iSoilMoistureVal = 0;
int zz = 0;
// Change Your Threshold Here
int Threshold = 300;
String SM = "";

// LED Green
int iLEDGreen = 15;

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

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

void loop() {

  // Gravity: Analog Soil Moisture Sensor
  isSoilMoisture();

  // DFRobot Display 240x320 - ASM
  isDisplayTH();

  // Delay 5 Second
  delay( 5000 );

}

getDisplay.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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 - ASM
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("Soil Moisture Sensor");
// Gravity: Analog Soil Moisture Sensor
screen.setCursor(0, 60);
screen.println( "ASM: " );
screen.setCursor(60, 60);
screen.println( iSoilMoistureVal );
screen.setCursor(0, 90);
screen.println( SM );
}
// 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 - ASM 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("Soil Moisture Sensor"); // Gravity: Analog Soil Moisture Sensor screen.setCursor(0, 60); screen.println( "ASM: " ); screen.setCursor(60, 60); screen.println( iSoilMoistureVal ); screen.setCursor(0, 90); screen.println( SM ); }
// 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 - ASM
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("Soil Moisture Sensor");
    // Gravity: Analog Soil Moisture Sensor
    screen.setCursor(0, 60);
    screen.println( "ASM: " );
    screen.setCursor(60, 60);
    screen.println( iSoilMoistureVal );
    screen.setCursor(0, 90);
    screen.println( SM );

}

getEEPROM.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// EEPROM
// isUID EEPROM Unique ID
void isUID() {
// Is Unit ID
uid = "";
for (int x = 0; x < 7; x++)
{
uid = uid + char(EEPROM.read(x));
}
}
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 7; x++) { uid = uid + char(EEPROM.read(x)); } }
// EEPROM
// isUID EEPROM Unique ID
void isUID() {
  
  // Is Unit ID
  uid = "";
  for (int x = 0; x < 7; x++)
  {
    uid = uid + char(EEPROM.read(x));
  }
  
}

getSoilMoisture.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// Gravity: Analog Soil Moisture Sensor
// Soil Moisture
void isSoilMoisture(){
// Connect Soil Moisture Sensor to Analog 0
zz = analogRead( iSoilMoisture );
// iSoilMoistureVal => 0~900 Soil Moisture
iSoilMoistureVal = map( zz, 0, 4095, 0, 900);
// Threshold
if (iSoilMoistureVal > Threshold)
// 300~950 - Humid Soil
SM = "Humid Soil";
else {
// 0-300 Dry Soil
SM = "Dry Soil";
}
}
// Gravity: Analog Soil Moisture Sensor // Soil Moisture void isSoilMoisture(){ // Connect Soil Moisture Sensor to Analog 0 zz = analogRead( iSoilMoisture ); // iSoilMoistureVal => 0~900 Soil Moisture iSoilMoistureVal = map( zz, 0, 4095, 0, 900); // Threshold if (iSoilMoistureVal > Threshold) // 300~950 - Humid Soil SM = "Humid Soil"; else { // 0-300 Dry Soil SM = "Dry Soil"; } }
// Gravity: Analog Soil Moisture Sensor
// Soil Moisture
void isSoilMoisture(){

  // Connect Soil Moisture Sensor to Analog 0
  zz = analogRead( iSoilMoisture );

  // iSoilMoistureVal => 0~900 Soil Moisture
  iSoilMoistureVal = map( zz, 0, 4095, 0, 900);

  // Threshold
  if (iSoilMoistureVal > Threshold)

    // 300~950 - Humid Soil
    SM = "Humid Soil";
    
  else {
    
    // 0-300 Dry Soil
    SM = "Dry Soil";

  }

}

setup.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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 );
// DFRobot Display 240x320
screen.begin();
// Delay
delay(100);
// 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 );
}
// 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 ); // DFRobot Display 240x320 screen.begin(); // Delay delay(100); // 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 ); }
// 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 );
  
  // DFRobot Display 240x320
  screen.begin();

  // Delay
  delay(100);

  // 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 – 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
/****** 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);
}
/****** 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); }
/****** 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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;
}
// 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; }
// 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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;
}
// 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; }
// 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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();
}
// 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(); }
// 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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 );
}
// 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 ); }
// 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// EEPROM
// isUID EEPROM Unique ID
void isUID() {
// Is Unit ID
uid = "";
for (int x = 0; x < 7; x++)
{
uid = uid + char(EEPROM.read(x));
}
}
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 7; x++) { uid = uid + char(EEPROM.read(x)); } }
// 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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);
}
}
// 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); } }
// 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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;
}
// 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; }
// 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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();
}
// 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(); }
// 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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 );
}
// 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 ); }
// 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
/****** 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);
}
/****** 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); }
/****** 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// Accelerometer ADXL335
// ADXL335
void isADXL335() {
// Accelerometer ADXL335
// Accelerometer X, Y, Z
// X
X = analogRead(iX);
// Y
Y = analogRead(iY);
// Z
Z = analogRead(iZ);
}
// Accelerometer ADXL335 // ADXL335 void isADXL335() { // Accelerometer ADXL335 // Accelerometer X, Y, Z // X X = analogRead(iX); // Y Y = analogRead(iY); // Z Z = analogRead(iZ); }
// 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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 );
}
// 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 ); }
// 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// EEPROM
// isUID EEPROM Unique ID
void isUID() {
// Is Unit ID
uid = "";
for (int x = 0; x < 7; x++)
{
uid = uid + char(EEPROM.read(x));
}
}
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 7; x++) { uid = uid + char(EEPROM.read(x)); } }
// 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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);
}
}
// 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); } }
// 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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;
}
// 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; }
// 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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;
}
// 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; }
// 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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();
}
// 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(); }
// 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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 );
}
// 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 ); }
// 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

Project #29 – DFRobot – HMC5883L – Mk17

——

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

——

HMC5883L

——

HMC5883L

——

HMC5883L

——

SparkFun Triple Axis Magnetometer Breakout – HMC5883L

This is a breakout board for Honeywell’s HMC5883L, a 3-axis digital compass. Communication with the HMC5883L is simple and all done through an I2C interface. There is no on-board regulator, so a regulated voltage of 2.16-3.6VDC should be supplied. The breakout board includes the HMC5883L sensor and all filtering capacitors as shown. The power and 2-wire interface pins are all broken out to a 0.1 inch pitch header.

DL2406Mk04

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 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

——

DL2406Mk04p.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
/****** Don Luc Electronics © ******
Software Version Information
Project #29 - DFRobot - HMC5883L - Mk17
29-17
DL2406Mk04p.ino
DL2406Mk04
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 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>
// 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-17";
void loop() {
// isGPS
isGPS();
// Accelerometer ADXL335
isADXL335();
// Magnetometer
isMagnetometer();
// 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);
}
/****** Don Luc Electronics © ****** Software Version Information Project #29 - DFRobot - HMC5883L - Mk17 29-17 DL2406Mk04p.ino DL2406Mk04 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 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> // 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-17"; void loop() { // isGPS isGPS(); // Accelerometer ADXL335 isADXL335(); // Magnetometer isMagnetometer(); // 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); }
/****** Don Luc Electronics © ******
Software Version Information
Project #29 - DFRobot - HMC5883L - Mk17
29-17
DL2406Mk04p.ino
DL2406Mk04
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 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>

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

void loop() {

  // isGPS
  isGPS();

  // Accelerometer ADXL335
  isADXL335();

  // Magnetometer
  isMagnetometer();

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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// Accelerometer ADXL335
// ADXL335
void isADXL335() {
// Accelerometer ADXL335
// Accelerometer X, Y, Z
// X
X = analogRead(iX);
// Y
Y = analogRead(iY);
// Z
Z = analogRead(iZ);
}
// Accelerometer ADXL335 // ADXL335 void isADXL335() { // Accelerometer ADXL335 // Accelerometer X, Y, Z // X X = analogRead(iX); // Y Y = analogRead(iY); // Z Z = analogRead(iZ); }
// 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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(2);
display.setTextColor(BLACK);
// Accelerometer X
display.setCursor(0,5);
display.print( "AX: " );
display.println( X );
// Accelerometer Y
display.setCursor(0,30);
display.print( "AY: " );
display.println( Y );
// Accelerometer Z
display.setCursor(0,55);
display.print( "AZ: " );
display.println( Z );
// Magnetometer X
display.setCursor(0,80);
display.print( "MX: " );
display.println( mX );
// Magnetometer Y
display.setCursor(0,105);
display.print( "MY: " );
display.println( mY );
// Magnetometer Z
display.setCursor(0,130);
display.print( "MZ: " );
display.println( mZ );
// 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 );
}
// 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(2); display.setTextColor(BLACK); // Accelerometer X display.setCursor(0,5); display.print( "AX: " ); display.println( X ); // Accelerometer Y display.setCursor(0,30); display.print( "AY: " ); display.println( Y ); // Accelerometer Z display.setCursor(0,55); display.print( "AZ: " ); display.println( Z ); // Magnetometer X display.setCursor(0,80); display.print( "MX: " ); display.println( mX ); // Magnetometer Y display.setCursor(0,105); display.print( "MY: " ); display.println( mY ); // Magnetometer Z display.setCursor(0,130); display.print( "MZ: " ); display.println( mZ ); // 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 ); }
// 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(2);
    display.setTextColor(BLACK);
    // Accelerometer X
    display.setCursor(0,5);
    display.print( "AX: " );
    display.println( X );
    // Accelerometer Y
    display.setCursor(0,30);
    display.print( "AY: " );
    display.println( Y );
    // Accelerometer Z
    display.setCursor(0,55);
    display.print( "AZ: " );
    display.println( Z );
    // Magnetometer X
    display.setCursor(0,80);
    display.print( "MX: " );
    display.println( mX );
    // Magnetometer Y
    display.setCursor(0,105);
    display.print( "MY: " );
    display.println( mY );
    // Magnetometer Z
    display.setCursor(0,130);
    display.print( "MZ: " );
    display.println( mZ );
    // 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// EEPROM
// isUID EEPROM Unique ID
void isUID() {
// Is Unit ID
uid = "";
for (int x = 0; x < 7; x++)
{
uid = uid + char(EEPROM.read(x));
}
}
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 7; x++) { uid = uid + char(EEPROM.read(x)); } }
// 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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);
}
}
// 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); } }
// 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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;
}
// 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; }
// 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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
//|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(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();
}
// 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 //|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(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(); }
// 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
  //|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(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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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();
// 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 );
}
// 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(); // 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 ); }
// 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();

  // 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 – ADXL335 – Mk16

——

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

——

ADXL335

——

ADXL335

——

ADXL335

——

SparkFun Triple Axis Accelerometer Breakout – ADXL335

Breakout board for the 3 axis ADXL335 from Analog Devices. This is the latest in a long, proven line of analog sensors – the holy grail of accelerometers. The ADXL335 is a triple axis MEMS accelerometer with extremely low noise and power consumption only 320 uA. The sensor has a full sensing range of +/- 3g. There is no on-board regulation, provided power should be between 1.8 and 3.6 Volt. Board comes fully assembled and tested with external components installed. The included 0.1 uF capacitors set the bandwidth of each axis to 50 Hz.

DL2406Mk03

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 Adafruit DS3231 Precision RTC FeatherWing – RTC
1 x Battery CR1220
1 x SparkFun Triple Axis Accelerometer ADXL335
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

——

DL2406Mk03p.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
/****** Don Luc Electronics © ******
Software Version Information
Project #29 - DFRobot - ADXL335 - Mk16
29-16
DL2406Mk03p.ino
DL2406Mk03
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 Adafruit DS3231 Precision RTC FeatherWing - RTC
1 x Battery CR1220
1 x SparkFun Triple Axis Accelerometer ADXL335
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>
// DS3231 RTC Date and Time
#include <RTClib.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>
// 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 = "";
// DS3231 RTC Date and Time
RTC_DS3231 rtc;
String sDate;
String sTime;
// 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-16";
void loop() {
// DS3231 RTC Date and Time
isRTC();
// isGPS
isGPS();
// Accelerometer ADXL335
isADXL335();
// 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);
}
/****** Don Luc Electronics © ****** Software Version Information Project #29 - DFRobot - ADXL335 - Mk16 29-16 DL2406Mk03p.ino DL2406Mk03 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 Adafruit DS3231 Precision RTC FeatherWing - RTC 1 x Battery CR1220 1 x SparkFun Triple Axis Accelerometer ADXL335 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> // DS3231 RTC Date and Time #include <RTClib.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> // 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 = ""; // DS3231 RTC Date and Time RTC_DS3231 rtc; String sDate; String sTime; // 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-16"; void loop() { // DS3231 RTC Date and Time isRTC(); // isGPS isGPS(); // Accelerometer ADXL335 isADXL335(); // 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); }
/****** Don Luc Electronics © ******
Software Version Information
Project #29 - DFRobot - ADXL335 - Mk16
29-16
DL2406Mk03p.ino
DL2406Mk03
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 Adafruit DS3231 Precision RTC FeatherWing - RTC
1 x Battery CR1220
1 x SparkFun Triple Axis Accelerometer ADXL335
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>
// DS3231 RTC Date and Time
#include <RTClib.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>

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

// DS3231 RTC Date and Time
RTC_DS3231 rtc;
String sDate;
String sTime;

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

void loop() {

  // DS3231 RTC Date and Time
  isRTC();

  // isGPS
  isGPS();

  // Accelerometer ADXL335
  isADXL335();

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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// Accelerometer ADXL335
// ADXL335
void isADXL335() {
// Accelerometer ADXL335
// Accelerometer X, Y, Z
// X
X = analogRead(iX);
// Y
Y = analogRead(iY);
// Z
Z = analogRead(iZ);
}
// Accelerometer ADXL335 // ADXL335 void isADXL335() { // Accelerometer ADXL335 // Accelerometer X, Y, Z // X X = analogRead(iX); // Y Y = analogRead(iY); // Z Z = analogRead(iZ); }
// 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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(2);
display.setTextColor(BLACK);
// Date
display.setCursor(0,5);
display.println( sDate );
// Time
display.setCursor(0,30);
display.println( sTime );
// X
display.setCursor(0,55);
display.print( "X: " );
display.println( X );
// Y
display.setCursor(0,80);
display.print( "Y: " );
display.println( Y );
// Z
display.setCursor(0,105);
display.print( "Z: " );
display.println( Z );
// 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 );
}
// 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(2); display.setTextColor(BLACK); // Date display.setCursor(0,5); display.println( sDate ); // Time display.setCursor(0,30); display.println( sTime ); // X display.setCursor(0,55); display.print( "X: " ); display.println( X ); // Y display.setCursor(0,80); display.print( "Y: " ); display.println( Y ); // Z display.setCursor(0,105); display.print( "Z: " ); display.println( Z ); // 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 ); }
// 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(2);
    display.setTextColor(BLACK);
    // Date
    display.setCursor(0,5);
    display.println( sDate );
    // Time
    display.setCursor(0,30);
    display.println( sTime );
    // X
    display.setCursor(0,55);
    display.print( "X: " );
    display.println( X );
    // Y
    display.setCursor(0,80);
    display.print( "Y: " );
    display.println( Y );
    // Z
    display.setCursor(0,105);
    display.print( "Z: " );
    display.println( Z );
    // 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// EEPROM
// isUID EEPROM Unique ID
void isUID() {
// Is Unit ID
uid = "";
for (int x = 0; x < 7; x++)
{
uid = uid + char(EEPROM.read(x));
}
}
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 7; x++) { uid = uid + char(EEPROM.read(x)); } }
// 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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);
}
}
// 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); } }
// 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);

  }
  
}

getRTC.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// DS3231 RTC Date and Time
// Setup DS3231 RTC
void isSetupRTC() {
if (! rtc.begin()) {
while (1);
}
if (rtc.lostPower()) {
// Following line sets the RTC to the date & time this sketch was compiled
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
// This line sets the RTC with an explicit date & time, for example to set
// January 21, 2014 at 3am you would call:
// rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
}
}
// DS3231 RTC Date and Time
void isRTC(){
// Date and Time
sDate = "";
sTime = "";
// Date Time
DateTime now = rtc.now();
// sData
sDate += String(now.year(), DEC);
sDate += "/";
sDate += String(now.month(), DEC);
sDate += "/";
sDate += String(now.day(), DEC);
// sTime
sTime += String(now.hour(), DEC);
sTime += ":";
sTime += String(now.minute(), DEC);
sTime += ":";
sTime += String(now.second(), DEC);
}
// DS3231 RTC Date and Time // Setup DS3231 RTC void isSetupRTC() { if (! rtc.begin()) { while (1); } if (rtc.lostPower()) { // Following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0)); } } // DS3231 RTC Date and Time void isRTC(){ // Date and Time sDate = ""; sTime = ""; // Date Time DateTime now = rtc.now(); // sData sDate += String(now.year(), DEC); sDate += "/"; sDate += String(now.month(), DEC); sDate += "/"; sDate += String(now.day(), DEC); // sTime sTime += String(now.hour(), DEC); sTime += ":"; sTime += String(now.minute(), DEC); sTime += ":"; sTime += String(now.second(), DEC); }
// DS3231 RTC Date and Time
// Setup DS3231 RTC
void isSetupRTC() {

  if (! rtc.begin()) {
    while (1);
  }

  if (rtc.lostPower()) {
    // Following line sets the RTC to the date & time this sketch was compiled
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date & time, for example to set
    // January 21, 2014 at 3am you would call:
    // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
  }
  
}
// DS3231 RTC Date and Time
void isRTC(){
 
    // Date and Time
    sDate = "";
    sTime = "";
    // Date Time
    DateTime now = rtc.now();

    // sData
    sDate += String(now.year(), DEC);
    sDate += "/";
    sDate += String(now.month(), DEC);
    sDate += "/";
    sDate += String(now.day(), DEC);

    // sTime
    sTime += String(now.hour(), DEC);
    sTime += ":";
    sTime += String(now.minute(), DEC);
    sTime += ":";
    sTime += String(now.second(), DEC);

}

getSD.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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
//|GPS|Latitude|Longitude|GPS Date|GPS Time|GPS Speed M/S|GPS Altitude|*\r
zzzzzz = "DFR|" + uid + "|" + sver + "|" + String(sDate) + "|" + String(sTime) + "|"
+ String(X) + "|" + String(Y) + "|" + String(Z) + "|"
+ 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();
}
// 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 //|GPS|Latitude|Longitude|GPS Date|GPS Time|GPS Speed M/S|GPS Altitude|*\r zzzzzz = "DFR|" + uid + "|" + sver + "|" + String(sDate) + "|" + String(sTime) + "|" + String(X) + "|" + String(Y) + "|" + String(Z) + "|" + 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(); }
// 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
  //|GPS|Latitude|Longitude|GPS Date|GPS Time|GPS Speed M/S|GPS Altitude|*\r
  zzzzzz = "DFR|" + uid + "|" + sver + "|" + String(sDate) + "|" + String(sTime) + "|"
  + String(X) + "|" + String(Y) + "|" + String(Z) + "|"
  + 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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);
// Setup DS3231 RTC
isSetupRTC();
//MicroSD Card
isSetupSD();
// SHARP Display Start & Clear the Display
display.begin();
// Clear Display
display.clearDisplay();
// Delay
delay( 100 );
// GPS Receiver
// Setup GPS
isSetupGPS();
// 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 );
}
// 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); // Setup DS3231 RTC isSetupRTC(); //MicroSD Card isSetupSD(); // SHARP Display Start & Clear the Display display.begin(); // Clear Display display.clearDisplay(); // Delay delay( 100 ); // GPS Receiver // Setup GPS isSetupGPS(); // 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 ); }
// 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);

  // Setup DS3231 RTC
  isSetupRTC();

  //MicroSD Card
  isSetupSD();

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

  // Delay
  delay( 100 );

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

  // 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 – GPS Receiver – Mk15

——

#DonLucElectronics #DonLuc #DFRobot #GPS #BME280 #CCS811 #FireBeetle2ESP32E #EEPROM #RTC #SD #Display #Adafruit #SparkFun #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

GPS Receiver

——

GPS Receiver

——

GPS Receiver

——

Global Positioning System (GPS)

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

GPS Receiver – GP-20U7

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

DL2406Mk02

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 Adafruit DS3231 Precision RTC FeatherWing – RTC
1 x Battery CR1220
1 x SparkFun Environmental Combo CCS811/BME280
1 x GPS Receiver – GP-20U7
3 x Switch
2 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
SWG – 1
VIN – +3.3V
GND – GND

——

DL2406Mk02p.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
/****** Don Luc Electronics © ******
Software Version Information
Project #29 - DFRobot - GPS Receiver - Mk15
29-15
DL2406Mk02p.ino
DL2406Mk02
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 Adafruit DS3231 Precision RTC FeatherWing - RTC
1 x Battery CR1220
1 x SparkFun Environmental Combo CCS811/BME280
1 x GPS Receiver - GP-20U7
3 x Switch
2 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>
// DS3231 RTC Date and Time
#include <RTClib.h>
// SD Card
#include "FS.h"
#include "SD.h"
#include "SPI.h"
// SHARP Memory Display
#include <Adafruit_SharpMem.h>
#include <Adafruit_GFX.h>
// SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure
#include <SparkFunBME280.h>
// SparkFun CCS811 - eCO2 & tVOC
#include <SparkFunCCS811.h>
// GPS Receiver
#include <TinyGPS++.h>
// ESP32 Hardware Serial
#include <HardwareSerial.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 = "";
// SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure
BME280 myBME280;
// Temperature Celsius
float BMEtempC = 0;
// Humidity
float BMEhumid = 0;
// Altitude Meters
float BMEaltitudeM = 0;
// Barometric Pressure
float BMEpressure = 0;
// SparkFun CCS811 - eCO2 & tVOC
// Default I2C Address
#define CCS811_ADDR 0x5B
CCS811 myCCS811(CCS811_ADDR);
// eCO2
float CCS811CO2 = 0;
// TVOC
float CCS811TVOC = 0;
// DS3231 RTC Date and Time
RTC_DS3231 rtc;
String sDate;
String sTime;
// 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;
// Switch GPS
int iSwitchGPS = 1;
// Variable for reading the Switch GPS status
int iSwitchGPSState = 0;
// EEPROM Unique ID Information
#define EEPROM_SIZE 64
String uid = "";
// Software Version Information
String sver = "29-15";
void loop() {
// DS3231 RTC Date and Time
isRTC();
// SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure
isBME280();
// SparkFun CCS811 - eCO2 & tVOC
isCCS811();
// isGPS
isGPS();
// Read the state of the Switch value
iSwitchState = digitalRead(iSwitch);
// The Switch is HIGH:
if (iSwitchState == HIGH) {
// Display Date, Time, Temperature, Humidity
isDisplayDTTH();
} else {
// Read the state of the Switch value
iSwitchGPSState = digitalRead(iSwitchGPS);
if (iSwitchGPSState == HIGH) {
// Display GPS
isDisplayGPS();
} else {
// Display Date, Time, eCO2 Concentration, tVOC Concentration
isDisplayDTCOVO();
}
}
// MicroSD Card
isSD();
// iLED HIGH
digitalWrite(iLED, HIGH );
// Delay 5 Second
delay(5000);
}
/****** Don Luc Electronics © ****** Software Version Information Project #29 - DFRobot - GPS Receiver - Mk15 29-15 DL2406Mk02p.ino DL2406Mk02 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 Adafruit DS3231 Precision RTC FeatherWing - RTC 1 x Battery CR1220 1 x SparkFun Environmental Combo CCS811/BME280 1 x GPS Receiver - GP-20U7 3 x Switch 2 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> // DS3231 RTC Date and Time #include <RTClib.h> // SD Card #include "FS.h" #include "SD.h" #include "SPI.h" // SHARP Memory Display #include <Adafruit_SharpMem.h> #include <Adafruit_GFX.h> // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure #include <SparkFunBME280.h> // SparkFun CCS811 - eCO2 & tVOC #include <SparkFunCCS811.h> // GPS Receiver #include <TinyGPS++.h> // ESP32 Hardware Serial #include <HardwareSerial.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 = ""; // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure BME280 myBME280; // Temperature Celsius float BMEtempC = 0; // Humidity float BMEhumid = 0; // Altitude Meters float BMEaltitudeM = 0; // Barometric Pressure float BMEpressure = 0; // SparkFun CCS811 - eCO2 & tVOC // Default I2C Address #define CCS811_ADDR 0x5B CCS811 myCCS811(CCS811_ADDR); // eCO2 float CCS811CO2 = 0; // TVOC float CCS811TVOC = 0; // DS3231 RTC Date and Time RTC_DS3231 rtc; String sDate; String sTime; // 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; // Switch GPS int iSwitchGPS = 1; // Variable for reading the Switch GPS status int iSwitchGPSState = 0; // EEPROM Unique ID Information #define EEPROM_SIZE 64 String uid = ""; // Software Version Information String sver = "29-15"; void loop() { // DS3231 RTC Date and Time isRTC(); // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure isBME280(); // SparkFun CCS811 - eCO2 & tVOC isCCS811(); // isGPS isGPS(); // Read the state of the Switch value iSwitchState = digitalRead(iSwitch); // The Switch is HIGH: if (iSwitchState == HIGH) { // Display Date, Time, Temperature, Humidity isDisplayDTTH(); } else { // Read the state of the Switch value iSwitchGPSState = digitalRead(iSwitchGPS); if (iSwitchGPSState == HIGH) { // Display GPS isDisplayGPS(); } else { // Display Date, Time, eCO2 Concentration, tVOC Concentration isDisplayDTCOVO(); } } // MicroSD Card isSD(); // iLED HIGH digitalWrite(iLED, HIGH ); // Delay 5 Second delay(5000); }
/****** Don Luc Electronics © ******
Software Version Information
Project #29 - DFRobot - GPS Receiver - Mk15
29-15
DL2406Mk02p.ino
DL2406Mk02
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 Adafruit DS3231 Precision RTC FeatherWing - RTC
1 x Battery CR1220
1 x SparkFun Environmental Combo CCS811/BME280
1 x GPS Receiver - GP-20U7
3 x Switch
2 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>
// DS3231 RTC Date and Time
#include <RTClib.h>
// SD Card
#include "FS.h"
#include "SD.h"
#include "SPI.h"
// SHARP Memory Display
#include <Adafruit_SharpMem.h>
#include <Adafruit_GFX.h>
// SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure
#include <SparkFunBME280.h>
// SparkFun CCS811 - eCO2 & tVOC
#include <SparkFunCCS811.h>
// GPS Receiver
#include <TinyGPS++.h>
// ESP32 Hardware Serial
#include <HardwareSerial.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 = "";

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

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

// DS3231 RTC Date and Time
RTC_DS3231 rtc;
String sDate;
String sTime;

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

// Switch GPS
int iSwitchGPS = 1;
// Variable for reading the Switch GPS status
int iSwitchGPSState = 0;

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

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

void loop() {

  // DS3231 RTC Date and Time
  isRTC();

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

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

  // isGPS
  isGPS();

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

    // Display Date, Time, Temperature, Humidity
    isDisplayDTTH();
  
  } else {
    
    // Read the state of the Switch value
    iSwitchGPSState = digitalRead(iSwitchGPS);
    
    if (iSwitchGPSState == HIGH) {

      // Display GPS
      isDisplayGPS();
      
    } else {
      
      // Display Date, Time, eCO2 Concentration, tVOC Concentration
      isDisplayDTCOVO();

    }  

  }
  
  // MicroSD Card
  isSD();

  // iLED HIGH
  digitalWrite(iLED, HIGH );

  // Delay 5 Second
  delay(5000);

}

getBME280.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure
// isBME280 - Temperature, Humidity, Altitude and Barometric Pressure
void isBME280(){
// Temperature Celsius
BMEtempC = myBME280.readTempC();
// Humidity
BMEhumid = myBME280.readFloatHumidity() ;
// Altitude Meters
BMEaltitudeM = myBME280.readFloatAltitudeMeters();
// Barometric Pressure
BMEpressure = myBME280.readFloatPressure();
}
// SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure // isBME280 - Temperature, Humidity, Altitude and Barometric Pressure void isBME280(){ // Temperature Celsius BMEtempC = myBME280.readTempC(); // Humidity BMEhumid = myBME280.readFloatHumidity() ; // Altitude Meters BMEaltitudeM = myBME280.readFloatAltitudeMeters(); // Barometric Pressure BMEpressure = myBME280.readFloatPressure(); }
// SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure
// isBME280 - Temperature, Humidity, Altitude and Barometric Pressure
void isBME280(){

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

getCCS811.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// CCS811 - eCO2 & tVOC
// isCCS811 - eCO2 & tVOC
void isCCS811(){
// This sends the temperature & humidity data to the CCS811
myCCS811.setEnvironmentalData(BMEhumid, BMEtempC);
// Calling this function updates the global tVOC and eCO2 variables
myCCS811.readAlgorithmResults();
// eCO2 Concentration
CCS811CO2 = myCCS811.getCO2();
// tVOC Concentration
CCS811TVOC = myCCS811.getTVOC();
}
// CCS811 - eCO2 & tVOC // isCCS811 - eCO2 & tVOC void isCCS811(){ // This sends the temperature & humidity data to the CCS811 myCCS811.setEnvironmentalData(BMEhumid, BMEtempC); // Calling this function updates the global tVOC and eCO2 variables myCCS811.readAlgorithmResults(); // eCO2 Concentration CCS811CO2 = myCCS811.getCO2(); // tVOC Concentration CCS811TVOC = myCCS811.getTVOC(); }
// CCS811 - eCO2 & tVOC
// isCCS811 - eCO2 & tVOC
void isCCS811(){

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

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

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

getDisplay.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// SHARP Memory Display
// SHARP Memory Display - UID
void isDisplayUID() {
// Text Display
// Clear Display
display.clearDisplay();
display.setRotation(4);
display.setTextSize(3);
display.setTextColor(BLACK);
// Don Luc Electronics
display.setCursor(0,10);
display.println( "Don Luc" );
display.setTextSize(2);
display.setCursor(0,40);
display.println( "Electronics" );
// Version
//display.setTextSize(3);
display.setCursor(0,70);
display.println( "Version" );
//display.setTextSize(2);
display.setCursor(0,95);
display.println( sver );
// EEPROM
display.setCursor(0,120);
display.println( "EEPROM" );
display.setCursor(0,140);
display.println( uid );
// Refresh
display.refresh();
delay( 100 );
}
// Display Date, Time, Temperature, Humidity, Altitude and Barometric Pressure
void isDisplayDTTH() {
// Text Display Date
// Clear Display
display.clearDisplay();
display.setRotation(4);
display.setTextSize(2);
display.setTextColor(BLACK);
// Date
display.setCursor(0,5);
display.println( sDate );
// Time
display.setCursor(0,30);
display.println( sTime );
// Temperature
display.setCursor(0,55);
display.print( BMEtempC );
display.println( "C" );
// Humidity
display.setCursor(0,80);
display.print( BMEhumid );
display.println( "%" );
// Altitude Meters
display.setCursor(0,105);
display.print( BMEaltitudeM );
display.println( "M" );
// Barometric Pressure
display.setCursor(0,130);
display.println( BMEpressure );
// Refresh
display.refresh();
delay( 100 );
}
// Display Display Date, Time, eCO2 Concentration, tVOC Concentration
void isDisplayDTCOVO() {
// Text Display Date
// Clear Display
display.clearDisplay();
display.setRotation(4);
display.setTextSize(2);
display.setTextColor(BLACK);
// Date
display.setCursor(0,5);
display.println( sDate );
// Time
display.setCursor(0,30);
display.println( sTime );
// eCO2 Concentration
display.setCursor(0,55);
display.println( "eCO2" );
display.setCursor(0,80);
display.println( CCS811CO2 );
// tVOC Concentration
display.setCursor(0,105);
display.println( "tVOC" );
display.setCursor(0,130);
display.println( CCS811TVOC );
// 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 );
}
// SHARP Memory Display // SHARP Memory Display - UID void isDisplayUID() { // Text Display // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(3); display.setTextColor(BLACK); // Don Luc Electronics display.setCursor(0,10); display.println( "Don Luc" ); display.setTextSize(2); display.setCursor(0,40); display.println( "Electronics" ); // Version //display.setTextSize(3); display.setCursor(0,70); display.println( "Version" ); //display.setTextSize(2); display.setCursor(0,95); display.println( sver ); // EEPROM display.setCursor(0,120); display.println( "EEPROM" ); display.setCursor(0,140); display.println( uid ); // Refresh display.refresh(); delay( 100 ); } // Display Date, Time, Temperature, Humidity, Altitude and Barometric Pressure void isDisplayDTTH() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Date display.setCursor(0,5); display.println( sDate ); // Time display.setCursor(0,30); display.println( sTime ); // Temperature display.setCursor(0,55); display.print( BMEtempC ); display.println( "C" ); // Humidity display.setCursor(0,80); display.print( BMEhumid ); display.println( "%" ); // Altitude Meters display.setCursor(0,105); display.print( BMEaltitudeM ); display.println( "M" ); // Barometric Pressure display.setCursor(0,130); display.println( BMEpressure ); // Refresh display.refresh(); delay( 100 ); } // Display Display Date, Time, eCO2 Concentration, tVOC Concentration void isDisplayDTCOVO() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Date display.setCursor(0,5); display.println( sDate ); // Time display.setCursor(0,30); display.println( sTime ); // eCO2 Concentration display.setCursor(0,55); display.println( "eCO2" ); display.setCursor(0,80); display.println( CCS811CO2 ); // tVOC Concentration display.setCursor(0,105); display.println( "tVOC" ); display.setCursor(0,130); display.println( CCS811TVOC ); // 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 ); }
// SHARP Memory Display
// SHARP Memory Display - UID
void isDisplayUID() {

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

    // Text Display Date
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // Date
    display.setCursor(0,5);
    display.println( sDate );
    // Time
    display.setCursor(0,30);
    display.println( sTime );
    // Temperature
    display.setCursor(0,55);
    display.print( BMEtempC );
    display.println( "C" );
    // Humidity
    display.setCursor(0,80);
    display.print( BMEhumid );
    display.println( "%" );
    // Altitude Meters
    display.setCursor(0,105);
    display.print( BMEaltitudeM );
    display.println( "M" );
    // Barometric Pressure
    display.setCursor(0,130);
    display.println( BMEpressure );
    // Refresh
    display.refresh();
    delay( 100 );

}
// Display Display Date, Time, eCO2 Concentration, tVOC Concentration
void isDisplayDTCOVO() {

    // Text Display Date
    // Clear Display
    display.clearDisplay();
    display.setRotation(4);
    display.setTextSize(2);
    display.setTextColor(BLACK);
    // Date
    display.setCursor(0,5);
    display.println( sDate );
    // Time
    display.setCursor(0,30);
    display.println( sTime );
    // eCO2 Concentration
    display.setCursor(0,55);
    display.println( "eCO2" );
    display.setCursor(0,80);
    display.println( CCS811CO2 );
    // tVOC Concentration
    display.setCursor(0,105);
    display.println( "tVOC" );
    display.setCursor(0,130);
    display.println( CCS811TVOC );
    // 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// EEPROM
// isUID EEPROM Unique ID
void isUID()
{
// Is Unit ID
uid = "";
for (int x = 0; x < 7; x++)
{
uid = uid + char(EEPROM.read(x));
}
}
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 7; x++) { uid = uid + char(EEPROM.read(x)); } }
// 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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);
}
}
// 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); } }
// 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);

  }
  
}

getRTC.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// DS3231 RTC Date and Time
// Setup DS3231 RTC
void isSetupRTC() {
if (! rtc.begin()) {
while (1);
}
if (rtc.lostPower()) {
// Following line sets the RTC to the date & time this sketch was compiled
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
// This line sets the RTC with an explicit date & time, for example to set
// January 21, 2014 at 3am you would call:
// rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
}
}
// DS3231 RTC Date and Time
void isRTC(){
// Date and Time
sDate = "";
sTime = "";
// Date Time
DateTime now = rtc.now();
// sData
sDate += String(now.year(), DEC);
sDate += "/";
sDate += String(now.month(), DEC);
sDate += "/";
sDate += String(now.day(), DEC);
// sTime
sTime += String(now.hour(), DEC);
sTime += ":";
sTime += String(now.minute(), DEC);
sTime += ":";
sTime += String(now.second(), DEC);
}
// DS3231 RTC Date and Time // Setup DS3231 RTC void isSetupRTC() { if (! rtc.begin()) { while (1); } if (rtc.lostPower()) { // Following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0)); } } // DS3231 RTC Date and Time void isRTC(){ // Date and Time sDate = ""; sTime = ""; // Date Time DateTime now = rtc.now(); // sData sDate += String(now.year(), DEC); sDate += "/"; sDate += String(now.month(), DEC); sDate += "/"; sDate += String(now.day(), DEC); // sTime sTime += String(now.hour(), DEC); sTime += ":"; sTime += String(now.minute(), DEC); sTime += ":"; sTime += String(now.second(), DEC); }
// DS3231 RTC Date and Time
// Setup DS3231 RTC
void isSetupRTC() {

  if (! rtc.begin()) {
    while (1);
  }

  if (rtc.lostPower()) {
    // Following line sets the RTC to the date & time this sketch was compiled
    rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
    // This line sets the RTC with an explicit date & time, for example to set
    // January 21, 2014 at 3am you would call:
    // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0));
  }
  
}
// DS3231 RTC Date and Time
void isRTC(){
 
    // Date and Time
    sDate = "";
    sTime = "";
    // Date Time
    DateTime now = rtc.now();

    // sData
    sDate += String(now.year(), DEC);
    sDate += "/";
    sDate += String(now.month(), DEC);
    sDate += "/";
    sDate += String(now.day(), DEC);

    // sTime
    sTime += String(now.hour(), DEC);
    sTime += ":";
    sTime += String(now.minute(), DEC);
    sTime += ":";
    sTime += String(now.second(), DEC);

}

getSD.ino

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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|Temperature Celsius|Humidity
//|Altitude Meters|Barometric Pressure|eCO2 Concentration|tVOC Concentration
//|GPS|Latitude|Longitude|GPS Date|GPS Time|GPS Speed M/S|GPS Altitude|*\r
zzzzzz = "DFR|" + uid + "|" + sver + "|" + sDate + "|" + sTime + "|"
+ String(BMEtempC) + "C|" + String(BMEhumid) + "%|"
+ String(BMEaltitudeM) + " M|" + String(BMEpressure) + "|" + String(CCS811CO2) + "|"
+ String(CCS811TVOC) + "|" + 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();
}
// 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|Temperature Celsius|Humidity //|Altitude Meters|Barometric Pressure|eCO2 Concentration|tVOC Concentration //|GPS|Latitude|Longitude|GPS Date|GPS Time|GPS Speed M/S|GPS Altitude|*\r zzzzzz = "DFR|" + uid + "|" + sver + "|" + sDate + "|" + sTime + "|" + String(BMEtempC) + "C|" + String(BMEhumid) + "%|" + String(BMEaltitudeM) + " M|" + String(BMEpressure) + "|" + String(CCS811CO2) + "|" + String(CCS811TVOC) + "|" + 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(); }
// 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|Temperature Celsius|Humidity
  //|Altitude Meters|Barometric Pressure|eCO2 Concentration|tVOC Concentration
  //|GPS|Latitude|Longitude|GPS Date|GPS Time|GPS Speed M/S|GPS Altitude|*\r
  zzzzzz = "DFR|" + uid + "|" + sver + "|" + sDate + "|" + sTime + "|" 
  + String(BMEtempC) + "C|" + String(BMEhumid) + "%|" 
  + String(BMEaltitudeM) + " M|" + String(BMEpressure) + "|" + String(CCS811CO2) + "|" 
  + String(CCS811TVOC) + "|" + 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

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
// 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);
// Setup DS3231 RTC
isSetupRTC();
//MicroSD Card
isSetupSD();
// SHARP Display Start & Clear the Display
display.begin();
// Clear Display
display.clearDisplay();
// Delay
delay( 100 );
// SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure
myBME280.begin();
// CCS811 - eCO2 & tVOC
myCCS811.begin();
// Delay
delay( 100 );
// GPS Receiver
// Setup GPS
isSetupGPS();
// 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);
// Initialize the Switch GPS
pinMode(iSwitchGPS, INPUT);
// Don Luc Electronics
// Version
// EEPROM
isDisplayUID();
// Delay 5 Second
delay( 5000 );
}
// 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); // Setup DS3231 RTC isSetupRTC(); //MicroSD Card isSetupSD(); // SHARP Display Start & Clear the Display display.begin(); // Clear Display display.clearDisplay(); // Delay delay( 100 ); // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure myBME280.begin(); // CCS811 - eCO2 & tVOC myCCS811.begin(); // Delay delay( 100 ); // GPS Receiver // Setup GPS isSetupGPS(); // 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); // Initialize the Switch GPS pinMode(iSwitchGPS, INPUT); // Don Luc Electronics // Version // EEPROM isDisplayUID(); // Delay 5 Second delay( 5000 ); }
// 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);

  // Setup DS3231 RTC
  isSetupRTC();

  //MicroSD Card
  isSetupSD();

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

  // Delay
  delay( 100 );

  // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure
  myBME280.begin();

  // CCS811 - eCO2 & tVOC
  myCCS811.begin();

  // Delay
  delay( 100 );

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

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

  // Initialize the Switch GPS
  pinMode(iSwitchGPS, 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