Arduino
Project #15: Environment – SparkFun Carbon Monoxide Gas Sensor – MQ-7 – Mk08
——
#DonLuc #Environment #Microcontrollers #ESP32 #MQ-X #GPS #SparkFun #Adafruit #Pololu #Fritzing #Programming #Arduino #Electronics #Consultant #Vlog #Aphasia
——
——
——
——
DL2005Mk08
1 x SparkFun Thing Plus – ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x SparkFun Environmental Combo Breakout – CCS811/BME280
1 x Adafruit Adalogger FeatherWing – RTC + SD
1 x SparkFun GPS Receiver – GP-20U7
1 x CR1220 12mm Lithium Battery
1 x 32Gb microSD Card
1 x Mountable Slide Switch
1 x SparkFun Rotary Switch – 10 Position
1 x Black Knob
1 x Breadboard Solderable
3 x Pololu Carrier for MQ Gas Sensors
1 x SparkFun Hydrogen Gas Sensor – MQ-8
1 x Pololu Carbon Monoxide & Flammable Gas Sensor – MQ-9
1 x SparkFun Carbon Monoxide Gas Sensor – MQ-7
1 x Qwiic Cable – 100mm
1 x LED Green
11 x 1K Ohm
1 x 4.7K Ohm
2 x 10K Ohm
1 x 20k Ohm
8 x Jumper Wires 3in M/M
9 x Jumper Wires 6in M/M
16 x Wire Solid Core – 22 AWG
2 x Full-Size Breadboard
1 x SparkFun Cerberus USB Cable
1 x DC Power Supply
SparkFun Thing Plus – ESP32 WROOM
LEG – Digital 21
SCK – Digital 13
MOS – Digital 12
SSD – Digital 27
SDA – Digital 23
SCL – Digital 22
SD1 – Digital 33
SC2 – Digital 5
MO2 – Digital 18
MI2 – Digital 19
SS1 – Digital 16
ROT – Analog A0
MH1 – Analog A1
MC1 – Analog A2
MC2 – Analog A3
GPS – Digital 14
VIN – +3.3V
GND – GND
DL2005Mk08p.ino
// ***** Don Luc Electronics © ***** // Software Version Information // Project #15: Environment - SparkFun Carbon Monoxide Gas Sensor - MQ-7 - Mk08 // 05-08 // DL2005Mk08p.ino 15-08 // EEPROM with Unique ID // 1 x SparkFun Thing Plus - ESP32 WROOM // 1 x Adafruit SHARP Memory Display // 1 x SparkFun Environmental Combo Breakout - CCS811/BME280 // 1 x Adafruit Adalogger FeatherWing - RTC + SD // 1 x SparkFun GPS Receiver - GP-20U7 // 1 x CR1220 12mm Lithium Battery // 1 x 32Gb microSD Card // 1 x Mountable Slide Switch // 1 x SparkFun Rotary Switch - 10 Position // 1 x Black Knob // 1 x Breadboard Solderable // 3 x Pololu Carrier for MQ Gas Sensors // 1 x Pololu Carbon Monoxide & Flammable Gas Sensor - MQ-9 // 1 x SparkFun Hydrogen Gas Sensor - MQ-8 // 1 x SparkFun Carbon Monoxide Gas Sensor - MQ-7 // 1 x Qwiic Cable - 100mm // 1 x LED Green // 11 x 1K Ohm // 1 x 4.7K Ohm // 1 x 10K Ohm // 1 x 20K Ohm // 8 x Jumper Wires 3in M/M // 9 x Jumper Wires 6in M/M // 16 x Wire Solid Core - 22 AWG // 2 x Full-Size Breadboard // 1 x SparkFun Cerberus USB Cable // 1 x DC Power Supply // Include the Library Code // EEPROM Library to Read and Write EEPROM with Unique ID for Unit #include "EEPROM.h" // Wire #include <Wire.h> // SHARP Memory Display #include <Adafruit_SharpMem.h> #include <Adafruit_GFX.h> // SparkFun CCS811 - eCO2 & tVOC #include <SparkFunCCS811.h> // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure #include <SparkFunBME280.h> // Date and Time #include "RTClib.h" // SD Card #include "FS.h" #include "SD.h" #include "SPI.h" // GPS Receiver #include <TinyGPS++.h> // Hardware Serial #include <HardwareSerial.h> // LED Green int iLEDGreen = 21; // SHARP Memory Display // any pins can be used #define SHARP_SCK 13 #define SHARP_MOSI 12 #define SHARP_SS 27 // Set the size of the display here - 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 // 1/2 of lesser of display width or height int minorHalfSize; // SparkFun CCS811 - eCO2 & tVOC // Default I2C Address #define CCS811_ADDR 0x5B CCS811 myCCS811(CCS811_ADDR); float CCS811CO2 = 0; float CCS811TVOC = 0; // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure BME280 myBME280; float BMEtempC = 0; float BMEhumid = 0; float BMEaltitudeM = 0; float BMEpressure = 0; // Date and Time // PCF8523 Precision RTC RTC_PCF8523 rtc; String dateRTC = ""; String timeRTC = ""; // microSD Card const int chipSelect = 33; String zzzzzz = ""; // Mountable Slide Switch int iSS1 = 16; // State int iSS1State = 0; // ESP32 HardwareSerial HardwareSerial tGPS(2); // GPS Receiver #define gpsRXPIN 14 // This one is unused and doesnt have a conection #define gpsTXPIN 32 // The TinyGPS++ object TinyGPSPlus gps; float TargetLat; float TargetLon; int GPSStatus = 0; // Rotary Switch - 10 Position // Number 1 => 10 int iRotNum = A0; // iRotVal - Value int iRotVal = 0; // Number int z = 0; int x = 0; // Gas Sensors MQ // Hydrogen Gas Sensor - MQ-8 int iMQ8 = A1; 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 = A2; int iMQ9Raw = 0; int iMQ9ppm = 0; // Carbon Monoxide Gas Sensor - MQ-7 int iMQ7 = A3; int iMQ7Raw = 0; int iMQ7ppm = 0; // Software Version Information String sver = "15-08"; // EEPROM Unique ID Information #define EEPROM_SIZE 64 String uid = ""; void loop() { // Receives NEMA data from GPS receiver isGPS(); // Date and Time isRTC(); // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure isBME280(); // SparkFun CCS811 - eCO2 & tVOC isCCS811(); // Gas Sensors MQ isGasSensor(); // Rotary Switch isRot(); // Slide Switch // Read the state of the iSS1 value iSS1State = digitalRead(iSS1); // If it is the Slide Switch State is HIGH if (iSS1State == HIGH) { // iLEDGreen digitalWrite(iLEDGreen, HIGH ); // microSD Card isSD(); } else { // iLEDGreen digitalWrite(iLEDGreen, LOW ); } delay( 1000 ); }
getBME280.ino
// SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure // isBME280 - Humidity, Temperature, Altitude and Barometric Pressure void isBME280(){ // Temperature Celsius BMEtempC = myBME280.readTempC(); // Humidity BMEhumid = myBME280.readFloatHumidity(); // Altitude Meters BMEaltitudeM = (myBME280.readFloatAltitudeMeters(), 2); // Barometric Pressure BMEpressure = myBME280.readFloatPressure(); }
getCCS811.ino
// CCS811 - eCO2 & tVOC // isCCS811 - eCO2 & tVOC void isCCS811(){ // This sends the temperature & humidity data to the CCS811 myCCS811.setEnvironmentalData(BMEhumid, BMEtempC); // Calling this function updates the global tVOC and eCO2 variables myCCS811.readAlgorithmResults(); // eCO2 Concentration CCS811CO2 = myCCS811.getCO2(); // tVOC Concentration CCS811TVOC = myCCS811.getTVOC(); }
getDisplay.ino
// Display // SHARP Memory Display - UID void isDisplayUID() { // Text Display // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(3); display.setTextColor(BLACK); // Don Luc Electronics display.setCursor(0,10); display.println( "Don Luc" ); display.setTextSize(2); display.setCursor(0,40); display.println( "Electronics" ); // Version display.setTextSize(3); display.setCursor(0,70); display.println( "Version" ); display.setTextSize(2); display.setCursor(0,100); display.println( sver ); // EEPROM Unique ID display.setTextSize(1); display.setCursor(0,130); display.println( "EEPROM Unique ID" ); display.setTextSize(2); display.setCursor(0,145); display.println( uid ); // Refresh display.refresh(); delay( 100 ); } // Display Environmental void isDisplayEnvironmental(){ // Text Display Environmental // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(1); display.setTextColor(BLACK); // Temperature Celsius display.setCursor(0,0); display.println( "Temperature Celsius" ); display.setCursor(0,10); display.print( BMEtempC ); display.println( " C" ); // Humidity display.setCursor(0,20); display.println( "Humidity" ); display.setCursor(0,30); display.print( BMEhumid ); display.println( "%" ); // Altitude Meters display.setCursor(0,40); display.println( "Altitude Meters" ); display.setCursor(0,50); display.print( BMEaltitudeM ); display.println( " m" ); // Pressure display.setCursor(0,60); display.println( "Barometric Pressure" ); display.setCursor(0,70); display.print( BMEpressure ); display.println( " Pa" ); // eCO2 Concentration display.setCursor(0,80); display.println( "eCO2 Concentration" ); display.setCursor(0,90); display.print( CCS811CO2 ); display.println( " ppm" ); // tVOC Concentration display.setCursor(0,100); display.println( "tVOC Concentration" ); display.setCursor(0,110); display.print( CCS811TVOC ); display.println( " ppb" ); // Date display.setCursor(0,120); display.println( dateRTC ); // Time display.setCursor(0,130); display.println( timeRTC ); // GPS Status display.setCursor(0,140); display.println( GPSStatus ); // Target Latitude display.setCursor(0,150); display.println( TargetLat ); // Target Longitude display.setCursor(0,160); display.println( TargetLon ); // Refresh display.refresh(); delay( 100 ); } // Display Date void isDisplayDate() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Date display.setCursor(0,5); display.println( dateRTC ); // Time display.setCursor(0,30); display.println( timeRTC ); // GPS Status display.setCursor(0,60); display.print( "GPS: " ); display.println( GPSStatus ); // Target Latitude display.setCursor(0,80); display.println( "Latitude" ); display.setCursor(0,100); display.println( TargetLat ); // Target Longitude display.setCursor(0,120); display.println( "Longitude" ); display.setCursor(0,140); display.println( TargetLon ); // Refresh display.refresh(); delay( 100 ); } // Display BME280 void isDisplayBME280() { // Text Display BME280 // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Temperature Celsius display.setCursor(0,10); display.println( "Temperature" ); display.setCursor(0,30); display.print( BMEtempC ); display.println( " C" ); // Humidity display.setCursor(0,50); display.println( "Humidity" ); display.setCursor(0,70); display.print( BMEhumid ); display.println( "%" ); // Altitude Meters display.setCursor(0,90); display.println( "Altitude M" ); display.setCursor(0,110); display.print( BMEaltitudeM ); display.println( " m" ); // Pressure display.setCursor(0,130); display.println( "Barometric" ); display.setCursor(0,150); display.print( BMEpressure ); display.println( "Pa" ); // Refresh display.refresh(); delay( 100 ); } // Display CCS811 - eCO2 & tVOC void isDisplayCCS811() { // Text Display CCS811 // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // eCO2 Concentration display.setCursor(0,10); display.println( "eCO2" ); display.setCursor(0,30); display.print( CCS811CO2 ); display.println( " ppm" ); // tVOC Concentration display.setCursor(0,60); display.println( "tVOC" ); display.setCursor(0,80); display.print( CCS811TVOC ); display.println( " ppb" ); // Refresh display.refresh(); delay( 100 ); } // Display Gas Sensors MQ void isDisplayMQ() { // Text Display MQ // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Gas Sensors MQ display.setCursor(0,10); display.println( "Gas Sensors" ); display.setCursor(0,30); display.println( "Gas H2 MQ8" ); display.setCursor(0,50); display.print( iMQ8ppm ); display.println( " ppm" ); display.setCursor(0,70); display.println( "Gas CO MQ9" ); display.setCursor(0,90); display.print( iMQ9ppm ); display.println( " ppm" ); display.setCursor(0,110); display.println( "Gas CO MQ7" ); display.setCursor(0,130); display.print( iMQ7ppm ); display.println( " ppm" ); // Refresh display.refresh(); delay( 100 ); } // Display Z void isDisplayZ() { // Text Display Z // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(3); display.setTextColor(BLACK); // Z display.setCursor(0,10); display.print( "Z: " ); display.println( z ); // Refresh display.refresh(); delay( 100 ); }
getEEPROM.ino
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getGPS.ino
// GPS Receiver // Setup GPS void setupGPS() { // Setup GPS tGPS.begin( 9600 , SERIAL_8N1, gpsRXPIN, gpsTXPIN ); } // isGPS void isGPS(){ // Receives NEMA data from GPS receiver // This sketch displays information every time a new sentence is correctly encoded. while ( tGPS.available() > 0) if (gps.encode( tGPS.read() )) { displayInfo(); } if (millis() > 5000 && gps.charsProcessed() < 10) { while(true); } } // GPS Vector Pointer Target void displayInfo(){ // Location if (gps.location.isValid()) { TargetLat = gps.location.lat(); TargetLon = gps.location.lng(); GPSStatus = 2; } else { GPSStatus = 0; } }
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 ); // Caclulate the PPM of each gas sensors // Hydrogen Gas Sensor - MQ-8 isMQ8(); // Carbon Monoxide & Flammable Gas Sensor - MQ-9 isMQ9(); // Carbon Monoxide Gas Sensor - MQ-7 isMQ7(); } // Hydrogen Gas Sensor - MQ-8 - PPM void isMQ8() { double RvRo = iMQ8Raw * (3.3 / 1023); iMQ8ppm = (pow(4.7,( ((log(RvRo)-H2Curve[1])/H2Curve[2]) + H2Curve[0]))); } // Carbon Monoxide & Flammable Gas Sensor - MQ-9 void isMQ9() { double RvRo = iMQ9Raw * (3.3 / 4095); iMQ9ppm = 3.027*exp(1.0698*( RvRo )); } // Carbon Monoxide Gas Sensor - MQ-7 int isMQ7() { double RvRo = iMQ7Raw * (3.3 / 4095); iMQ7ppm = 3.027*exp(1.0698*( RvRo )); }
getRTC.ino
// Date & Time // PCF8523 Precision RTC void setupRTC() { // Date & Time // pcf8523 Precision RTC if (! rtc.begin()) { while (1); } if (! rtc.initialized()) { // Following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: // rtc.adjust(DateTime(2018, 9, 29, 12, 17, 0)); } } // Date and Time RTC void isRTC () { // Date and Time dateRTC = ""; timeRTC = ""; 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; }
getRot.ino
// Rotary Switch // isRot - iRotVal - Value void isRot() { // Rotary Switch z = analogRead( iRotNum ); x = map(z, 0, 4095, 0, 9); iRotVal = map(z, 0, 4095, 0, 10); // Range Value switch ( iRotVal ) { case 0: // Display Environmental isDisplayEnvironmental(); break; case 1: // Display Date isDisplayDate(); break; case 2: // Display BME280 isDisplayBME280(); break; case 3: // Display CCS811 - eCO2 & tVOC isDisplayCCS811(); break; case 4: // Display Gas Sensors MQ isDisplayMQ(); break; case 5: // Display UID isDisplayUID(); break; case 6: // Z isDisplayZ(); break; case 7: // Z isDisplayZ(); break; case 8: // Z isDisplayZ(); break; case 9: // Z isDisplayZ(); break; } }
getSD.ino
// microSD Card // microSD Setup void setupSD() { // microSD Card pinMode( chipSelect , OUTPUT ); if(!SD.begin( chipSelect )){ ; return; } uint8_t cardType = SD.cardType(); if(cardType == CARD_NONE){ ; return; } //Serial.print("SD Card Type: "); if(cardType == CARD_MMC){ ; } else if(cardType == CARD_SD){ ; } else if(cardType == CARD_SDHC){ ; } else { ; } uint64_t cardSize = SD.cardSize() / (1024 * 1024); } // microSD Card void isSD() { zzzzzz = ""; // EEPROM Unique ID|Version|Date|Time|GPS Status|Target Latitude|Target Longitude|Temperature Celsius|Humidity|Altitude Meters|Barometric Pressure|eCO2 Concentration|tVOC Concentration|H2 Gas Sensor MQ-8|CO Gas Sensor MQ-9|CO Gas Sensor MQ-7 zzzzzz = uid + "|" + sver + "|" + dateRTC + "|" + timeRTC + "|" + GPSStatus + "|" + TargetLat + "|" + TargetLon + "|" + BMEtempC + "|" + BMEhumid + "|" + BMEaltitudeM + "|" + BMEpressure + "|" + CCS811CO2 + "|" + CCS811TVOC + "|" + iMQ8ppm + "|" + iMQ9ppm + "|" + iMQ7ppm + "|\r"; char msg[zzzzzz.length() + 1]; zzzzzz.toCharArray(msg, zzzzzz.length() + 1); appendFile(SD, "/espdata.txt", msg ); } // List Dir void listDir(fs::FS &fs, const char * dirname, uint8_t levels){ 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){ 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){ path; File file = fs.open(path, FILE_APPEND); if(!file){ return; } if(file.print(message)){ ; } else { ; } file.close(); }
setup.ino
// Setup void setup() { // EEPROM Size EEPROM.begin(EEPROM_SIZE); // EEPROM Unique ID isUID(); // GPS Receiver // Setup GPS setupGPS(); // SHARP Display Start & Clear the Display display.begin(); // Clear Display display.clearDisplay(); // Display UID isDisplayUID(); // Wire - Inialize I2C Hardware Wire.begin(); // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure myBME280.begin(); // CCS811 - eCO2 & tVOC myCCS811.begin(); // Initialize the LED Green pinMode(iLEDGreen, OUTPUT); // Date & Time RTC // PCF8523 Precision RTC setupRTC(); // Date & Time isRTC(); // microSD Card setupSD(); // Slide Switch pinMode(iSS1, INPUT); delay( 5000 ); }
Technology Experience
- 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
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
- Robotics
- Arduino
- Raspberry Pi
- Espressif
Follow Us
The Alpha Geek
Aphasia
https://www.donluc.com/?page_id=2149
J. Luc Paquin – Curriculum Vitae
https://www.donluc.com/DLHackster/LucPaquinCVEngMk2020a.pdf
Web: https://www.donluc.com/
Web: http://www.jlpconsultants.com/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
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/
Don Luc
Project #15: Environment – Pololu Carbon Monoxide & Flammable Gas Sensor – MQ-9 – Mk07
——
#DonLuc #Environment #Microcontrollers #ESP32 #MQ-X #GPS #SparkFun #Adafruit #Pololu #Fritzing #Programming #Arduino #Electronics #Consultant #Vlog #Aphasia
——
——
——
——
——
DL2005Mk06
1 x SparkFun Thing Plus – ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x SparkFun Environmental Combo Breakout – CCS811/BME280
1 x Adafruit Adalogger FeatherWing – RTC + SD
1 x SparkFun GPS Receiver – GP-20U7
1 x CR1220 12mm Lithium Battery
1 x 32Gb microSD Card
1 x Mountable Slide Switch
1 x SparkFun Rotary Switch – 10 Position
1 x Black Knob
1 x Breadboard Solderable
2 x Pololu Carrier for MQ Gas Sensors
1 x SparkFun Hydrogen Gas Sensor – MQ-8
1 x Pololu Carbon Monoxide & Flammable Gas Sensor – MQ-9
1 x Qwiic Cable – 100mm
1 x LED Green
11 x 1K Ohm
1 x 4.7K Ohm
1 x 10K Ohm
1 x 20k Ohm
6 x Jumper Wires 3in M/M
8 x Jumper Wires 6in M/M
16 x Wire Solid Core – 22 AWG
2 x Full-Size Breadboard
1 x SparkFun Cerberus USB Cable
1 x DC Power Supply
SparkFun Thing Plus – ESP32 WROOM
LEG – Digital 21
SCK – Digital 13
MOS – Digital 12
SSD – Digital 27
SDA – Digital 23
SCL – Digital 22
SD1 – Digital 33
SC2 – Digital 5
MO2 – Digital 18
MI2 – Digital 19
SS1 – Digital 16
ROT – Analog A0
MH1 – Analog A1
MC1 – Analog A2
GPS – Digital 14
VIN – +3.3V
GND – GND
DL2005Mk06p.ino
// ***** Don Luc Electronics © ***** // Software Version Information // Project #15: Environment - Pololu Carbon Monoxide & Flammable Gas Sensor - MQ-9 - Mk07 // 05-06 // DL2005Mk06p.ino 15-07 // EEPROM with Unique ID // 1 x SparkFun Thing Plus - ESP32 WROOM // 1 x Adafruit SHARP Memory Display // 1 x SparkFun Environmental Combo Breakout - CCS811/BME280 // 1 x Adafruit Adalogger FeatherWing - RTC + SD // 1 x SparkFun GPS Receiver - GP-20U7 // 1 x CR1220 12mm Lithium Battery // 1 x 32Gb microSD Card // 1 x Mountable Slide Switch // 1 x SparkFun Rotary Switch - 10 Position // 1 x Black Knob // 1 x Breadboard Solderable // 2 x Pololu Carrier for MQ Gas Sensors // 1 x Pololu Carbon Monoxide & Flammable Gas Sensor - MQ-9 // 1 x SparkFun Hydrogen Gas Sensor - MQ-8 // 1 x Qwiic Cable - 100mm // 1 x LED Green // 11 x 1K Ohm // 1 x 4.7K Ohm // 1 x 10K Ohm // 1 x 20K Ohm // 6 x Jumper Wires 3in M/M // 8 x Jumper Wires 6in M/M // 16 x Wire Solid Core - 22 AWG // 2 x Full-Size Breadboard // 1 x SparkFun Cerberus USB Cable // 1 x DC Power Supply // Include the Library Code // EEPROM Library to Read and Write EEPROM with Unique ID for Unit #include "EEPROM.h" // Wire #include <Wire.h> // SHARP Memory Display #include <Adafruit_SharpMem.h> #include <Adafruit_GFX.h> // SparkFun CCS811 - eCO2 & tVOC #include <SparkFunCCS811.h> // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure #include <SparkFunBME280.h> // Date and Time #include "RTClib.h" // SD Card #include "FS.h" #include "SD.h" #include "SPI.h" // GPS Receiver #include <TinyGPS++.h> // Hardware Serial #include <HardwareSerial.h> // LED Green int iLEDGreen = 21; // SHARP Memory Display // any pins can be used #define SHARP_SCK 13 #define SHARP_MOSI 12 #define SHARP_SS 27 // Set the size of the display here - 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 // 1/2 of lesser of display width or height int minorHalfSize; // SparkFun CCS811 - eCO2 & tVOC // Default I2C Address #define CCS811_ADDR 0x5B CCS811 myCCS811(CCS811_ADDR); float CCS811CO2 = 0; float CCS811TVOC = 0; // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure BME280 myBME280; float BMEtempC = 0; float BMEhumid = 0; float BMEaltitudeM = 0; float BMEpressure = 0; // Date and Time // PCF8523 Precision RTC RTC_PCF8523 rtc; String dateRTC = ""; String timeRTC = ""; // microSD Card const int chipSelect = 33; String zzzzzz = ""; // Mountable Slide Switch int iSS1 = 16; // State int iSS1State = 0; // ESP32 HardwareSerial HardwareSerial tGPS(2); // GPS Receiver #define gpsRXPIN 14 // This one is unused and doesnt have a conection #define gpsTXPIN 32 // The TinyGPS++ object TinyGPSPlus gps; float TargetLat; float TargetLon; int GPSStatus = 0; // Rotary Switch - 10 Position // Number 1 => 10 int iRotNum = A0; // iRotVal - Value int iRotVal = 0; // Number int z = 0; int x = 0; // Gas Sensors MQ // Hydrogen Gas Sensor - MQ-8 int iMQ8 = A1; 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 = A2; int iMQ9Raw = 0; int iMQ9ppm = 0; // Software Version Information String sver = "15-07"; // EEPROM Unique ID Information #define EEPROM_SIZE 64 String uid = ""; void loop() { // Receives NEMA data from GPS receiver isGPS(); // Date and Time isRTC(); // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure isBME280(); // SparkFun CCS811 - eCO2 & tVOC isCCS811(); // Gas Sensors MQ isGasSensor(); // Rotary Switch isRot(); // Slide Switch // Read the state of the iSS1 value iSS1State = digitalRead(iSS1); // If it is the Slide Switch State is HIGH if (iSS1State == HIGH) { // iLEDGreen digitalWrite(iLEDGreen, HIGH ); // microSD Card isSD(); } else { // iLEDGreen digitalWrite(iLEDGreen, LOW ); } delay( 1000 ); }
getBME280.ino
// SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure // isBME280 - Humidity, Temperature, Altitude and Barometric Pressure void isBME280(){ // Temperature Celsius BMEtempC = myBME280.readTempC(); // Humidity BMEhumid = myBME280.readFloatHumidity(); // Altitude Meters BMEaltitudeM = (myBME280.readFloatAltitudeMeters(), 2); // Barometric Pressure BMEpressure = myBME280.readFloatPressure(); }
getCCS811.ino
// CCS811 - eCO2 & tVOC // isCCS811 - eCO2 & tVOC void isCCS811(){ // This sends the temperature & humidity data to the CCS811 myCCS811.setEnvironmentalData(BMEhumid, BMEtempC); // Calling this function updates the global tVOC and eCO2 variables myCCS811.readAlgorithmResults(); // eCO2 Concentration CCS811CO2 = myCCS811.getCO2(); // tVOC Concentration CCS811TVOC = myCCS811.getTVOC(); }
getDisplay.ino
// Display // SHARP Memory Display - UID void isDisplayUID() { // Text Display // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(3); display.setTextColor(BLACK); // Don Luc Electronics display.setCursor(0,10); display.println( "Don Luc" ); display.setTextSize(2); display.setCursor(0,40); display.println( "Electronics" ); // Version display.setTextSize(3); display.setCursor(0,70); display.println( "Version" ); display.setTextSize(2); display.setCursor(0,100); display.println( sver ); // EEPROM Unique ID display.setTextSize(1); display.setCursor(0,130); display.println( "EEPROM Unique ID" ); display.setTextSize(2); display.setCursor(0,145); display.println( uid ); // Refresh display.refresh(); delay( 100 ); } // Display Environmental void isDisplayEnvironmental(){ // Text Display Environmental // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(1); display.setTextColor(BLACK); // Temperature Celsius display.setCursor(0,0); display.println( "Temperature Celsius" ); display.setCursor(0,10); display.print( BMEtempC ); display.println( " C" ); // Humidity display.setCursor(0,20); display.println( "Humidity" ); display.setCursor(0,30); display.print( BMEhumid ); display.println( "%" ); // Altitude Meters display.setCursor(0,40); display.println( "Altitude Meters" ); display.setCursor(0,50); display.print( BMEaltitudeM ); display.println( " m" ); // Pressure display.setCursor(0,60); display.println( "Barometric Pressure" ); display.setCursor(0,70); display.print( BMEpressure ); display.println( " Pa" ); // eCO2 Concentration display.setCursor(0,80); display.println( "eCO2 Concentration" ); display.setCursor(0,90); display.print( CCS811CO2 ); display.println( " ppm" ); // tVOC Concentration display.setCursor(0,100); display.println( "tVOC Concentration" ); display.setCursor(0,110); display.print( CCS811TVOC ); display.println( " ppb" ); // Date display.setCursor(0,120); display.println( dateRTC ); // Time display.setCursor(0,130); display.println( timeRTC ); // GPS Status display.setCursor(0,140); display.println( GPSStatus ); // Target Latitude display.setCursor(0,150); display.println( TargetLat ); // Target Longitude display.setCursor(0,160); display.println( TargetLon ); // Refresh display.refresh(); delay( 100 ); } // Display Date void isDisplayDate() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Date display.setCursor(0,5); display.println( dateRTC ); // Time display.setCursor(0,30); display.println( timeRTC ); // GPS Status display.setCursor(0,60); display.print( "GPS: " ); display.println( GPSStatus ); // Target Latitude display.setCursor(0,80); display.println( "Latitude" ); display.setCursor(0,100); display.println( TargetLat ); // Target Longitude display.setCursor(0,120); display.println( "Longitude" ); display.setCursor(0,140); display.println( TargetLon ); // Refresh display.refresh(); delay( 100 ); } // Display BME280 void isDisplayBME280() { // Text Display BME280 // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Temperature Celsius display.setCursor(0,10); display.println( "Temperature" ); display.setCursor(0,30); display.print( BMEtempC ); display.println( " C" ); // Humidity display.setCursor(0,50); display.println( "Humidity" ); display.setCursor(0,70); display.print( BMEhumid ); display.println( "%" ); // Altitude Meters display.setCursor(0,90); display.println( "Altitude M" ); display.setCursor(0,110); display.print( BMEaltitudeM ); display.println( " m" ); // Pressure display.setCursor(0,130); display.println( "Barometric" ); display.setCursor(0,150); display.print( BMEpressure ); display.println( "Pa" ); // Refresh display.refresh(); delay( 100 ); } // Display CCS811 - eCO2 & tVOC void isDisplayCCS811() { // Text Display CCS811 // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // eCO2 Concentration display.setCursor(0,10); display.println( "eCO2" ); display.setCursor(0,30); display.print( CCS811CO2 ); display.println( " ppm" ); // tVOC Concentration display.setCursor(0,60); display.println( "tVOC" ); display.setCursor(0,80); display.print( CCS811TVOC ); display.println( " ppb" ); // Refresh display.refresh(); delay( 100 ); } // Display Gas Sensors MQ void isDisplayMQ() { // Text Display MQ // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Gas Sensors MQ display.setCursor(0,10); display.println( "Gas Sensors" ); display.setCursor(0,30); display.println( "Gas H2 MQ8" ); display.setCursor(0,50); display.print( iMQ8ppm ); display.println( " ppm" ); display.setCursor(0,70); display.println( "Gas CO MQ9" ); display.setCursor(0,90); display.print( iMQ9ppm ); display.println( " ppm" ); // Refresh display.refresh(); delay( 100 ); } // Display Z void isDisplayZ() { // Text Display Z // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(3); display.setTextColor(BLACK); // Z display.setCursor(0,10); display.print( "Z: " ); display.println( z ); // Refresh display.refresh(); delay( 100 ); }
getEEPROM.ino
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getGPS.ino
// GPS Receiver // Setup GPS void setupGPS() { // Setup GPS tGPS.begin( 9600 , SERIAL_8N1, gpsRXPIN, gpsTXPIN ); } // isGPS void isGPS(){ // Receives NEMA data from GPS receiver // This sketch displays information every time a new sentence is correctly encoded. while ( tGPS.available() > 0) if (gps.encode( tGPS.read() )) { displayInfo(); } if (millis() > 5000 && gps.charsProcessed() < 10) { while(true); } } // GPS Vector Pointer Target void displayInfo(){ // Location if (gps.location.isValid()) { TargetLat = gps.location.lat(); TargetLon = gps.location.lng(); GPSStatus = 2; } else { GPSStatus = 0; } }
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 ); // Caclulate the PPM of each gas sensors // Hydrogen Gas Sensor - MQ-8 isMQ8(); // Carbon Monoxide & Flammable Gas Sensor - MQ-9 isMQ9(); } // Hydrogen Gas Sensor - MQ-8 - PPM void isMQ8() { // RvRo double RvRo = iMQ8Raw * (3.3 / 1023); iMQ8ppm = (pow(4.7,( ((log(RvRo)-H2Curve[1])/H2Curve[2]) + H2Curve[0]))); } // Carbon Monoxide & Flammable Gas Sensor - MQ-9 void isMQ9() { double RvRo = iMQ9Raw * (3.3 / 4095); iMQ9ppm = 3.027*exp(1.0698*( RvRo )); }
getRTC.ino
// Date & Time // PCF8523 Precision RTC void setupRTC() { // Date & Time // pcf8523 Precision RTC if (! rtc.begin()) { while (1); } if (! rtc.initialized()) { // Following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: // rtc.adjust(DateTime(2018, 9, 29, 12, 17, 0)); } } // Date and Time RTC void isRTC () { // Date and Time dateRTC = ""; timeRTC = ""; 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; }
getRot.ino
// Rotary Switch // isRot - iRotVal - Value void isRot() { // Rotary Switch z = analogRead( iRotNum ); x = map(z, 0, 4095, 0, 9); iRotVal = map(z, 0, 4095, 0, 10); // Range Value switch ( iRotVal ) { case 0: // Display Environmental isDisplayEnvironmental(); break; case 1: // Display Date isDisplayDate(); break; case 2: // Display BME280 isDisplayBME280(); break; case 3: // Display CCS811 - eCO2 & tVOC isDisplayCCS811(); break; case 4: // Display Gas Sensors MQ isDisplayMQ(); break; case 5: // Display UID isDisplayUID(); break; case 6: // Z isDisplayZ(); break; case 7: // Z isDisplayZ(); break; case 8: // Z isDisplayZ(); break; case 9: // Z isDisplayZ(); break; default: // Z isDisplayZ(); break; } }
getSD.ino
// microSD Card // microSD Setup void setupSD() { // microSD Card pinMode( chipSelect , OUTPUT ); if(!SD.begin( chipSelect )){ ; return; } uint8_t cardType = SD.cardType(); if(cardType == CARD_NONE){ ; return; } //Serial.print("SD Card Type: "); if(cardType == CARD_MMC){ ; } else if(cardType == CARD_SD){ ; } else if(cardType == CARD_SDHC){ ; } else { ; } uint64_t cardSize = SD.cardSize() / (1024 * 1024); } // microSD Card void isSD() { zzzzzz = ""; // EEPROM Unique ID|Version|Date|Time|GPS Status|Target Latitude|Target Longitude|Temperature Celsius|Humidity|Altitude Meters|Barometric Pressure|eCO2 Concentration|tVOC Concentration|H2 Gas Sensor MQ-8|CO Gas Sensor MQ-9 zzzzzz = uid + "|" + sver + "|" + dateRTC + "|" + timeRTC + "|" + GPSStatus + "|" + TargetLat + "|" + TargetLon + "|" + BMEtempC + "|" + BMEhumid + "|" + BMEaltitudeM + "|" + BMEpressure + "|" + CCS811CO2 + "|" + CCS811TVOC + "|" + iMQ8ppm + + "|" + iMQ9ppm + "|\r"; char msg[zzzzzz.length() + 1]; zzzzzz.toCharArray(msg, zzzzzz.length() + 1); appendFile(SD, "/espdata.txt", msg ); } // List Dir void listDir(fs::FS &fs, const char * dirname, uint8_t levels){ 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){ 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){ path; File file = fs.open(path, FILE_APPEND); if(!file){ return; } if(file.print(message)){ ; } else { ; } file.close(); }
setup.ino
// Setup void setup() { // EEPROM Size EEPROM.begin(EEPROM_SIZE); // EEPROM Unique ID isUID(); // GPS Receiver // Setup GPS setupGPS(); // SHARP Display Start & Clear the Display display.begin(); // Clear Display display.clearDisplay(); // Display UID isDisplayUID(); // Wire - Inialize I2C Hardware Wire.begin(); // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure myBME280.begin(); // CCS811 - eCO2 & tVOC myCCS811.begin(); // Initialize the LED Green pinMode(iLEDGreen, OUTPUT); // Date & Time RTC // PCF8523 Precision RTC setupRTC(); // Date & Time isRTC(); // microSD Card setupSD(); // Slide Switch pinMode(iSS1, INPUT); delay( 5000 ); }
Technology Experience
- 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
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
- Robotics
- Arduino
- Raspberry Pi
- Espressif
Follow Us
The Alpha Geek
Aphasia
https://www.donluc.com/?page_id=2149
J. Luc Paquin – Curriculum Vitae
https://www.donluc.com/DLHackster/LucPaquinCVEngMk2020a.pdf
Web: https://www.donluc.com/
Web: http://www.jlpconsultants.com/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
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/
Don Luc
Project #15: Environment – SparkFun Hydrogen Gas Sensor – MQ-8 – Mk06
——
#DonLuc #Environment #Microcontrollers #ESP32 #MQ-8 #GPS #SparkFun #Adafruit #Pololu #Fritzing #Programming #Arduino #Electronics #Consultant #Vlog #Aphasia
——
——
——
——
DL2005Mk04
1 x SparkFun Thing Plus – ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x SparkFun Environmental Combo Breakout – CCS811/BME280
1 x Adafruit Adalogger FeatherWing – RTC + SD
1 x SparkFun GPS Receiver – GP-20U7
1 x CR1220 12mm Lithium Battery
1 x 32Gb microSD Card
1 x Mountable Slide Switch
1 x SparkFun Rotary Switch – 10 Position
1 x Black Knob
1 x Breadboard Solderable
1 x Pololu Adjustable Boost Regulator 2.5-9.5V
1 x Pololu Carrier for MQ Gas Sensors
1 x SparkFun Hydrogen Gas Sensor – MQ-8
1 x Qwiic Cable – 100mm
1 x LED Green
11 x 1K Ohm
1 x 4.7K Ohm
1 x 10K Ohm
4 x Jumper Wires 3in M/M
8 x Jumper Wires 6in M/M
16 x Wire Solid Core – 22 AWG
2 x Full-Size Breadboard
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
LEG – Digital 21
SCK – Digital 13
MOS – Digital 12
SSD – Digital 27
SDA – Digital 23
SCL – Digital 22
SD1 – Digital 33
SC2 – Digital 5
MO2 – Digital 18
MI2 – Digital 19
SS1 – Digital 16
ROT – Analog A0
MH1 – Analog A1
GPS – Digital 14
VIN – +3.3V
GND – GND
DL2005Mk04p.ino
// ***** Don Luc Electronics © ***** // Software Version Information // Project #15: Environment - SparkFun Hydrogen Gas Sensor - MQ-8 - Mk06 // 05-04 // DL2005Mk04p.ino 15-06 // EEPROM with Unique ID // 1 x SparkFun Thing Plus - ESP32 WROOM // 1 x Adafruit SHARP Memory Display // 1 x SparkFun Environmental Combo Breakout - CCS811/BME280 // 1 x Adafruit Adalogger FeatherWing - RTC + SD // 1 x SparkFun GPS Receiver - GP-20U7 // 1 x CR1220 12mm Lithium Battery // 1 x 32Gb microSD Card // 1 x Mountable Slide Switch // 1 x SparkFun Rotary Switch - 10 Position // 1 x Black Knob // 1 x Breadboard Solderable // 1 x Pololu Adjustable Boost Regulator 2.5-9.5V // 1 x Pololu Carrier for MQ Gas Sensors // 1 x SparkFun Hydrogen Gas Sensor - MQ-8 // 1 x Qwiic Cable - 100mm // 1 x LED Green // 11 x 1K Ohm // 1 x 4.7K Ohm // 1 x 10K Ohm // 4 x Jumper Wires 3in M/M // 8 x Jumper Wires 6in M/M // 16 x Wire Solid Core - 22 AWG // 2 x Full-Size Breadboard // 1 x SparkFun Cerberus USB Cable // Include the Library Code // EEPROM Library to Read and Write EEPROM with Unique ID for Unit #include "EEPROM.h" // Wire #include <Wire.h> // SHARP Memory Display #include <Adafruit_SharpMem.h> #include <Adafruit_GFX.h> // SparkFun CCS811 - eCO2 & tVOC #include <SparkFunCCS811.h> // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure #include <SparkFunBME280.h> // Date and Time #include "RTClib.h" // SD Card #include "FS.h" #include "SD.h" #include "SPI.h" // GPS Receiver #include <TinyGPS++.h> // Hardware Serial #include <HardwareSerial.h> // LED Green int iLEDGreen = 21; // SHARP Memory Display // any pins can be used #define SHARP_SCK 13 #define SHARP_MOSI 12 #define SHARP_SS 27 // Set the size of the display here - 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 // 1/2 of lesser of display width or height int minorHalfSize; // SparkFun CCS811 - eCO2 & tVOC // Default I2C Address #define CCS811_ADDR 0x5B CCS811 myCCS811(CCS811_ADDR); float CCS811CO2 = 0; float CCS811TVOC = 0; // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure BME280 myBME280; float BMEtempC = 0; float BMEhumid = 0; float BMEaltitudeM = 0; float BMEpressure = 0; // Date and Time // PCF8523 Precision RTC RTC_PCF8523 rtc; String dateRTC = ""; String timeRTC = ""; // microSD Card const int chipSelect = 33; String zzzzzz = ""; // Mountable Slide Switch int iSS1 = 16; // State int iSS1State = 0; // ESP32 HardwareSerial HardwareSerial tGPS(2); // GPS Receiver #define gpsRXPIN 14 // This one is unused and doesnt have a conection #define gpsTXPIN 32 // The TinyGPS++ object TinyGPSPlus gps; float TargetLat; float TargetLon; int GPSStatus = 0; // Rotary Switch - 10 Position // Number 1 => 10 int iRotNum = A0; // iRotVal - Value int iRotVal = 0; // Number int z = 0; // Gas Sensors MQ // Hydrogen Gas Sensor - MQ-8 int iMQ8 = A1; 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}; // Software Version Information String sver = "15-06"; // EEPROM Unique ID Information #define EEPROM_SIZE 64 String uid = ""; void loop() { // Receives NEMA data from GPS receiver isGPS(); // Date and Time isRTC(); // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure isBME280(); // SparkFun CCS811 - eCO2 & tVOC isCCS811(); // Gas Sensors MQ isGasSensor(); // Rotary Switch isRot(); // Slide Switch // Read the state of the iSS1 value iSS1State = digitalRead(iSS1); // If it is the Slide Switch State is HIGH if (iSS1State == HIGH) { // iLEDGreen digitalWrite(iLEDGreen, HIGH ); // microSD Card isSD(); } else { // iLEDGreen digitalWrite(iLEDGreen, LOW ); } delay( 1000 ); }
getBME280.ino
// SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure // isBME280 - Humidity, Temperature, Altitude and Barometric Pressure void isBME280(){ // Temperature Celsius BMEtempC = myBME280.readTempC(); // Humidity BMEhumid = myBME280.readFloatHumidity(); // Altitude Meters BMEaltitudeM = (myBME280.readFloatAltitudeMeters(), 2); // Barometric Pressure BMEpressure = myBME280.readFloatPressure(); }
getCCS811.ino
// CCS811 - eCO2 & tVOC // isCCS811 - eCO2 & tVOC void isCCS811(){ // This sends the temperature & humidity data to the CCS811 myCCS811.setEnvironmentalData(BMEhumid, BMEtempC); // Calling this function updates the global tVOC and eCO2 variables myCCS811.readAlgorithmResults(); // eCO2 Concentration CCS811CO2 = myCCS811.getCO2(); // tVOC Concentration CCS811TVOC = myCCS811.getTVOC(); }
getDisplay.ino
// Display // SHARP Memory Display - UID void isDisplayUID() { // Text Display // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(3); display.setTextColor(BLACK); // Don Luc Electronics display.setCursor(0,10); display.println( "Don Luc" ); display.setTextSize(2); display.setCursor(0,40); display.println( "Electronics" ); // Version display.setTextSize(3); display.setCursor(0,70); display.println( "Version" ); display.setTextSize(2); display.setCursor(0,100); display.println( sver ); // EEPROM Unique ID display.setTextSize(1); display.setCursor(0,130); display.println( "EEPROM Unique ID" ); display.setTextSize(2); display.setCursor(0,145); display.println( uid ); // Refresh display.refresh(); delay( 100 ); } // Display Environmental void isDisplayEnvironmental(){ // Text Display Environmental // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(1); display.setTextColor(BLACK); // Temperature Celsius display.setCursor(0,0); display.println( "Temperature Celsius" ); display.setCursor(0,10); display.print( BMEtempC ); display.println( " C" ); // Humidity display.setCursor(0,20); display.println( "Humidity" ); display.setCursor(0,30); display.print( BMEhumid ); display.println( "%" ); // Altitude Meters display.setCursor(0,40); display.println( "Altitude Meters" ); display.setCursor(0,50); display.print( BMEaltitudeM ); display.println( " m" ); // Pressure display.setCursor(0,60); display.println( "Barometric Pressure" ); display.setCursor(0,70); display.print( BMEpressure ); display.println( " Pa" ); // eCO2 Concentration display.setCursor(0,80); display.println( "eCO2 Concentration" ); display.setCursor(0,90); display.print( CCS811CO2 ); display.println( " ppm" ); // tVOC Concentration display.setCursor(0,100); display.println( "tVOC Concentration" ); display.setCursor(0,110); display.print( CCS811TVOC ); display.println( " ppb" ); // Date display.setCursor(0,120); display.println( dateRTC ); // Time display.setCursor(0,130); display.println( timeRTC ); // GPS Status display.setCursor(0,140); display.println( GPSStatus ); // Target Latitude display.setCursor(0,150); display.println( TargetLat ); // Target Longitude display.setCursor(0,160); display.println( TargetLon ); // Refresh display.refresh(); delay( 100 ); } // Display Date void isDisplayDate() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Date display.setCursor(0,5); display.println( dateRTC ); // Time display.setCursor(0,30); display.println( timeRTC ); // GPS Status display.setCursor(0,60); display.print( "GPS: " ); display.println( GPSStatus ); // Target Latitude display.setCursor(0,80); display.println( "Latitude" ); display.setCursor(0,100); display.println( TargetLat ); // Target Longitude display.setCursor(0,120); display.println( "Longitude" ); display.setCursor(0,140); display.println( TargetLon ); // Refresh display.refresh(); delay( 100 ); } // Display BME280 void isDisplayBME280() { // Text Display BME280 // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Temperature Celsius display.setCursor(0,10); display.println( "Temperature" ); display.setCursor(0,30); display.print( BMEtempC ); display.println( " C" ); // Humidity display.setCursor(0,50); display.println( "Humidity" ); display.setCursor(0,70); display.print( BMEhumid ); display.println( "%" ); // Altitude Meters display.setCursor(0,90); display.println( "Altitude M" ); display.setCursor(0,110); display.print( BMEaltitudeM ); display.println( " m" ); // Pressure display.setCursor(0,130); display.println( "Barometric" ); display.setCursor(0,150); display.print( BMEpressure ); display.println( "Pa" ); // Refresh display.refresh(); delay( 100 ); } // Display CCS811 - eCO2 & tVOC void isDisplayCCS811() { // Text Display CCS811 // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // eCO2 Concentration display.setCursor(0,10); display.println( "eCO2" ); display.setCursor(0,30); display.print( CCS811CO2 ); display.println( " ppm" ); // tVOC Concentration display.setCursor(0,60); display.println( "tVOC" ); display.setCursor(0,80); display.print( CCS811TVOC ); display.println( " ppb" ); // Refresh display.refresh(); delay( 100 ); } // Display Gas Sensors MQ void isDisplayMQ() { // Text Display MQ // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Gas Sensors MQ display.setCursor(0,5); display.println( "Gas H2 MQ8" ); display.setCursor(0,25); display.print( iMQ8ppm ); display.println( " ppm" ); // Refresh display.refresh(); delay( 100 ); } // Display Z void isDisplayZ() { // Text Display Z // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(3); display.setTextColor(BLACK); // Z display.setCursor(0,10); display.print( "Z: " ); display.println( z ); // Refresh display.refresh(); delay( 100 ); }
getEEPROM.ino
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getGPS.ino
// GPS Receiver // Setup GPS void setupGPS() { // Setup GPS tGPS.begin( 9600 , SERIAL_8N1, gpsRXPIN, gpsTXPIN ); } // isGPS void isGPS(){ // Receives NEMA data from GPS receiver // This sketch displays information every time a new sentence is correctly encoded. while ( tGPS.available() > 0) if (gps.encode( tGPS.read() )) { displayInfo(); } if (millis() > 5000 && gps.charsProcessed() < 10) { while(true); } } // GPS Vector Pointer Target void displayInfo(){ // Location if (gps.location.isValid()) { TargetLat = gps.location.lat(); TargetLon = gps.location.lng(); GPSStatus = 2; } else { GPSStatus = 0; } }
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 ); // Caclulate the PPM of each gas sensors // Hydrogen Gas Sensor - MQ-8 iMQ8ppm = isMQ8( iMQ8Raw ); } // 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]))); }
getRTC.ino
// Date & Time // PCF8523 Precision RTC void setupRTC() { // Date & Time // pcf8523 Precision RTC if (! rtc.begin()) { while (1); } if (! rtc.initialized()) { // Following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: // rtc.adjust(DateTime(2018, 9, 29, 12, 17, 0)); } } // Date and Time RTC void isRTC () { // Date and Time dateRTC = ""; timeRTC = ""; 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; }
getRot.ino
// Rotary Switch // isRot - iRotVal - Value void isRot() { // Rotary Switch z = analogRead( iRotNum ); // Rotary Switch - 10 Position // Number 1 => 10 if ( z >= 3600 ) { // Z iRotVal = 10; } else if ( z >= 3200 ) { // Z iRotVal = 9; } else if ( z >= 2700 ) { // Z iRotVal = 8; } else if ( z >= 2400 ) { // Z iRotVal = 7; } else if ( z >= 2000 ) { // Z iRotVal = 6; } else if ( z >= 1600 ) { // Z iRotVal = 5; } else if ( z >= 1200 ) { // Z iRotVal = 4; } else if ( z >= 900 ) { // Z iRotVal = 3; } else if ( z >= 500 ) { // Z iRotVal = 2; } else { // Z iRotVal = 1; } // Range Value switch ( iRotVal ) { case 1: // Display Environmental isDisplayEnvironmental(); break; case 2: // Display Date isDisplayDate(); break; case 3: // Display BME280 isDisplayBME280(); break; case 4: // Display CCS811 - eCO2 & tVOC isDisplayCCS811(); break; case 5: // Display Gas Sensors MQ isDisplayMQ(); break; case 6: // Display UID isDisplayUID(); break; case 7: // Z isDisplayZ(); break; case 8: // Z isDisplayZ(); break; case 9: // Z isDisplayZ(); break; case 10: // Z isDisplayZ(); break; } }
getSD.ino
// microSD Card // microSD Setup void setupSD() { // microSD Card pinMode( chipSelect , OUTPUT ); if(!SD.begin( chipSelect )){ ; return; } uint8_t cardType = SD.cardType(); // CARD NONE if(cardType == CARD_NONE){ ; return; } // SD Card Type if(cardType == CARD_MMC){ ; } else if(cardType == CARD_SD){ ; } else if(cardType == CARD_SDHC){ ; } else { ; } // Size uint64_t cardSize = SD.cardSize() / (1024 * 1024); } // microSD Card void isSD() { zzzzzz = ""; // EEPROM Unique ID|Version|Date|Time|GPS Status|Target Latitude|Target Longitude|Temperature Celsius|Humidity|Altitude Meters|Barometric Pressure|eCO2 Concentration|tVOC Concentration|H2 Gas Sensor MQ-8 zzzzzz = uid + "|" + sver + "|" + dateRTC + "|" + timeRTC + "|" + GPSStatus + "|" + TargetLat + "|" + TargetLon + "|" + BMEtempC + "|" + BMEhumid + "|" + BMEaltitudeM + "|" + BMEpressure + "|" + CCS811CO2 + "|" + CCS811TVOC + "|" + iMQ8ppm + "|\r"; char msg[zzzzzz.length() + 1]; zzzzzz.toCharArray(msg, zzzzzz.length() + 1); // Append File appendFile(SD, "/espdata.txt", msg ); } // List Dir void listDir(fs::FS &fs, const char * dirname, uint8_t levels){ // List Dir dirname; File root = fs.open(dirname); if(!root){ return; } if(!root.isDirectory()){ return; } File file = root.openNextFile(); while(file){ if(file.isDirectory()){ file.name(); if(levels){ listDir(fs, file.name(), levels -1); } } else { file.name(); file.size(); } file = root.openNextFile(); } } // Write File void writeFile(fs::FS &fs, const char * path, const char * message){ // Write File path; File file = fs.open(path, FILE_WRITE); if(!file){ return; } if(file.print(message)){ ; } else { ; } file.close(); } // Append File void appendFile(fs::FS &fs, const char * path, const char * message){ // Append File path; File file = fs.open(path, FILE_APPEND); if(!file){ return; } if(file.print(message)){ ; } else { ; } file.close(); }
setup.ino
// Setup void setup() { // EEPROM Size EEPROM.begin(EEPROM_SIZE); // EEPROM Unique ID isUID(); // GPS Receiver // Setup GPS setupGPS(); // SHARP Display Start & Clear the Display display.begin(); // Clear Display display.clearDisplay(); // Display UID isDisplayUID(); // Wire - Inialize I2C Hardware Wire.begin(); // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure myBME280.begin(); // CCS811 - eCO2 & tVOC myCCS811.begin(); // Initialize the LED Green pinMode(iLEDGreen, OUTPUT); // Date & Time RTC // PCF8523 Precision RTC setupRTC(); // Date & Time isRTC(); // microSD Card setupSD(); // Slide Switch pinMode(iSS1, INPUT); delay( 5000 ); }
Technology Experience
- 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
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
- Robotics
- Arduino
- Raspberry Pi
- Espressif
Follow Us
The Alpha Geek
Aphasia
https://www.donluc.com/?page_id=2149
J. Luc Paquin – Curriculum Vitae
https://www.donluc.com/DLHackster/LucPaquinCVEngMk2020a.pdf
Web: https://www.donluc.com/
Web: http://www.jlpconsultants.com/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
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/
Don Luc
Project #15: Environment – SparkFun Rotary Switch – 10 Position – Mk05
——
#DonLuc #Environment #Microcontrollers #ESP32 #Adalogger #GPS #RotarySwitch #SparkFun #Fritzing #Programming #Adafruit #Arduino #Electronics #Consultant #Vlog #Aphasia
——
——
——
——
DL2004Mk13
1 x SparkFun Thing Plus – ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x SparkFun Environmental Combo Breakout – CCS811/BME280
1 x Adafruit Adalogger FeatherWing – RTC + SD
1 x SparkFun GPS Receiver – GP-20U7
1 x CR1220 12mm Lithium Battery
1 x 32Gb microSD Card
1 x Mountable Slide Switch
1 x SparkFun Rotary Switch – 10 Position
1 x Black Knob
1 x Breadboard Solderable
1 x Qwiic Cable – 100mm
1 x LED Green
11 x 1K Ohm
1 x 10K Ohm
2 x Jumper Wires 3in M/M
5 x Jumper Wires 6in M/M
16 x Wire Solid Core – 22 AWG
1 x Full-Size Breadboard
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
LEG – Digital 21
SCK – Digital 13
MOS – Digital 12
SSD – Digital 27
SDA – Digital 23
SCL – Digital 22
SD1 – Digital 33
SC2 – Digital 5
MO2 – Digital 18
MI2 – Digital 19
SS1 – Digital 16
ROT – Digital A1
GPS – Digital 4
VIN – +3.3V
GND – GND
DL2004Mk13p.ino
// ***** Don Luc Electronics © ***** // Software Version Information // Project #15: Environment - SparkFun Rotary Switch - 10 Position - Mk05 // 04-13 // DL2004Mk13p.ino 15-05 // EEPROM with Unique ID // 1 x SparkFun Thing Plus - ESP32 WROOM // 1 x Adafruit SHARP Memory Display // 1 x SparkFun Environmental Combo Breakout - CCS811/BME280 // 1 x Adafruit Adalogger FeatherWing - RTC + SD // 1 x SparkFun GPS Receiver - GP-20U7 // 1 x CR1220 12mm Lithium Battery // 1 x 32Gb microSD Card // 1 x Mountable Slide Switch // 1 x SparkFun Rotary Switch - 10 Position // 1 x Black Knob // 1 x Breadboard Solderable // 1 x Qwiic Cable - 100mm // 1 x LED Green // 11 x 1K Ohm // 1 x 10K Ohm // 2 x Jumper Wires 3in M/M // 5 x Jumper Wires 6in M/M // 16 x Wire Solid Core - 22 AWG // 1 x Full-Size Breadboard // 1 x SparkFun Cerberus USB Cable // Include the Library Code // EEPROM Library to Read and Write EEPROM with Unique ID for Unit #include "EEPROM.h" // Wire #include <Wire.h> // SHARP Memory Display #include <Adafruit_SharpMem.h> #include <Adafruit_GFX.h> // SparkFun CCS811 - eCO2 & tVOC #include <SparkFunCCS811.h> // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure #include <SparkFunBME280.h> // Date and Time #include "RTClib.h" // SD Card #include "FS.h" #include "SD.h" #include "SPI.h" // GPS Receiver #include <TinyGPS++.h> // Hardware Serial #include <HardwareSerial.h> // LED Green int iLEDGreen = 21; // SHARP Memory Display // any pins can be used #define SHARP_SCK 13 #define SHARP_MOSI 12 #define SHARP_SS 27 // Set the size of the display here - 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 // 1/2 of lesser of display width or height int minorHalfSize; // SparkFun CCS811 - eCO2 & tVOC // Default I2C Address #define CCS811_ADDR 0x5B CCS811 myCCS811(CCS811_ADDR); float CCS811CO2 = 0; float CCS811TVOC = 0; // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure BME280 myBME280; float BMEtempC = 0; float BMEhumid = 0; float BMEaltitudeM = 0; float BMEpressure = 0; // Date and Time // PCF8523 Precision RTC RTC_PCF8523 rtc; String dateRTC = ""; String timeRTC = ""; // microSD Card const int chipSelect = 33; String zzzzzz = ""; // Mountable Slide Switch int iSS1 = 16; // State int iSS1State = 0; // ESP32 HardwareSerial HardwareSerial tGPS(2); // GPS Receiver #define gpsRXPIN 4 // This one is unused and doesnt have a conection #define gpsTXPIN 36 // The TinyGPS++ object TinyGPSPlus gps; float TargetLat; float TargetLon; int GPSStatus = 0; // Rotary Switch - 10 Position // Number 1 => 10 int iRotNum = A1; // iRotVal - Value int iRotVal = 0; // Number int z = 0; // Software Version Information String sver = "15-05"; // EEPROM Unique ID Information #define EEPROM_SIZE 64 String uid = ""; void loop() { // Receives NEMA data from GPS receiver isGPS(); // Date and Time isRTC(); // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure isBME280(); // SparkFun CCS811 - eCO2 & tVOC isCCS811(); // Rotary Switch isRot(); // Slide Switch // Read the state of the iSS1 value iSS1State = digitalRead(iSS1); // If it is the Slide Switch State is HIGH if (iSS1State == HIGH) { // iLEDGreen digitalWrite(iLEDGreen, HIGH ); // microSD Card isSD(); } else { // iLEDGreen digitalWrite(iLEDGreen, LOW ); } delay( 1000 ); }
getBME280.ino
// SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure // isBME280 - Humidity, Temperature, Altitude and Barometric Pressure void isBME280(){ // Temperature Celsius BMEtempC = myBME280.readTempC(); // Humidity BMEhumid = myBME280.readFloatHumidity(); // Altitude Meters BMEaltitudeM = (myBME280.readFloatAltitudeMeters(), 2); // Barometric Pressure BMEpressure = myBME280.readFloatPressure(); }
getCCS811.ino
// CCS811 - eCO2 & tVOC // isCCS811 - eCO2 & tVOC void isCCS811(){ // This sends the temperature & humidity data to the CCS811 myCCS811.setEnvironmentalData(BMEhumid, BMEtempC); // Calling this function updates the global tVOC and eCO2 variables myCCS811.readAlgorithmResults(); // eCO2 Concentration CCS811CO2 = myCCS811.getCO2(); // tVOC Concentration CCS811TVOC = myCCS811.getTVOC(); }
getDisplay.ino
// Display // SHARP Memory Display - UID void isDisplayUID() { // Text Display // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(3); display.setTextColor(BLACK); // Don Luc Electronics display.setCursor(0,10); display.println( "Don Luc" ); display.setTextSize(2); display.setCursor(0,40); display.println( "Electronics" ); // Version display.setTextSize(3); display.setCursor(0,70); display.println( "Version" ); display.setTextSize(2); display.setCursor(0,100); display.println( sver ); // EEPROM Unique ID display.setTextSize(1); display.setCursor(0,130); display.println( "EEPROM Unique ID" ); display.setTextSize(2); display.setCursor(0,145); display.println( uid ); // Refresh display.refresh(); delay( 100 ); } // Display Environmental void isDisplayEnvironmental(){ // Text Display Environmental // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(1); display.setTextColor(BLACK); // Temperature Celsius display.setCursor(0,0); display.println( "Temperature Celsius" ); display.setCursor(0,10); display.print( BMEtempC ); display.println( " C" ); // Humidity display.setCursor(0,20); display.println( "Humidity" ); display.setCursor(0,30); display.print( BMEhumid ); display.println( "%" ); // Altitude Meters display.setCursor(0,40); display.println( "Altitude Meters" ); display.setCursor(0,50); display.print( BMEaltitudeM ); display.println( " m" ); // Pressure display.setCursor(0,60); display.println( "Barometric Pressure" ); display.setCursor(0,70); display.print( BMEpressure ); display.println( " Pa" ); // eCO2 Concentration display.setCursor(0,80); display.println( "eCO2 Concentration" ); display.setCursor(0,90); display.print( CCS811CO2 ); display.println( " ppm" ); // tVOC Concentration display.setCursor(0,100); display.println( "tVOC Concentration" ); display.setCursor(0,110); display.print( CCS811TVOC ); display.println( " ppb" ); // Date display.setCursor(0,120); display.println( dateRTC ); // Time display.setCursor(0,130); display.println( timeRTC ); // GPS Status display.setCursor(0,140); display.println( GPSStatus ); // Target Latitude display.setCursor(0,150); display.println( TargetLat ); // Target Longitude display.setCursor(0,160); display.println( TargetLon ); // Refresh display.refresh(); delay( 100 ); } // Display Date void isDisplayDate() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Date display.setCursor(0,5); display.println( dateRTC ); // Time display.setCursor(0,30); display.println( timeRTC ); // GPS Status display.setCursor(0,60); display.print( "GPS: " ); display.println( GPSStatus ); // Target Latitude display.setCursor(0,80); display.println( "Latitude" ); display.setCursor(0,100); display.println( TargetLat ); // Target Longitude display.setCursor(0,120); display.println( "Longitude" ); display.setCursor(0,140); display.println( TargetLon ); // Refresh display.refresh(); delay( 100 ); } // Display BME280 void isDisplayBME280() { // Text Display BME280 // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Temperature Celsius display.setCursor(0,10); display.println( "Temperature" ); display.setCursor(0,30); display.print( BMEtempC ); display.println( " C" ); // Humidity display.setCursor(0,50); display.println( "Humidity" ); display.setCursor(0,70); display.print( BMEhumid ); display.println( "%" ); // Altitude Meters display.setCursor(0,90); display.println( "Altitude M" ); display.setCursor(0,110); display.print( BMEaltitudeM ); display.println( " m" ); // Pressure display.setCursor(0,130); display.println( "Barometric" ); display.setCursor(0,150); display.print( BMEpressure ); display.println( "Pa" ); // Refresh display.refresh(); delay( 100 ); } // Display CCS811 - eCO2 & tVOC void isDisplayCCS811() { // Text Display CCS811 // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // eCO2 Concentration display.setCursor(0,10); display.println( "eCO2" ); display.setCursor(0,30); display.print( CCS811CO2 ); display.println( " ppm" ); // tVOC Concentration display.setCursor(0,60); display.println( "tVOC" ); display.setCursor(0,80); display.print( CCS811TVOC ); display.println( " ppb" ); // Refresh display.refresh(); delay( 100 ); } // Display Z void isDisplayZ() { // Text Display Z // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(3); display.setTextColor(BLACK); // Z display.setCursor(0,10); display.print( "Z: " ); display.println( z ); // Refresh display.refresh(); delay( 100 ); }
getEEPROM.ino
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getGPS.ino
// GPS Receiver // Setup GPS void setupGPS() { // Setup GPS tGPS.begin( 9600 , SERIAL_8N1, gpsRXPIN, gpsTXPIN ); } // isGPS void isGPS(){ // Receives NEMA data from GPS receiver // This sketch displays information every time a new sentence is correctly encoded. while ( tGPS.available() > 0) if (gps.encode( tGPS.read() )) { displayInfo(); } if (millis() > 5000 && gps.charsProcessed() < 10) { while(true); } } // GPS Vector Pointer Target void displayInfo(){ // Location if (gps.location.isValid()) { TargetLat = gps.location.lat(); TargetLon = gps.location.lng(); GPSStatus = 2; } else { GPSStatus = 0; } }
getRTC.ino
// Date & Time // PCF8523 Precision RTC void setupRTC() { // Date & Time // pcf8523 Precision RTC if (! rtc.begin()) { while (1); } if (! rtc.initialized()) { // Following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: // rtc.adjust(DateTime(2018, 9, 29, 12, 17, 0)); } } // Date and Time RTC void isRTC () { // Date and Time dateRTC = ""; timeRTC = ""; 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; }
getRot.ino
// Rotary Switch // isRot - iRotVal - Value void isRot() { // Rotary Switch z = analogRead( iRotNum ); // Rotary Switch - 10 Position // Number 1 => 10 if ( z >= 3600 ) { // Z iRotVal = 10; } else if ( z >= 3200 ) { // Z iRotVal = 9; } else if ( z >= 2700 ) { // Z iRotVal = 8; } else if ( z >= 2400 ) { // Z iRotVal = 7; } else if ( z >= 2000 ) { // Z iRotVal = 6; } else if ( z >= 1600 ) { // Z iRotVal = 5; } else if ( z >= 1200 ) { // Z iRotVal = 4; } else if ( z >= 900 ) { // Z iRotVal = 3; } else if ( z >= 500 ) { // Z iRotVal = 2; } else { // Z iRotVal = 1; } // Range Value switch ( iRotVal ) { case 1: // Display Environmental isDisplayEnvironmental(); break; case 2: // Display Date isDisplayDate(); break; case 3: // Display BME280 isDisplayBME280(); break; case 4: // Display CCS811 - eCO2 & tVOC isDisplayCCS811(); break; case 5: // Display UID isDisplayUID(); break; case 6: // Z isDisplayZ(); break; case 7: // Z isDisplayZ(); break; case 8: // Z isDisplayZ(); break; case 9: // Z isDisplayZ(); break; case 10: // Z isDisplayZ(); break; } }
getSD.ino
// microSD Card // microSD Setup void setupSD() { // microSD Card pinMode( chipSelect , OUTPUT ); if(!SD.begin( chipSelect )){ ; return; } uint8_t cardType = SD.cardType(); if(cardType == CARD_NONE){ ; return; } //Serial.print("SD Card Type: "); if(cardType == CARD_MMC){ ; } else if(cardType == CARD_SD){ ; } else if(cardType == CARD_SDHC){ ; } else { ; } uint64_t cardSize = SD.cardSize() / (1024 * 1024); } // microSD Card void isSD() { zzzzzz = ""; // EEPROM Unique ID|Version|Date|Time|GPS Status|Target Latitude|Target Longitude|Temperature Celsius|Humidity|Altitude Meters|Barometric Pressure|eCO2 Concentration|tVOC Concentration zzzzzz = uid + "|" + sver + "|" + dateRTC + "|" + timeRTC + "|" + GPSStatus + "|" + TargetLat + "|" + TargetLon + "|" + BMEtempC + "|" + BMEhumid + "|" + BMEaltitudeM + "|" + BMEpressure + "|" + CCS811CO2 + "|" + CCS811TVOC + "|\r"; char msg[zzzzzz.length() + 1]; zzzzzz.toCharArray(msg, zzzzzz.length() + 1); appendFile(SD, "/espdata.txt", msg ); } // List Dir void listDir(fs::FS &fs, const char * dirname, uint8_t levels){ 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){ 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){ path; File file = fs.open(path, FILE_APPEND); if(!file){ return; } if(file.print(message)){ ; } else { ; } file.close(); }
setup.ino
// Setup void setup() { // EEPROM Size EEPROM.begin(EEPROM_SIZE); // EEPROM Unique ID isUID(); // GPS Receiver // Setup GPS setupGPS(); // SHARP Display Start & Clear the Display display.begin(); // Clear Display display.clearDisplay(); // Display UID isDisplayUID(); // Wire - Inialize I2C Hardware Wire.begin(); // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure myBME280.begin(); // CCS811 - eCO2 & tVOC myCCS811.begin(); // Initialize the LED Green pinMode(iLEDGreen, OUTPUT); // Date & Time RTC // PCF8523 Precision RTC setupRTC(); // Date & Time isRTC(); // microSD Card setupSD(); // Slide Switch pinMode(iSS1, INPUT); delay( 5000 ); }
Technology Experience
- 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
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
- Robotics
- Arduino
- Raspberry Pi
- Espressif
Follow Us
The Alpha Geek
Aphasia
https://www.donluc.com/?page_id=2149
J. Luc Paquin – Curriculum Vitae
https://www.donluc.com/DLHackster/LucPaquinCVEngMk2020a.pdf
Web: https://www.donluc.com/
Web: http://www.jlpconsultants.com/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
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/
Don Luc
Project #15: Environment – SparkFun GPS Receiver – GP-20U7 – Mk04
——
#DonLuc #Environment #Microcontrollers #ESP32 #Adalogger #GPS #SparkFun #Fritzing #Programming #Adafruit #Arduino #Electronics #Consultant #Vlog #Aphasia
——
——
——
——
DL2004Mk11
1 x SparkFun Thing Plus – ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x SparkFun Environmental Combo Breakout – CCS811/BME280
1 x Adafruit Adalogger FeatherWing – RTC + SD
1 x SparkFun GPS Receiver – GP-20U7
1 x CR1220 12mm Lithium Battery
1 x 32Gb microSD Card
1 x Mountable Slide Switch
1 x Qwiic Cable – 100mm
1 x LED Green
1 x 10K Ohm
2 x Jumper Wires 3in M/M
5 x Jumper Wires 6in M/M
13 x Wire Solid Core – 22 AWG
1 x Full-Size Breadboard
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
LEG – Digital 21
SCK – Digital 13
MOS – Digital 12
SSD – Digital 27
SDA – Digital 23
SCL – Digital 22
SD1 – Digital 33
SC2 – Digital 5
MO2 – Digital 18
MI2 – Digital 19
SS1 – Digital 16
GPS – Digital 4
VIN – +3.3V
GND – GND
DL2004Mk11p.ino
// ***** Don Luc Electronics © ***** // Software Version Information // Project #15: Environment - Adafruit Adalogger FeatherWing - RTC + SD - Mk04 // 04-11 // DL2004Mk11p.ino 15-04 // EEPROM with Unique ID // 1 x SparkFun Thing Plus - ESP32 WROOM // 1 x Adafruit SHARP Memory Display // 1 x SparkFun Environmental Combo Breakout - CCS811/BME280 // 1 x Adafruit Adalogger FeatherWing - RTC + SD // 1 x SparkFun GPS Receiver - GP-20U7 // 1 x CR1220 12mm Lithium Battery // 1 x 32Gb microSD Card // 1 x Mountable Slide Switch // 1 x Qwiic Cable - 100mm // 1 x LED Green // 1 x 10K Ohm // 2 x Jumper Wires 3in M/M // 5 x Jumper Wires 6in M/M // 13 x Wire Solid Core - 22 AWG // 1 x Full-Size Breadboard // 1 x SparkFun Cerberus USB Cable // Include the Library Code // EEPROM Library to Read and Write EEPROM with Unique ID for Unit #include "EEPROM.h" // Wire #include <Wire.h> // SHARP Memory Display #include <Adafruit_SharpMem.h> #include <Adafruit_GFX.h> // SparkFun CCS811 - eCO2 & tVOC #include <SparkFunCCS811.h> // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure #include <SparkFunBME280.h> // Date and Time #include "RTClib.h" // SD Card #include "FS.h" #include "SD.h" #include "SPI.h" // GPS Receiver #include <TinyGPS++.h> // Hardware Serial #include <HardwareSerial.h> // LED Green int iLEDGreen = 21; // SHARP Memory Display // any pins can be used #define SHARP_SCK 13 #define SHARP_MOSI 12 #define SHARP_SS 27 // Set the size of the display here - 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 // 1/2 of lesser of display width or height int minorHalfSize; // SparkFun CCS811 - eCO2 & tVOC // Default I2C Address #define CCS811_ADDR 0x5B CCS811 myCCS811(CCS811_ADDR); float CCS811CO2 = 0; float CCS811TVOC = 0; // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure BME280 myBME280; float BMEtempC = 0; float BMEhumid = 0; float BMEaltitudeM = 0; float BMEpressure = 0; // Date and Time // PCF8523 Precision RTC RTC_PCF8523 rtc; String dateRTC = ""; String timeRTC = ""; // microSD Card const int chipSelect = 33; String zzzzzz = ""; // Mountable Slide Switch int iSS1 = 16; // State int iSS1State = 0; // ESP32 HardwareSerial HardwareSerial tGPS(2); // GPS Receiver #define gpsRXPIN 4 // This one is unused and doesnt have a conection #define gpsTXPIN 36 // The TinyGPS++ object TinyGPSPlus gps; float TargetLat; float TargetLon; int GPSStatus = 0; // Software Version Information String sver = "15-04"; // EEPROM Unique ID Information #define EEPROM_SIZE 64 String uid = ""; void loop() { // Receives NEMA data from GPS receiver isGPS(); // Date and Time isRTC(); // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure isBME280(); // SparkFun CCS811 - eCO2 & tVOC isCCS811(); // Display Environmental isDisplayEnvironmental(); // 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 digitalWrite(iLEDGreen, HIGH ); // microSD Card isSD(); } else { // iLEDGreen digitalWrite(iLEDGreen, LOW ); } delay( 1000 ); }
getBME280.ino
// SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure // isBME280 - Humidity, Temperature, Altitude and Barometric Pressure void isBME280(){ // Temperature Celsius BMEtempC = myBME280.readTempC(); // Humidity BMEhumid = myBME280.readFloatHumidity(); // Altitude Meters BMEaltitudeM = (myBME280.readFloatAltitudeMeters(), 2); // Barometric Pressure BMEpressure = myBME280.readFloatPressure(); }
getCCS811.ino
// CCS811 - eCO2 & tVOC // isCCS811 - eCO2 & tVOC void isCCS811(){ // This sends the temperature & humidity data to the CCS811 myCCS811.setEnvironmentalData(BMEhumid, BMEtempC); // Calling this function updates the global tVOC and eCO2 variables myCCS811.readAlgorithmResults(); // eCO2 Concentration CCS811CO2 = myCCS811.getCO2(); // tVOC Concentration CCS811TVOC = myCCS811.getTVOC(); }
getDisplay.ino
// Display // SHARP Memory Display - UID void isDisplayUID() { // Text Display display.setRotation(4); display.setTextSize(3); display.setTextColor(BLACK); // Don Luc Electronics display.setCursor(0,10); display.println( "Don Luc" ); display.setTextSize(2); display.setCursor(0,40); display.println( "Electronics" ); // Version display.setTextSize(3); display.setCursor(0,70); display.println( "Version" ); display.setTextSize(2); display.setCursor(0,100); display.println( sver ); // EEPROM Unique ID display.setTextSize(1); display.setCursor(0,130); display.println( "EEPROM Unique ID" ); display.setTextSize(2); display.setCursor(0,145); display.println( uid ); // Refresh display.refresh(); delay( 100 ); } // Display Environmental void isDisplayEnvironmental(){ // Text Display Environmental // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(1); display.setTextColor(BLACK); // Temperature Celsius display.setCursor(0,0); display.println( "Temperature Celsius" ); display.setCursor(0,10); display.print( BMEtempC ); display.println( " C" ); // Humidity display.setCursor(0,20); display.println( "Humidity" ); display.setCursor(0,30); display.print( BMEhumid ); display.println( "%" ); // Altitude Meters display.setCursor(0,40); display.println( "Altitude Meters" ); display.setCursor(0,50); display.print( BMEaltitudeM ); display.println( " m" ); // Pressure display.setCursor(0,60); display.println( "Barometric Pressure" ); display.setCursor(0,70); display.print( BMEpressure ); display.println( " Pa" ); // eCO2 Concentration display.setCursor(0,80); display.println( "eCO2 Concentration" ); display.setCursor(0,90); display.print( CCS811CO2 ); display.println( " ppm" ); // tVOC Concentration display.setCursor(0,100); display.println( "tVOC Concentration" ); display.setCursor(0,110); display.print( CCS811TVOC ); display.println( " ppb" ); // Date display.setCursor(0,120); display.println( dateRTC ); // Time display.setCursor(0,130); display.println( timeRTC ); // GPS Status display.setCursor(0,140); display.println( GPSStatus ); // Target Latitude display.setCursor(0,150); display.println( TargetLat ); // Target Longitude display.setCursor(0,160); display.println( TargetLon ); // Refresh display.refresh(); delay( 100 ); }
getEEPROM.ino
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getGPS.ino
// GPS Receiver // Setup GPS void setupGPS() { // Setup GPS tGPS.begin( 9600 , SERIAL_8N1, gpsRXPIN, gpsTXPIN ); } // isGPS void isGPS(){ // Receives NEMA data from GPS receiver // This sketch displays information every time a new sentence is correctly encoded. while ( tGPS.available() > 0) if (gps.encode( tGPS.read() )) { displayInfo(); } if (millis() > 5000 && gps.charsProcessed() < 10) { while(true); } } // GPS Vector Pointer Target void displayInfo(){ // Location if (gps.location.isValid()) { TargetLat = gps.location.lat(); TargetLon = gps.location.lng(); GPSStatus = 2; } else { GPSStatus = 0; } }
getRTC.ino
// Date & Time // PCF8523 Precision RTC void setupRTC() { // Date & Time // pcf8523 Precision RTC if (! rtc.begin()) { while (1); } if (! rtc.initialized()) { // Following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: // rtc.adjust(DateTime(2018, 9, 29, 12, 17, 0)); } } // Date and Time RTC void isRTC () { // Date and Time dateRTC = ""; timeRTC = ""; 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; }
getSD.ino
// microSD Card // microSD Setup void setupSD() { // microSD Card pinMode( chipSelect , OUTPUT ); if(!SD.begin( chipSelect )){ ; return; } uint8_t cardType = SD.cardType(); if(cardType == CARD_NONE){ ; return; } //Serial.print("SD Card Type: "); if(cardType == CARD_MMC){ ; } else if(cardType == CARD_SD){ ; } else if(cardType == CARD_SDHC){ ; } else { ; } uint64_t cardSize = SD.cardSize() / (1024 * 1024); } // microSD Card void isSD() { zzzzzz = ""; // EEPROM Unique ID|Version|Date|Time|GPS Status|Target Latitude|Target Longitude|Temperature Celsius|Humidity|Altitude Meters|Barometric Pressure|eCO2 Concentration|tVOC Concentration zzzzzz = uid + "|" + sver + "|" + dateRTC + "|" + timeRTC + "|" + GPSStatus + "|" + TargetLat + "|" + TargetLon + "|" + BMEtempC + "|" + BMEhumid + "|" + BMEaltitudeM + "|" + BMEpressure + "|" + CCS811CO2 + "|" + CCS811TVOC + "|\r"; char msg[zzzzzz.length() + 1]; zzzzzz.toCharArray(msg, zzzzzz.length() + 1); appendFile(SD, "/espdata.txt", msg ); } // List Dir void listDir(fs::FS &fs, const char * dirname, uint8_t levels){ 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){ 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){ path; File file = fs.open(path, FILE_APPEND); if(!file){ return; } if(file.print(message)){ ; } else { ; } file.close(); }
setup.ino
// Setup void setup() { // EEPROM Size EEPROM.begin(EEPROM_SIZE); // EEPROM Unique ID isUID(); // GPS Receiver // Setup GPS setupGPS(); // SHARP Display Start & Clear the Display display.begin(); // Clear Display display.clearDisplay(); // Display UID isDisplayUID(); // Wire - Inialize I2C Hardware Wire.begin(); // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure myBME280.begin(); // CCS811 - eCO2 & tVOC myCCS811.begin(); // Initialize the LED Green pinMode(iLEDGreen, OUTPUT); // Date & Time RTC // PCF8523 Precision RTC setupRTC(); // Date & Time isRTC(); // microSD Card setupSD(); // Slide Switch pinMode(iSS1, INPUT); delay( 10000 ); }
Technology Experience
- 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
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
- Robotics
- Arduino
- Raspberry Pi
- Espressif
Follow Us
The Alpha Geek
Aphasia
https://www.donluc.com/?page_id=2149
J. Luc Paquin – Curriculum Vitae
https://www.donluc.com/DLHackster/LucPaquinCVEngMk2020a.pdf
Web: https://www.donluc.com/
Web: http://www.jlpconsultants.com/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
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/
Don Luc
Project #15: Environment – Adafruit Adalogger FeatherWing – RTC + SD – Mk03
——
#DonLuc #Environment #Microcontrollers #ESP32 #Adalogger #SparkFun #Fritzing #Programming #Adafruit #Arduino #Electronics #Consultant #Vlog #Aphasia
——
——
——
——
——
——
DL2004Mk09
1 x SparkFun Thing Plus – ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x SparkFun Environmental Combo Breakout – CCS811/BME280
1 x Adafruit Adalogger FeatherWing – RTC + SD
1 x CR1220 12mm Lithium Battery
1 x 32Gb microSD Card
1 x Mountable Slide Switch
1 x Qwiic Cable – 100mm
1 x LED Green
1 x 10K Ohm
2 x Jumper Wires 3in M/M
5 x Jumper Wires 6in M/M
10 x Wire Solid Core – 22 AWG
1 x Full-Size Breadboard
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
LEG – Digital 21
SCK – Digital 13
MOS – Digital 12
SSD – Digital 27
SDA – Digital 23
SCL – Digital 22
SD1 – Digital 33
SC2 – Digital 5
MO2 – Digital 18
MI2 – Digital 19
SS1 – Digital 16
VIN – +3.3V
GND – GND
DL2004Mk09p.ino
// ***** Don Luc Electronics © ***** // Software Version Information // Project #15: Environment - Adafruit Adalogger FeatherWing - RTC + SD - Mk03 // 04-09 // DL2004Mk09p.ino 15-03 // EEPROM with Unique ID // 1 x SparkFun Thing Plus - ESP32 WROOM // 1 x Adafruit SHARP Memory Display // 1 x SparkFun Environmental Combo Breakout - CCS811/BME280 // 1 x Adafruit Adalogger FeatherWing - RTC + SD // 1 x CR1220 12mm Lithium Battery // 1 x 32Gb microSD Card // 1 x Mountable Slide Switch // 1 x Qwiic Cable - 100mm // 1 x LED Green // 1 x 10K Ohm // 2 x Jumper Wires 3in M/M // 5 x Jumper Wires 6in M/M // 10 x Wire Solid Core - 22 AWG // 1 x Full-Size Breadboard // 1 x SparkFun Cerberus USB Cable // Include the Library Code // EEPROM Library to Read and Write EEPROM with Unique ID for Unit #include "EEPROM.h" // Wire #include <Wire.h> // SHARP Memory Display #include <Adafruit_SharpMem.h> #include <Adafruit_GFX.h> // SparkFun CCS811 - eCO2 & tVOC #include <SparkFunCCS811.h> // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure #include <SparkFunBME280.h> // Date and Time #include "RTClib.h" // SD Card #include "FS.h" #include "SD.h" #include "SPI.h" // LED Green int iLEDGreen = 21; // SHARP Memory Display // any pins can be used #define SHARP_SCK 13 #define SHARP_MOSI 12 #define SHARP_SS 27 // Set the size of the display here - 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 // 1/2 of lesser of display width or height int minorHalfSize; // SparkFun CCS811 - eCO2 & tVOC // Default I2C Address #define CCS811_ADDR 0x5B CCS811 myCCS811(CCS811_ADDR); float CCS811CO2 = 0; float CCS811TVOC = 0; // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure BME280 myBME280; float BMEtempC = 0; float BMEhumid = 0; float BMEaltitudeM = 0; float BMEpressure = 0; // Date and Time // PCF8523 Precision RTC RTC_PCF8523 rtc; String dateRTC = ""; String timeRTC = ""; // microSD Card const int chipSelect = 33; String zzzzzz = ""; // Mountable Slide Switch int iSS1 = 16; // State int iSS1State = 0; // Software Version Information String sver = "15-03"; // EEPROM Unique ID Information #define EEPROM_SIZE 64 String uid = ""; void loop() { // Date and Time isRTC(); // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure isBME280(); // SparkFun CCS811 - eCO2 & tVOC isCCS811(); // Display Environmental isDisplayEnvironmental(); // 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 digitalWrite(iLEDGreen, HIGH ); // microSD Card isSD(); } else { // iLEDGreen digitalWrite(iLEDGreen, LOW ); } delay( 1000 ); }
getBME280.ino
// SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure // isBME280 - Humidity, Temperature, Altitude and Barometric Pressure void isBME280(){ // Temperature Celsius BMEtempC = myBME280.readTempC(); // Humidity BMEhumid = myBME280.readFloatHumidity(); // Altitude Meters BMEaltitudeM = (myBME280.readFloatAltitudeMeters(), 2); // Barometric Pressure BMEpressure = myBME280.readFloatPressure(); }
getCCS811.ino
// CCS811 - eCO2 & tVOC // isCCS811 - eCO2 & tVOC void isCCS811(){ // This sends the temperature & humidity data to the CCS811 myCCS811.setEnvironmentalData(BMEhumid, BMEtempC); // Calling this function updates the global tVOC and eCO2 variables myCCS811.readAlgorithmResults(); // eCO2 Concentration CCS811CO2 = myCCS811.getCO2(); // tVOC Concentration CCS811TVOC = myCCS811.getTVOC(); }
getDisplay.ino
// Display // SHARP Memory Display - UID void isDisplayUID() { // Text Display display.setRotation(4); display.setTextSize(3); display.setTextColor(BLACK); // Don Luc Electronics display.setCursor(0,10); display.println( "Don Luc" ); display.setTextSize(2); display.setCursor(0,40); display.println( "Electronics" ); // Version display.setTextSize(3); display.setCursor(0,70); display.println( "Version" ); display.setTextSize(2); display.setCursor(0,100); display.println( sver ); // EEPROM Unique ID display.setTextSize(1); display.setCursor(0,130); display.println( "EEPROM Unique ID" ); display.setTextSize(2); display.setCursor(0,145); display.println( uid ); // Refresh display.refresh(); delay( 100 ); } // Display Environmental void isDisplayEnvironmental(){ // Text Display Environmental // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(1); display.setTextColor(BLACK); // Temperature Celsius display.setCursor(0,0); display.println( "Temperature Celsius" ); display.setCursor(0,10); display.print( BMEtempC ); display.println( " C" ); // Humidity display.setCursor(0,20); display.println( "Humidity" ); display.setCursor(0,30); display.print( BMEhumid ); display.println( "%" ); // Altitude Meters display.setCursor(0,40); display.println( "Altitude Meters" ); display.setCursor(0,50); display.print( BMEaltitudeM ); display.println( " m" ); // Pressure display.setCursor(0,60); display.println( "Barometric Pressure" ); display.setCursor(0,70); display.print( BMEpressure ); display.println( " Pa" ); // eCO2 Concentration display.setCursor(0,80); display.println( "eCO2 Concentration" ); display.setCursor(0,90); display.print( CCS811CO2 ); display.println( " ppm" ); // tVOC Concentration display.setCursor(0,100); display.println( "tVOC Concentration" ); display.setCursor(0,110); display.print( CCS811TVOC ); display.println( " ppb" ); // Date display.setCursor(0,120); display.println( dateRTC ); // Time display.setCursor(0,130); display.println( timeRTC ); // Refresh display.refresh(); delay( 100 ); }
getEEPROM.ino
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getRTC.ino
// Date & Time // PCF8523 Precision RTC void setupRTC() { // Date & Time // pcf8523 Precision RTC if (! rtc.begin()) { while (1); } if (! rtc.initialized()) { // Following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: // rtc.adjust(DateTime(2018, 9, 29, 12, 17, 0)); } } // Date and Time RTC void isRTC () { // Date and Time dateRTC = ""; timeRTC = ""; 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; }
getSD.ino
// microSD Card // microSD Setup void setupSD() { // microSD Card pinMode( chipSelect , OUTPUT ); if(!SD.begin( chipSelect )){ ; return; } uint8_t cardType = SD.cardType(); if(cardType == CARD_NONE){ ; return; } //Serial.print("SD Card Type: "); if(cardType == CARD_MMC){ ; } else if(cardType == CARD_SD){ ; } else if(cardType == CARD_SDHC){ ; } else { ; } uint64_t cardSize = SD.cardSize() / (1024 * 1024); } // microSD Card void isSD() { zzzzzz = ""; // EEPROM Unique ID|Version|Date|Time|Temperature Celsius|Humidity|Altitude Meters|Barometric Pressure|eCO2 Concentration|tVOC Concentration zzzzzz = uid + "|" + sver + "|" + dateRTC + "|" + timeRTC + "|" + BMEtempC + "|" + BMEhumid + "|" + BMEaltitudeM + "|" + BMEpressure + "|" + CCS811CO2 + "|" + CCS811TVOC + "|\r"; char msg[zzzzzz.length() + 1]; zzzzzz.toCharArray(msg, zzzzzz.length() + 1); appendFile(SD, "/espdata.txt", msg ); } // List Dir void listDir(fs::FS &fs, const char * dirname, uint8_t levels){ 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){ 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){ path; File file = fs.open(path, FILE_APPEND); if(!file){ return; } if(file.print(message)){ ; } else { ; } file.close(); }
setup.ino
// Setup void setup() { // EEPROM Size EEPROM.begin(EEPROM_SIZE); // EEPROM Unique ID isUID(); // SHARP Display Start & Clear the Display display.begin(); // Clear Display display.clearDisplay(); // Display UID isDisplayUID(); // Wire - Inialize I2C Hardware Wire.begin(); // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure myBME280.begin(); // CCS811 - eCO2 & tVOC myCCS811.begin(); // Initialize the LED Green pinMode(iLEDGreen, OUTPUT); // Date & Time RTC // PCF8523 Precision RTC setupRTC(); // Date & Time isRTC(); // microSD Card setupSD(); // Slide Switch pinMode(iSS1, INPUT); delay( 10000 ); }
Technology Experience
- 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
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
- Robotics
- Arduino
- Raspberry Pi
- Espressif
Follow Us
The Alpha Geek
Aphasia
https://www.donluc.com/?page_id=2149
J. Luc Paquin – Curriculum Vitae
https://www.donluc.com/DLHackster/LucPaquinCVEngMk2020a.pdf
Web: https://www.donluc.com/
Web: http://www.jlpconsultants.com/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
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/
Don Luc
Project #15: Environment – SparkFun Environmental CCS811/BME280 – Mk02
——
#DonLuc #Environment #Microcontrollers #ESP32 #SparkFun #Fritzing #Programming #Adafruit #Arduino #Electronics #Consultant #Vlog #Aphasia
——
——
——
——
——
DL2004Mk05
1 x SparkFun Thing Plus – ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x SparkFun Environmental Combo Breakout – CCS811/BME280
1 x Qwiic Cable – 100mm
1 x LED Green
4 x Jumper Wires 3in M/M
5 x Wire Solid Core – 22 AWG
1 x Full-Size Breadboard
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
LEG – Digital 21
SCK – Digital 13
MOS – Digital 12
SSD – Digital 27
VIN – +3.3V
GND – GND
DL2004Mk05p.ino
// ***** Don Luc Electronics © ***** // Software Version Information // Project #15: Environment - SparkFun Environmental Combo Breakout - CCS811/BME280 - Mk02 // 04-05 // DL2004Mk05p.ino 15-02 // EEPROM with Unique ID // 1 x SparkFun Thing Plus - ESP32 WROOM // 1 x Adafruit SHARP Memory Display // 1 x SparkFun Environmental Combo Breakout - CCS811/BME280 // 1 x Qwiic Cable - 100mm // 1 x LED Green // 4 x Jumper Wires 3in M/M // 5 x Wire Solid Core - 22 AWG // 1 x Full-Size Breadboard // 1 x SparkFun Cerberus USB Cable // Include the Library Code // EEPROM Library to Read and Write EEPROM with Unique ID for Unit #include "EEPROM.h" // Wire #include <Wire.h> // SHARP Memory Display #include <Adafruit_SharpMem.h> #include <Adafruit_GFX.h> // SparkFun CCS811 - eCO2 & tVOC #include <SparkFunCCS811.h> // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure #include <SparkFunBME280.h> // LED Green int iLEDGreen = 21; // SHARP Memory Display // any pins can be used #define SHARP_SCK 13 #define SHARP_MOSI 12 #define SHARP_SS 27 // Set the size of the display here - 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 // 1/2 of lesser of display width or height int minorHalfSize; // SparkFun CCS811 - eCO2 & tVOC // Default I2C Address #define CCS811_ADDR 0x5B CCS811 myCCS811(CCS811_ADDR); float CCS811CO2 = 0; float CCS811TVOC = 0; // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure BME280 myBME280; float BMEtempC = 0; float BMEhumid = 0; float BMEaltitudeM = 0; float BMEpressure = 0; // Software Version Information String sver = "15-02"; // EEPROM Unique ID Information #define EEPROM_SIZE 64 String uid = ""; void loop() { // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure isBME280(); // SparkFun CCS811 - eCO2 & tVOC isCCS811(); // Display Environmental isDisplayEnvironmental(); delay( 1000 ); }
getBME280.ino
// SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure // isBME280 - Humidity, Temperature, Altitude and Barometric Pressure void isBME280(){ // Temperature Celsius BMEtempC = myBME280.readTempC(); // Humidity BMEhumid = myBME280.readFloatHumidity(); // Altitude Meters BMEaltitudeM = (myBME280.readFloatAltitudeMeters(), 2); // Barometric Pressure BMEpressure = myBME280.readFloatPressure(); }
getCCS811.ino
// CCS811 - eCO2 & tVOC // isCCS811 - eCO2 & tVOC void isCCS811(){ // This sends the temperature & humidity data to the CCS811 myCCS811.setEnvironmentalData(BMEhumid, BMEtempC); // Calling this function updates the global tVOC and eCO2 variables myCCS811.readAlgorithmResults(); // eCO2 Concentration CCS811CO2 = myCCS811.getCO2(); // tVOC Concentration CCS811TVOC = myCCS811.getTVOC(); }
getDisplay.ino
// Display // SHARP Memory Display - UID void isDisplayUID() { // Text Display display.setRotation(4); display.setTextSize(3); display.setTextColor(BLACK); // Don Luc Electronics display.setCursor(0,10); display.println( "Don Luc" ); display.setTextSize(2); display.setCursor(0,40); display.println( "Electronics" ); // Version display.setTextSize(3); display.setCursor(0,70); display.println( "Version" ); display.setTextSize(2); display.setCursor(0,100); display.println( sver ); // EEPROM Unique ID display.setTextSize(1); display.setCursor(0,130); display.println( "EEPROM Unique ID" ); display.setTextSize(2); display.setCursor(0,145); display.println( uid ); // Refresh display.refresh(); delay( 100 ); } // Display Environmental void isDisplayEnvironmental(){ // Text Display Environmental // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(1); display.setTextColor(BLACK); // Temperature Celsius display.setCursor(0,0); display.println( "Temperature Celsius" ); display.setCursor(0,10); display.print( BMEtempC ); display.println( " C" ); // Humidity display.setCursor(0,20); display.println( "Humidity" ); display.setCursor(0,30); display.print( BMEhumid ); display.println( "%" ); // Altitude Meters display.setCursor(0,40); display.println( "Altitude Meters" ); display.setCursor(0,50); display.print( BMEaltitudeM ); display.println( " m" ); // Pressure display.setCursor(0,60); display.println( "Barometric Pressure" ); display.setCursor(0,70); display.print( BMEpressure ); display.println( " Pa" ); // eCO2 Concentration display.setCursor(0,80); display.println( "eCO2 Concentration" ); display.setCursor(0,90); display.print( CCS811CO2 ); display.println( " ppm" ); // tVOC Concentration display.setCursor(0,100); display.println( "tVOC Concentration" ); display.setCursor(0,110); display.print( CCS811TVOC ); display.println( " ppb" ); // Refresh display.refresh(); delay( 100 ); }
getEEPROM.ino
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
setup.ino
// Setup void setup() { // EEPROM Size EEPROM.begin(EEPROM_SIZE); // EEPROM Unique ID isUID(); // SHARP Display Start & Clear the Display display.begin(); // Clear Display display.clearDisplay(); // Display UID isDisplayUID(); // Wire - Inialize I2C Hardware Wire.begin(); // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure myBME280.begin(); // CCS811 - eCO2 & tVOC myCCS811.begin(); delay( 10000 ); // LED Green pinMode(iLEDGreen, OUTPUT); digitalWrite(iLEDGreen, HIGH); }
Technology Experience
- 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
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
- Robotics
- Arduino
- Raspberry Pi
- Espressif
Follow Us
The Alpha Geek
Aphasia
https://www.donluc.com/?page_id=2149
J. Luc Paquin – Curriculum Vitae
https://www.donluc.com/DLHackster/LucPaquinCVEngMk2020a.pdf
Web: https://www.donluc.com/
Web: http://www.jlpconsultants.com/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
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/
Don Luc
Project #15: Environment – SparkFun Thing Plus – ESP32 WROOM – Mk01
——
#DonLuc #Environment #Electronics #Microcontrollers #ESP32 #SparkFun #Fritzing #Programming #Adafruit #Arduino #Consultant #Vlog #Aphasia
——
——
——
——
——
DL2004Mk04
1 x SparkFun Thing Plus – ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x LED Green
4 x Jumper Wires 3in M/M
5 x Wire Solid Core – 22 AWG
1 x Half-Size Breadboard
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
LEG – Digital 21
SCK – Digital 13
MOS – Digital 12
SSD – Digital 27
VIN – +3.3V
GND – GND
DL2004Mk04p.ino
// ***** Don Luc Electronics © ***** // Software Version Information // Project #15: Environment - SparkFun Thing Plus - ESP32 WROOM - Mk01 // 04-04 // DL2004Mk04p.ino 15-01 // EEPROM with Unique ID // 1 x SparkFun Thing Plus - ESP32 WROOM // 1 x Adafruit SHARP Memory Display // 1 x LED Green // 4 x Jumper Wires 3in M/M // 5 x Wire Solid Core - 22 AWG // 1 x Half-Size Breadboard // 1 x SparkFun Cerberus USB Cable // Include the library code: // EEPROM library to read and write EEPROM with unique ID for unit #include "EEPROM.h" #include <Adafruit_SharpMem.h> #include <Adafruit_GFX.h> // LED Green int iLEDGreen = 21; // SHARP Memory Display // any pins can be used #define SHARP_SCK 13 #define SHARP_MOSI 12 #define SHARP_SS 27 // Set the size of the display here - 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 int minorHalfSize; // 1/2 of lesser of display width or height // Software Version Information #define EEPROM_SIZE 64 String sver = "15-01"; // Unit ID information String uid = ""; void loop() { // Return }
getDisplay.ino
// Display // SHARP Memory Display - UID void isDisplayUID() { // text display EEPROM display.setRotation(4); display.setTextSize(3); display.setTextColor(BLACK); display.setCursor(0,20); display.println( "Don Luc" ); display.setTextSize(2); display.setCursor(0,50); display.println( "Electronics" ); display.setTextSize(3); display.setCursor(0,80); display.println( sver ); display.setCursor(0,120); display.println( uid ); display.refresh(); delay( 100 ); }
getEEPROM.ino
// EEPROM // isUID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
setup.ino
// Setup void setup() { // EEPROM with unique ID EEPROM.begin(EEPROM_SIZE); // EEPROM Unit ID isUID(); // SHARP Display start & clear the display display.begin(); display.clearDisplay(); isDisplayUID(); delay( 5000 ); // LED Green pinMode(iLEDGreen, OUTPUT); digitalWrite(iLEDGreen, HIGH); }
Technology Experience
- 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
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
- Robotics
- Arduino
- Raspberry Pi
- Espressif
Follow Us
The Alpha Geek
Aphasia
https://www.donluc.com/?page_id=2149
J. Luc Paquin – Curriculum Vitae
https://www.donluc.com/DLHackster/LucPaquinCVEngMk2020a.pdf
Web: https://www.donluc.com/
Web: http://www.jlpconsultants.com/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
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/
Don Luc
Project #12: Robotics – Unmanned Vehicles 1h – Mk12
——
——
——
——
——
Pololu Stepper Motor Bipolar, 200 Steps/Rev, 2.8V, 1.7 A/Phase
This hybrid bipolar stepping motor has a 1.8° step angle (200 steps/revolution). Each phase draws 1.7 A at 2.8 V, allowing for a holding torque of 3.7 kg-cm. The motor has four color-coded wires terminated with bare leads: black and green connect to one coil; red and blue connect to the other.
DL2003Mk05
1 x SparkFun RedBoard Qwiic
2 x Pololu DRV8834 Low-Voltage Stepper Motor Driver Carrier
2 x Electrolytic Decoupling Capacitors – 100uF/25V
2 x Pololu Stepper Motor Bipolar, 2.8V, 1.7 A/Phase
2 x Pololu Universal Aluminum Mounting Hub for 5mm Shaft, M3 Holes
1 x Adafruit Perma-Proto Half-sized Breadboard PCB
14 x Wire Solid Core – 22 AWG
1 x SparkFun Cerberus USB Cable
SparkFun RedBoard Qwiic
SP1 – Digital 9
DI1 – Digital 8
SP2 – Digital 7
DI2 – Digital 6
VIN – 3.3V
GND – GND
DL2003Mk05Rp.ino
// ***** Don Luc Electronics © ***** // Software Version Information // Project #12: Robotics - Unmanned Vehicles 1h - Mk12 // 03-05 // DL2003Mk05Rp.ino 12-12 // Receiver // 1 x SparkFun RedBoard Qwiic // 2 x Pololu DRV8834 Low-Voltage Stepper Motor Driver Carrier // 2 x Electrolytic Decoupling Capacitors - 100uF/25V // 2 x Pololu Stepper Motor Bipolar, 2.8V, 1.7 A/Phase // 2 x Pololu Universal Aluminum Mounting Hub for 5mm Shaft, M3 Holes // 1 x Adafruit Perma-Proto Half-sized Breadboard PCB // Include the library code: // DRV8834 Stepper Motor Driver #include <BasicStepperDriver.h> #include <MultiDriver.h> // DRV8834 Stepper Motor Driver // Stepper motor steps per revolution. Most steppers are 200 steps or 1.8 degrees/step #define MOTOR_STEPS 200 // Target RPM for X axis stepper motor #define MOTOR_X_RPM 800 // Target RPM for Y axis stepper motor #define MOTOR_Y_RPM 800 // Since microstepping is set externally, make sure this matches the selected mode // If it doesn't, the motor will move at a different RPM than chosen // 1=full step, 2=half step etc. #define MICROSTEPS 1 // X Stepper motor #define DIR_X 8 #define STEP_X 9 // Y Stepper motor #define DIR_Y 6 #define STEP_Y 7 // BasicStepperDriver BasicStepperDriver stepperX(MOTOR_STEPS, DIR_X, STEP_X); BasicStepperDriver stepperY(MOTOR_STEPS, DIR_Y, STEP_Y); // Pick one of the two controllers below each motor moves independently MultiDriver controller(stepperX, stepperY); // Software Version Information String sver = "12-12"; // Unit ID information String uid = ""; void loop() { controller.rotate(360, 360); }
getStepper.ino
// Stepper // isStepperSetup void isStepperSetup() { // Set stepper target motors RPM. stepperX.begin(MOTOR_X_RPM, MICROSTEPS); stepperY.begin(MOTOR_Y_RPM, MICROSTEPS); }
setup.ino
// Setup void setup() { // DRV8834 Stepper Motor Driver isStepperSetup(); }
Technology Experience
- 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
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
- Robotics
- Arduino
- Raspberry Pi
- Espressif
Follow Us
The Alpha Geek
Aphasia
https://www.donluc.com/?page_id=2149
J. Luc Paquin – Curriculum Vitae
https://www.donluc.com/DLHackster/LucPaquinCVEngMk2020a.pdf
Web: https://www.donluc.com/
Web: http://www.jlpconsultants.com/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
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/
Don Luc
Project #12: Robotics – Unmanned Vehicles 1f – Mk10
——
——
——
——
——
——
——
——
——
Transmitter
DL2002Mk07
1 x Arduino UNO – R3
1 x ProtoScrewShield
1 x Adafruit RGB LCD Shield 16×2 Character Display
1 x XBee S1
1 x SparkFun XBee Explorer Regulated
1 x Slide Pot (Small)
1 x Knob
1 x Acrylic Blue 5.75in x 3.75in x 1/8in
24 x Screw – 4-40
12 x Standoff – Metal 4-40 – 3/8″
7 x Wire Solid Core – 22 AWG
1 x SparkFun XBee Explorer USB
1 x DIGI XCTU Software
1 x SparkFun Cerberus USB Cable
Arduino UNO
TX0 – Digital 1
RX0 – Digital 0
LP1 – Analog A0
VIN – +5V
GND – GND
XBee S1: Transmitter
CH Channel: C
PAN Id: 3333
SH Serial Number: 13A200
SL Serial Number: 40717A1F
CE Coordinator: Coordinator
BD: 9600
DL2002Mk07p.ino
// ***** Don Luc Electronics © ***** // Software Version Information // Project #12: Robotics - Unmanned Vehicles 1f - Mk10 // 02-07 // DL2002Mk01p.ino 12-10 // Arduino UNO - R3 // ProtoScrewShield // Adafruit RGB LCD Shield 16×2 Character Display // EEPROM with Unique ID // Transmitter // XBee S1 // Stepper // Slide Pot (Small) // Knob // Include the library code: // EEPROM library to read and write EEPROM with unique ID for unit #include <EEPROM.h> // Adafruit RGB LCD Shield #include <Adafruit_RGBLCDShield.h> // 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; // Communication unsigned long dTime = 50; // Slide Pot (Small) int iSP1 = A0; // Select the input pin for the slide pot int iValue = 0; // Variable to store the value // The current address in the EEPROM (i.e. which byte we're going to read to next) // Version String sver = "12-10.p"; // Unit ID Information String uid = ""; void loop() { // Clear RGBLCDShield.clear(); // set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Robotics"); // Robotics // Momentary Button momentaryButton = RGBLCDShield.readButtons(); switch ( yy ) { case 1: // Forward isSwitch1(); break; case 2: // Reverse isSwitch2(); break; case 3: // Right isSwitch3(); break; case 4: // Left isSwitch4(); break; case 5: // Stop isSwitch5(); break; default: // Stop yy = 5; RGBLCDShield.setBacklight(RED); isSwitch5(); } if ( momentaryButton ) { if ( momentaryButton & BUTTON_UP ) { yy = 1; // Forward RGBLCDShield.setBacklight(GREEN); } if ( momentaryButton & BUTTON_DOWN ) { yy = 2; // Reverse RGBLCDShield.setBacklight(VIOLET); } if ( momentaryButton & BUTTON_LEFT ) { yy = 3; // Right RGBLCDShield.setBacklight(TEAL); } if ( momentaryButton & BUTTON_RIGHT ) { yy = 4; // Left RGBLCDShield.setBacklight(YELLOW); } if ( momentaryButton & BUTTON_SELECT ) { yy = 5; // Stop RGBLCDShield.setBacklight(RED); } } // Read the value iValue = analogRead( iSP1 ); // Process Message isProcessMessage(); delay( dTime ); }
getEEPROM.ino
// EEPROM // isUID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getProcessMessage.ino
// ProcessMessage // isProcessMessage void isProcessMessage() { // Loop through serial buffer while ( Serial.available() ) { // Print = "<" + yy + "|" + sver + "|" + iValue + "*" Serial.print( '<' ); Serial.print( yy ); Serial.print( '|' ); Serial.print( iValue ); Serial.println( '*' ); } }
getSwitch.ino
// Switch // Switch 1 void isSwitch1(){ yy = 1; // Stepper // Forward RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Forward"); } // Switch 2 void isSwitch2(){ yy = 2; // Stepper // Reverse RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Reverse"); } // Switch 3 void isSwitch3(){ yy = 3; // Stepper // Right RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Right"); } // Switch 4 void isSwitch4(){ yy = 4; // Stepper // Left RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Left"); } // Switch 5 void isSwitch5(){ yy = 5; // Stepper // Stop RGBLCDShield.setCursor(0,1); RGBLCDShield.print("Stop"); }
setup.ino
// Setup void setup() { // Open serial port at 9600 baud Serial.begin( 9600 ); // Pause delay(5); // EEPROM Unit ID isUID(); // Pause delay(5); // Adafruit RGB LCD Shield // Set up the LCD's number of columns and rows: RGBLCDShield.begin(16, 2); RGBLCDShield.setBacklight(GREEN); // Display // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Don Luc Electron"); // Don luc Electron // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); RGBLCDShield.print("Robotics"); // Robotics delay(5000); // Clear RGBLCDShield.clear(); // Display // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Version: "); // Version RGBLCDShield.print( sver ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); RGBLCDShield.print("UID: "); // Unit ID Information RGBLCDShield.print( uid ); delay(5000); // Clear RGBLCDShield.clear(); }
Follow Us
J. Luc Paquin – Curriculum Vitae
https://www.donluc.com/DLHackster/LucPaquinCVEngMk2020a.pdf
Web: https://www.donluc.com/
Web: http://www.jlpconsultants.com/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: http://neosteamlabs.com/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Facebook: https://www.facebook.com/neosteam.labs.9/
Instagram: https://www.instagram.com/neosteamlabs/
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Twitter: https://twitter.com/labs_steam
Etsy: https://www.etsy.com/shop/NeoSteamLabs
Don Luc