Programming ESP32
Project #24 – RTOS – FreeRTOS – Mk01
——
#DonLucElectronics #DonLuc #ESP32 #RTOS #FreeRTOS #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Real-Time Operating System
A real-time operating system (RTOS) is an operating system for real-time applications that processes data and events that have critically defined time constraints. A RTOS is distinct from a time-sharing operating system, such as Unix, which manages the sharing of system resources with a scheduler, data buffers, or fixed task prioritization in a multitasking or multiprogramming environment. Processing time requirements need to be fully understood and bound rather than just kept as a minimum. All processing must occur within the defined constraints. Real-time operating systems are event-driven and preemptive, meaning the OS is capable of monitoring the relevant priority of competing tasks, and make changes to the task priority. Event-driven systems switch between tasks based on their priorities, while time-sharing systems switch the task based on clock interrupts.
FreeRTOS
FreeRTOS is a real-time operating system kernel for embedded devices that has been ported to 35 microcontroller platforms. It is distributed under the MIT License. FreeRTOS is designed to be small and simple. It is mostly written in the C programming language to make it easy to port and maintain. It also comprises a few assembly language functions where needed, mostly in architecture-specific scheduler routines.
FreeRTOS is ideally suited to deeply embedded real-time applications that use microcontrollers or small microprocessors. This type of application normally includes a mix of both hard and soft real-time requirements. Soft real-time requirements are those that state a time deadline, but breaching the deadline would not render the system useless. For example, responding to keystrokes too slowly might make a system seem annoyingly unresponsive without actually making it unusable.
DL2210Mk02
1 x Adafruit HUZZAH32 – ESP32 Feather
1 x 100K Potentiometer
1 x Knob
1 x SparkFun Cerberus USB Cable
ESP32 Feather
PO0 – Analog A0
LED – Digital 13
VIN – +3.3V
GND – GND
DL2210Mk02p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #24 - RTOS - FreeRTOS - Mk01 24-01 DL2210Mk02p.ino 1 x Adafruit HUZZAH32 – ESP32 Feather 1 x 100K Potentiometer 1 x Knob 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // FreeRTOS ESP32 #if CONFIG_FREERTOS_UNICORE #define ARDUINO_RUNNING_CORE 0 #else #define ARDUINO_RUNNING_CORE 1 #endif // Led Built In #ifndef LED_BUILTIN #define LED_BUILTIN 13 #endif // Define two tasks for Blink & AnalogRead void isTaskBlink( void *pvParameters ); void isTaskAnalogReadA0( void *pvParameters ); // Software Version Information String sver = "24-01"; void loop() { // Empty // Things are done in Tasks }
getTasks.ino
// Tasks // This is a Task Blink void isTaskBlink(void *pvParameters) { (void) pvParameters; // Blink // Turns on an LED on for 2 second, then off for 2 second, repeatedly // Initialize digital LED_BUILTIN on pin 13 as an output. pinMode(LED_BUILTIN, OUTPUT); // A Task shall never return or exit for (;;) { // Turn the LED on (HIGH is the voltage level) digitalWrite(LED_BUILTIN, HIGH); // One tick delay in between reads vTaskDelay(2000); // Turn the LED off by making the voltage LOW digitalWrite(LED_BUILTIN, LOW); // One tick delay in between reads vTaskDelay(2000); } } // This is a Task Analog Read Serial void isTaskAnalogReadA0(void *pvParameters) { (void) pvParameters; // Analog Read Serial // Reads an analog input on pin A0, prints the result to the serial monitor for (;;) { // Read the input on analog pin A0 int sensorValueA0 = analogRead(A0); // Print out the value you read Serial.print( "Pot A0: " ); Serial.println(sensorValueA0); // One tick delay (15ms) in between reads for stability vTaskDelay(100); } }
setup.ino
// Setup void setup() { // Initialize serial communication // at 115200 bits per second Serial.begin(115200); // Now set up two tasks to run independently // TaskBlink xTaskCreatePinnedToCore( isTaskBlink , "TaskBlink" // A name just for humans , 1024 // This stack size can be checked & adjusted by reading. , NULL , 2 // Priority, with 2 being the highest, and 0 being the lowest. , NULL , ARDUINO_RUNNING_CORE); // AnalogReadA0 xTaskCreatePinnedToCore( isTaskAnalogReadA0 , "AnalogReadA0" , 1024 // Stack size , NULL , 1 // Priority , NULL , ARDUINO_RUNNING_CORE); // Now the task scheduler, which takes over control of scheduling individual tasks, // is automatically started. }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Research & Development (R & D)
Instructor and E-Mentor
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
J. Luc Paquin – Curriculum Vitae – 2022 English & Español
https://www.jlpconsultants.com/luc/
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #16: Sound – Bluetooth – Mk21
——
#DonLucElectronics #DonLuc #ESP32 #Bluetooth #ThumbJoystick #Keyboard #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Bluetooth
Bluetooth is a short-range wireless technology standard that is used for exchanging data between fixed and mobile devices over short distances and building personal area networks. It employs UHF radio waves in the ISM bands, from 2.402 GHz to 2.48 GHz. It is mainly used as an alternative to wire connections, to exchange files between nearby portable devices, computer and connect cell phones and music players with wireless headphones. In the most widely used mode, transmission power is limited to 2.5 milliwatts, giving it a very short range of up to 10 metres.
DL2210Mk01
1 x Adafruit HUZZAH32 – ESP32 Feather
1 x Lithium Ion Battery – 2500mAh
1 x Thumb Joystick
1 x SparkFun Thumb Joystick Breakout
1 x SparkFun Cerberus USB Cable
ESP32 Feather
JY0 – Analog A0
JY1 – Analog A5
SE0 – Digital 13
VIN – +3.3V
GND – GND
——
DL2210Mk01p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #16: Sound - Bluetooth - Mk21 16-21 DL2210Mk01p.ino 1 x Adafruit HUZZAH32 – ESP32 Feather 1 x Lithium Ion Battery - 2500mAh 1 x Thumb Joystick 1 x SparkFun Thumb Joystick Breakout 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // ESP32 BLE Keyboard #include <BleKeyboard.h> // ESP32 BLE Keyboard BleKeyboard bleKeyboard; // Connections to joystick // Vertical const int VERT = A0; // Horizontal const int HORIZ = A5; // Pushbutton const int SEL = 13; // Initialize variables for analog and digital values int vertical; int horizontal; int selec; // Software Version Information String sver = "16-21"; void loop() { // ESP32 BLE Keyboard if(bleKeyboard.isConnected()) { // Thumb Joystick isThumbJoystick(); } // Delay delay( 1000 ); }
getThumbJoystick.ino
// Thumb Joystick void isThumbJoystick() { // Read all values from the joystick // Joystick was sitting around 2047 for the vertical and horizontal values // Will be 0-4095 // Vertical vertical = analogRead(VERT); if (vertical == 4095) { // Volume Up bleKeyboard.write(KEY_MEDIA_VOLUME_UP); } else if (vertical == 0) { // Volume Down bleKeyboard.write(KEY_MEDIA_VOLUME_DOWN); } // Horizontal // Will be 0-4095 horizontal = analogRead(HORIZ); if (horizontal == 4095) { // Previous Track bleKeyboard.write(KEY_MEDIA_PREVIOUS_TRACK); } else if (horizontal == 0) { // Next Track bleKeyboard.write(KEY_MEDIA_NEXT_TRACK); } // Will be HIGH (1) if not pressed, and LOW (0) if pressed selec = digitalRead(SEL); if (selec == 0) { // Play/Pause media key bleKeyboard.write(KEY_MEDIA_PLAY_PAUSE); } }
setup.ino
// Setup void setup() { // Make the SEL line an input pinMode(SEL, INPUT_PULLUP); // ESP32 BLE Keyboard bleKeyboard.begin(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Research & Development (R & D)
Instructor and E-Mentor
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
J. Luc Paquin – Curriculum Vitae – 2022 English & Español
https://www.jlpconsultants.com/luc/
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #19: Time – NeoPixel Stick – 8 – Mk11
——
#DonLucElectronics #DonLuc #Time #EMF #IMU #NeoPixel #RTC #Display #Adalogger #MicroSD #GPSReceiver #CCS811 #BME280 #Arduino #ESP32 #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog
——
——
——
——
——
Pololu Adjustable Step-Up Voltage Regulator U1V11A
This compact U1V11A switching step-up voltage regulator efficiently boosts input voltages as low as 0.5 V to an adjustable output voltage between 2 V and 5.25 V. Unlike most boost regulators, the U1V11A offers a true shutdown option that turns off power to the load, and it automatically switches to a linear down-regulation mode when the input voltage exceeds the output. The pins have a 0.1 inch spacing, making this board compatible with standard solderless breadboards.
NeoPixel Stick – 8 x 5050 RGB LED
Make your own little LED strip arrangement with this stick of NeoPixel LEDs. We crammed 8 of the tiny 5050 (5mm x 5mm) smart RGB LEDs onto a PCB with mounting holes and a chainable design. Use only one microcontroller pin to control as many as you can chain together! Each LED is addressable as the driver chip is inside the LED. Each one has ~18mA constant current drive so the color will be very consistent even if the voltage varies, and no external choke resistors are required making the design slim. Power the whole thing with 5VDC.
DL2109Mk02
1 x SparkFun Thing Plus – ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x Adalogger FeatherWing – RTC + SD
1 x SparkFun Environmental Combo CCS811/BME280 (Qwiic)
1 x Pololu MinIMU-9
1 x Telescopic Antenna SMA – 300 MHz to 1.1 GHz (ANT700)
1 x SMA Connector
1 x NeoPixel Stick – 8 x 5050 RGB LED
1 x Pololu Adjustable Step-Up Voltage Regulator U1V11A
1 x CR1220 3V Lithium Coin Cell Battery
1 x 32Gb microSD Card
1 x LED Green
1 x Rocker Switch – SPST (Round)
1 x Terminal Block Breakout FeatherWing
1 x Lithium Ion Battery – 850mAh
1 x GPS Receiver – GP-20U7
1 x Rotary Switch – 10 Position
1 x SparkFun Rotary Switch – 10 Position
1 x Black Knob
2 x Spring Terminals – PCB Mount (6-Pin)
2 x Screw Terminals 5mm Pitch (2-Pin)
2 x Breadboard Solderable
12 x 1K Ohm
1 x 3.3m Ohm
1 x FeatherWing Proto
1 x Acrylic Orange 5.75 inches x 3.75 inches x 1/8 inch
1 x Acrylic Black 5.75 inches x 3.75 inches x 1/8 inch
54 x Screw – 4-40
19 x Standoff – Metal 4-40 – 3/8″
8 x Standoff – Metal 4-40 – 1″
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
NEO – Digital 15
SCK – Digital 13
MSI – Digital 12
SS0 – Digital 27
GRX – Digital 16
GTX – Digital 17
SDA – Digital 23
SDL – Digital 22
SCK – Digital 5
MSO – Digital 19
MSI – Digital 18
SS1 – Digital 33
LEG – Digital 21
SW0 – Digital 32
ROT – Analog A0
EMF – Analog A1
VIN – +3.3V
GND – GND
——
DL2109Mk02p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #19: Time - NeoPixel Stick - 8 - Mk11 09-02 DL2109Mk02p.ino 1 x SparkFun Thing Plus - ESP32 WROOM 1 x Adafruit SHARP Memory Display 1 x Adalogger FeatherWing - RTC + SD 1 x SparkFun Environmental Combo CCS811/BME280 (Qwiic) 1 x Pololu MinIMU-9 1 x Telescopic Antenna SMA - 300 MHz to 1.1 GHz (ANT700) 1 x SMA Connector 1 x NeoPixel Stick - 8 x 5050 RGB LED 1 x Pololu Adjustable Step-Up Voltage Regulator U1V11A 1 x CR1220 3V Lithium Coin Cell Battery 1 x 32Gb microSD Card 1 x LED Green 1 x Rocker Switch - SPST (Round) 1 x Terminal Block Breakout FeatherWing 1 x Lithium Ion Battery - 850mAh 1 x GPS Receiver - GP-20U7 1 x Rotary Switch - 10 Position 1 x SparkFun Rotary Switch – 10 Position 1 x Black Knob 2 x Spring Terminals - PCB Mount (6-Pin) 2 x Screw Terminals 5mm Pitch (2-Pin) 2 x Breadboard Solderable 12 x 1K Ohm 1 x 3.3m Ohm 1 x FeatherWing Proto 1 x Acrylic Orange 5.75 inches x 3.75 inches x 1/8 inch 1 x Acrylic Black 5.75 inches x 3.75 inches x 1/8 inch 54 x Screw - 4-40 19 x Standoff - Metal 4-40 - 3/8" 8 x Standoff - Metal 4-40 - 1" 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // EEPROM Library to Read and Write EEPROM with Unique ID for Unit #include "EEPROM.h" // Wire #include <Wire.h> // SHARP Memory Display #include <Adafruit_SharpMem.h> #include <Adafruit_GFX.h> // Date and time RTC #include "RTClib.h" // GPS Receiver #include <TinyGPS++.h> // ESP32 Hardware Serial #include <HardwareSerial.h> // SD Card #include "FS.h" #include "SD.h" #include "SPI.h" // SparkFun CCS811 - eCO2 & tVOC #include <SparkFunCCS811.h> // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure #include <SparkFunBME280.h> // 9DoF IMU // STMicroelectronics LSM6DS33 #include <LSM6.h> // STMicroelectronics LIS3MDL #include <LIS3MDL.h> // NeoPixels #include <Adafruit_NeoPixel.h> // SHARP Memory Display #define SHARP_SCK 13 #define SHARP_MOSI 12 #define SHARP_SS 27 // Set the size of the display here, e.g. 144x168! Adafruit_SharpMem display(SHARP_SCK, SHARP_MOSI, SHARP_SS, 144, 168); // The currently-available SHARP Memory Display (144x168 pixels) // requires > 4K of microcontroller RAM; it WILL NOT WORK on Arduino Uno // or other <4K "classic" devices. #define BLACK 0 #define WHITE 1 // Date and Time // PCF8523 Precision RTC RTC_PCF8523 rtc; // Date String dateRTC = ""; // Time String timeRTC = ""; // ESP32 HardwareSerial HardwareSerial tGPS(2); // GPS Receiver #define gpsRXPIN 16 // This one is unused and doesnt have a conection #define gpsTXPIN 17 // The TinyGPS++ object TinyGPSPlus gps; // Latitude float TargetLat; // Longitude float TargetLon; // GPS Date, Time, Speed, Altitude // GPS Date String TargetDat; // GPS Time String TargetTim; // GPS Speeds M/S String TargetSMS; // GPS Speeds Km/h String TargetSKH; // GPS Altitude Meters String TargetALT; // GPS Status String GPSSt = ""; // Rotary Switch - 10 Position // Number 1 => 10 int iRotNum = A0; // iRotVal - Value int iRotVal = 0; // Number int z = 0; // MicroSD Card const int chipSelect = 33; String zzzzzz = ""; // LED Green int iLEDGreen = 21; // Rocker Switch - SPST (Round) int iSS1 = 32; // State int iSS1State = 0; // SparkFun CCS811 - eCO2 & tVOC // Default I2C Address #define CCS811_ADDR 0x5B CCS811 myCCS811(CCS811_ADDR); // eCO2 float CCS811CO2 = 0; // TVOC float CCS811TVOC = 0; // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure BME280 myBME280; // Temperature Celsius float BMEtempC = 0; // Humidity float BMEhumid = 0; // Altitude Meters float BMEaltitudeM = 0; // Barometric Pressure float BMEpressure = 0; // 9DoF IMU // STMicroelectronics LSM6DS33 LSM6 imu; // // Accelerometer and Gyroscopes // Accelerometer int imuAX; int imuAY; int imuAZ; // Gyroscopes int imuGX; int imuGY; int imuGZ; // STMicroelectronics LIS3MDL LIS3MDL mag; // Magnetometer int magX; int magY; int magZ; // NeoPixels // On digital pin 15 #define PIN 15 // NeoPixels NUMPIXELS = 8 #define NUMPIXELS 8 // Pixels Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); // Red int red = 0; // Green int green = 0; // Blue int blue = 0; // Neopix int iNeo = 0; // Value int zz = 0; // EMF Meter (Single Axis) int iEMF = A1; // Raise this number to increase data smoothing #define NUMREADINGS 15 // Raise this number to decrease sensitivity (up to 1023 max) int senseLimit = 15; // EMF Value int val = 0; // Readings from the analog input int readings[ NUMREADINGS ]; // Index of the current reading int indexEMF = 0; // Running total int totalEMF = 0; // Final average of the probe reading int averageEMF = 0; // Display EMF int iEMFDis = 0; int iEMFRect = 0; // Software Version Information // EEPROM Unique ID Information #define EEPROM_SIZE 64 String uid = ""; // Version String sver = "19-11"; void loop() { // Dates and Time isRTC(); // isGPS isGPS(); // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure isBME280(); // SparkFun CCS811 - eCO2 & tVOC isCCS811(); // Accelerometer and Gyroscopes isIMU(); // Magnetometer isMag(); // EMF Meter (Single Axis) isEMF(); // Rotary Switch isRot(); // Slide Switch // Read the state of the iSS1 value iSS1State = digitalRead(iSS1); // If it is the Slide Switch State is HIGH if (iSS1State == HIGH) { // iLEDGreen HIGH digitalWrite(iLEDGreen, HIGH ); // MicroSD Card isSD(); } else { // iLEDGreen LOW digitalWrite(iLEDGreen, LOW ); } delay( 1000 ); }
getAccelGyro.ino
// Accelerometer and Gyroscopes // Setup IMU void setupIMU() { // Setup IMU imu.init(); // Default imu.enableDefault(); } // Accelerometer and Gyroscopes void isIMU() { // Accelerometer and Gyroscopes imu.read(); // Accelerometer x, y, z imuAX = imu.a.x; imuAY = imu.a.y; imuAZ = imu.a.z; // Gyroscopes x, y, z imuGX = imu.g.x; imuGY = imu.g.y; imuGZ = imu.g.z; }
getBME280.ino
// SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure // isBME280 - Temperature, Humidity, Altitude and Barometric Pressure void isBME280(){ // Temperature Celsius BMEtempC = myBME280.readTempC(); // Humidity BMEhumid = myBME280.readFloatHumidity(); // Altitude Meters BMEaltitudeM = (myBME280.readFloatAltitudeMeters(), 2); // Barometric Pressure BMEpressure = myBME280.readFloatPressure(); }
getCCS811.ino
// CCS811 - eCO2 & tVOC // isCCS811 - eCO2 & tVOC void isCCS811(){ // This sends the temperature & humidity data to the CCS811 myCCS811.setEnvironmentalData(BMEhumid, BMEtempC); // Calling this function updates the global tVOC and eCO2 variables myCCS811.readAlgorithmResults(); // eCO2 Concentration CCS811CO2 = myCCS811.getCO2(); // tVOC Concentration CCS811TVOC = myCCS811.getTVOC(); }
getDisplay.ino
// SHARP Memory Display // SHARP Memory Display - UID void isDisplayUID() { // Text Display // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(3); display.setTextColor(BLACK); // Don Luc Electronics display.setCursor(0,10); display.println( "Don Luc" ); display.setTextSize(2); display.setCursor(0,40); display.println( "Electronics" ); // Version //display.setTextSize(3); display.setCursor(0,70); display.println( "Version" ); //display.setTextSize(2); display.setCursor(0,95); display.println( sver ); // EEPROM display.setCursor(0,120); display.println( "EEPROM" ); display.setCursor(0,140); display.println( uid ); // Refresh display.refresh(); delay( 100 ); } // Display Date void isDisplayDate() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Date display.setCursor(0,5); display.println( "Date" ); display.setCursor(0,30); display.println( dateRTC ); // Time display.setCursor(0,55); display.println( "Time" ); display.setCursor(0,75); display.println( timeRTC ); // Refresh display.refresh(); delay( 100 ); } // Display GPS void isDisplayGPS() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // GPS Status display.setCursor(0,5); display.print( "GPS: " ); display.println( GPSSt ); // Target Latitude display.setCursor(0,25); display.println( "Latitude" ); display.setCursor(0,45); display.println( TargetLat ); // Target Longitude display.setCursor(0,65); display.println( "Longitude" ); display.setCursor(0,90); display.println( TargetLon ); // Refresh display.refresh(); delay( 100 ); } // GPS Date, Time, Speed, Altitude void isDisplayGPSDate() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // GPS display.setCursor(0,5); display.println( "GPS" ); // Date display.setCursor(0,30); display.println( TargetDat ); // Time display.setCursor(0,55); display.println( TargetTim ); // Speed display.setCursor(0,75); display.print( "M/S: " ); display.println( TargetSMS ); display.setCursor(0,95); display.print( "Km/h: " ); display.println( TargetSKH ); display.setCursor(0,115); display.print( "Alt: " ); display.println( TargetALT ); // Refresh display.refresh(); delay( 100 ); } // Display SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure void isDisplayBME280() { // Text Display BME280 // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Temperature Celsius display.setCursor(0,5); display.println( "Temperature" ); display.setCursor(0,25); display.print( BMEtempC ); display.println( " C" ); // Humidity display.setCursor(0,45); display.println( "Humidity" ); display.setCursor(0,65); display.print( BMEhumid ); display.println( "%" ); // Altitude Meters display.setCursor(0,85); display.println( "Altitude M" ); display.setCursor(0,105); display.print( BMEaltitudeM ); display.println( " m" ); // Pressure display.setCursor(0,125); display.println( "Barometric" ); display.setCursor(0,145); 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,5); display.println( "eCO2" ); display.setCursor(0,25); display.print( CCS811CO2 ); display.println( " ppm" ); // tVOC Concentration display.setCursor(0,55); display.println( "tVOC" ); display.setCursor(0,75); display.print( CCS811TVOC ); display.println( " ppb" ); // Refresh display.refresh(); delay( 100 ); } // Display Accelerometer and Gyroscopes void isDisplayAccGyr() { // Text Display Accelerometer and Gyroscopes // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Accelerometer display.setCursor(0,5); display.println( "Accelero" ); display.setCursor(0,25); display.print( "X: " ); display.println( imuAX ); display.setCursor(0,45); display.print( "Y: " ); display.println( imuAY ); display.setCursor(0,65); display.print( "Z: " ); display.println( imuAZ ); display.setCursor(0,85); display.println( "Gyro" ); display.setCursor(0,105); display.print( "X: " ); display.println( imuGX ); display.setCursor(0,125); display.print( "Y: " ); display.println( imuGY ); display.setCursor(0,145); display.print( "Z: " ); display.println( imuGZ ); // Refresh display.refresh(); delay( 100 ); } // Display Magnetometer void isDisplayMag() { // Text Display Magnetometer // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Magnetometer display.setCursor(0,5); display.println( "Magnetometer" ); display.setCursor(0,25); display.print( "X: " ); display.println( magX ); display.setCursor(0,45); display.print( "Y: " ); display.println( magY ); display.setCursor(0,65); display.print( "Z: " ); display.println( magZ ); // Refresh display.refresh(); delay( 100 ); } // EMF Meter (Single Axis) void isDisplayEMF() { // Text Display EMF Meter // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // EMF Meter display.setCursor(0,10); display.println( "EMF Meter" ); display.setCursor(0,30); display.print( "EMF: " ); display.println( iEMFDis ); display.setTextSize(1); display.println( "0 1 2 3 4 5 6 7 8 9 10" ); display.setCursor(0,70); display.drawRect(0, 70, iEMFRect , display.height(), BLACK); display.fillRect(0, 70, iEMFRect , display.height(), BLACK); // 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)); } }
getEMF.ino
// EMF Meter (Single Axis) // EMF Meter void isEMF() { isNUMPIXELSoff(); // Probe EMF Meter for (int i = 0; i < NUMREADINGS; i++){ // Readings readings[ i ] = analogRead( iEMF ); // Average averageEMF += readings[i]; } // Calculate the average val = averageEMF / NUMREADINGS; // If the reading isn't zero, proceed if( val >= 1 ){ // Turn any reading higher than the senseLimit value into the senseLimit value val = constrain( val, 1, senseLimit ); // Remap the constrained value within a 1 to 1023 range val = map( val, 1, senseLimit, 1, 1023 ); // Subtract the last reading totalEMF -= readings[ indexEMF ]; // Read from the sensor readings[ indexEMF ] = val; // Add the reading to the total totalEMF += readings[ indexEMF ]; // Advance to the next index indexEMF = ( indexEMF + 1 ); // If the average is over 50 ... if (averageEMF > 50){ zz = 0; isNUMPIXELS(); } // If the average is over 250 ... if (averageEMF > 250){ zz = 1; isNUMPIXELS(); } // If the average is over 350 ... if (averageEMF > 350){ zz = 2; isNUMPIXELS(); } // If the average is over 500 ... if (averageEMF > 500){ zz = 3; isNUMPIXELS(); } // If the average is over 650 ... if (averageEMF > 650){ zz = 4; isNUMPIXELS(); } // If the average is over 750 ... if (averageEMF > 750){ zz = 5; isNUMPIXELS(); } // If the average is over 850 ... if (averageEMF > 850){ zz = 6; isNUMPIXELS(); } // If the average is over 950 ... if (averageEMF > 950){ zz = 7; isNUMPIXELS(); } iEMFDis = averageEMF; iEMFRect = map( averageEMF, 1, 1023, 1, 144 ); // Average averageEMF = 0; } else { // Average averageEMF = 0; } }
getGPS.ino
// GPS Receiver // Setup GPS void setupGPS() { // Setup GPS tGPS.begin( 9600 , SERIAL_8N1 , gpsRXPIN , gpsTXPIN ); } // isGPS void isGPS(){ // Receives NEMA data from GPS receiver // This sketch displays information every time a new sentence is correctly encoded while ( tGPS.available() > 0) if (gps.encode( tGPS.read() )) { // GPS Vector Pointer Target displayInfo(); // GPS Date, Time, Speed, Altitude displayDTS(); } if (millis() > 5000 && gps.charsProcessed() < 10) { while(true); } } // GPS Vector Pointer Target void displayInfo(){ // Location if (gps.location.isValid()) { // Latitude TargetLat = gps.location.lat(); // Longitude TargetLon = gps.location.lng(); // GPS Status 2 GPSSt = "Yes"; } else { // GPS Status 0 GPSSt = "No"; } } // GPS Date, Time, Speed, Altitude void displayDTS(){ // Date TargetDat = ""; if (gps.date.isValid()) { // Date // Year TargetDat += String(gps.date.year(), DEC); TargetDat += "/"; // Month TargetDat += String(gps.date.month(), DEC); TargetDat += "/"; // Day TargetDat += String(gps.date.day(), DEC); } // Time TargetTim = ""; if (gps.time.isValid()) { // Time // Hour TargetTim += String(gps.time.hour(), DEC); TargetTim += ":"; // Minute TargetTim += String(gps.time.minute(), DEC); TargetTim += ":"; // Secound TargetTim += String(gps.time.second(), DEC); } // Speed TargetSMS = ""; TargetSKH = ""; if (gps.speed.isValid()) { // Speed // M/S int x = gps.speed.mps(); TargetSMS = String( x, DEC); // Km/h int y = gps.speed.kmph(); TargetSKH = String( y, DEC); } // Altitude TargetALT = ""; if (gps.altitude.isValid()) { // Altitude // Meters int z = gps.altitude.meters(); TargetALT = String( z, DEC); } }
getMagnetometer.ino
// Magnetometer // Setup Magnetometer void setupMag() { // Setup Magnetometer mag.init(); // Default mag.enableDefault(); } // Magnetometer void isMag() { // Magnetometer mag.read(); // Magnetometer x, y, z magX = mag.m.x; magY = mag.m.y; magZ = mag.m.z; }
getNeopix.ino
// NeoPixels // Neopix void isNeopix() { // Pixels pixels.setBrightness( 150 ); // Pixels color takes RGB values, from 0,0,0 up to 255,255,255 pixels.setPixelColor( iNeo, pixels.Color(red,green,blue) ); // This sends the updated pixel color to the hardware pixels.show(); // Delay for a period of time (in milliseconds) delay(50); } // isNUMPIXELS void isNUMPIXELS() { // Neopix Value switch ( zz ) { case 0: // NeoPixels // Green // Red red = 0; // Green green = 255; // Blue blue = 0; // Neopix iNeo = 0; isNeopix(); break; case 1: // NeoPixels // Green // Red red = 0; // Green green = 255; // Blue blue = 0; // Neopix iNeo = 1; isNeopix(); break; case 2: // NeoPixels // Green // Red red = 0; // Green green = 255; // Blue blue = 0; // Neopix iNeo = 2; isNeopix(); break; case 3: // NeoPixels // Yellow // Red red = 255; // Green green = 255; // Blue blue = 0; // Neopix iNeo = 3; isNeopix(); break; case 4: // NeoPixels // Yellow // Red red = 255; // Green green = 255; // Blue blue = 0; // Neopix iNeo = 4; isNeopix(); break; case 5: // NeoPixels // Yellow // Red red = 255; // Green green = 255; // Blue blue = 0; // Neopix iNeo = 5; isNeopix(); break; case 6: // NeoPixels // Yellow // Red red = 255; // Green green = 255; // Blue blue = 0; // Neopix iNeo = 6; isNeopix(); break; case 7: // NeoPixels // Red // Red red = 255; // Green green = 0; // Blue blue = 0; // Neopix iNeo = 7; isNeopix(); break; } } // isNUMPIXELSoff void isNUMPIXELSoff() { // Black Off // NeoPixels for(int y=0; y < NUMPIXELS; y++) { red = 0; // Red green = 0; // Green blue = 0; // Blue iNeo = y; // Neopix isNeopix(); } }
getRTC.ino
// Date & Time // PCF8523 Precision RTC void setupRTC() { // Date & Time // pcf8523 Precision RTC if (! rtc.begin()) { while (1); } if (! rtc.initialized()) { // Following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0)); // rtc.adjust(DateTime(2021, 8, 18, 8, 48, 0)); } } // Date and Time RTC PCF8523 void isRTC () { // Date and Time dateRTC = ""; timeRTC = ""; DateTime now = rtc.now(); // Date // Year dateRTC = now.year(), DEC; dateRTC = dateRTC + "/"; // Month dateRTC = dateRTC + now.month(), DEC; dateRTC = dateRTC + "/"; // Day dateRTC = dateRTC + now.day(), DEC; // Time // Hour timeRTC = now.hour(), DEC; timeRTC = timeRTC + ":"; // Minute timeRTC = timeRTC + now.minute(), DEC; timeRTC = timeRTC + ":"; // Second timeRTC = timeRTC + now.second(), DEC; }
getRot.ino
// Rotary Switch // isRot - iRotVal - Value void isRot() { // Rotary Switch z = analogRead( iRotNum ); // Rotary Switch - 10 Position // Number 1 => 10 if ( z >= 3600 ) { // Z iRotVal = 10; } else if ( z >= 3200 ) { // Z iRotVal = 9; } else if ( z >= 2700 ) { // Z iRotVal = 8; } else if ( z >= 2400 ) { // Z iRotVal = 7; } else if ( z >= 2000 ) { // Z iRotVal = 6; } else if ( z >= 1600 ) { // Z iRotVal = 5; } else if ( z >= 1200 ) { // Z iRotVal = 4; } else if ( z >= 900 ) { // Z iRotVal = 3; } else if ( z >= 500 ) { // Z iRotVal = 2; } else { // Z iRotVal = 1; } // Range Value switch ( iRotVal ) { case 1: // Display Date, Time isDisplayDate(); break; case 2: // Display GPS isDisplayGPS(); break; case 3: // GPS Date, Time, Speed, Altitude //isDisplayGPSDate(); break; case 4: // GPS Display Date, Time, Speed isDisplayGPSDate(); break; case 5: // Display SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure isDisplayBME280(); break; case 6: // Display CCS811 - eCO2 & tVOC isDisplayCCS811(); break; case 7: // Accelerometer and Gyroscopes isDisplayAccGyr(); break; case 8: // Display Magnetometer isDisplayMag(); break; case 9: // EMF Meter (Single Axis) isDisplayEMF(); break; case 10: // Display UID isDisplayUID(); break; } }
getSD.ino
// MicroSD Card // MicroSD Setup void setupSD() { // MicroSD Card pinMode( chipSelect , OUTPUT ); if(!SD.begin( chipSelect )){ ; return; } uint8_t cardType = SD.cardType(); // CARD NONE if(cardType == CARD_NONE){ ; return; } // SD Card Type if(cardType == CARD_MMC){ ; } else if(cardType == CARD_SD){ ; } else if(cardType == CARD_SDHC){ ; } else { ; } // Size uint64_t cardSize = SD.cardSize() / (1024 * 1024); } // MicroSD Card void isSD() { zzzzzz = ""; // EEPROM Unique ID|Version|Date|Time|GPS Status|Target Latitude|Target Longitude|GPS Date|GPS Time|GPS Speed M/S|GPS Speed Km/h|GPS Altitude //|Temperature Celsius|Humidity|Altitude Meters|Barometric Pressure|eCO2 Concentration|tVOC Concentration|Accelerometer X|Accelerometer Y|Accelerometer Z| //Gyroscopes X|Gyroscopes Y|Gyroscopes Z|Magnetometer X|Magnetometer Y|Magnetometer Z|EMF|\r zzzzzz = uid + "|" + sver + "|" + dateRTC + "|" + timeRTC + "|" + GPSSt + "|" + TargetLat + "|" + TargetLon + "|" + TargetDat + "|" + TargetTim + "|" + TargetSMS + "|" + TargetSKH + "|" + TargetALT + "|" + BMEtempC + "|" + BMEhumid + "|" + BMEaltitudeM + "|" + BMEpressure + "|" + CCS811CO2 + "|" + CCS811TVOC + "|" + imuAX + "|" + imuAY + "|" + imuAZ + "|" + imuGX + "|" + imuGY + "|" + imuGZ + "|" + magX + "|" + magY + "|" + magZ + "|" + iEMFDis + "|\r"; // msg + 1 char msg[zzzzzz.length() + 1]; zzzzzz.toCharArray(msg, zzzzzz.length() + 1); // Append File appendFile(SD, "/espdata.txt", msg ); } // List Dir void listDir(fs::FS &fs, const char * dirname, uint8_t levels){ // List Dir dirname; File root = fs.open(dirname); if(!root){ return; } if(!root.isDirectory()){ return; } File file = root.openNextFile(); while(file){ if(file.isDirectory()){ file.name(); if(levels){ listDir(fs, file.name(), levels -1); } } else { file.name(); file.size(); } file = root.openNextFile(); } } // Write File void writeFile(fs::FS &fs, const char * path, const char * message){ // Write File path; File file = fs.open(path, FILE_WRITE); if(!file){ return; } if(file.print(message)){ ; } else { ; } file.close(); } // Append File void appendFile(fs::FS &fs, const char * path, const char * message){ // Append File path; File file = fs.open(path, FILE_APPEND); if(!file){ return; } if(file.print(message)){ ; } else { ; } file.close(); }
setup.ino
// Setup void setup() { // EEPROM Size EEPROM.begin(EEPROM_SIZE); // EEPROM Unique ID isUID(); // NeoPixels // This initializes the NeoPixel library pixels.begin(); // GPS Receiver // Setup GPS setupGPS(); // Set up I2C bus Wire.begin(); // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure myBME280.begin(); // CCS811 - eCO2 & tVOC myCCS811.begin(); // SHARP Display Start & Clear the Display display.begin(); // Clear Display display.clearDisplay(); // Date & Time RTC // PCF8523 Precision RTC isDisplayUID(); // Setup RTC setupRTC(); //MicroSD Card setupSD(); // Setup IMU setupIMU(); // Setup Magnetometer setupMag(); // NeoPixels // isNUMPIXELS Off isNUMPIXELSoff(); // Initialize the LED Green pinMode(iLEDGreen, OUTPUT); // Slide Switch pinMode(iSS1, INPUT); delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Research & Development (R & D)
- Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
- Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
- Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
- Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
- Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
- Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
- eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)
Instructor
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
Follow Us
J. Luc Paquin – Curriculum Vitae – 2021 English & Español
https://www.jlpconsultants.com/CV/LucPaquinCVEngMk2021c.pdf
https://www.jlpconsultants.com/CV/LucPaquinCVEspMk2021c.pdf
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Web: https://www.donluc.com/DLE/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: https://zoom.us/
Patreon: https://www.patreon.com/DonLucElectronics
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #19: Time – EMF Meters – Mk10
——
#DonLucElectronics #DonLuc #Time #EMF #NeoPixel #Arduino #ESP32 #SparkFunESP32WROOM #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog
——
——
——
——
——
EMF Meters
EMF measurements are measurements of ambient electromagnetic fields that are performed using particular sensors or probes, such as EMF meters. These probes can be generally considered as antennas although with different characteristics. In fact, probes should not perturb the electromagnetic field and must prevent coupling and reflection as much as possible in order to obtain precise results. EMF probes may respond to fields only on one axis frequency selective measurements in which the measurement system consists of a field antenna and a frequency selective receiver or spectrum analyzer allowing to monitor the frequency range of interest. Amplified, active, probes can improve measurement precision and sensitivity but their active components may limit their speed of response.
SMA Connector
PCB edge mount – SMA RF connector. Perfect for prototyping with the GPS and Cellular devices that require an antenna connection. These connectors have a female signal pin and will correctly mate with the original SMA type antennas.
Telescopic Antenna SMA – 300 MHz to 1.1 GHz (ANT700)
This ANT700 is a telescopic antenna designed for operation from 300 MHz to 1.1 GHz with a total length that is configurable from 9.5 cm to 24.5 cm. Each ANT700 is constructed of stainless steel and features an SMA male connector, rotating shaft, and adjustable elbow.
DL2109Mk01
1 x SparkFun Thing Plus – ESP32 WROOM
1 x Telescopic Antenna SMA – 300 MHz to 1.1 GHz (ANT700)
1 x SMA Connector
1 x 3.3m Ohm
1 x NeoPixel Stick – 8 x 5050 RGB LED
1 x Pololu Adjustable Step-Up Voltage Regulator U1V11A
1 x Lithium Ion Battery – 850mAh
1 x Half-Size Breadboard
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
NEO – Digital 15
EMF – Analog A1
VIN – +3.3V
GND – GND
DL2109Mk01p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #19: Time - EMF Meters - Mk10 09-01 DL2109Mk01p.ino 1 x SparkFun Thing Plus - ESP32 WROOM 1 x Telescopic Antenna SMA - 300 MHz to 1.1 GHz (ANT700) 1 x SMA Connector 1 x 3.3m Ohm 1 x NeoPixel Stick - 8 x 5050 RGB LED 1 x Pololu Adjustable Step-Up Voltage Regulator U1V11A 1 x Lithium Ion Battery - 850mAh 1 x Half-Size Breadboard 1 x SparkFun Cerberus USB Cable */ // Include Library Code #include <Adafruit_NeoPixel.h> // NeoPixels // On digital pin 15 #define PIN 15 // NeoPixels NUMPIXELS = 8 #define NUMPIXELS 8 // Pixels Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); // Red int red = 0; // Green int green = 0; // Blue int blue = 0; // Neopix int iNeo = 0; // Value int z = 0; // EMF Meter (Single Axis) int iEMF = A1; // Raise this number to increase data smoothing #define NUMREADINGS 15 // Raise this number to decrease sensitivity (up to 1023 max) int senseLimit = 15; // EMF Value int val = 0; // Readings from the analog input int readings[ NUMREADINGS ]; // Index of the current reading int indexEMF = 0; // Running total int totalEMF = 0; // Final average of the probe reading int averageEMF = 0; // Software Version Information // Version String sver = "19-10"; void loop() { // EMF Meter (Single Axis) isEMF(); delay(250); }
getEMF.ino
// EMF Meter (Single Axis) // EMF Meter void isEMF() { isNUMPIXELSoff(); // Probe EMF Meter for (int i = 0; i < NUMREADINGS; i++){ // Readings readings[ i ] = analogRead( iEMF ); // Average averageEMF += readings[i]; } // Calculate the average val = averageEMF / NUMREADINGS; // If the reading isn't zero, proceed if( val >= 1 ){ // Turn any reading higher than the senseLimit value into the senseLimit value val = constrain( val, 1, senseLimit ); // Remap the constrained value within a 1 to 1023 range val = map( val, 1, senseLimit, 1, 1023 ); // Subtract the last reading totalEMF -= readings[ indexEMF ]; // Read from the sensor readings[ indexEMF ] = val; // Add the reading to the total totalEMF += readings[ indexEMF ]; // Advance to the next index indexEMF = ( indexEMF + 1 ); // If the average is over 50 ... if (averageEMF > 50){ z = 0; isNUMPIXELS(); } // If the average is over 250 ... if (averageEMF > 250){ z = 1; isNUMPIXELS(); } // If the average is over 350 ... if (averageEMF > 350){ z = 2; isNUMPIXELS(); } // If the average is over 500 ... if (averageEMF > 500){ z = 3; isNUMPIXELS(); } // If the average is over 650 ... if (averageEMF > 650){ z = 4; isNUMPIXELS(); } // If the average is over 750 ... if (averageEMF > 750){ z = 5; isNUMPIXELS(); } // If the average is over 850 ... if (averageEMF > 850){ z = 6; isNUMPIXELS(); } // If the average is over 950 ... if (averageEMF > 950){ z = 7; isNUMPIXELS(); } // Average averageEMF = 0; } else { // Average averageEMF = 0; } }
getNeopix.ino
// NeoPixels // Neopix void isNeopix() { // Pixels pixels.setBrightness( 150 ); // Pixels color takes RGB values, from 0,0,0 up to 255,255,255 pixels.setPixelColor( iNeo, pixels.Color(red,green,blue) ); // This sends the updated pixel color to the hardware pixels.show(); // Delay for a period of time (in milliseconds) delay(50); } // isNUMPIXELS void isNUMPIXELS() { // Neopix Value switch ( z ) { case 0: // NeoPixels // Green // Red red = 0; // Green green = 255; // Blue blue = 0; // Neopix iNeo = 0; isNeopix(); break; case 1: // NeoPixels // Green // Red red = 0; // Green green = 255; // Blue blue = 0; // Neopix iNeo = 1; isNeopix(); break; case 2: // NeoPixels // Green // Red red = 0; // Green green = 255; // Blue blue = 0; // Neopix iNeo = 2; isNeopix(); break; case 3: // NeoPixels // Yellow // Red red = 255; // Green green = 255; // Blue blue = 0; // Neopix iNeo = 3; isNeopix(); break; case 4: // NeoPixels // Yellow // Red red = 255; // Green green = 255; // Blue blue = 0; // Neopix iNeo = 4; isNeopix(); break; case 5: // NeoPixels // Yellow // Red red = 255; // Green green = 255; // Blue blue = 0; // Neopix iNeo = 5; isNeopix(); break; case 6: // NeoPixels // Yellow // Red red = 255; // Green green = 255; // Blue blue = 0; // Neopix iNeo = 6; isNeopix(); break; case 7: // NeoPixels // Red // Red red = 255; // Green green = 0; // Blue blue = 0; // Neopix iNeo = 7; isNeopix(); break; } } // isNUMPIXELSoff void isNUMPIXELSoff() { // Black Off // NeoPixels for(int y=0; y < NUMPIXELS; y++) { red = 0; // Red green = 0; // Green blue = 0; // Blue iNeo = y; // Neopix isNeopix(); } }
setup.ino
// Setup void setup() { // NeoPixels // This initializes the NeoPixel library pixels.begin(); // isNUMPIXELS Off isNUMPIXELSoff(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Research & Development (R & D)
- Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
- Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
- Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
- Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
- Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
- Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
- eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)
Instructor
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
Follow Us
J. Luc Paquin – Curriculum Vitae – 2021 English & Español
https://www.jlpconsultants.com/CV/LucPaquinCVEngMk2021c.pdf
https://www.jlpconsultants.com/CV/LucPaquinCVEspMk2021c.pdf
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Web: https://www.donluc.com/DLE/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: https://zoom.us/
Patreon: https://www.patreon.com/DonLucElectronics
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #19: Time – 9DoF IMU – Mk09
——
#DonLucElectronics #DonLuc #Time #IMU #RTC #Display #Adalogger #MicroSD #GPSReceiver #CCS811 #BME280 #Arduino #ESP32 #SparkFunESP32WROOM #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog
——
——
——
——
IMU
Accelerometers, gyroscopes and magnetometer are great, but alone they don’t give you quite enough information to be able to comfortably calculate things like orientation, position, and velocity. To measure those and other variables many people combine the two sensors, to create an inertial measurement unit (IMU) which provides two to nine degrees of freedom (DOF). IMUs are widely used in devices that require knowledge of their exact position, for example robotic arms, guided missiles, and tools used in the study of body motion.
IMUs can really be broken down into two classes: simple IMU combo boards, which just mount an accelerometer, gyroscopes and magnetometer onto a single PCB, and more complex units that interface a microcontroller with the sensors to produce a serial output. If you’ve glanced over the previous sections, you should know what kind of specifications to be looking for in IMUs: the number of axes (both for the accelerometer, gyroscopes and magnetometer), the measuring range of the sensors, and the interface.
Pololu MinIMU-9 v5 Gyro, Accelerometer, and Compass
The Pololu MinIMU-9 v5 is an inertial measurement unit (9DoF IMU) that packs an LSM6DS33 3-axis gyro and 3-axis accelerometer and an LIS3MDL 3-axis magnetometer onto a tiny board. An I²C interface accesses nine independent rotation, acceleration, and magnetic measurements that can be used to calculate the sensor’s absolute orientation. The MinIMU-9 v5 board includes a voltage regulator and a level-shifting circuit that allow operation from 2.5 to 5.5 V, and the pin spacing makes it easy to use with standard solderless breadboards and perfboards.
STMicroelectronics LSM6DS33
The LSM6DS33 is a system-in-package featuring a 3D digital accelerometer and a 3D digital gyroscope performing at 1.25 mA in high-performance mode and enabling always-on low-power features for an optimal motion experience for the consumer. ST’s family of MEMS sensor modules leverages the robust and mature manufacturing processes already used for the production of micromachined accelerometers and gyroscopes.
STMicroelectronics LIS3MDL
The LIS3MDL is an ultra-low-power high-performance three-axis magnetic sensor. The LIS3MDL has user-selectable full scales of gauss. The self-test capability allows the user to check the functioning of the sensor in the final application. The device may be configured to generate interrupt signals for magnetic field detection.
DL2108Mk10
1 x SparkFun Thing Plus – ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x Adalogger FeatherWing – RTC + SD
1 x SparkFun Environmental Combo CCS811/BME280 (Qwiic)
1 x Pololu MinIMU-9
1 x CR1220 3V Lithium Coin Cell Battery
1 x 32Gb microSD Card
1 x LED Green
1 x Rocker Switch – SPST (Round)
1 x Terminal Block Breakout FeatherWing
1 x Lithium Ion Battery – 850mAh
1 x GPS Receiver – GP-20U7
1 x Rotary Switch – 10 Position
1 x SparkFun Rotary Switch – 10 Position
1 x Black Knob
2 x Spring Terminals – PCB Mount (6-Pin)
2 x Breadboard Solderable
12 x 1K Ohm
1 x FeatherWing Proto
1 x Acrylic Orange 5.75 inches x 3.75 inches x 1/8 inch
1 x Acrylic Black 5.75 inches x 3.75 inches x 1/8 inch
54 x Screw – 4-40
19 x Standoff – Metal 4-40 – 3/8″
8 x Standoff – Metal 4-40 – 1″
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
SCK – Digital 13
MSI – Digital 12
SS0 – Digital 27
GRX – Digital 16
GTX – Digital 17
SDA – Digital 23
SDL – Digital 22
SCK – Digital 5
MSO – Digital 19
MSI – Digital 18
SS1 – Digital 33
LEG – Digital 21
SW0 – Digital 32
ROT – Analog A0
VIN – +3.3V
GND – GND
——
DL2108Mk10p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #19: Time - 9DoF IMU - Mk09 08-10 DL2108Mk10p.ino 1 x SparkFun Thing Plus - ESP32 WROOM 1 x Adafruit SHARP Memory Display 1 x Adalogger FeatherWing - RTC + SD 1 x SparkFun Environmental Combo CCS811/BME280 (Qwiic) 1 x Pololu MinIMU-9 1 x CR1220 3V Lithium Coin Cell Battery 1 x 32Gb microSD Card 1 x LED Green 1 x Rocker Switch - SPST (Round) 1 x Terminal Block Breakout FeatherWing 1 x Lithium Ion Battery - 850mAh 1 x GPS Receiver - GP-20U7 1 x Rotary Switch - 10 Position 1 x SparkFun Rotary Switch – 10 Position 1 x Black Knob 2 x Spring Terminals - PCB Mount (6-Pin) 2 x Breadboard Solderable 12 x 1K Ohm 1 x FeatherWing Proto 1 x Acrylic Orange 5.75 inches x 3.75 inches x 1/8 inch 1 x Acrylic Black 5.75 inches x 3.75 inches x 1/8 inch 54 x Screw - 4-40 19 x Standoff - Metal 4-40 - 3/8" 8 x Standoff - Metal 4-40 - 1" 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // EEPROM Library to Read and Write EEPROM with Unique ID for Unit #include "EEPROM.h" // Wire #include <Wire.h> // SHARP Memory Display #include <Adafruit_SharpMem.h> #include <Adafruit_GFX.h> // Date and time RTC #include "RTClib.h" // GPS Receiver #include <TinyGPS++.h> // ESP32 Hardware Serial #include <HardwareSerial.h> // SD Card #include "FS.h" #include "SD.h" #include "SPI.h" // SparkFun CCS811 - eCO2 & tVOC #include <SparkFunCCS811.h> // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure #include <SparkFunBME280.h> // 9DoF IMU // STMicroelectronics LSM6DS33 #include <LSM6.h> // STMicroelectronics LIS3MDL #include <LIS3MDL.h> // SHARP Memory Display #define SHARP_SCK 13 #define SHARP_MOSI 12 #define SHARP_SS 27 // Set the size of the display here, e.g. 144x168! Adafruit_SharpMem display(SHARP_SCK, SHARP_MOSI, SHARP_SS, 144, 168); // The currently-available SHARP Memory Display (144x168 pixels) // requires > 4K of microcontroller RAM; it WILL NOT WORK on Arduino Uno // or other <4K "classic" devices. #define BLACK 0 #define WHITE 1 // Date and Time // PCF8523 Precision RTC RTC_PCF8523 rtc; // Date String dateRTC = ""; // Time String timeRTC = ""; // ESP32 HardwareSerial HardwareSerial tGPS(2); // GPS Receiver #define gpsRXPIN 16 // This one is unused and doesnt have a conection #define gpsTXPIN 17 // The TinyGPS++ object TinyGPSPlus gps; // Latitude float TargetLat; // Longitude float TargetLon; // GPS Date, Time, Speed, Altitude // GPS Date String TargetDat; // GPS Time String TargetTim; // GPS Speeds M/S String TargetSMS; // GPS Speeds Km/h String TargetSKH; // GPS Altitude Meters String TargetALT; // GPS Status String GPSSt = ""; // Rotary Switch - 10 Position // Number 1 => 10 int iRotNum = A0; // iRotVal - Value int iRotVal = 0; // Number int z = 0; // MicroSD Card const int chipSelect = 33; String zzzzzz = ""; // LED Green int iLEDGreen = 21; // Rocker Switch - SPST (Round) int iSS1 = 32; // State int iSS1State = 0; // SparkFun CCS811 - eCO2 & tVOC // Default I2C Address #define CCS811_ADDR 0x5B CCS811 myCCS811(CCS811_ADDR); // eCO2 float CCS811CO2 = 0; // TVOC float CCS811TVOC = 0; // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure BME280 myBME280; // Temperature Celsius float BMEtempC = 0; // Humidity float BMEhumid = 0; // Altitude Meters float BMEaltitudeM = 0; // Barometric Pressure float BMEpressure = 0; // 9DoF IMU // STMicroelectronics LSM6DS33 LSM6 imu; // // Accelerometer and Gyroscopes // Accelerometer int imuAX; int imuAY; int imuAZ; // Gyroscopes int imuGX; int imuGY; int imuGZ; // STMicroelectronics LIS3MDL LIS3MDL mag; // Magnetometer int magX; int magY; int magZ; // Software Version Information // EEPROM Unique ID Information #define EEPROM_SIZE 64 String uid = ""; // Version String sver = "19-09"; void loop() { // Dates and Time isRTC(); // isGPS isGPS(); // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure isBME280(); // SparkFun CCS811 - eCO2 & tVOC isCCS811(); // Accelerometer and Gyroscopes isIMU(); // Magnetometer isMag(); // Rotary Switch isRot(); // Slide Switch // Read the state of the iSS1 value iSS1State = digitalRead(iSS1); // If it is the Slide Switch State is HIGH if (iSS1State == HIGH) { // iLEDGreen HIGH digitalWrite(iLEDGreen, HIGH ); // MicroSD Card isSD(); } else { // iLEDGreen LOW digitalWrite(iLEDGreen, LOW ); } delay( 1000 ); }
getAccelGyro.ino
// Accelerometer and Gyroscopes // Setup IMU void setupIMU() { // Setup IMU imu.init(); // Default imu.enableDefault(); } // Accelerometer and Gyroscopes void isIMU() { // Accelerometer and Gyroscopes imu.read(); // Accelerometer x, y, z imuAX = imu.a.x; imuAY = imu.a.y; imuAZ = imu.a.z; // Gyroscopes x, y, z imuGX = imu.g.x; imuGY = imu.g.y; imuGZ = imu.g.z; }
getBME280.ino
// SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure // isBME280 - Temperature, Humidity, Altitude and Barometric Pressure void isBME280(){ // Temperature Celsius BMEtempC = myBME280.readTempC(); // Humidity BMEhumid = myBME280.readFloatHumidity(); // Altitude Meters BMEaltitudeM = (myBME280.readFloatAltitudeMeters(), 2); // Barometric Pressure BMEpressure = myBME280.readFloatPressure(); }
getCCS811.ino
// CCS811 - eCO2 & tVOC // isCCS811 - eCO2 & tVOC void isCCS811(){ // This sends the temperature & humidity data to the CCS811 myCCS811.setEnvironmentalData(BMEhumid, BMEtempC); // Calling this function updates the global tVOC and eCO2 variables myCCS811.readAlgorithmResults(); // eCO2 Concentration CCS811CO2 = myCCS811.getCO2(); // tVOC Concentration CCS811TVOC = myCCS811.getTVOC(); }
getDisplay.ino
// SHARP Memory Display // SHARP Memory Display - UID void isDisplayUID() { // Text Display // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(3); display.setTextColor(BLACK); // Don Luc Electronics display.setCursor(0,10); display.println( "Don Luc" ); display.setTextSize(2); display.setCursor(0,40); display.println( "Electronics" ); // Version //display.setTextSize(3); display.setCursor(0,70); display.println( "Version" ); //display.setTextSize(2); display.setCursor(0,95); display.println( sver ); // EEPROM display.setCursor(0,120); display.println( "EEPROM" ); display.setCursor(0,140); display.println( uid ); // Refresh display.refresh(); delay( 100 ); } // Display Date void isDisplayDate() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Date display.setCursor(0,5); display.println( "Date" ); display.setCursor(0,30); display.println( dateRTC ); // Time display.setCursor(0,55); display.println( "Time" ); display.setCursor(0,75); display.println( timeRTC ); // Refresh display.refresh(); delay( 100 ); } // Display GPS void isDisplayGPS() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // GPS Status display.setCursor(0,5); display.print( "GPS: " ); display.println( GPSSt ); // Target Latitude display.setCursor(0,25); display.println( "Latitude" ); display.setCursor(0,45); display.println( TargetLat ); // Target Longitude display.setCursor(0,65); display.println( "Longitude" ); display.setCursor(0,90); display.println( TargetLon ); // Refresh display.refresh(); delay( 100 ); } // GPS Date, Time, Speed, Altitude void isDisplayGPSDate() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // GPS display.setCursor(0,5); display.println( "GPS" ); // Date display.setCursor(0,30); display.println( TargetDat ); // Time display.setCursor(0,55); display.println( TargetTim ); // Speed display.setCursor(0,75); display.print( "M/S: " ); display.println( TargetSMS ); display.setCursor(0,95); display.print( "Km/h: " ); display.println( TargetSKH ); display.setCursor(0,115); display.print( "Alt: " ); display.println( TargetALT ); // Refresh display.refresh(); delay( 100 ); } // Display SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure void isDisplayBME280() { // Text Display BME280 // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Temperature Celsius display.setCursor(0,5); display.println( "Temperature" ); display.setCursor(0,25); display.print( BMEtempC ); display.println( " C" ); // Humidity display.setCursor(0,45); display.println( "Humidity" ); display.setCursor(0,65); display.print( BMEhumid ); display.println( "%" ); // Altitude Meters display.setCursor(0,85); display.println( "Altitude M" ); display.setCursor(0,105); display.print( BMEaltitudeM ); display.println( " m" ); // Pressure display.setCursor(0,125); display.println( "Barometric" ); display.setCursor(0,145); 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,5); display.println( "eCO2" ); display.setCursor(0,25); display.print( CCS811CO2 ); display.println( " ppm" ); // tVOC Concentration display.setCursor(0,55); display.println( "tVOC" ); display.setCursor(0,75); display.print( CCS811TVOC ); display.println( " ppb" ); // Refresh display.refresh(); delay( 100 ); } // Display Accelerometer and Gyroscopes void isDisplayAccGyr() { // Text Display Accelerometer and Gyroscopes // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Accelerometer display.setCursor(0,5); display.println( "Accelero" ); display.setCursor(0,25); display.print( "X: " ); display.println( imuAX ); display.setCursor(0,45); display.print( "Y: " ); display.println( imuAY ); display.setCursor(0,65); display.print( "Z: " ); display.println( imuAZ ); display.setCursor(0,85); display.println( "Gyro" ); display.setCursor(0,105); display.print( "X: " ); display.println( imuGX ); display.setCursor(0,125); display.print( "Y: " ); display.println( imuGY ); display.setCursor(0,145); display.print( "Z: " ); display.println( imuGZ ); // Refresh display.refresh(); delay( 100 ); } // Display Magnetometer void isDisplayMag() { // Text Display Magnetometer // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Magnetometer display.setCursor(0,5); display.println( "Magnetometer" ); display.setCursor(0,25); display.print( "X: " ); display.println( magX ); display.setCursor(0,45); display.print( "Y: " ); display.println( magY ); display.setCursor(0,65); display.print( "Z: " ); display.println( magZ ); // Refresh display.refresh(); delay( 100 ); } // Display Z void isDisplayZ() { // Text Display Z // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(3); display.setTextColor(BLACK); // Z display.setCursor(0,10); display.print( "Z: " ); display.println( z ); // Refresh display.refresh(); delay( 100 ); }
getEEPROM.ino
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getGPS.ino
// GPS Receiver // Setup GPS void setupGPS() { // Setup GPS tGPS.begin( 9600 , SERIAL_8N1 , gpsRXPIN , gpsTXPIN ); } // isGPS void isGPS(){ // Receives NEMA data from GPS receiver // This sketch displays information every time a new sentence is correctly encoded while ( tGPS.available() > 0) if (gps.encode( tGPS.read() )) { // GPS Vector Pointer Target displayInfo(); // GPS Date, Time, Speed, Altitude displayDTS(); } if (millis() > 5000 && gps.charsProcessed() < 10) { while(true); } } // GPS Vector Pointer Target void displayInfo(){ // Location if (gps.location.isValid()) { // Latitude TargetLat = gps.location.lat(); // Longitude TargetLon = gps.location.lng(); // GPS Status 2 GPSSt = "Yes"; } else { // GPS Status 0 GPSSt = "No"; } } // GPS Date, Time, Speed, Altitude void displayDTS(){ // Date TargetDat = ""; if (gps.date.isValid()) { // Date // Year TargetDat += String(gps.date.year(), DEC); TargetDat += "/"; // Month TargetDat += String(gps.date.month(), DEC); TargetDat += "/"; // Day TargetDat += String(gps.date.day(), DEC); } // Time TargetTim = ""; if (gps.time.isValid()) { // Time // Hour TargetTim += String(gps.time.hour(), DEC); TargetTim += ":"; // Minute TargetTim += String(gps.time.minute(), DEC); TargetTim += ":"; // Secound TargetTim += String(gps.time.second(), DEC); } // Speed TargetSMS = ""; TargetSKH = ""; if (gps.speed.isValid()) { // Speed // M/S int x = gps.speed.mps(); TargetSMS = String( x, DEC); // Km/h int y = gps.speed.kmph(); TargetSKH = String( y, DEC); } // Altitude TargetALT = ""; if (gps.altitude.isValid()) { // Altitude // Meters int z = gps.altitude.meters(); TargetALT = String( z, DEC); } }
getMagnetometer.ino
// Magnetometer // Setup Magnetometer void setupMag() { // Setup Magnetometer mag.init(); // Default mag.enableDefault(); } // Magnetometer void isMag() { // Magnetometer mag.read(); // Magnetometer x, y, z magX = mag.m.x; magY = mag.m.y; magZ = mag.m.z; }
getRTC.ino
// Date & Time // PCF8523 Precision RTC void setupRTC() { // Date & Time // pcf8523 Precision RTC if (! rtc.begin()) { while (1); } if (! rtc.initialized()) { // Following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0)); // rtc.adjust(DateTime(2021, 8, 18, 8, 48, 0)); } } // Date and Time RTC PCF8523 void isRTC () { // Date and Time dateRTC = ""; timeRTC = ""; DateTime now = rtc.now(); // Date // Year dateRTC = now.year(), DEC; dateRTC = dateRTC + "/"; // Month dateRTC = dateRTC + now.month(), DEC; dateRTC = dateRTC + "/"; // Day dateRTC = dateRTC + now.day(), DEC; // Time // Hour timeRTC = now.hour(), DEC; timeRTC = timeRTC + ":"; // Minute timeRTC = timeRTC + now.minute(), DEC; timeRTC = timeRTC + ":"; // Second timeRTC = timeRTC + now.second(), DEC; }
getRot.ino
// Rotary Switch // isRot - iRotVal - Value void isRot() { // Rotary Switch z = analogRead( iRotNum ); // Rotary Switch - 10 Position // Number 1 => 10 if ( z >= 3600 ) { // Z iRotVal = 10; } else if ( z >= 3200 ) { // Z iRotVal = 9; } else if ( z >= 2700 ) { // Z iRotVal = 8; } else if ( z >= 2400 ) { // Z iRotVal = 7; } else if ( z >= 2000 ) { // Z iRotVal = 6; } else if ( z >= 1600 ) { // Z iRotVal = 5; } else if ( z >= 1200 ) { // Z iRotVal = 4; } else if ( z >= 900 ) { // Z iRotVal = 3; } else if ( z >= 500 ) { // Z iRotVal = 2; } else { // Z iRotVal = 1; } // Range Value switch ( iRotVal ) { case 1: // Display Date, Time isDisplayDate(); break; case 2: // Display GPS isDisplayGPS(); break; case 3: // GPS Date, Time, Speed, Altitude //isDisplayGPSDate(); break; case 4: // GPS Display Date, Time, Speed isDisplayGPSDate(); break; case 5: // Display SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure isDisplayBME280(); break; case 6: // Display CCS811 - eCO2 & tVOC isDisplayCCS811(); break; case 7: // Accelerometer and Gyroscopes isDisplayAccGyr(); break; case 8: // Display Magnetometer isDisplayMag(); break; case 9: // Z isDisplayZ(); break; case 10: // Z isDisplayZ(); break; } }
getSD.ino
// MicroSD Card // MicroSD Setup void setupSD() { // MicroSD Card pinMode( chipSelect , OUTPUT ); if(!SD.begin( chipSelect )){ ; return; } uint8_t cardType = SD.cardType(); // CARD NONE if(cardType == CARD_NONE){ ; return; } // SD Card Type if(cardType == CARD_MMC){ ; } else if(cardType == CARD_SD){ ; } else if(cardType == CARD_SDHC){ ; } else { ; } // Size uint64_t cardSize = SD.cardSize() / (1024 * 1024); } // MicroSD Card void isSD() { zzzzzz = ""; // EEPROM Unique ID|Version|Date|Time|GPS Status|Target Latitude|Target Longitude|GPS Date|GPS Time|GPS Speed M/S|GPS Speed Km/h|GPS Altitude //|Temperature Celsius|Humidity|Altitude Meters|Barometric Pressure|eCO2 Concentration|tVOC Concentration|Accelerometer X|Accelerometer Y|Accelerometer Z| //Gyroscopes X|Gyroscopes Y|Gyroscopes Z|Magnetometer X|Magnetometer Y|Magnetometer Z|\r zzzzzz = uid + "|" + sver + "|" + dateRTC + "|" + timeRTC + "|" + GPSSt + "|" + TargetLat + "|" + TargetLon + "|" + TargetDat + "|" + TargetTim + "|" + TargetSMS + "|" + TargetSKH + "|" + TargetALT + "|" + BMEtempC + "|" + BMEhumid + "|" + BMEaltitudeM + "|" + BMEpressure + "|" + CCS811CO2 + "|" + CCS811TVOC + "|" + imuAX + "|" + imuAY + "|" + imuAZ + "|" + imuGX + "|" + imuGY + "|" + imuGZ + "|" + magX + "|" + magY + "|" + magZ + "|\r"; // msg + 1 char msg[zzzzzz.length() + 1]; zzzzzz.toCharArray(msg, zzzzzz.length() + 1); // Append File appendFile(SD, "/espdata.txt", msg ); } // List Dir void listDir(fs::FS &fs, const char * dirname, uint8_t levels){ // List Dir dirname; File root = fs.open(dirname); if(!root){ return; } if(!root.isDirectory()){ return; } File file = root.openNextFile(); while(file){ if(file.isDirectory()){ file.name(); if(levels){ listDir(fs, file.name(), levels -1); } } else { file.name(); file.size(); } file = root.openNextFile(); } } // Write File void writeFile(fs::FS &fs, const char * path, const char * message){ // Write File path; File file = fs.open(path, FILE_WRITE); if(!file){ return; } if(file.print(message)){ ; } else { ; } file.close(); } // Append File void appendFile(fs::FS &fs, const char * path, const char * message){ // Append File path; File file = fs.open(path, FILE_APPEND); if(!file){ return; } if(file.print(message)){ ; } else { ; } file.close(); }
setup.ino
// Setup void setup() { // EEPROM Size EEPROM.begin(EEPROM_SIZE); // EEPROM Unique ID isUID(); // GPS Receiver // Setup GPS setupGPS(); // Set up I2C bus Wire.begin(); // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure myBME280.begin(); // CCS811 - eCO2 & tVOC myCCS811.begin(); // SHARP Display Start & Clear the Display display.begin(); // Clear Display display.clearDisplay(); // Date & Time RTC // PCF8523 Precision RTC isDisplayUID(); // Setup RTC setupRTC(); //MicroSD Card setupSD(); // Initialize the LED Green pinMode(iLEDGreen, OUTPUT); // Slide Switch pinMode(iSS1, INPUT); // Setup IMU setupIMU(); // Setup Magnetometer setupMag(); delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Research & Development (R & D)
- Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
- Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
- Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
- Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
- Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
- Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
- eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)
Instructor
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
Follow Us
J. Luc Paquin – Curriculum Vitae – 2021 English & Español
https://www.jlpconsultants.com/CV/LucPaquinCVEngMk2021c.pdf
https://www.jlpconsultants.com/CV/LucPaquinCVEspMk2021c.pdf
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Web: https://www.donluc.com/DLE/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: https://zoom.us/
Patreon: https://www.patreon.com/DonLucElectronics
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #19: Time – Qwiic Connect System – Mk08
—–
#DonLucElectronics #DonLuc #Time #RTC #Display #Adalogger #MicroSD #GPSReceiver #CCS811 #BME280 #Arduino #ESP32 #SparkFunESP32WROOM #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog #VideoBlog
——
——
——
——
Qwiic Connect System
Prototyping with I2C has never been easier. SparkFun’s Qwiic Connect System uses 4-pin JST connectors to quickly interface development boards with sensors, LCDs, relays and more.
DL2108Mk09
1 x SparkFun Thing Plus – ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x Adalogger FeatherWing – RTC + SD
1 x SparkFun Environmental Combo CCS811/BME280 (Qwiic)
1 x CR1220 3V Lithium Coin Cell Battery
1 x 32Gb microSD Card
1 x LED Green
1 x Rocker Switch – SPST (Round)
1 x Terminal Block Breakout FeatherWing
1 x Lithium Ion Battery – 850mAh
1 x GPS Receiver – GP-20U7
1 x Rotary Switch – 10 Position
1 x SparkFun Rotary Switch – 10 Position
1 x Black Knob
2 x Spring Terminals – PCB Mount (6-Pin)
2 x Breadboard Solderable
12 x 1K Ohm
1 x FeatherWing Proto
1 x Acrylic Orange 5.75 inches x 3.75 inches x 1/8 inch
1 x Acrylic Black 5.75 inches x 3.75 inches x 1/8 inch
52 x Screw – 4-40
18 x Standoff – Metal 4-40 – 3/8″
8 x Standoff – Metal 4-40 – 1″
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
SCK – Digital 13
MSI – Digital 12
SS0 – Digital 27
GRX – Digital 16
GTX – Digital 17
SDA – Digital 23
SDL – Digital 22
SCK – Digital 5
MSO – Digital 19
MSI – Digital 18
SS1 – Digital 33
LEG – Digital 21
SW0 – Digital 32
ROT – Analog A0
VIN – +3.3V
GND – GND
DL2108Mk09p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #19: Time - Qwiic Connect System - Mk08 08-08 DL2108Mk09p.ino 1 x SparkFun Thing Plus - ESP32 WROOM 1 x Adafruit SHARP Memory Display 1 x Adalogger FeatherWing - RTC + SD 1 x SparkFun Environmental Combo CCS811/BME280 (Qwiic) 1 x CR1220 3V Lithium Coin Cell Battery 1 x 32Gb microSD Card 1 x LED Green 1 x Rocker Switch - SPST (Round) 1 x Terminal Block Breakout FeatherWing 1 x Lithium Ion Battery - 850mAh 1 x GPS Receiver - GP-20U7 1 x Rotary Switch - 10 Position 1 x SparkFun Rotary Switch – 10 Position 1 x Black Knob 2 x Spring Terminals - PCB Mount (6-Pin) 2 x Breadboard Solderable 12 x 1K Ohm 1 x FeatherWing Proto 1 x Acrylic Orange 5.75 inches x 3.75 inches x 1/8 inch 1 x Acrylic Black 5.75 inches x 3.75 inches x 1/8 inch 52 x Screw - 4-40 18 x Standoff - Metal 4-40 - 3/8" 8 x Standoff - Metal 4-40 - 1" 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // EEPROM Library to Read and Write EEPROM with Unique ID for Unit #include "EEPROM.h" // Wire #include <Wire.h> // SHARP Memory Display #include <Adafruit_SharpMem.h> #include <Adafruit_GFX.h> // Date and time RTC #include "RTClib.h" // GPS Receiver #include <TinyGPS++.h> // ESP32 Hardware Serial #include <HardwareSerial.h> // SD Card #include "FS.h" #include "SD.h" #include "SPI.h" // SparkFun CCS811 - eCO2 & tVOC #include <SparkFunCCS811.h> // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure #include <SparkFunBME280.h> // SHARP Memory Display #define SHARP_SCK 13 #define SHARP_MOSI 12 #define SHARP_SS 27 // Set the size of the display here, e.g. 144x168! Adafruit_SharpMem display(SHARP_SCK, SHARP_MOSI, SHARP_SS, 144, 168); // The currently-available SHARP Memory Display (144x168 pixels) // requires > 4K of microcontroller RAM; it WILL NOT WORK on Arduino Uno // or other <4K "classic" devices. #define BLACK 0 #define WHITE 1 // Date and Time // PCF8523 Precision RTC RTC_PCF8523 rtc; // Date String dateRTC = ""; // Time String timeRTC = ""; // ESP32 HardwareSerial HardwareSerial tGPS(2); // GPS Receiver #define gpsRXPIN 16 // This one is unused and doesnt have a conection #define gpsTXPIN 17 // The TinyGPS++ object TinyGPSPlus gps; // Latitude float TargetLat; // Longitude float TargetLon; // GPS Date, Time, Speed, Altitude // GPS Date String TargetDat; // GPS Time String TargetTim; // GPS Speeds M/S String TargetSMS; // GPS Speeds Km/h String TargetSKH; // GPS Altitude Meters String TargetALT; // GPS Status String GPSSt = ""; // Rotary Switch - 10 Position // Number 1 => 10 int iRotNum = A0; // iRotVal - Value int iRotVal = 0; // Number int z = 0; // MicroSD Card const int chipSelect = 33; String zzzzzz = ""; // LED Green int iLEDGreen = 21; // Rocker Switch - SPST (Round) int iSS1 = 32; // State int iSS1State = 0; // SparkFun CCS811 - eCO2 & tVOC // Default I2C Address #define CCS811_ADDR 0x5B CCS811 myCCS811(CCS811_ADDR); // eCO2 float CCS811CO2 = 0; // TVOC float CCS811TVOC = 0; // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure BME280 myBME280; // Temperature Celsius float BMEtempC = 0; // Humidity float BMEhumid = 0; // Altitude Meters float BMEaltitudeM = 0; // Barometric Pressure float BMEpressure = 0; // Software Version Information // EEPROM Unique ID Information #define EEPROM_SIZE 64 String uid = ""; // Version String sver = "19-08"; void loop() { // Dates and Time isRTC(); // isGPS isGPS(); // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure isBME280(); // SparkFun CCS811 - eCO2 & tVOC isCCS811(); // Rotary Switch isRot(); // Slide Switch // Read the state of the iSS1 value iSS1State = digitalRead(iSS1); // If it is the Slide Switch State is HIGH if (iSS1State == HIGH) { // iLEDGreen HIGH digitalWrite(iLEDGreen, HIGH ); // MicroSD Card isSD(); } else { // iLEDGreen LOW digitalWrite(iLEDGreen, LOW ); } delay( 1000 ); }
getBME280.ino
// SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure // isBME280 - Humidity, Temperature, Altitude and Barometric Pressure void isBME280(){ // Temperature Celsius BMEtempC = myBME280.readTempC(); // Humidity BMEhumid = myBME280.readFloatHumidity(); // Altitude Meters BMEaltitudeM = (myBME280.readFloatAltitudeMeters(), 2); // Barometric Pressure BMEpressure = myBME280.readFloatPressure(); }
getCCS811.ino
// CCS811 - eCO2 & tVOC // isCCS811 - eCO2 & tVOC void isCCS811(){ // This sends the temperature & humidity data to the CCS811 myCCS811.setEnvironmentalData(BMEhumid, BMEtempC); // Calling this function updates the global tVOC and eCO2 variables myCCS811.readAlgorithmResults(); // eCO2 Concentration CCS811CO2 = myCCS811.getCO2(); // tVOC Concentration CCS811TVOC = myCCS811.getTVOC(); }
getDisplay.ino
// SHARP Memory Display // SHARP Memory Display - UID void isDisplayUID() { // Text Display // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(3); display.setTextColor(BLACK); // Don Luc Electronics display.setCursor(0,10); display.println( "Don Luc" ); display.setTextSize(2); display.setCursor(0,40); display.println( "Electronics" ); // Version //display.setTextSize(3); display.setCursor(0,70); display.println( "Version" ); //display.setTextSize(2); display.setCursor(0,95); display.println( sver ); // EEPROM display.setCursor(0,120); display.println( "EEPROM" ); display.setCursor(0,140); display.println( uid ); // Refresh display.refresh(); delay( 100 ); } // Display Date void isDisplayDate() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Date display.setCursor(0,5); display.println( "Date" ); display.setCursor(0,30); display.println( dateRTC ); // Time display.setCursor(0,55); display.println( "Time" ); display.setCursor(0,75); display.println( timeRTC ); // Refresh display.refresh(); delay( 100 ); } // Display GPS void isDisplayGPS() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // GPS Status display.setCursor(0,5); display.print( "GPS: " ); display.println( GPSSt ); // Target Latitude display.setCursor(0,25); display.println( "Latitude" ); display.setCursor(0,45); display.println( TargetLat ); // Target Longitude display.setCursor(0,65); display.println( "Longitude" ); display.setCursor(0,90); display.println( TargetLon ); // Refresh display.refresh(); delay( 100 ); } // GPS Date, Time, Speed, Altitude void isDisplayGPSDate() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // GPS display.setCursor(0,5); display.println( "GPS" ); // Date display.setCursor(0,30); display.println( TargetDat ); // Time display.setCursor(0,55); display.println( TargetTim ); // Speed display.setCursor(0,75); display.print( "M/S: " ); display.println( TargetSMS ); display.setCursor(0,95); display.print( "Km/h: " ); display.println( TargetSKH ); display.setCursor(0,115); display.print( "Alt: " ); display.println( TargetALT ); // Refresh display.refresh(); delay( 100 ); } // Display BME280 - Humidity, Temperature, Altitude and Barometric Pressure void isDisplayBME280() { // Text Display BME280 // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Temperature Celsius display.setCursor(0,10); display.println( "Temperature" ); display.setCursor(0,30); display.print( BMEtempC ); display.println( " C" ); // Humidity display.setCursor(0,50); display.println( "Humidity" ); display.setCursor(0,70); display.print( BMEhumid ); display.println( "%" ); // Altitude Meters display.setCursor(0,90); display.println( "Altitude M" ); display.setCursor(0,110); display.print( BMEaltitudeM ); display.println( " m" ); // Pressure display.setCursor(0,130); display.println( "Barometric" ); display.setCursor(0,150); display.print( BMEpressure ); display.println( "Pa" ); // Refresh display.refresh(); delay( 100 ); } // Display CCS811 - eCO2 & tVOC void isDisplayCCS811() { // Text Display CCS811 // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // eCO2 Concentration display.setCursor(0,10); display.println( "eCO2" ); display.setCursor(0,30); display.print( CCS811CO2 ); display.println( " ppm" ); // tVOC Concentration display.setCursor(0,60); display.println( "tVOC" ); display.setCursor(0,80); display.print( CCS811TVOC ); display.println( " ppb" ); // Refresh display.refresh(); delay( 100 ); } // Display Z void isDisplayZ() { // Text Display Z // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(3); display.setTextColor(BLACK); // Z display.setCursor(0,10); display.print( "Z: " ); display.println( z ); // Refresh display.refresh(); delay( 100 ); }
getEEPROM.ino
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getGPS.ino
// GPS Receiver // Setup GPS void setupGPS() { // Setup GPS tGPS.begin( 9600 , SERIAL_8N1 , gpsRXPIN , gpsTXPIN ); } // isGPS void isGPS(){ // Receives NEMA data from GPS receiver // This sketch displays information every time a new sentence is correctly encoded while ( tGPS.available() > 0) if (gps.encode( tGPS.read() )) { // GPS Vector Pointer Target displayInfo(); // GPS Date, Time, Speed, Altitude displayDTS(); } if (millis() > 5000 && gps.charsProcessed() < 10) { while(true); } } // GPS Vector Pointer Target void displayInfo(){ // Location if (gps.location.isValid()) { // Latitude TargetLat = gps.location.lat(); // Longitude TargetLon = gps.location.lng(); // GPS Status 2 GPSSt = "Yes"; } else { // GPS Status 0 GPSSt = "No"; } } // GPS Date, Time, Speed, Altitude void displayDTS(){ // Date TargetDat = ""; if (gps.date.isValid()) { // Date // Year TargetDat += String(gps.date.year(), DEC); TargetDat += "/"; // Month TargetDat += String(gps.date.month(), DEC); TargetDat += "/"; // Day TargetDat += String(gps.date.day(), DEC); } // Time TargetTim = ""; if (gps.time.isValid()) { // Time // Hour TargetTim += String(gps.time.hour(), DEC); TargetTim += ":"; // Minute TargetTim += String(gps.time.minute(), DEC); TargetTim += ":"; // Secound TargetTim += String(gps.time.second(), DEC); } // Speed TargetSMS = ""; TargetSKH = ""; if (gps.speed.isValid()) { // Speed // M/S int x = gps.speed.mps(); TargetSMS = String( x, DEC); // Km/h int y = gps.speed.kmph(); TargetSKH = String( y, DEC); } // Altitude TargetALT = ""; if (gps.altitude.isValid()) { // Altitude // Meters int z = gps.altitude.meters(); TargetALT = String( z, DEC); } }
getRTC.ino
// Date & Time // PCF8523 Precision RTC void setupRTC() { // Date & Time // pcf8523 Precision RTC if (! rtc.begin()) { while (1); } if (! rtc.initialized()) { // Following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0)); // rtc.adjust(DateTime(2021, 8, 18, 8, 48, 0)); } } // Date and Time RTC PCF8523 void isRTC () { // Date and Time dateRTC = ""; timeRTC = ""; DateTime now = rtc.now(); // Date // Year dateRTC = now.year(), DEC; dateRTC = dateRTC + "/"; // Month dateRTC = dateRTC + now.month(), DEC; dateRTC = dateRTC + "/"; // Day dateRTC = dateRTC + now.day(), DEC; // Time // Hour timeRTC = now.hour(), DEC; timeRTC = timeRTC + ":"; // Minute timeRTC = timeRTC + now.minute(), DEC; timeRTC = timeRTC + ":"; // Second timeRTC = timeRTC + now.second(), DEC; }
getRot.ino
// Rotary Switch // isRot - iRotVal - Value void isRot() { // Rotary Switch z = analogRead( iRotNum ); // Rotary Switch - 10 Position // Number 1 => 10 if ( z >= 3600 ) { // Z iRotVal = 10; } else if ( z >= 3200 ) { // Z iRotVal = 9; } else if ( z >= 2700 ) { // Z iRotVal = 8; } else if ( z >= 2400 ) { // Z iRotVal = 7; } else if ( z >= 2000 ) { // Z iRotVal = 6; } else if ( z >= 1600 ) { // Z iRotVal = 5; } else if ( z >= 1200 ) { // Z iRotVal = 4; } else if ( z >= 900 ) { // Z iRotVal = 3; } else if ( z >= 500 ) { // Z iRotVal = 2; } else { // Z iRotVal = 1; } // Range Value switch ( iRotVal ) { case 1: // Display Date, Time isDisplayDate(); break; case 2: // Display GPS isDisplayGPS(); break; case 3: // GPS Date, Time, Speed, Altitude //isDisplayGPSDate(); break; case 4: // GPS Display Date, Time, Speed isDisplayGPSDate(); break; case 5: // Display BME280 isDisplayBME280(); break; case 6: // Display CCS811 - eCO2 & tVOC isDisplayCCS811(); break; case 7: // Z isDisplayZ(); break; case 8: // Z isDisplayZ(); break; case 9: // Z isDisplayZ(); break; case 10: // Z isDisplayZ(); break; } }
getSD.ino
// MicroSD Card // MicroSD Setup void setupSD() { // MicroSD Card pinMode( chipSelect , OUTPUT ); if(!SD.begin( chipSelect )){ ; return; } uint8_t cardType = SD.cardType(); // CARD NONE if(cardType == CARD_NONE){ ; return; } // SD Card Type if(cardType == CARD_MMC){ ; } else if(cardType == CARD_SD){ ; } else if(cardType == CARD_SDHC){ ; } else { ; } // Size uint64_t cardSize = SD.cardSize() / (1024 * 1024); } // MicroSD Card void isSD() { zzzzzz = ""; // EEPROM Unique ID|Version|Date|Time|GPS Status|Target Latitude|Target Longitude|GPS Date|GPS Time|GPS Speed M/S|GPS Speed Km/h|GPS Altitude|Temperature Celsius|Humidity|Altitude Meters|Barometric Pressure|eCO2 Concentration|tVOC Concentration|\r zzzzzz = uid + "|" + sver + "|" + dateRTC + "|" + timeRTC + "|" + GPSSt + "|" + TargetLat + "|" + TargetLon + "|" + TargetDat + "|" + TargetTim + "|" + TargetSMS + "|" + TargetSKH + "|" + TargetALT + "|" + BMEtempC + "|" + BMEhumid + "|" + BMEaltitudeM + "|" + BMEpressure + "|" + CCS811CO2 + "|" + CCS811TVOC + + "|\r"; // msg + 1 char msg[zzzzzz.length() + 1]; zzzzzz.toCharArray(msg, zzzzzz.length() + 1); // Append File appendFile(SD, "/espdata.txt", msg ); } // List Dir void listDir(fs::FS &fs, const char * dirname, uint8_t levels){ // List Dir dirname; File root = fs.open(dirname); if(!root){ return; } if(!root.isDirectory()){ return; } File file = root.openNextFile(); while(file){ if(file.isDirectory()){ file.name(); if(levels){ listDir(fs, file.name(), levels -1); } } else { file.name(); file.size(); } file = root.openNextFile(); } } // Write File void writeFile(fs::FS &fs, const char * path, const char * message){ // Write File path; File file = fs.open(path, FILE_WRITE); if(!file){ return; } if(file.print(message)){ ; } else { ; } file.close(); } // Append File void appendFile(fs::FS &fs, const char * path, const char * message){ // Append File path; File file = fs.open(path, FILE_APPEND); if(!file){ return; } if(file.print(message)){ ; } else { ; } file.close(); }
setup.ino
// Setup void setup() { // EEPROM Size EEPROM.begin(EEPROM_SIZE); // EEPROM Unique ID isUID(); // GPS Receiver // Setup GPS setupGPS(); // Set up I2C bus Wire.begin(); // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure myBME280.begin(); // CCS811 - eCO2 & tVOC myCCS811.begin(); // SHARP Display Start & Clear the Display display.begin(); // Clear Display display.clearDisplay(); // Date & Time RTC // PCF8523 Precision RTC isDisplayUID(); // Setup RTC setupRTC(); //MicroSD Card setupSD(); // Initialize the LED Green pinMode(iLEDGreen, OUTPUT); // Slide Switch pinMode(iSS1, INPUT); delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Research & Development (R & D)
- Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
- Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
- Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
- Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
- Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
- Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
- eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)
Instructor
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
Follow Us
J. Luc Paquin – Curriculum Vitae – 2021 English & Español
https://www.jlpconsultants.com/CV/LucPaquinCVEngMk2021c.pdf
https://www.jlpconsultants.com/CV/LucPaquinCVEspMk2021c.pdf
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Web: https://www.donluc.com/DLE/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: https://zoom.us/
Patreon: https://www.patreon.com/DonLucElectronics
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #19: Time – Terminal Block Breakout FeatherWing – Mk07
——
#DonLucElectronics #DonLuc #Time #RTC #Display #Adalogger #MicroSD #GPSReceiver #CCS811 #BME280 #Arduino #ESP32 #SparkFunESP32WROOM #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog
——
——
——
——
——
Terminal Block Breakout FeatherWing
The Terminal Block Breakout FeatherWing kit is like the of prototyping FeatherWings. To start, you get a nice prototyping area underneath your Feather, with extra pads for ground, 3.3V and SDA/SCL. There’s also four mounting holes so you can attach the breakout to your enclosure or project.
This product works with all our Feathers. The terminal blocks allow you to connect to any of the external Feather pins, great for wiring temporary or permanent installations. We also give you a few extra terminal block pins for ground and 3.3V connections since those are so useful.
FeatherWing Proto
This is the FeatherWing Proto – a prototyping add-on for all Feather boards. This has a duplicate breakout for each pin on a Feather, as well as a bunch of plain grid proto holes. For GND and 3.3V, we give you a strip of connected pads. There’s plenty of room for buttons, indicator LEDs, or anything for your portable project. The FeatherWing Proto makes an ideal partner for any of our Feather boards.
DL2108Mk08
1 x SparkFun Thing Plus – ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x Adalogger FeatherWing – RTC + SD
1 x SparkFun Environmental Combo CCS811/BME280 (Qwiic)
1 x Qwiic Cable – 100mm
1 x CR1220 3V Lithium Coin Cell Battery
1 x 32Gb microSD Card
1 x LED Green
1 x Rocker Switch – SPST (Round)
1 x Terminal Block Breakout FeatherWing
1 x Lithium Ion Battery – 850mAh
1 x GPS Receiver – GP-20U7
1 x Rotary Switch – 10 Position
1 x SparkFun Rotary Switch – 10 Position
1 x Black Knob
2 x Spring Terminals – PCB Mount (6-Pin)
2 x Breadboard Solderable
12 x 1K Ohm
1 x FeatherWing Proto
1 x Acrylic Orange 5.75 inches x 3.75 inches x 1/8 inch
1 x Acrylic Black 5.75 inches x 3.75 inches x 1/8 inch
52 x Screw – 4-40
18 x Standoff – Metal 4-40 – 3/8″
8 x Standoff – Metal 4-40 – 1″
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
Qwiic – 0x77
Qwiic – 0x5B
SCK – Digital 13
MSI – Digital 12
SS0 – Digital 27
GRX – Digital 16
GTX – Digital 17
SDA – Digital 23
SDL – Digital 22
SCK – Digital 5
MSO – Digital 19
MSI – Digital 18
SS1 – Digital 33
LEG – Digital 21
SW0 – Digital 32
ROT – Analog A0
VIN – +3.3V
GND – GND
——
DL2108Mk08p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #19: Time - Terminal Block Breakout FeatherWing - Mk07 08-07 DL2108Mk07p.ino 1 x SparkFun Thing Plus - ESP32 WROOM 1 x Adafruit SHARP Memory Display 1 x Adalogger FeatherWing - RTC + SD 1 x SparkFun Environmental Combo CCS811/BME280 (Qwiic) 1 x CR1220 3V Lithium Coin Cell Battery 1 x 32Gb microSD Card 1 x LED Green 1 x Rocker Switch - SPST (Round) 1 x Terminal Block Breakout FeatherWing 1 x Lithium Ion Battery - 850mAh 1 x GPS Receiver - GP-20U7 1 x Rotary Switch - 10 Position 1 x SparkFun Rotary Switch – 10 Position 1 x Black Knob 2 x Spring Terminals - PCB Mount (6-Pin) 2 x Breadboard Solderable 12 x 1K Ohm 1 x FeatherWing Proto 1 x Acrylic Orange 5.75 inches x 3.75 inches x 1/8 inch 1 x Acrylic Black 5.75 inches x 3.75 inches x 1/8 inch 52 x Screw - 4-40 18 x Standoff - Metal 4-40 - 3/8" 8 x Standoff - Metal 4-40 - 1" 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // EEPROM Library to Read and Write EEPROM with Unique ID for Unit #include "EEPROM.h" // Wire #include <Wire.h> // SHARP Memory Display #include <Adafruit_SharpMem.h> #include <Adafruit_GFX.h> // Date and time RTC #include "RTClib.h" // GPS Receiver #include <TinyGPS++.h> // ESP32 Hardware Serial #include <HardwareSerial.h> // SD Card #include "FS.h" #include "SD.h" #include "SPI.h" // SparkFun CCS811 - eCO2 & tVOC #include <SparkFunCCS811.h> // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure #include <SparkFunBME280.h> // SHARP Memory Display #define SHARP_SCK 13 #define SHARP_MOSI 12 #define SHARP_SS 27 // Set the size of the display here, e.g. 144x168! Adafruit_SharpMem display(SHARP_SCK, SHARP_MOSI, SHARP_SS, 144, 168); // The currently-available SHARP Memory Display (144x168 pixels) // requires > 4K of microcontroller RAM; it WILL NOT WORK on Arduino Uno // or other <4K "classic" devices. #define BLACK 0 #define WHITE 1 // Date and Time // PCF8523 Precision RTC RTC_PCF8523 rtc; // Date String dateRTC = ""; // Time String timeRTC = ""; // ESP32 HardwareSerial HardwareSerial tGPS(2); // GPS Receiver #define gpsRXPIN 16 // This one is unused and doesnt have a conection #define gpsTXPIN 17 // The TinyGPS++ object TinyGPSPlus gps; // Latitude float TargetLat; // Longitude float TargetLon; // GPS Date, Time, Speed, Altitude // GPS Date String TargetDat; // GPS Time String TargetTim; // GPS Speeds M/S String TargetSMS; // GPS Speeds Km/h String TargetSKH; // GPS Altitude Meters String TargetALT; // GPS Status String GPSSt = ""; // Rotary Switch - 10 Position // Number 1 => 10 int iRotNum = A0; // iRotVal - Value int iRotVal = 0; // Number int z = 0; // MicroSD Card const int chipSelect = 33; String zzzzzz = ""; // LED Green int iLEDGreen = 21; // Rocker Switch - SPST (Round) int iSS1 = 32; // State int iSS1State = 0; // SparkFun CCS811 - eCO2 & tVOC // Default I2C Address #define CCS811_ADDR 0x5B CCS811 myCCS811(CCS811_ADDR); // eCO2 float CCS811CO2 = 0; // TVOC float CCS811TVOC = 0; // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure BME280 myBME280; // Temperature Celsius float BMEtempC = 0; // Humidity float BMEhumid = 0; // Altitude Meters float BMEaltitudeM = 0; // Barometric Pressure float BMEpressure = 0; // Software Version Information // EEPROM Unique ID Information #define EEPROM_SIZE 64 String uid = ""; // Version String sver = "19-07"; void loop() { // Dates and Time isRTC(); // isGPS isGPS(); // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure isBME280(); // SparkFun CCS811 - eCO2 & tVOC isCCS811(); // Rotary Switch isRot(); // Slide Switch // Read the state of the iSS1 value iSS1State = digitalRead(iSS1); // If it is the Slide Switch State is HIGH if (iSS1State == HIGH) { // iLEDGreen HIGH digitalWrite(iLEDGreen, HIGH ); // MicroSD Card isSD(); } else { // iLEDGreen LOW digitalWrite(iLEDGreen, LOW ); } delay( 1000 ); }
getBME280.ino
// SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure // isBME280 - Humidity, Temperature, Altitude and Barometric Pressure void isBME280(){ // Temperature Celsius BMEtempC = myBME280.readTempC(); // Humidity BMEhumid = myBME280.readFloatHumidity(); // Altitude Meters BMEaltitudeM = (myBME280.readFloatAltitudeMeters(), 2); // Barometric Pressure BMEpressure = myBME280.readFloatPressure(); }
getCCS811.ino
// CCS811 - eCO2 & tVOC // isCCS811 - eCO2 & tVOC void isCCS811(){ // This sends the temperature & humidity data to the CCS811 myCCS811.setEnvironmentalData(BMEhumid, BMEtempC); // Calling this function updates the global tVOC and eCO2 variables myCCS811.readAlgorithmResults(); // eCO2 Concentration CCS811CO2 = myCCS811.getCO2(); // tVOC Concentration CCS811TVOC = myCCS811.getTVOC(); }
getDisplay.ino
// SHARP Memory Display // SHARP Memory Display - UID void isDisplayUID() { // Text Display // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(3); display.setTextColor(BLACK); // Don Luc Electronics display.setCursor(0,10); display.println( "Don Luc" ); display.setTextSize(2); display.setCursor(0,40); display.println( "Electronics" ); // Version //display.setTextSize(3); display.setCursor(0,70); display.println( "Version" ); //display.setTextSize(2); display.setCursor(0,95); display.println( sver ); // EEPROM display.setCursor(0,120); display.println( "EEPROM" ); display.setCursor(0,140); display.println( uid ); // Refresh display.refresh(); delay( 100 ); } // Display Date void isDisplayDate() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Date display.setCursor(0,5); display.println( "Date" ); display.setCursor(0,30); display.println( dateRTC ); // Time display.setCursor(0,55); display.println( "Time" ); display.setCursor(0,75); display.println( timeRTC ); // Refresh display.refresh(); delay( 100 ); } // Display GPS void isDisplayGPS() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // GPS Status display.setCursor(0,5); display.print( "GPS: " ); display.println( GPSSt ); // Target Latitude display.setCursor(0,25); display.println( "Latitude" ); display.setCursor(0,45); display.println( TargetLat ); // Target Longitude display.setCursor(0,65); display.println( "Longitude" ); display.setCursor(0,90); display.println( TargetLon ); // Refresh display.refresh(); delay( 100 ); } // GPS Date, Time, Speed, Altitude void isDisplayGPSDate() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // GPS display.setCursor(0,5); display.println( "GPS" ); // Date display.setCursor(0,30); display.println( TargetDat ); // Time display.setCursor(0,55); display.println( TargetTim ); // Speed display.setCursor(0,75); display.print( "M/S: " ); display.println( TargetSMS ); display.setCursor(0,95); display.print( "Km/h: " ); display.println( TargetSKH ); display.setCursor(0,115); display.print( "Alt: " ); display.println( TargetALT ); // Refresh display.refresh(); delay( 100 ); } // Display BME280 - Humidity, Temperature, Altitude and Barometric Pressure void isDisplayBME280() { // Text Display BME280 // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Temperature Celsius display.setCursor(0,10); display.println( "Temperature" ); display.setCursor(0,30); display.print( BMEtempC ); display.println( " C" ); // Humidity display.setCursor(0,50); display.println( "Humidity" ); display.setCursor(0,70); display.print( BMEhumid ); display.println( "%" ); // Altitude Meters display.setCursor(0,90); display.println( "Altitude M" ); display.setCursor(0,110); display.print( BMEaltitudeM ); display.println( " m" ); // Pressure display.setCursor(0,130); display.println( "Barometric" ); display.setCursor(0,150); display.print( BMEpressure ); display.println( "Pa" ); // Refresh display.refresh(); delay( 100 ); } // Display CCS811 - eCO2 & tVOC void isDisplayCCS811() { // Text Display CCS811 // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // eCO2 Concentration display.setCursor(0,10); display.println( "eCO2" ); display.setCursor(0,30); display.print( CCS811CO2 ); display.println( " ppm" ); // tVOC Concentration display.setCursor(0,60); display.println( "tVOC" ); display.setCursor(0,80); display.print( CCS811TVOC ); display.println( " ppb" ); // Refresh display.refresh(); delay( 100 ); } // Display Z void isDisplayZ() { // Text Display Z // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(3); display.setTextColor(BLACK); // Z display.setCursor(0,10); display.print( "Z: " ); display.println( z ); // Refresh display.refresh(); delay( 100 ); }
getEEPROM.ino
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getGPS.ino
// GPS Receiver // Setup GPS void setupGPS() { // Setup GPS tGPS.begin( 9600 , SERIAL_8N1 , gpsRXPIN , gpsTXPIN ); } // isGPS void isGPS(){ // Receives NEMA data from GPS receiver // This sketch displays information every time a new sentence is correctly encoded while ( tGPS.available() > 0) if (gps.encode( tGPS.read() )) { // GPS Vector Pointer Target displayInfo(); // GPS Date, Time, Speed, Altitude displayDTS(); } if (millis() > 5000 && gps.charsProcessed() < 10) { while(true); } } // GPS Vector Pointer Target void displayInfo(){ // Location if (gps.location.isValid()) { // Latitude TargetLat = gps.location.lat(); // Longitude TargetLon = gps.location.lng(); // GPS Status 2 GPSSt = "Yes"; } else { // GPS Status 0 GPSSt = "No"; } } // GPS Date, Time, Speed, Altitude void displayDTS(){ // Date TargetDat = ""; if (gps.date.isValid()) { // Date // Year TargetDat += String(gps.date.year(), DEC); TargetDat += "/"; // Month TargetDat += String(gps.date.month(), DEC); TargetDat += "/"; // Day TargetDat += String(gps.date.day(), DEC); } // Time TargetTim = ""; if (gps.time.isValid()) { // Time // Hour TargetTim += String(gps.time.hour(), DEC); TargetTim += ":"; // Minute TargetTim += String(gps.time.minute(), DEC); TargetTim += ":"; // Secound TargetTim += String(gps.time.second(), DEC); } // Speed TargetSMS = ""; TargetSKH = ""; if (gps.speed.isValid()) { // Speed // M/S int x = gps.speed.mps(); TargetSMS = String( x, DEC); // Km/h int y = gps.speed.kmph(); TargetSKH = String( y, DEC); } // Altitude TargetALT = ""; if (gps.altitude.isValid()) { // Altitude // Meters int z = gps.altitude.meters(); TargetALT = String( z, DEC); } }
getRTC.ino
// Date & Time // PCF8523 Precision RTC void setupRTC() { // Date & Time // pcf8523 Precision RTC if (! rtc.begin()) { while (1); } if (! rtc.initialized()) { // Following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0)); // rtc.adjust(DateTime(2021, 8, 18, 8, 48, 0)); } } // Date and Time RTC PCF8523 void isRTC () { // Date and Time dateRTC = ""; timeRTC = ""; DateTime now = rtc.now(); // Date // Year dateRTC = now.year(), DEC; dateRTC = dateRTC + "/"; // Month dateRTC = dateRTC + now.month(), DEC; dateRTC = dateRTC + "/"; // Day dateRTC = dateRTC + now.day(), DEC; // Time // Hour timeRTC = now.hour(), DEC; timeRTC = timeRTC + ":"; // Minute timeRTC = timeRTC + now.minute(), DEC; timeRTC = timeRTC + ":"; // Second timeRTC = timeRTC + now.second(), DEC; }
getRot.ino
// Rotary Switch // isRot - iRotVal - Value void isRot() { // Rotary Switch z = analogRead( iRotNum ); // Rotary Switch - 10 Position // Number 1 => 10 if ( z >= 3600 ) { // Z iRotVal = 10; } else if ( z >= 3200 ) { // Z iRotVal = 9; } else if ( z >= 2700 ) { // Z iRotVal = 8; } else if ( z >= 2400 ) { // Z iRotVal = 7; } else if ( z >= 2000 ) { // Z iRotVal = 6; } else if ( z >= 1600 ) { // Z iRotVal = 5; } else if ( z >= 1200 ) { // Z iRotVal = 4; } else if ( z >= 900 ) { // Z iRotVal = 3; } else if ( z >= 500 ) { // Z iRotVal = 2; } else { // Z iRotVal = 1; } // Range Value switch ( iRotVal ) { case 1: // Display Date, Time isDisplayDate(); break; case 2: // Display GPS isDisplayGPS(); break; case 3: // GPS Date, Time, Speed, Altitude //isDisplayGPSDate(); break; case 4: // GPS Display Date, Time, Speed isDisplayGPSDate(); break; case 5: // Display BME280 isDisplayBME280(); break; case 6: // Display CCS811 - eCO2 & tVOC isDisplayCCS811(); break; case 7: // Z isDisplayZ(); break; case 8: // Z isDisplayZ(); break; case 9: // Z isDisplayZ(); break; case 10: // Z isDisplayZ(); break; } }
getSD.ino
// MicroSD Card // MicroSD Setup void setupSD() { // MicroSD Card pinMode( chipSelect , OUTPUT ); if(!SD.begin( chipSelect )){ ; return; } uint8_t cardType = SD.cardType(); // CARD NONE if(cardType == CARD_NONE){ ; return; } // SD Card Type if(cardType == CARD_MMC){ ; } else if(cardType == CARD_SD){ ; } else if(cardType == CARD_SDHC){ ; } else { ; } // Size uint64_t cardSize = SD.cardSize() / (1024 * 1024); } // MicroSD Card void isSD() { zzzzzz = ""; // EEPROM Unique ID|Version|Date|Time|GPS Status|Target Latitude|Target Longitude|GPS Date|GPS Time|GPS Speed M/S|GPS Speed Km/h|GPS Altitude|Temperature Celsius|Humidity|Altitude Meters|Barometric Pressure|eCO2 Concentration|tVOC Concentration|\r zzzzzz = uid + "|" + sver + "|" + dateRTC + "|" + timeRTC + "|" + GPSSt + "|" + TargetLat + "|" + TargetLon + "|" + TargetDat + "|" + TargetTim + "|" + TargetSMS + "|" + TargetSKH + "|" + TargetALT + "|" + BMEtempC + "|" + BMEhumid + "|" + BMEaltitudeM + "|" + BMEpressure + "|" + CCS811CO2 + "|" + CCS811TVOC + + "|\r"; // msg + 1 char msg[zzzzzz.length() + 1]; zzzzzz.toCharArray(msg, zzzzzz.length() + 1); // Append File appendFile(SD, "/espdata.txt", msg ); } // List Dir void listDir(fs::FS &fs, const char * dirname, uint8_t levels){ // List Dir dirname; File root = fs.open(dirname); if(!root){ return; } if(!root.isDirectory()){ return; } File file = root.openNextFile(); while(file){ if(file.isDirectory()){ file.name(); if(levels){ listDir(fs, file.name(), levels -1); } } else { file.name(); file.size(); } file = root.openNextFile(); } } // Write File void writeFile(fs::FS &fs, const char * path, const char * message){ // Write File path; File file = fs.open(path, FILE_WRITE); if(!file){ return; } if(file.print(message)){ ; } else { ; } file.close(); } // Append File void appendFile(fs::FS &fs, const char * path, const char * message){ // Append File path; File file = fs.open(path, FILE_APPEND); if(!file){ return; } if(file.print(message)){ ; } else { ; } file.close(); }
setup.ino
// Setup void setup() { // EEPROM Size EEPROM.begin(EEPROM_SIZE); // EEPROM Unique ID isUID(); // GPS Receiver // Setup GPS setupGPS(); // Set up I2C bus Wire.begin(); // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure myBME280.begin(); // CCS811 - eCO2 & tVOC myCCS811.begin(); // SHARP Display Start & Clear the Display display.begin(); // Clear Display display.clearDisplay(); // Date & Time RTC // PCF8523 Precision RTC isDisplayUID(); // Setup RTC setupRTC(); //MicroSD Card setupSD(); // Initialize the LED Green pinMode(iLEDGreen, OUTPUT); // Slide Switch pinMode(iSS1, INPUT); delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Research & Development (R & D)
- Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
- Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
- Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
- Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
- Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
- Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
- eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)
Instructor
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
Follow Us
J. Luc Paquin – Curriculum Vitae – 2021 English & Español
https://www.jlpconsultants.com/CV/LucPaquinCVEngMk2021c.pdf
https://www.jlpconsultants.com/CV/LucPaquinCVEspMk2021c.pdf
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Web: https://www.donluc.com/DLE/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: https://zoom.us/
Patreon: https://www.patreon.com/DonLucElectronics
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #19: Time – SparkFun Environmental Combo CCS811/BME280 – Mk06
——
#DonLucElectronics #DonLuc #Time #RTC #Display #Adalogger #MicroSD #GPSReceiver #CCS811 #BME280 #Arduino #ESP32 #SparkFunESP32WROOM #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog
——
——
——
——
——
SparkFun Environmental Combo Breakout – CCS811/BME280 (Qwiic)
The SparkFun CCS811/BME280 Environmental Combo Breakout takes care of all your atmospheric-quality sensing needs with the popular CCS811 and BME280 ICs. This unique breakout provides a variety of environmental data, including barometric pressure, humidity, temperature, TVOCs and equivalent eCO2 levels. To make it even easier to use this breakout, all communication is enacted exclusively via I2C, utilizing our handy Qwiic system. However, we still have broken out 0.1″ spaced pins in case you prefer to use a breadboard.
Bosch Sensortec BME280
The BME280 is as combined digital humidity, pressure and temperature sensor based on proven sensing principles. Its small dimensions and its low power consumption allow the implementation in battery driven devices such as handsets, GPS modules or watches. The BME280 achieves high performance in all applications requiring humidity and pressure measurement. These emerging applications of home automation control, indoor navigation, health care as well as GPS refinement require a high accuracy and a low TCO at the same time. The humidity sensor provides an extremely fast response time for fast context awareness applications and high overall accuracy over a wide temperature range. The pressure sensor is an absolute barometric pressure sensor with extremely high accuracy and resolution.
Typical Application
-Context awareness, e.g. skin detection, room change detection
-Health monitoring / well-being
-Warning regarding dehydration or heat stroke
-Spirometry (measurement of lung volume and air flow)
-Home automation control
-Control heating, venting, air conditioning (HVAC)
-Internet of Things
-GPS enhancement (e.g. time-to-first-fix improvement, dead reckoning, slope detection)
-Indoor navigation (change of floor detection, elevator detection)
-Outdoor navigation, leisure and sports applications
-Weather forecast
-Vertical velocity indication (rise/sink speed)
Target devices
-Handsets such as mobile phones, tablet PCs, GPS devices
-Navigation systems
-Gaming, e.g flying toys
-Camera (DSC, video)
-Portable health care devices
-Home weather stations
-Flying toys
-Watches
ams AG CCS811
The CCS811 is an exceedingly popular sensor, providing readings for equivalent eCO2 in the PPM and total volatile organic compounds in the PPB. The CCS811 is an ultra-low power digital gas sensor solution which integrates a metal oxide (MOX) gas sensor to detect a wide range of Volatile Organic Compounds (VOCs) for indoor air quality monitoring with a microcontroller unit (MCU), which includes an Analog-to-Digital converter (ADC), and an I²C interface.
DL2108Mk07
1 x SparkFun Thing Plus – ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x Adalogger FeatherWing – RTC + SD
1 x SparkFun Environmental Combo CCS811/BME280 (Qwiic)
1 x Qwiic Cable – 100mm
1 x CR1220 3V Lithium Coin Cell Battery
1 x 32Gb microSD Card
1 x LED Green
1 x Rocker Switch – SPST (Round)
1 x Terminal Block Breakout FeatherWing
1 x Lithium Ion Battery – 850mAh
1 x GPS Receiver – GP-20U7
1 x Rotary Switch – 10 Position
1 x SparkFun Rotary Switch – 10 Position
1 x Black Knob
2 x Spring Terminals – PCB Mount (6-Pin)
2 x Breadboard Solderable
12 x 1K Ohm
1 x FeatherWing Proto
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
Qwiic – 0x77
Qwiic – 0x5B
SCK – Digital 13
MSI – Digital 12
SS0 – Digital 27
GRX – Digital 16
GTX – Digital 17
SDA – Digital 23
SDL – Digital 22
SCK – Digital 5
MSO – Digital 19
MSI – Digital 18
SS1 – Digital 33
LEG – Digital 21
SW0 – Digital 32
ROT – Analog A0
VIN – +3.3V
GND – GND
——
DL2108Mk07p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #19: Time - SparkFun Environmental Combo CCS811/BME280 - Mk06 08-07 DL2108Mk07p.ino 1 x SparkFun Thing Plus - ESP32 WROOM 1 x Adafruit SHARP Memory Display 1 x Adalogger FeatherWing - RTC + SD 1 x SparkFun Environmental Combo CCS811/BME280 (Qwiic) 1 x CR1220 3V Lithium Coin Cell Battery 1 x 32Gb microSD Card 1 x LED Green 1 x Rocker Switch - SPST (Round) 1 x Terminal Block Breakout FeatherWing 1 x Lithium Ion Battery - 850mAh 1 x GPS Receiver - GP-20U7 1 x Rotary Switch - 10 Position 1 x SparkFun Rotary Switch – 10 Position 1 x Black Knob 2 x Spring Terminals - PCB Mount (6-Pin) 2 x Breadboard Solderable 12 x 1K Ohm 1 x FeatherWing Proto 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // EEPROM Library to Read and Write EEPROM with Unique ID for Unit #include "EEPROM.h" // Wire #include <Wire.h> // SHARP Memory Display #include <Adafruit_SharpMem.h> #include <Adafruit_GFX.h> // Date and time RTC #include "RTClib.h" // GPS Receiver #include <TinyGPS++.h> // ESP32 Hardware Serial #include <HardwareSerial.h> // SD Card #include "FS.h" #include "SD.h" #include "SPI.h" // SparkFun CCS811 - eCO2 & tVOC #include <SparkFunCCS811.h> // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure #include <SparkFunBME280.h> // SHARP Memory Display #define SHARP_SCK 13 #define SHARP_MOSI 12 #define SHARP_SS 27 // Set the size of the display here, e.g. 144x168! Adafruit_SharpMem display(SHARP_SCK, SHARP_MOSI, SHARP_SS, 144, 168); // The currently-available SHARP Memory Display (144x168 pixels) // requires > 4K of microcontroller RAM; it WILL NOT WORK on Arduino Uno // or other <4K "classic" devices. #define BLACK 0 #define WHITE 1 // Date and Time // PCF8523 Precision RTC RTC_PCF8523 rtc; // Date String dateRTC = ""; // Time String timeRTC = ""; // ESP32 HardwareSerial HardwareSerial tGPS(2); // GPS Receiver #define gpsRXPIN 16 // This one is unused and doesnt have a conection #define gpsTXPIN 17 // The TinyGPS++ object TinyGPSPlus gps; // Latitude float TargetLat; // Longitude float TargetLon; // GPS Date, Time, Speed, Altitude // GPS Date String TargetDat; // GPS Time String TargetTim; // GPS Speeds M/S String TargetSMS; // GPS Speeds Km/h String TargetSKH; // GPS Altitude Meters String TargetALT; // GPS Status String GPSSt = ""; // Rotary Switch - 10 Position // Number 1 => 10 int iRotNum = A0; // iRotVal - Value int iRotVal = 0; // Number int z = 0; // MicroSD Card const int chipSelect = 33; String zzzzzz = ""; // LED Green int iLEDGreen = 21; // Rocker Switch - SPST (Round) int iSS1 = 32; // State int iSS1State = 0; // SparkFun CCS811 - eCO2 & tVOC // Default I2C Address #define CCS811_ADDR 0x5B CCS811 myCCS811(CCS811_ADDR); // eCO2 float CCS811CO2 = 0; // TVOC float CCS811TVOC = 0; // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure BME280 myBME280; // Temperature Celsius float BMEtempC = 0; // Humidity float BMEhumid = 0; // Altitude Meters float BMEaltitudeM = 0; // Barometric Pressure float BMEpressure = 0; // Software Version Information // EEPROM Unique ID Information #define EEPROM_SIZE 64 String uid = ""; // Version String sver = "19-06"; void loop() { // Dates and Time isRTC(); // isGPS isGPS(); // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure isBME280(); // SparkFun CCS811 - eCO2 & tVOC isCCS811(); // Rotary Switch isRot(); // Slide Switch // Read the state of the iSS1 value iSS1State = digitalRead(iSS1); // If it is the Slide Switch State is HIGH if (iSS1State == HIGH) { // iLEDGreen HIGH digitalWrite(iLEDGreen, HIGH ); // MicroSD Card isSD(); } else { // iLEDGreen LOW digitalWrite(iLEDGreen, LOW ); } delay( 1000 ); }
getBME280.ino
// SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure // isBME280 - Humidity, Temperature, Altitude and Barometric Pressure void isBME280(){ // Temperature Celsius BMEtempC = myBME280.readTempC(); // Humidity BMEhumid = myBME280.readFloatHumidity(); // Altitude Meters BMEaltitudeM = (myBME280.readFloatAltitudeMeters(), 2); // Barometric Pressure BMEpressure = myBME280.readFloatPressure(); }
getCCS811.ino
// CCS811 - eCO2 & tVOC // isCCS811 - eCO2 & tVOC void isCCS811(){ // This sends the temperature & humidity data to the CCS811 myCCS811.setEnvironmentalData(BMEhumid, BMEtempC); // Calling this function updates the global tVOC and eCO2 variables myCCS811.readAlgorithmResults(); // eCO2 Concentration CCS811CO2 = myCCS811.getCO2(); // tVOC Concentration CCS811TVOC = myCCS811.getTVOC(); }
getDisplay.ino
// SHARP Memory Display // SHARP Memory Display - UID void isDisplayUID() { // Text Display // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(3); display.setTextColor(BLACK); // Don Luc Electronics display.setCursor(0,10); display.println( "Don Luc" ); display.setTextSize(2); display.setCursor(0,40); display.println( "Electronics" ); // Version //display.setTextSize(3); display.setCursor(0,70); display.println( "Version" ); //display.setTextSize(2); display.setCursor(0,95); display.println( sver ); // EEPROM display.setCursor(0,120); display.println( "EEPROM" ); display.setCursor(0,140); display.println( uid ); // Refresh display.refresh(); delay( 100 ); } // Display Date void isDisplayDate() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Date display.setCursor(0,5); display.println( "Date" ); display.setCursor(0,30); display.println( dateRTC ); // Time display.setCursor(0,55); display.println( "Time" ); display.setCursor(0,75); display.println( timeRTC ); // Refresh display.refresh(); delay( 100 ); } // Display GPS void isDisplayGPS() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // GPS Status display.setCursor(0,5); display.print( "GPS: " ); display.println( GPSSt ); // Target Latitude display.setCursor(0,25); display.println( "Latitude" ); display.setCursor(0,45); display.println( TargetLat ); // Target Longitude display.setCursor(0,65); display.println( "Longitude" ); display.setCursor(0,90); display.println( TargetLon ); // Refresh display.refresh(); delay( 100 ); } // GPS Date, Time, Speed, Altitude void isDisplayGPSDate() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // GPS display.setCursor(0,5); display.println( "GPS" ); // Date display.setCursor(0,30); display.println( TargetDat ); // Time display.setCursor(0,55); display.println( TargetTim ); // Speed display.setCursor(0,75); display.print( "M/S: " ); display.println( TargetSMS ); display.setCursor(0,95); display.print( "Km/h: " ); display.println( TargetSKH ); display.setCursor(0,115); display.print( "Alt: " ); display.println( TargetALT ); // Refresh display.refresh(); delay( 100 ); } // Display BME280 - Humidity, Temperature, Altitude and Barometric Pressure void isDisplayBME280() { // Text Display BME280 // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Temperature Celsius display.setCursor(0,10); display.println( "Temperature" ); display.setCursor(0,30); display.print( BMEtempC ); display.println( " C" ); // Humidity display.setCursor(0,50); display.println( "Humidity" ); display.setCursor(0,70); display.print( BMEhumid ); display.println( "%" ); // Altitude Meters display.setCursor(0,90); display.println( "Altitude M" ); display.setCursor(0,110); display.print( BMEaltitudeM ); display.println( " m" ); // Pressure display.setCursor(0,130); display.println( "Barometric" ); display.setCursor(0,150); display.print( BMEpressure ); display.println( "Pa" ); // Refresh display.refresh(); delay( 100 ); } // Display CCS811 - eCO2 & tVOC void isDisplayCCS811() { // Text Display CCS811 // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // eCO2 Concentration display.setCursor(0,10); display.println( "eCO2" ); display.setCursor(0,30); display.print( CCS811CO2 ); display.println( " ppm" ); // tVOC Concentration display.setCursor(0,60); display.println( "tVOC" ); display.setCursor(0,80); display.print( CCS811TVOC ); display.println( " ppb" ); // Refresh display.refresh(); delay( 100 ); } // Display Z void isDisplayZ() { // Text Display Z // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(3); display.setTextColor(BLACK); // Z display.setCursor(0,10); display.print( "Z: " ); display.println( z ); // Refresh display.refresh(); delay( 100 ); }
getEEPROM.ino
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getGPS.ino
// GPS Receiver // Setup GPS void setupGPS() { // Setup GPS tGPS.begin( 9600 , SERIAL_8N1 , gpsRXPIN , gpsTXPIN ); } // isGPS void isGPS(){ // Receives NEMA data from GPS receiver // This sketch displays information every time a new sentence is correctly encoded while ( tGPS.available() > 0) if (gps.encode( tGPS.read() )) { // GPS Vector Pointer Target displayInfo(); // GPS Date, Time, Speed, Altitude displayDTS(); } if (millis() > 5000 && gps.charsProcessed() < 10) { while(true); } } // GPS Vector Pointer Target void displayInfo(){ // Location if (gps.location.isValid()) { // Latitude TargetLat = gps.location.lat(); // Longitude TargetLon = gps.location.lng(); // GPS Status 2 GPSSt = "Yes"; } else { // GPS Status 0 GPSSt = "No"; } } // GPS Date, Time, Speed, Altitude void displayDTS(){ // Date TargetDat = ""; if (gps.date.isValid()) { // Date // Year TargetDat += String(gps.date.year(), DEC); TargetDat += "/"; // Month TargetDat += String(gps.date.month(), DEC); TargetDat += "/"; // Day TargetDat += String(gps.date.day(), DEC); } // Time TargetTim = ""; if (gps.time.isValid()) { // Time // Hour TargetTim += String(gps.time.hour(), DEC); TargetTim += ":"; // Minute TargetTim += String(gps.time.minute(), DEC); TargetTim += ":"; // Secound TargetTim += String(gps.time.second(), DEC); } // Speed TargetSMS = ""; TargetSKH = ""; if (gps.speed.isValid()) { // Speed // M/S int x = gps.speed.mps(); TargetSMS = String( x, DEC); // Km/h int y = gps.speed.kmph(); TargetSKH = String( y, DEC); } // Altitude TargetALT = ""; if (gps.altitude.isValid()) { // Altitude // Meters int z = gps.altitude.meters(); TargetALT = String( z, DEC); } }
getRTC.ino
// Date & Time // PCF8523 Precision RTC void setupRTC() { // Date & Time // pcf8523 Precision RTC if (! rtc.begin()) { while (1); } if (! rtc.initialized()) { // Following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0)); // rtc.adjust(DateTime(2021, 8, 18, 8, 48, 0)); } } // Date and Time RTC PCF8523 void isRTC () { // Date and Time dateRTC = ""; timeRTC = ""; DateTime now = rtc.now(); // Date // Year dateRTC = now.year(), DEC; dateRTC = dateRTC + "/"; // Month dateRTC = dateRTC + now.month(), DEC; dateRTC = dateRTC + "/"; // Day dateRTC = dateRTC + now.day(), DEC; // Time // Hour timeRTC = now.hour(), DEC; timeRTC = timeRTC + ":"; // Minute timeRTC = timeRTC + now.minute(), DEC; timeRTC = timeRTC + ":"; // Second timeRTC = timeRTC + now.second(), DEC; }
getRot.ino
// Rotary Switch // isRot - iRotVal - Value void isRot() { // Rotary Switch z = analogRead( iRotNum ); // Rotary Switch - 10 Position // Number 1 => 10 if ( z >= 3600 ) { // Z iRotVal = 10; } else if ( z >= 3200 ) { // Z iRotVal = 9; } else if ( z >= 2700 ) { // Z iRotVal = 8; } else if ( z >= 2400 ) { // Z iRotVal = 7; } else if ( z >= 2000 ) { // Z iRotVal = 6; } else if ( z >= 1600 ) { // Z iRotVal = 5; } else if ( z >= 1200 ) { // Z iRotVal = 4; } else if ( z >= 900 ) { // Z iRotVal = 3; } else if ( z >= 500 ) { // Z iRotVal = 2; } else { // Z iRotVal = 1; } // Range Value switch ( iRotVal ) { case 1: // Display Date, Time isDisplayDate(); break; case 2: // Display GPS isDisplayGPS(); break; case 3: // GPS Date, Time, Speed, Altitude //isDisplayGPSDate(); break; case 4: // GPS Display Date, Time, Speed isDisplayGPSDate(); break; case 5: // Display BME280 isDisplayBME280(); break; case 6: // Display CCS811 - eCO2 & tVOC isDisplayCCS811(); break; case 7: // Z isDisplayZ(); break; case 8: // Z isDisplayZ(); break; case 9: // Z isDisplayZ(); break; case 10: // Z isDisplayZ(); break; } }
getSD.ino
// MicroSD Card // MicroSD Setup void setupSD() { // MicroSD Card pinMode( chipSelect , OUTPUT ); if(!SD.begin( chipSelect )){ ; return; } uint8_t cardType = SD.cardType(); // CARD NONE if(cardType == CARD_NONE){ ; return; } // SD Card Type if(cardType == CARD_MMC){ ; } else if(cardType == CARD_SD){ ; } else if(cardType == CARD_SDHC){ ; } else { ; } // Size uint64_t cardSize = SD.cardSize() / (1024 * 1024); } // MicroSD Card void isSD() { zzzzzz = ""; // EEPROM Unique ID|Version|Date|Time|GPS Status|Target Latitude|Target Longitude|GPS Date|GPS Time|GPS Speed M/S|GPS Speed Km/h|GPS Altitude|Temperature Celsius|Humidity|Altitude Meters|Barometric Pressure|eCO2 Concentration|tVOC Concentration|\r zzzzzz = uid + "|" + sver + "|" + dateRTC + "|" + timeRTC + "|" + GPSSt + "|" + TargetLat + "|" + TargetLon + "|" + TargetDat + "|" + TargetTim + "|" + TargetSMS + "|" + TargetSKH + "|" + TargetALT + "|" + BMEtempC + "|" + BMEhumid + "|" + BMEaltitudeM + "|" + BMEpressure + "|" + CCS811CO2 + "|" + CCS811TVOC + + "|\r"; // msg + 1 char msg[zzzzzz.length() + 1]; zzzzzz.toCharArray(msg, zzzzzz.length() + 1); // Append File appendFile(SD, "/espdata.txt", msg ); } // List Dir void listDir(fs::FS &fs, const char * dirname, uint8_t levels){ // List Dir dirname; File root = fs.open(dirname); if(!root){ return; } if(!root.isDirectory()){ return; } File file = root.openNextFile(); while(file){ if(file.isDirectory()){ file.name(); if(levels){ listDir(fs, file.name(), levels -1); } } else { file.name(); file.size(); } file = root.openNextFile(); } } // Write File void writeFile(fs::FS &fs, const char * path, const char * message){ // Write File path; File file = fs.open(path, FILE_WRITE); if(!file){ return; } if(file.print(message)){ ; } else { ; } file.close(); } // Append File void appendFile(fs::FS &fs, const char * path, const char * message){ // Append File path; File file = fs.open(path, FILE_APPEND); if(!file){ return; } if(file.print(message)){ ; } else { ; } file.close(); }
setup.ino
// Setup void setup() { // EEPROM Size EEPROM.begin(EEPROM_SIZE); // EEPROM Unique ID isUID(); // GPS Receiver // Setup GPS setupGPS(); // Set up I2C bus Wire.begin(); // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure myBME280.begin(); // CCS811 - eCO2 & tVOC myCCS811.begin(); // SHARP Display Start & Clear the Display display.begin(); // Clear Display display.clearDisplay(); // Date & Time RTC // PCF8523 Precision RTC isDisplayUID(); // Setup RTC setupRTC(); //MicroSD Card setupSD(); // Initialize the LED Green pinMode(iLEDGreen, OUTPUT); // Slide Switch pinMode(iSS1, INPUT); delay( 5000 ); }
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Research & Development (R & D)
- Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
- Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
- Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
- Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
- Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
- Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
- eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)
Instructor
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
Follow Us
J. Luc Paquin – Curriculum Vitae – 2021 English & Español
https://www.jlpconsultants.com/CV/LucPaquinCVEngMk2021c.pdf
https://www.jlpconsultants.com/CV/LucPaquinCVEspMk2021c.pdf
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Web: https://www.donluc.com/DLE/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: https://zoom.us/
Patreon: https://www.patreon.com/DonLucElectronics
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #19: Time – Adalogger FeatherWing – RTC + SD – Mk05
——
#DonLucElectronics #DonLuc #Time #RTC #Display #Adalogger #MicroSD #GPSReceiver #Arduino #ESP32 #SparkFunESP32WROOM #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog
——
——
——
——
——
Adalogger FeatherWing – RTC + SD
A Feather board without ambition is a Feather board without FeatherWings. This is the Adalogger FeatherWing: it adds both a battery-backed Real Time Clock and MicroSD card storage to any Feather main board. This FeatherWing will make it real easy to add datalogging to any of our existing Feathers. You get both an I2C Real Time Clock (PCF8523) with 32KHz crystal and battery backup, and a MicroSD socket that connects to the SPI port pins.
MicroSD Card
If you have a project with any audio, video, graphics, data logging, etc in it, you’ll find that having a removable storage option is essential. Most microcontrollers have extremely limited built-in storage. If you’re doing any sort of data logging, graphics or audio, you’ll need at least a megabyte of storage, and 64M is probably the minimum.
MicroSD cards are ‘raw’ storage. They’re just sectors in a flash chip, there’s no structure that you have to use. That means you could format an SD card to be a Linux filesystem, a FAT (DOS) filesystem or a Mac filesystem. You could also not have any filesystem at all. However, 99% of computers, cameras, MP3 players, GPS loggers, etc require FAT16 or FAT32 for the filesystem. The tradeoff here is that for smaller microcontrollers the addition of the complex file format handling can take a lot of flash storage and RAM.
DL2108Mk06
1 x SparkFun Thing Plus – ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x Adalogger FeatherWing – RTC + SD
1 x CR1220 3V Lithium Coin Cell Battery
1 x 32Gb microSD Card
1 x LED Green
1 x Rocker Switch – SPST (Round)
1 x Terminal Block Breakout FeatherWing
1 x Lithium Ion Battery – 850mAh
1 x GPS Receiver – GP-20U7
1 x Rotary Switch – 10 Position
1 x SparkFun Rotary Switch – 10 Position
1 x Black Knob
1 x Breadboard Solderable
12 x 1K Ohm
1 x Half-Size Breadboard
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
SCK – Digital 13
MSI – Digital 12
SS0 – Digital 27
GRX – Digital 16
GTX – Digital 17
SDA – Digital 23
SDL – Digital 22
SCK – Digital 5
MSO – Digital 19
MSI – Digital 18
SS1 – Digital 33
LEG – Digital 21
SW0 – Digital 32
ROT – Analog A0
VIN – +3.3V
GND – GND
DL2108Mk06p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #19: Time - Adalogger FeatherWing - RTC + SD - Mk05 08-06 DL2108Mk06p.ino 1 x SparkFun Thing Plus - ESP32 WROOM 1 x Adafruit SHARP Memory Display 1 x Adalogger FeatherWing - RTC + SD 1 x CR1220 3V Lithium Coin Cell Battery 1 x 32Gb microSD Card 1 x LED Green 1 x Rocker Switch - SPST (Round) 1 x Terminal Block Breakout FeatherWing 1 x Lithium Ion Battery - 850mAh 1 x GPS Receiver - GP-20U7 1 x Rotary Switch - 10 Position 1 x SparkFun Rotary Switch – 10 Position 1 x Black Knob 1 x Breadboard Solderable 12 x 1K Ohm 1 x Half-Size Breadboard 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // EEPROM Library to Read and Write EEPROM with Unique ID for Unit #include "EEPROM.h" // Wire // #include <Wire.h> // SHARP Memory Display #include <Adafruit_SharpMem.h> #include <Adafruit_GFX.h> // Date and time RTC #include "RTClib.h" // GPS Receiver #include <TinyGPS++.h> // ESP32 Hardware Serial #include <HardwareSerial.h> // SD Card #include "FS.h" #include "SD.h" #include "SPI.h" // SHARP Memory Display #define SHARP_SCK 13 #define SHARP_MOSI 12 #define SHARP_SS 27 // Set the size of the display here, e.g. 144x168! Adafruit_SharpMem display(SHARP_SCK, SHARP_MOSI, SHARP_SS, 144, 168); // The currently-available SHARP Memory Display (144x168 pixels) // requires > 4K of microcontroller RAM; it WILL NOT WORK on Arduino Uno // or other <4K "classic" devices. #define BLACK 0 #define WHITE 1 // Date and Time // PCF8523 Precision RTC RTC_PCF8523 rtc; // Date String dateRTC = ""; // Time String timeRTC = ""; // ESP32 HardwareSerial HardwareSerial tGPS(2); // GPS Receiver #define gpsRXPIN 16 // This one is unused and doesnt have a conection #define gpsTXPIN 17 // The TinyGPS++ object TinyGPSPlus gps; // Latitude float TargetLat; // Longitude float TargetLon; // GPS Date, Time, Speed, Altitude // GPS Date String TargetDat; // GPS Time String TargetTim; // GPS Speeds M/S String TargetSMS; // GPS Speeds Km/h String TargetSKH; // GPS Altitude Meters String TargetALT; // GPS Status String GPSSt = ""; // Rotary Switch - 10 Position // Number 1 => 10 int iRotNum = A0; // iRotVal - Value int iRotVal = 0; // Number int z = 0; // MicroSD Card const int chipSelect = 33; String zzzzzz = ""; // LED Green int iLEDGreen = 21; // Rocker Switch - SPST (Round) int iSS1 = 32; // State int iSS1State = 0; // Software Version Information // EEPROM Unique ID Information #define EEPROM_SIZE 64 String uid = ""; // Version String sver = "19-05"; void loop() { // Dates and Time isRTC(); // isGPS isGPS(); // Rotary Switch isRot(); // Slide Switch // Read the state of the iSS1 value iSS1State = digitalRead(iSS1); // If it is the Slide Switch State is HIGH if (iSS1State == HIGH) { // iLEDGreen HIGH digitalWrite(iLEDGreen, HIGH ); // MicroSD Card isSD(); } else { // iLEDGreen LOW digitalWrite(iLEDGreen, LOW ); } delay( 1000 ); }
getDisplay.ino
// SHARP Memory Display // SHARP Memory Display - UID void isDisplayUID() { // Text Display // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(3); display.setTextColor(BLACK); // Don Luc Electronics display.setCursor(0,10); display.println( "Don Luc" ); display.setTextSize(2); display.setCursor(0,40); display.println( "Electronics" ); // Version //display.setTextSize(3); display.setCursor(0,70); display.println( "Version" ); //display.setTextSize(2); display.setCursor(0,95); display.println( sver ); // EEPROM display.setCursor(0,120); display.println( "EEPROM" ); display.setCursor(0,140); display.println( uid ); // Refresh display.refresh(); delay( 100 ); } // Display Date void isDisplayDate() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Date display.setCursor(0,5); display.println( "Date" ); display.setCursor(0,30); display.println( dateRTC ); // Time display.setCursor(0,55); display.println( "Time" ); display.setCursor(0,75); display.println( timeRTC ); // Refresh display.refresh(); delay( 100 ); } // Display GPS void isDisplayGPS() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // GPS Status display.setCursor(0,5); display.print( "GPS: " ); display.println( GPSSt ); // Target Latitude display.setCursor(0,25); display.println( "Latitude" ); display.setCursor(0,45); display.println( TargetLat ); // Target Longitude display.setCursor(0,65); display.println( "Longitude" ); display.setCursor(0,90); display.println( TargetLon ); // Refresh display.refresh(); delay( 100 ); } // GPS Date, Time, Speed, Altitude void isDisplayGPSDate() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // GPS display.setCursor(0,5); display.println( "GPS" ); // Date display.setCursor(0,30); display.println( TargetDat ); // Time display.setCursor(0,55); display.println( TargetTim ); // Speed display.setCursor(0,75); display.print( "M/S: " ); display.println( TargetSMS ); display.setCursor(0,95); display.print( "Km/h: " ); display.println( TargetSKH ); display.setCursor(0,115); display.print( "Alt: " ); display.println( TargetALT ); // Refresh display.refresh(); delay( 100 ); } // Display Z void isDisplayZ() { // Text Display Z // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(3); display.setTextColor(BLACK); // Z display.setCursor(0,10); display.print( "Z: " ); display.println( z ); // Refresh display.refresh(); delay( 100 ); }
getEEPROM.ino
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getGPS.ino
// GPS Receiver // Setup GPS void setupGPS() { // Setup GPS tGPS.begin( 9600 , SERIAL_8N1 , gpsRXPIN , gpsTXPIN ); } // isGPS void isGPS(){ // Receives NEMA data from GPS receiver // This sketch displays information every time a new sentence is correctly encoded while ( tGPS.available() > 0) if (gps.encode( tGPS.read() )) { // GPS Vector Pointer Target displayInfo(); // GPS Date, Time, Speed, Altitude displayDTS(); } if (millis() > 5000 && gps.charsProcessed() < 10) { while(true); } } // GPS Vector Pointer Target void displayInfo(){ // Location if (gps.location.isValid()) { // Latitude TargetLat = gps.location.lat(); // Longitude TargetLon = gps.location.lng(); // GPS Status 2 GPSSt = "Yes"; } else { // GPS Status 0 GPSSt = "No"; } } // GPS Date, Time, Speed, Altitude void displayDTS(){ // Date TargetDat = ""; if (gps.date.isValid()) { // Date // Year TargetDat += String(gps.date.year(), DEC); TargetDat += "/"; // Month TargetDat += String(gps.date.month(), DEC); TargetDat += "/"; // Day TargetDat += String(gps.date.day(), DEC); } // Time TargetTim = ""; if (gps.time.isValid()) { // Time // Hour TargetTim += String(gps.time.hour(), DEC); TargetTim += ":"; // Minute TargetTim += String(gps.time.minute(), DEC); TargetTim += ":"; // Secound TargetTim += String(gps.time.second(), DEC); } // Speed TargetSMS = ""; TargetSKH = ""; if (gps.speed.isValid()) { // Speed // M/S int x = gps.speed.mps(); TargetSMS = String( x, DEC); // Km/h int y = gps.speed.kmph(); TargetSKH = String( y, DEC); } // Altitude TargetALT = ""; if (gps.altitude.isValid()) { // Altitude // Meters int z = gps.altitude.meters(); TargetALT = String( z, DEC); } }
getRTC.ino
// Date & Time // PCF8523 Precision RTC void setupRTC() { // Date & Time // pcf8523 Precision RTC if (! rtc.begin()) { while (1); } if (! rtc.initialized()) { // Following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0)); // rtc.adjust(DateTime(2021, 8, 16, 12, 27, 0)); } } // Date and Time RTC PCF8523 void isRTC () { // Date and Time dateRTC = ""; timeRTC = ""; DateTime now = rtc.now(); // Date // Year dateRTC = now.year(), DEC; dateRTC = dateRTC + "/"; // Month dateRTC = dateRTC + now.month(), DEC; dateRTC = dateRTC + "/"; // Day dateRTC = dateRTC + now.day(), DEC; // Time // Hour timeRTC = now.hour(), DEC; timeRTC = timeRTC + ":"; // Minute timeRTC = timeRTC + now.minute(), DEC; timeRTC = timeRTC + ":"; // Second timeRTC = timeRTC + now.second(), DEC; }
getRot.ino
// Rotary Switch // isRot - iRotVal - Value void isRot() { // Rotary Switch z = analogRead( iRotNum ); // Rotary Switch - 10 Position // Number 1 => 10 if ( z >= 3500 ) { // Z iRotVal = 10; } else if ( z >= 3000 ) { // Z iRotVal = 9; } else if ( z >= 2600 ) { // Z iRotVal = 8; } else if ( z >= 2300 ) { // Z iRotVal = 7; } else if ( z >= 1900 ) { // Z iRotVal = 6; } else if ( z >= 1500 ) { // Z iRotVal = 5; } else if ( z >= 1200 ) { // Z iRotVal = 4; } else if ( z >= 800 ) { // Z iRotVal = 3; } else if ( z >= 400 ) { // Z iRotVal = 2; } else { // Z iRotVal = 1; } // Range Value switch ( iRotVal ) { case 1: // Display Date, Time isDisplayDate(); break; case 2: // Display GPS isDisplayGPS(); break; case 3: // GPS Date, Time, Speed, Altitude //isDisplayGPSDate(); break; case 4: // GPS Display Date, Time, Speed isDisplayGPSDate(); break; case 5: // Z isDisplayZ(); break; case 6: // Z isDisplayZ(); break; case 7: // Z isDisplayZ(); break; case 8: // Z isDisplayZ(); break; case 9: // Z isDisplayZ(); break; case 10: // Z isDisplayZ(); break; } }
getSD.ino
// MicroSD Card // MicroSD Setup void setupSD() { // MicroSD Card pinMode( chipSelect , OUTPUT ); if(!SD.begin( chipSelect )){ ; return; } uint8_t cardType = SD.cardType(); // CARD NONE if(cardType == CARD_NONE){ ; return; } // SD Card Type if(cardType == CARD_MMC){ ; } else if(cardType == CARD_SD){ ; } else if(cardType == CARD_SDHC){ ; } else { ; } // Size uint64_t cardSize = SD.cardSize() / (1024 * 1024); } // MicroSD Card void isSD() { zzzzzz = ""; // EEPROM Unique ID|Version|Date|Time|GPS Status|Target Latitude|Target Longitude|GPS Date|GPS Time|GPS Speed M/S|GPS Speed Km/h|GPS Altitude|\r zzzzzz = uid + "|" + sver + "|" + dateRTC + "|" + timeRTC + "|" + GPSSt + "|" + TargetLat + "|" + TargetLon + "|" + TargetDat + "|" + TargetTim + "|" + TargetSMS + "|" + TargetSKH + "|" + TargetALT + "|\r"; // msg + 1 char msg[zzzzzz.length() + 1]; zzzzzz.toCharArray(msg, zzzzzz.length() + 1); // Append File appendFile(SD, "/espdata.txt", msg ); } // List Dir void listDir(fs::FS &fs, const char * dirname, uint8_t levels){ // List Dir dirname; File root = fs.open(dirname); if(!root){ return; } if(!root.isDirectory()){ return; } File file = root.openNextFile(); while(file){ if(file.isDirectory()){ file.name(); if(levels){ listDir(fs, file.name(), levels -1); } } else { file.name(); file.size(); } file = root.openNextFile(); } } // Write File void writeFile(fs::FS &fs, const char * path, const char * message){ // Write File path; File file = fs.open(path, FILE_WRITE); if(!file){ return; } if(file.print(message)){ ; } else { ; } file.close(); } // Append File void appendFile(fs::FS &fs, const char * path, const char * message){ // Append File path; File file = fs.open(path, FILE_APPEND); if(!file){ return; } if(file.print(message)){ ; } else { ; } file.close(); }
setup.ino
// Setup void setup() { // EEPROM Size EEPROM.begin(EEPROM_SIZE); // EEPROM Unique ID isUID(); // GPS Receiver // Setup GPS setupGPS(); // Set up I2C bus // Wire.begin(); // SHARP Display Start & Clear the Display display.begin(); // Clear Display display.clearDisplay(); // Date & Time RTC // PCF8523 Precision RTC isDisplayUID(); // Setup RTC setupRTC(); //MicroSD Card setupSD(); // Initialize the LED Green pinMode(iLEDGreen, OUTPUT); // Slide Switch pinMode(iSS1, INPUT); delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Research & Development (R & D)
- Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
- Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
- Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
- Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
- Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
- Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
- eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)
Instructor
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
Follow Us
J. Luc Paquin – Curriculum Vitae – 2021 English & Español
https://www.jlpconsultants.com/CV/LucPaquinCVEngMk2021c.pdf
https://www.jlpconsultants.com/CV/LucPaquinCVEspMk2021c.pdf
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Web: https://www.donluc.com/DLE/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: https://zoom.us/
Patreon: https://www.patreon.com/DonLucElectronics
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #19: Time – Global Positioning System – Mk04
——
#DonLucElectronics #DonLuc #Time #DS3231PrecisionRTC #SHARPMemoryDisplay #GPSReceiver #Arduino #ESP32 #SparkFunThingPlusESP32WROOM #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog
——
——
——
——
——
Global Positioning System (GPS)
The Global Positioning System (GPS) is a satellite-based radionavigation system owned by the United States government and operated by the United States Space Force. It is one of the global navigation satellite systems (GNSS) that provides geolocation and time information to a GPS receiver anywhere on or near the Earth where there is an unobstructed line of sight to four or more GPS satellites. Obstacles such as mountains and buildings block the relatively weak GPS signals.
A satellite navigation device, colloquially called a GPS receiver, or simply a GPS, is a device that is capable of receiving information from GNSS satellites and then calculate the device’s geographical position. Using suitable software, the device may display the position on a map, and it may offer routing directions. The Global Positioning System (GPS) is one of a handful of global navigation satellite systems (GNSS) made up of a network of a minimum of 24, but currently 30, satellites placed into orbit by the U.S. Department of Defense.
A satellite navigation device can retrieve (from one or more satellite systems) location and time information in all weather conditions, anywhere on or near the Earth. GPS reception requires an unobstructed line of sight to four or more GPS satellites, and is subject to poor satellite signal conditions. Today, most standalone GPS receivers are used in automobiles. The GPS capability of smartphones may use assisted GPS (A-GPS) technology, which can use the base station or cell towers to provide a faster Time to First Fix (TTFF), especially when GPS signals are poor or unavailable. However, the mobile network part of the A-GPS technology would not be available when the smartphone is outside the range of the mobile reception network, while the GPS aspect would otherwise continue to be available.
DL2108Mk05
1 x SparkFun Thing Plus – ESP32 WROOM
1 x Adafruit SHARP Memory Display
1 x DS3231 Precision RTC FeatherWing
1 x CR1220 3V Lithium Coin Cell Battery
1 x Terminal Block Breakout FeatherWing
1 x Lithium Ion Battery – 850mAh
1 x GPS Receiver – GP-20U7
1 x Mountable Slide Switch
1 x SparkFun Rotary Switch – 10 Position
1 x Black Knob
1 x Breadboard Solderable
11 x 1K Ohm
1 x Half-Size Breadboard
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
SCK – Digital 13
MSI – Digital 12
SS0 – Digital 27
GRX – Digital 16
GTX – Digital 17
SDA – Digital 23
SDL – Digital 22
ROT – Analog A0
VIN – +3.3V
GND – GND
DL2108Mk05p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #19: Time - Global Positioning System - Mk04 08-05 DL2108Mk05p.ino 1 x SparkFun Thing Plus - ESP32 WROOM 1 x Adafruit SHARP Memory Display 1 x DS3231 Precision RTC FeatherWing 1 x CR1220 3V Lithium Coin Cell Battery 1 x Terminal Block Breakout FeatherWing 1 x Lithium Ion Battery - 850mAh 1 x GPS Receiver - GP-20U7 1 x Mountable Slide Switch 1 x SparkFun Rotary Switch – 10 Position 1 x Black Knob 1 x Breadboard Solderable 11 x 1K Ohm 1 x Half-Size Breadboard 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Wire // #include <Wire.h> // SHARP Memory Display #include <Adafruit_SharpMem.h> #include <Adafruit_GFX.h> // Date and time DS3231 RTC #include <RTClib.h> // GPS Receiver #include <TinyGPS++.h> // ESP32 Hardware Serial #include <HardwareSerial.h> // SHARP Memory Display #define SHARP_SCK 13 #define SHARP_MOSI 12 #define SHARP_SS 27 // Set the size of the display here, e.g. 144x168! Adafruit_SharpMem display(SHARP_SCK, SHARP_MOSI, SHARP_SS, 144, 168); // The currently-available SHARP Memory Display (144x168 pixels) // requires > 4K of microcontroller RAM; it WILL NOT WORK on Arduino Uno // or other <4K "classic" devices. #define BLACK 0 #define WHITE 1 // Date and time functions using a DS3231 RTC RTC_DS3231 RTC; // Date String sDate; // Time String sTime; // ESP32 HardwareSerial HardwareSerial tGPS(2); // GPS Receiver #define gpsRXPIN 16 // This one is unused and doesnt have a conection #define gpsTXPIN 17 // The TinyGPS++ object TinyGPSPlus gps; // Latitude float TargetLat; // Longitude float TargetLon; // GPS Date, Time, Speed, Altitude // GPS Date String TargetDat; // GPS Time String TargetTim; // GPS Speeds M/S String TargetSMS; // GPS Speeds Km/h String TargetSKH; // GPS Altitude Meters String TargetALT; // GPS Status String GPSSt = ""; // Rotary Switch - 10 Position // Number 1 => 10 int iRotNum = A0; // iRotVal - Value int iRotVal = 0; // Number int z = 0; // Software Version Information // Version String sver = "19-04"; void loop() { // Dates and Time timeRTC(); // isGPS isGPS(); // Rotary Switch isRot(); delay( 1000 ); }
getDisplay.ino
// SHARP Memory Display // SHARP Memory Display - UID void isDisplayUID() { // Text Display // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(3); display.setTextColor(BLACK); // Don Luc Electronics display.setCursor(0,10); display.println( "Don Luc" ); display.setTextSize(2); display.setCursor(0,40); display.println( "Electronics" ); // Version display.setTextSize(3); display.setCursor(0,70); display.println( "Version" ); display.setTextSize(2); display.setCursor(0,100); display.println( sver ); // Refresh display.refresh(); delay( 100 ); } // Display Date void isDisplayDate() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Date display.setCursor(0,5); display.println( "Date" ); display.setCursor(0,30); display.println( sDate ); // Time display.setCursor(0,55); display.println( "Time" ); display.setCursor(0,75); display.println( sTime ); // Refresh display.refresh(); delay( 100 ); } // Display GPS void isDisplayGPS() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // GPS Status display.setCursor(0,5); display.print( "GPS: " ); display.println( GPSSt ); // Target Latitude display.setCursor(0,25); display.println( "Latitude" ); display.setCursor(0,45); display.println( TargetLat ); // Target Longitude display.setCursor(0,65); display.println( "Longitude" ); display.setCursor(0,90); display.println( TargetLon ); // Refresh display.refresh(); delay( 100 ); } // GPS Date, Time, Speed, Altitude void isDisplayGPSDate() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // GPS display.setCursor(0,5); display.println( "GPS" ); // Date display.setCursor(0,30); display.println( TargetDat ); // Time display.setCursor(0,55); display.println( TargetTim ); // Speed display.setCursor(0,75); display.print( "M/S: " ); display.println( TargetSMS ); display.setCursor(0,95); display.print( "Km/h: " ); display.println( TargetSKH ); display.setCursor(0,115); display.print( "Alt: " ); display.println( TargetALT ); // Refresh display.refresh(); delay( 100 ); } // Display Z void isDisplayZ() { // Text Display Z // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(3); display.setTextColor(BLACK); // Z display.setCursor(0,10); display.print( "Z: " ); display.println( z ); // Refresh display.refresh(); delay( 100 ); }
getGPS.ino
// GPS Receiver // Setup GPS void setupGPS() { // Setup GPS tGPS.begin( 9600 , SERIAL_8N1 , gpsRXPIN , gpsTXPIN ); } // isGPS void isGPS(){ // Receives NEMA data from GPS receiver // This sketch displays information every time a new sentence is correctly encoded while ( tGPS.available() > 0) if (gps.encode( tGPS.read() )) { // GPS Vector Pointer Target displayInfo(); // GPS Date, Time, Speed, Altitude displayDTS(); } if (millis() > 5000 && gps.charsProcessed() < 10) { while(true); } } // GPS Vector Pointer Target void displayInfo(){ // Location if (gps.location.isValid()) { // Latitude TargetLat = gps.location.lat(); // Longitude TargetLon = gps.location.lng(); // GPS Status 2 GPSSt = "Yes"; } else { // GPS Status 0 GPSSt = "No"; } } // GPS Date, Time, Speed, Altitude void displayDTS(){ // Date TargetDat = ""; if (gps.date.isValid()) { // Date // Year TargetDat += String(gps.date.year(), DEC); TargetDat += "/"; // Month TargetDat += String(gps.date.month(), DEC); TargetDat += "/"; // Day TargetDat += String(gps.date.day(), DEC); } // Time TargetTim = ""; if (gps.time.isValid()) { // Time // Hour TargetTim += String(gps.time.hour(), DEC); TargetTim += ":"; // Minute TargetTim += String(gps.time.minute(), DEC); TargetTim += ":"; // Secound TargetTim += String(gps.time.second(), DEC); } // Speed TargetSMS = ""; TargetSKH = ""; if (gps.speed.isValid()) { // Speed // M/S int x = gps.speed.mps(); TargetSMS = String( x, DEC); // Km/h int y = gps.speed.kmph(); TargetSKH = String( y, DEC); } // Altitude TargetALT = ""; if (gps.altitude.isValid()) { // Altitude // Meters int z = gps.altitude.meters(); TargetALT = String( z, DEC); } }
getRTCDS3231.ino
// DS3231 Precision RTC // Setup RTC void setupRTC() { // DS3231 Precision RTC RTC.begin(); if (! RTC.begin()) { while (1); } // Date Time DateTime now = RTC.now(); if (RTC.lostPower()) { // Following line sets the RTC to the date & time this sketch was compiled RTC.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // August 2, 2021 at 13:53:0 you would call: // RTC.adjust(DateTime(2021, 8, 2, 14, 11, 0)); } } // timeRTC void timeRTC() { // DS3231 Precision RTC sDate = ""; sTime = ""; // Date Time DateTime now = RTC.now(); // sData sDate += String(now.year(), DEC); sDate += "/"; sDate += String(now.month(), DEC); sDate += "/"; sDate += String(now.day(), DEC); // sTime sTime += String(now.hour(), DEC); sTime += ":"; sTime += String(now.minute(), DEC); sTime += ":"; sTime += String(now.second(), DEC); }
getRot.ino
// Rotary Switch // isRot - iRotVal - Value void isRot() { // Rotary Switch z = analogRead( iRotNum ); // Rotary Switch - 10 Position // Number 1 => 10 if ( z >= 3500 ) { // Z iRotVal = 10; } else if ( z >= 3000 ) { // Z iRotVal = 9; } else if ( z >= 2600 ) { // Z iRotVal = 8; } else if ( z >= 2300 ) { // Z iRotVal = 7; } else if ( z >= 1900 ) { // Z iRotVal = 6; } else if ( z >= 1500 ) { // Z iRotVal = 5; } else if ( z >= 1200 ) { // Z iRotVal = 4; } else if ( z >= 800 ) { // Z iRotVal = 3; } else if ( z >= 400 ) { // Z iRotVal = 2; } else { // Z iRotVal = 1; } // Range Value switch ( iRotVal ) { case 1: // Display Date, Time isDisplayDate(); break; case 2: // Display GPS isDisplayGPS(); break; case 3: // GPS Date, Time, Speed, Altitude //isDisplayGPSDate(); break; case 4: // GPS Display Date, Time, Speed isDisplayGPSDate(); break; case 5: // Z isDisplayZ(); break; case 6: // Z isDisplayZ(); break; case 7: // Z isDisplayZ(); break; case 8: // Z isDisplayZ(); break; case 9: // Z isDisplayZ(); break; case 10: // Z isDisplayZ(); break; } }
setup.ino
// Setup void setup() { // GPS Receiver // Setup GPS setupGPS(); // Set up I2C bus // Wire.begin(); // SHARP Display Start & Clear the Display display.begin(); // Clear Display display.clearDisplay(); // Display UID isDisplayUID(); // Setup RTC setupRTC(); delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Research & Development (R & D)
- Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
- Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
- Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
- Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
- Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
- Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
- eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)
Instructor
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
Follow Us
J. Luc Paquin – Curriculum Vitae – 2021 English & Español
https://www.jlpconsultants.com/CV/LucPaquinCVEngMk2021c.pdf
https://www.jlpconsultants.com/CV/LucPaquinCVEspMk2021c.pdf
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Web: https://www.donluc.com/DLE/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: https://zoom.us/
Patreon: https://www.patreon.com/DonLucElectronics
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc