The Alpha Geek – Geeking Out

MicroSD Card

Project #23: E-Textiles – MicroSD Card – Mk07

——

#DonLucElectronics #DonLuc #ETextiles #Wearable #FLORA #BME280 #CCS811 #RTC #SD #Arduino #Project #Programming #Electronics #Microcontrollers #Consultant

——

MicroSD Card

——

MicroSD Card

——

MicroSD Card

——

MicroSD Card Breakout Board+

Not just a simple breakout board, this microSD adapter goes the extra mile designed for ease of use.

  • Onboard 5 Volt – 3 Volt regulator provides 150mA for power-hungry cards.
  • 3 Volt level shifting means you can use this with ease on either 3 Volt or 5 Volt systems.
  • Uses a proper level shifting chip, not resistors, less problems, and faster read/write access.
  • Use 3 or 4 digital pins to read and write 8 Gb of storage.
  • Activity LED lights up when the SD card is being read or written.
  • Push-push socket with card slightly over the edge of the PCB so its easy to insert and remove.
  • Comes with 0.1″ header, unattached, so you can get it on a breadboard or use wires your choice.

To use with an Arduino, connect GND to ground, 5 Volt – 3 Volt to 5 Volt – 3 Volt, CLK to pin 13, DO to pin 12, DI to pin 11, and CS to pin 10. Then you can use the Arduino IDE’s SD library which supports FAT and FAT32 SD cards.

DL2205Mk01

1 x FLORA – Version 1.0a
1 x SparkFun Environmental Combo CCS811/BME280
1 x DS3231 Precision RTC FeatherWing
1 x MicroSD card breakout board+
1 x MicroSD card 8 Gb
1 x CR1220 Coin Cell Battery
1 x LED Red
1 x 220 Ohm
1 x SparkFun Cerberus USB Cable

FLORA – Version 1.0a

CLK – ICSP 3
DO – ICSP 1
DI – ICSP 4
CS – Digital 10
LER – Digital 6
SCL – Digital 3
SDA – Digital 2
VIN – +5V
VIN – +3.3V
GND – GND

——

DL2205Mk01p.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #23: E-Textiles - MicroSD Card - Mk07
23-07
DL2205Mk01p.ino
1 x FLORA - Version 1.0a
1 x SparkFun Environmental Combo CCS811/BME280
1 x DS3231 Precision RTC FeatherWing
1 x MicroSD card breakout board+
1 x MicroSD card 8 Gb
1 x CR1220 Coin Cell Battery
1 x LED Red
1 x 220 Ohm
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code
// Wire
#include <Wire.h>
// SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure
#include <SparkFunBME280.h>
// SparkFun CCS811 - eCO2 & tVOC
#include <SparkFunCCS811.h>
// Date and time DS3231 RTC
#include <RTClib.h>
// Serial Peripheral Interface (SPI)
#include <SPI.h>
// Secure Digital (SD Card)
#include <SD.h>

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

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

// Secure Digital (SD Card)
const int chipSelect = 10;
String zzzzzz = "";

// LED Red
const int iLEDR = 6;

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

void loop() {

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

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

  // Dates and Time
  timeRTC();

  // MicroSD Card
  isSD();

  // 1 Seconds
  delay( 1000 );

}

getBME280.ino

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

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

getRTCDS3231.ino

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

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

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

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

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

}

getSD.ino

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

    // MicroSD Card
   // See if the card is present and can be initialized:
  if (!SD.begin(chipSelect)) {

    // Don't do anything more:
    while (1);
    
  }

}
// MicroSD Card
void isSD() {

  zzzzzz = "";

  // Version|Date|Time|Temperature Celsius|Humidity|Altitude Meters|Barometric Pressure
  //|eCO2 Concentration|tVOC Concentration|
  zzzzzz = sver + "|" + sDate + "|" + sTime + "|" 
  + BMEtempC + "|" + BMEhumid + "|" + BMEaltitudeM + "|" + BMEpressure + "|"
  + CCS811CO2 + "|" + CCS811TVOC + "|";

  // Open the file. Note that only one file can be open at a time,
  // so you have to close this one before opening another.
  File dataFile = SD.open("DLE22Log.txt", FILE_WRITE);

  // If the file is available, write to it:
  if (dataFile) {
    
    // Write
    dataFile.println( zzzzzz );
    dataFile.close();

  }

}

setup.ino

// Setup
void setup() {

  // Delay
  delay( 100 );
  
  // Set up I2C bus
  Wire.begin();

  // Delay
  delay( 50 );

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

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

  // Setup RTC
  setupRTC();

  //MicroSD Card
  setupSD();

  // LED Red
  pinMode( iLEDR , OUTPUT);
  // Turn the LED Red on HIGH
  digitalWrite( iLEDR , HIGH);

}

——

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

Technology Experience

  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
  • IoT
  • Robotics
  • Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
  • Unmanned Vehicles Terrestrial and Marine
  • Research & Development (R & D)

Instructor and E-Mentor

  • IoT
  • PIC Microcontrollers
  • Arduino
  • Raspberry Pi
  • Espressif
  • Robotics

Follow Us

J. Luc Paquin – Curriculum Vitae – 2022 English & Español
https://www.jlpconsultants.com/luc/

Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/

Don Luc

Project #15: Environment – MicroSD Card – Mk17

——

#DonLucElectronics #DonLuc #Environment #MQ #PIR #RHT03 #RTC #ArduinoUNO #Arduino #AdafruitPowerBoost #Project #Programming #Electronics #Microcontrollers #Consultant

——

MicroSD Card

——

MicroSD Card

——

MicroSD Card

——

MicroSD Card

——

MicroSD Card Breakout Board+

Not just a simple breakout board, this microSD adapter goes the extra mile – designed for ease of use.

  • -Onboard 5v->3v regulator provides 150mA for power-hungry cards
  • -3v level shifting means you can use this with ease on either 3v or 5v systems
  • -Uses a proper level shifting chip, not resistors: less problems, and faster read/write access
  • -Use 3 or 4 digital pins to read and write 2Gb+ of storage
  • -Activity LED lights up when the SD card is being read or written
  • -Push-push socket with card slightly over the edge of the PCB so its easy to insert and remove
  • -Comes with 0.1″ header so you can get it on a breadboard or use wires

To use with an Arduino, connect GND to ground, 5V to 5V, CLK to pin 13, DO to pin 12, DI to pin 11, and CS to pin 10.

DL2110Mk04

1 x Arduino UNO – R3
1 x ProtoScrewShield
1 x RGB LCD Shield 16×2 Character Negative Display
1 x ChronoDot – Ultra-Precise Real Time Clock – v2.1
1 x MicroSD Card Breakout Board+
1 x MicroSD 2.0 GB
1 x Rocker Switch – SPST (Round)
1 x 10K Ohm
1 x LED Green
1 x 220 Ohm
1 x Adafruit PowerBoost 500 Shield
1 x Lithium Ion Battery – 3.7v 2000mAh
4 x Pololu Carrier for MQ Gas Sensors
1 x SparkFun Hydrogen Gas Sensor – MQ-8
1 x 4.7K Ohm
1 x Pololu Carbon Monoxide & Flammable Gas Sensor – MQ-9
1 x 22k Ohm
1 x SparkFun Carbon Monoxide Gas Sensor – MQ-7
1 x 10K Ohm
1 x SparkFun Alcohol Gas Sensor – MQ-3
1 x 220k Ohm
1 x Temperature and Humidity Sensor- RHT03
1 x PIR Motion Sensor (JST)
1 x SparkFun Solderable Half-Breadboard
1 x Half-Breadboard
1 x SparkFun Cerberus USB Cable

Arduino UNO – R3

CLK – Digital 13
DO – Digital 12
DI – Digital 11
CS – Digital 10
PIR – Digital 7
RHT – Digital 5
RS0 – Digital 3
LEG – Digital 2
MQ8 – Analog 0
MQ9 – Analog 1
MQ7 – Analog 2
MQ3 – Analog 3
SDA – Analog 4
SCL – Analog 5
VIN – +5V
GND – GND

——

DL2110Mk04p.ino

/* 
***** Don Luc Electronics © *****
Software Version Information
Project #15: Environment – MicroSD Card – Mk17
10-04
DL2110Mk04p.ino
1 x Arduino UNO - R3
1 x ProtoScrewShield
1 x RGB LCD Shield 16x2 Character Negative Display
1 x ChronoDot - Ultra-Precise Real Time Clock - v2.1
1 x MicroSD Card Breakout Board+
1 x MicroSD 2.0 GB
1 x Rocker Switch - SPST (Round)
1 x 10K Ohm
1 x LED Green
1 x 220 Ohm
1 x Adafruit PowerBoost 500 Shield
1 x Lithium Ion Battery - 3.7v 2000mAh
4 x Pololu Carrier for MQ Gas Sensors
1 x SparkFun Hydrogen Gas Sensor - MQ-8
1 x 4.7K Ohm
1 x Pololu Carbon Monoxide & Flammable Gas Sensor - MQ-9
1 x 22k Ohm
1 x SparkFun Carbon Monoxide Gas Sensor - MQ-7
1 x 10K Ohm
1 x SparkFun Alcohol Gas Sensor - MQ-3
1 x 220k Ohm
1 x Temperature and Humidity Sensor - RHT03
1 x PIR Motion Sensor (JST)
1 x SparkFun Solderable Half-Breadboard
1 x Half-Breadboard
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code
// EEPROM Library to Read and Write EEPROM with Unique ID for Unit
#include <EEPROM.h>
// RHT Temperature and Humidity Sensor
#include <SparkFun_RHT03.h>
// Adafruit RGB LCD Shield 16x2
#include <Adafruit_RGBLCDShield.h>
// Wire
#include <Wire.h>
// DS3231 RTC Date and Time
#include <RTClib.h>
// SD Card
#include <SPI.h>
#include <SD.h>

// RHT Temperature and Humidity Sensor
// RHT03 data pin Digital 5
const int RHT03_DATA_PIN = 5;
// This creates a RTH03 object, which we'll use to interact with the sensor
RHT03 rht;
float latestHumidity;
float latestTempC;

// Gas Sensors MQ
// Hydrogen Gas Sensor - MQ-8
int iMQ8 = A0;
int iMQ8Raw = 0;
int iMQ8ppm = 0;
// Two points are taken from the curve in datasheet.
// With these two points, a line is formed which is
// "approximately equivalent" to the original curve.
float H2Curve[3] = {2.3, 0.93,-1.44};

// Carbon Monoxide & Flammable Gas Sensor - MQ-9
int iMQ9 = A1;
int iMQ9Raw = 0;
int iMQ9ppm = 0;

// Carbon Monoxide Gas Sensor - MQ-7
int iMQ7 = A2;
int iMQ7Raw = 0;
int iMQ7ppm = 0;

// Alcohol Gas Sensor - MQ-3
int iMQ3 = A3;
int iMQ3Raw = 0;
int iMQ3ppm = 0;

// PIR Motion
// Motion detector
const int iMotion = 7;
// Proximity
int proximity = LOW;
String Det = "";

// Adafruit RGB LCD Shield
Adafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield();
// These #defines make it easy to set the backlight color
#define OFF 0x0
#define RED 0x1
#define YELLOW 0x3
#define GREEN 0x2
#define TEAL 0x6
#define BLUE 0x4
#define VIOLET 0x5
#define WHITE 0x7
// Momentary Button
int yy = 0;
uint8_t momentaryButton = 0;

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

// SD Card
const int chipSelect = 10;
String zzzzzz = "";

// LED Green
int iLEDGreen = 2;

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

// Software Version Information
String uid = "";
// Version
String sver = "15-17";

void loop()
{
     
  // Adafruit RGB LCD Shield
  // Clear
  RGBLCDShield.clear();

  // iLEDGreen LOW
  digitalWrite(iLEDGreen,  LOW );
  
  // RHT Temperature and Humidity Sensor
  isRHT03();

  // Gas Sensors MQ
  isGasSensor();

  // isPIR Motion
  isPIR();

  // DS3231 RTC Date and Time
  isRTC();

  // Adafruit RGB LCD Shield
  // Display
  isDisplay();

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

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

  } else {

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

  // Delay
  delay( 1000 );
 
}

getEEPROM.ino

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

getGasSensorMQ.ino

// Gas Sensors MQ
// Gas Sensor
void isGasSensor() {

  // Read in analog value from each gas sensors
  
  // Hydrogen Gas Sensor - MQ-8
  iMQ8Raw = analogRead( iMQ8 );

  // Carbon Monoxide & Flammable Gas Sensor - MQ-9
  iMQ9Raw = analogRead( iMQ9 );  

  // Carbon Monoxide Gas Sensor - MQ-7
  iMQ7Raw = analogRead( iMQ7 );

  // Alcohol Gas Sensor - MQ-3
  iMQ3Raw = analogRead( iMQ3 );
  
  // Caclulate the PPM of each gas sensors

  // Hydrogen Gas Sensor - MQ-8
  iMQ8ppm = isMQ8( iMQ8Raw );

  // Carbon Monoxide & Flammable Gas Sensor - MQ-9
  iMQ9ppm = isMQ9( iMQ9Raw ); 

  // Carbon Monoxide Gas Sensor - MQ-7
  iMQ7ppm = isMQ7( iMQ7Raw ); 

  // Alcohol Gas Sensor - MQ-3
  iMQ3ppm = isMQ3( iMQ3Raw ); 

}
// Hydrogen Gas Sensor - MQ-8 - PPM
int isMQ8(double rawValue) {

  // RvRo
  double RvRo = rawValue * (3.3 / 1023);

  return (pow(4.7,( ((log(RvRo)-H2Curve[1])/H2Curve[2]) + H2Curve[0])));
  
}
// Carbon Monoxide & Flammable Gas Sensor - MQ-9
int isMQ9(double rawValue) {

  double RvRo = rawValue * 3.3 / 4095;

  double ppm = 3.027*exp(1.0698*( RvRo ));
  return ppm;
  
}
// Carbon Monoxide Gas Sensor - MQ-7
int isMQ7(double rawValue) {

  double RvRo = rawValue * 3.3 / 4095;

  double ppm = 3.027*exp(1.0698*( RvRo ));
  return ppm;
  
}
// Alcohol Gas Sensor - MQ-3
int isMQ3(double rawValue) {

  double RvRo = rawValue * 3.3 / 4095;

  double bac = RvRo * 0.21;
  return bac;
  
}

getPIR.ino

// PIR Motion
// Setup PIR
void setupPIR() {

  // Setup PIR Montion
  pinMode(iMotion, INPUT_PULLUP);
  
}
// isPIR Motion
void isPIR() {

  // Proximity
  proximity = digitalRead(iMotion);
  if (proximity == LOW) 
  {

    // PIR Motion Sensor's LOW, Motion is detected
    Det = "Motion Yes";

  }
  else
  {

    // PIR Motion Sensor's HIGH
    Det = "No";
    
  }
  
}

getRGBLCDShield.ino

// Adafruit RGB LCD Shield
// Setup RGB LCD Shield
void isSetupRGBLCDShield() {

  // Adafruit RGB LCD Shield
  // Set up the LCD's number of columns and rows: 
  RGBLCDShield.begin(16, 2);

  // Set the cursor to column 0, line 0
  RGBLCDShield.setBacklight(RED);
  // Don luc 
  RGBLCDShield.setCursor(0,0);
  RGBLCDShield.print("Don Luc");
  // Set the cursor to column 0, line 1
  RGBLCDShield.setCursor(0, 1);
  // Electronics
  RGBLCDShield.print("Electronics");
  // Delay
  delay(5000);
  // Clear
  RGBLCDShield.clear();

  // Set the cursor to column 0, line 0
  RGBLCDShield.setBacklight(TEAL);
  // Version 
  RGBLCDShield.setCursor(0,0);
  RGBLCDShield.print("Version: " + sver);
  // Set the cursor to column 0, line 1
  RGBLCDShield.setCursor(0, 1);
  // Unit ID
  RGBLCDShield.print("Unit ID: " + uid);
  // Delay
  delay(5000);
  // Clear
  RGBLCDShield.clear();
  
}
// isDisplay
void isDisplay() {

  // Momentary Button
  momentaryButton = RGBLCDShield.readButtons();

  switch ( yy ) {
    case 1:
    
      // RHT Temperature and Humidity Sensor
      // Set the cursor to column 0, line 0
      RGBLCDShield.setCursor(0,0);
      // Temperature C
      RGBLCDShield.print( "Temp C: " );
      RGBLCDShield.print( latestTempC );
      // Set the cursor to column 0, line 1
      RGBLCDShield.setCursor(0, 1);
      // Humidity
      RGBLCDShield.print( "Humidity: " );
      RGBLCDShield.print( latestHumidity );

      break;
    case 2:
    
      // PIR Motion Sensor
      // Set the cursor to column 0, line 0
      // PIR Motion Sensor
      RGBLCDShield.setCursor(0,0);
      RGBLCDShield.print( "PIR Motion" );
      // Set the cursor to column 0, line 1
      RGBLCDShield.setCursor(0, 1);
      // Det
      RGBLCDShield.print( Det );
      
      break;
    case 3:

      // Gas Sensors 1
      // Set the cursor to column 0, line 0
      RGBLCDShield.setCursor(0,0);
      // Hydrogen Gas Sensor - MQ-8
      RGBLCDShield.print( "MQ-8: " );
      RGBLCDShield.print( iMQ8ppm );
      // Set the cursor to column 0, line 1
      RGBLCDShield.setCursor(0, 1);
      // Carbon Monoxide & Flammable Gas Sensor - MQ-9
      RGBLCDShield.print( "MQ-9: " );
      RGBLCDShield.print( iMQ9ppm );
      
      break;
    case 4:

      // Gas Sensors 2
      // Set the cursor to column 0, line 0
      RGBLCDShield.setCursor(0,0);
      // Carbon Monoxide Gas Sensor - MQ-7
      RGBLCDShield.print( "MQ-7: " );
      RGBLCDShield.print( iMQ7ppm );
      // Set the cursor to column 0, line 1
      RGBLCDShield.setCursor(0, 1);
      // Alcohol Gas Sensor - MQ-3
      RGBLCDShield.print( "MQ-3: " );
      RGBLCDShield.print( iMQ3ppm );
      
      break;
    case 5:

      // DS3231 RTC Date and Time
      // Date and Time
      DateTime now = rtc.now();
      // Set the cursor to column 0, line 0
      // Date 
      RGBLCDShield.setCursor(0,0);
      RGBLCDShield.print( sDate );
      // Set the cursor to column 0, line 1
      RGBLCDShield.setCursor(0, 1);
      // Time
      RGBLCDShield.print( sTime );
      
      break;
    default:

      // Don luc Electronics
      yy = 5;
      RGBLCDShield.setBacklight(RED);
      // Set the cursor to column 0, line 0
      // Don luc 
      RGBLCDShield.setCursor(0,0);
      RGBLCDShield.print("Don Luc");
      // Set the cursor to column 0, line 1
      RGBLCDShield.setCursor(0, 1);
      // Electronics
      RGBLCDShield.print("Electronics");

   }
   
   if ( momentaryButton ) {
    
    if ( momentaryButton & BUTTON_UP ) {
      
      yy = 1;
      // RHT Temperature and Humidity Sensor
      RGBLCDShield.setBacklight(GREEN);
      
    }
    
    if ( momentaryButton & BUTTON_DOWN ) {
      
      yy = 2;
      // PIR Motion Sensor
      RGBLCDShield.setBacklight(VIOLET);
      
    }
    
    if ( momentaryButton & BUTTON_LEFT ) {
      
      yy = 3;
      // Gas Sensors 1
      RGBLCDShield.setBacklight(TEAL);
      
    }
    
    if ( momentaryButton & BUTTON_RIGHT ) {

      yy = 4;
      // Gas Sensors 2
      RGBLCDShield.setBacklight(YELLOW);
    }
    
    if ( momentaryButton & BUTTON_SELECT ) {

      yy = 5;
      // DS3231 RTC Date and Time
      RGBLCDShield.setBacklight(WHITE);
   
    }
    
  }
  
}

getRHT.ino

// RHT Temperature and Humidity Sensor
// setup RHT Temperature and Humidity Sensor
void setupRTH03() {

  // RHT Temperature and Humidity Sensor
  // Call rht.begin() to initialize the sensor and our data pin
  rht.begin(RHT03_DATA_PIN);
  
}
// RHT Temperature and Humidity Sensor
void isRHT03(){

  // Call rht.update() to get new humidity and temperature values from the sensor.
  int updateRet = rht.update();

  // The humidity(), tempC(), and tempF() functions can be called -- after 
  // a successful update() -- to get the last humidity and temperature value 
  latestHumidity = rht.humidity();
  latestTempC = rht.tempC();

}

getRTC.ino

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

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

  // MicroSD Card
  if (!SD.begin(chipSelect)) {

     while (true);

  }
 
}
// MicroSD Card
void isSD() {

  zzzzzz = "";

  // Don Luc Electronics © (1983-2021)
  // Arduino Data
  // EEPROM Unique ID
  // Version
  // Date
  // Time
  // Temperature Celsius
  // Humidity
  // Hydrogen Gas Sensor - MQ-8
  // Carbon Monoxide & Flammable Gas Sensor - MQ-9
  // Carbon Monoxide Gas Sensor - MQ-7
  // Alcohol Gas Sensor - MQ-3
  // PIR Motion
  // EEPROM Unique ID|Version|Date|Time|Temperature Celsius|Humidity|MQ-8|MQ-9|MQ-7|MQ-3|PIR Motion|\r
  zzzzzz = uid + "|" + sver + "|" + sDate + "|" + sTime + "|" + latestTempC + "|" + latestHumidity + "|"
  + iMQ8ppm + "|" + iMQ9ppm + "|" + iMQ7ppm + "|" + 
  iMQ3ppm + "|" + Det + "|";

  
  // Open the file. Note that only one file can be open at a time,
  // so you have to close this one before opening another.

  File dataFile = SD.open("arddata.txt", FILE_WRITE);

  // If the file is available, write to it:
  if ( dataFile ) {

    dataFile.println( zzzzzz );

    dataFile.close();

  }
  
}

setup.ino

// Setup
void setup()
{
    
  // EEPROM Unique ID
  isUID();
  
  // RHT Temperature and Humidity Sensor
  // Setup RTH03 Temperature and Humidity Sensor
  setupRTH03();

  // PIR Motion
  // Setup PIR
  setupPIR();

  // Setup DS3231 RTC
  isSetupRTC();

  //MicroSD Card
  setupSD();

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

  // Slide Switch
  pinMode(iSS1, INPUT);

  // Adafruit RGB LCD Shield
  isSetupRGBLCDShield();

}

——

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

Technology Experience

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

Instructor and E-Mentor

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

Follow Us

J. Luc Paquin – Curriculum Vitae – 2021 English & Español
https://www.jlpconsultants.com/luc/

Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/

Don Luc

Categories
Archives