GPS Receiver
Project #29 – DFRobot – AltIMU-10 – Mk19
——
#DonLucElectronics #DonLuc #DFRobot #AltIMU10 #9DOF #GPS #FireBeetle2ESP32E #EEPROM #RTC #SD #Display #Pololu #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Pololu AltIMU-10 v5 Gyro, Accelerometer, Compass, and Altimeter
The Pololu AltIMU-10 v5 is a compact board that combines ST’s LSM6DS33 3-axis gyroscope and 3-axis accelerometer, LIS3MDL 3-axis magnetometer, and LPS25H digital barometer to form an inertial measurement unit (IMU) and altimeter. These sensors are great ICs, but their small packages make them difficult for the typical student or hobbyist to use. They also operate at voltages below 3.6 Volt, which can make interfacing difficult for microcontrollers operating at 5 Volt. The AltIMU-10 v5 addresses these issues by incorporating additional electronics, including a voltage regulator and a level-shifting circuit, while keeping the overall size as compact as possible. The board ships fully populated with its SMD components, including the LSM6DS33, LIS3MDL, and LPS25H.
Attitude and Heading Reference System (AHRS)
An attitude and heading reference system (AHRS) uses an inertial measurement unit (IMU) consisting of microelectromechanical system (MEMS) inertial sensors to measure the angular rate, acceleration, and Earth’s magnetic field. These measurements can then be used to derive an estimate of the object’s attitude. An AHRS typically includes a 3-axis gyroscope, a 3-axis accelerometer, and a 3-axis magnetometer to determine an estimate of a system’s orientation. Each of these sensors contribute different measurements to the combined system and each exhibit unique limitations.
DL2406Mk06
1 x DFRobot FireBeetle 2 ESP32-E
1 x Adafruit SHARP Memory Display
1 x Adafruit MicroSD card breakout board+
1 x MicroSD 16 GB
1 x Pololu AltIMU-10 v5
1 x GPS Receiver – GP-20U7
2 x Switch
1 x 1K Ohm
1 x 1 x Lithium Ion Battery – 1000mAh
1 x Green LED
1 x USB 3.1 Cable A to C
DFRobot FireBeetle 2 ESP32-E
LED – 2
DSCK – 4
DMOSI – 16
DSS – 17
SCK – 22
MOSI – 23
MISO – 19
CS – 13
GPR – 26
GPT – 25
SCL – 21
SDA – 22
LED – 14
SWI – 3
XAC – A0
YAC – A1
ZAC – A2
VIN – +3.3V
GND – GND
——
DL2406Mk06p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #29 - DFRobot - AltIMU-10 - Mk19 29-19 DL2406Mk06p.ino DL2406Mk06 1 x DFRobot FireBeetle 2 ESP32-E 1 x Adafruit SHARP Memory Display 1 x Adafruit MicroSD card breakout board+ 1 x MicroSD 16 GB 1 x Pololu AltIMU-10 v5 1 x GPS Receiver - GP-20U7 2 x Switch 1 x 1K Ohm 1 x 1 x Lithium Ion Battery - 1000mAh 1 x Green LED 1 x USB 3.1 Cable A to C */ // Include the Library Code // EEPROM Library to Read and Write EEPROM // with Unique ID for Unit #include "EEPROM.h" // Wire #include <Wire.h> // SD Card #include "FS.h" #include "SD.h" #include "SPI.h" // SHARP Memory Display #include <Adafruit_SharpMem.h> #include <Adafruit_GFX.h> // GPS Receiver #include <TinyGPS++.h> // ESP32 Hardware Serial #include <HardwareSerial.h> // Includes and variables for IMU integration // STMicroelectronics LSM6DS33 Gyroscope and Accelerometer #include <LSM6.h> // STMicroelectronics LIS3MDL Magnetometer #include <LIS3MDL.h> // STMicroelectronics LPS25H digital Barometer #include <LPS.h> // Earth's magnetic field varies by location. Add or subtract // a declination to get a more accurate heading. Calculate // your's here: http://www.ngdc.noaa.gov/geomag-web/#declination // Declination (degrees) in Mexicali #define DECLINATION 10.31 // 9DoF IMU // STMicroelectronics LSM6DS33 Gyroscope and Accelerometer LSM6 imu; // Accelerometer and Gyroscopes // Accelerometer int imuAX; int imuAY; int imuAZ; //String FullStringB = ""; // Gyroscopes int imuGX; int imuGY; int imuGZ; // STMicroelectronics LIS3MDL magnetometer LIS3MDL mag; // Magnetometer int magX; int magY; int magZ; // STMicroelectronics LPS25H digital barometer LPS ps; // Digital Barometer float pressure; float altitude; float temperature; // Attitude Calculate Pitch, Roll, and Headind float r; float p; float h; // ESP32 HardwareSerial HardwareSerial tGPS(2); // GPS Receiver #define gpsRXPIN 26 // This one is unused and doesnt have a conection #define gpsTXPIN 25 // The TinyGPS++ object TinyGPSPlus gps; // Latitude float TargetLat; // Longitude float TargetLon; // GPS Date, Time, Speed, Altitude // GPS Date String TargetDat; // GPS Time String TargetTim; // GPS Speeds M/S String TargetSMS; // GPS Speeds Km/h String TargetSKH; // GPS Altitude Meters String TargetALT; // GPS Status String GPSSt = ""; // MicroSD Card const int chipSelect = 13; String zzzzzz = ""; // SHARP Memory Display #define SHARP_SCK 4 #define SHARP_MOSI 16 #define SHARP_SS 17 // Set the size of the display here, e.g. 144x168! Adafruit_SharpMem display(SHARP_SCK, SHARP_MOSI, SHARP_SS, 144, 168); // The currently-available SHARP Memory Display (144x168 pixels) // requires > 4K of microcontroller RAM; it WILL NOT WORK on Arduino Uno // or other <4K "classic" devices. #define BLACK 0 #define WHITE 1 // LED Green int iLEDGreen = 2; // Define LED int iLED = 14; // Switch int iSwitch = 3; // Variable for reading the Switch status int iSwitchState = 0; // EEPROM Unique ID Information #define EEPROM_SIZE 64 String uid = ""; // Software Version Information String sver = "29-19"; void loop() { // Accelerometer and Gyroscopes isIMU(); // Magnetometer isMag(); // Barometer isBarometer(); // Attitude Calculate Pitch, Roll, and Heading isAttitude(imuAX, imuAY, imuAZ, -imuGY, -imuGX, imuGZ); // isGPS isGPS(); // Read the state of the Switch value iSwitchState = digitalRead(iSwitch); // The Switch is HIGH: if (iSwitchState == HIGH) { // Attitude Calculate Pitch, Roll, and Heading and Barometer isDisplayAttitude(); } else { // Display GPS isDisplayGPS(); } // MicroSD Card isSD(); // iLED HIGH digitalWrite(iLED, HIGH ); // Delay 5 Second delay(5000); }
getAccelGyro.ino
// Accelerometer and Gyroscopes // Setup IMU void isSetupIMU() { // Setup IMU imu.init(); // Default imu.enableDefault(); } // Accelerometer and Gyroscopes void isIMU() { // Accelerometer and Gyroscopes imu.read(); // Accelerometer x, y, z imuAX = imu.a.x; imuAY = imu.a.y; imuAZ = imu.a.z; // Gyroscopes x, y, z imuGX = imu.g.x; imuGY = imu.g.y; imuGZ = imu.g.z; }
getAttitude.ino
// Attitude Calculate Pitch, Roll, and Heading void isAttitude(float ax, float ay, float az, float mx, float my, float mz) { // Attitude Calculate Pitch, Roll, and Heading float roll = atan2(ay, az); float pitch = atan2(-ax, sqrt(ay * ay + az * az)); float heading; if (my == 0) heading = (mx < 0) ? PI : 0; else heading = atan2(mx, my); heading -= DECLINATION * PI / 180; if (heading > PI) heading -= (2 * PI); else if (heading < -PI) heading += (2 * PI); // Convert everything from radians to degrees: heading *= 180.0 / PI; pitch *= 180.0 / PI; roll *= 180.0 / PI; h = heading; p = pitch; r = roll; }
getBarometer.ino
// STMicroelectronics LPS25H digital barometer // Setup Barometer void isSetupBarometer(){ // Setup Barometer ps.init(); // Default ps.enableDefault(); } // Barometer void isBarometer(){ // Barometer pressure = ps.readPressureMillibars(); // Altitude Meters altitude = ps.pressureToAltitudeMeters(pressure); // Temperature Celsius temperature = ps.readTemperatureC(); }
getDisplay.ino
// SHARP Memory Display // SHARP Memory Display - UID void isDisplayUID() { // Text Display // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(3); display.setTextColor(BLACK); // Don Luc Electronics display.setCursor(0,10); display.println( "Don Luc" ); display.setTextSize(2); display.setCursor(0,40); display.println( "Electronics" ); // Version //display.setTextSize(3); display.setCursor(0,70); display.println( "Version" ); //display.setTextSize(2); display.setCursor(0,95); display.println( sver ); // EEPROM display.setCursor(0,120); display.println( "EEPROM" ); display.setCursor(0,140); display.println( uid ); // Refresh display.refresh(); delay( 100 ); } // Attitude Calculate Pitch, Roll, and Heading void isDisplayAttitude() { // Text Display // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Pitch display.setCursor(0,5); display.print( "Pi: " ); display.println( p ); // Roll display.setCursor(0,25); display.print( "Ro: " ); display.println( r ); // Heading display.setCursor(0,45); display.print( "He: " ); display.println( h ); // Temperature Celsius display.setCursor(0,65); display.print( "Te: " ); display.println( temperature ); // Barometer display.setCursor(0,85); display.print( "Ba: " ); display.println( pressure ); // Altitude Meters display.setCursor(0,105); display.print( "Al: " ); display.println( altitude ); // Refresh display.refresh(); delay( 100 ); } // Display GPS void isDisplayGPS() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Latitude display.setCursor(0,5); display.print( "Lat: " ); display.println( TargetLat ); // Longitude display.setCursor(0,30); display.print( "Lon: " ); display.println( TargetLon ); // GPS Date display.setCursor(0,55); display.println( TargetDat ); // GPS Time display.setCursor(0,80); display.println( TargetTim ); // GPS Speed M/S display.setCursor(0,105); display.print( TargetSMS ); display.println( " M/S" ); // GPS Altitude Meters display.setCursor(0,130); display.print( TargetALT ); display.println( " M" ); // Refresh display.refresh(); delay( 100 ); }
getEEPROM.ino
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 7; x++) { uid = uid + char(EEPROM.read(x)); } }
getGPS.ino
// GPS Receiver // Setup GPS void isSetupGPS() { // Setup GPS tGPS.begin( 9600 , SERIAL_8N1 , gpsRXPIN , gpsTXPIN ); } // isGPS void isGPS(){ // Receives NEMA data from GPS receiver // This sketch displays information every time a new sentence is correctly encoded while ( tGPS.available() > 0) if (gps.encode( tGPS.read() )) { // GPS Vector Pointer Target displayInfo(); // GPS Date, Time, Speed, Altitude displayDTS(); } if (millis() > 5000 && gps.charsProcessed() < 10) { while(true); } } // GPS Vector Pointer Target void displayInfo(){ // Location if (gps.location.isValid()) { // Latitude TargetLat = gps.location.lat(); // Longitude TargetLon = gps.location.lng(); // GPS Status 2 GPSSt = "Yes"; } else { // GPS Status 0 GPSSt = "No"; } } // GPS Date, Time, Speed, Altitude void displayDTS(){ // Date TargetDat = ""; if (gps.date.isValid()) { // Date // Year TargetDat += String(gps.date.year(), DEC); TargetDat += "/"; // Month TargetDat += String(gps.date.month(), DEC); TargetDat += "/"; // Day TargetDat += String(gps.date.day(), DEC); } // Time TargetTim = ""; if (gps.time.isValid()) { // Time // Hour TargetTim += String(gps.time.hour(), DEC); TargetTim += ":"; // Minute TargetTim += String(gps.time.minute(), DEC); TargetTim += ":"; // Secound TargetTim += String(gps.time.second(), DEC); } // Speed TargetSMS = ""; TargetSKH = ""; if (gps.speed.isValid()) { // Speed // M/S int x = gps.speed.mps(); TargetSMS = String( x, DEC); // Km/h int y = gps.speed.kmph(); TargetSKH = String( y, DEC); } // Altitude TargetALT = ""; if (gps.altitude.isValid()) { // Altitude // Meters int z = gps.altitude.meters(); TargetALT = String( z, DEC); } }
getMagnetometer.ino
// Magnetometer // Setup Magnetometer void isSetupMag() { // Setup Magnetometer mag.init(); // Default mag.enableDefault(); } // Magnetometer void isMag() { // Magnetometer mag.read(); // Magnetometer x, y, z magX = mag.m.x; magY = mag.m.y; magZ = mag.m.z; }
getSD.ino
// MicroSD Card // MicroSD Setup void isSetupSD() { // MicroSD Card pinMode( chipSelect , OUTPUT ); if(!SD.begin( chipSelect )){ ; return; } uint8_t cardType = SD.cardType(); // CARD NONE if(cardType == CARD_NONE){ ; return; } // SD Card Type if(cardType == CARD_MMC){ ; } else if(cardType == CARD_SD){ ; } else if(cardType == CARD_SDHC){ ; } else { ; } // Size uint64_t cardSize = SD.cardSize() / (1024 * 1024); } // MicroSD Card void isSD() { zzzzzz = ""; //DFR|EEPROM Unique ID|Version| //Accelerometer X|Accelerometer Y|Accelerometer Z| //Gyroscope X|Gyroscope Y|Gyroscope Z| //Magnetometer X|Magnetometer Y|Magnetometer Z| //Pitch|Roll|Heading| //Temperature C|Pressure Millibars|Altitude Meters| //GPS|Latitude|Longitude|GPS Date|GPS Time|GPS Speed M/S|GPS Altitude|*\r zzzzzz = "DFR|" + uid + "|" + sver + "|" + String(imuAX) + "|" + String(imuAY) + "|" + String(imuAZ) + "|" + String(imuGX) + "|" + String(imuGY) + "|" + String(imuGZ) + "|" + String(magX) + "|" + String(magY) + "|" + String(magZ) + "|" + String(p) + "|" + String(r) + "|" + String(h) + "|" + String(temperature) + "|" + String(pressure) + "|" + String(altitude) + "|" + String(GPSSt) + "|" + String(TargetLat) + "|" + String(TargetLon) + "|" + String(TargetDat) + "|" + String(TargetTim) + "|" + String(TargetSMS) + "|" + String(TargetALT)+ "|*\r"; // msg + 1 char msg[zzzzzz.length() + 1]; zzzzzz.toCharArray(msg, zzzzzz.length() + 1); // Append File appendFile(SD, "/dfrdata.txt", msg ); } // List Dir void listDir(fs::FS &fs, const char * dirname, uint8_t levels){ // List Dir dirname; File root = fs.open(dirname); if(!root){ return; } if(!root.isDirectory()){ return; } File file = root.openNextFile(); while(file){ if(file.isDirectory()){ file.name(); if(levels){ listDir(fs, file.name(), levels -1); } } else { file.name(); file.size(); } file = root.openNextFile(); } } // Write File void writeFile(fs::FS &fs, const char * path, const char * message){ // Write File path; File file = fs.open(path, FILE_WRITE); if(!file){ return; } if(file.print(message)){ ; } else { ; } file.close(); } // Append File void appendFile(fs::FS &fs, const char * path, const char * message){ // Append File path; File file = fs.open(path, FILE_APPEND); if(!file){ return; } if(file.print(message)){ ; } else { ; } file.close(); }
setup.ino
// Setup void setup() { // Give display time to power on delay(100); // EEPROM Size EEPROM.begin(EEPROM_SIZE); // EEPROM Unique ID isUID(); // Give display delay(100); // Set up I2C bus Wire.begin(); // Give display delay(100); //MicroSD Card isSetupSD(); // SHARP Display Start & Clear the Display display.begin(); // Clear Display display.clearDisplay(); // Delay delay( 100 ); // GPS Receiver // Setup GPS isSetupGPS(); // Delay delay( 100 ); // Setup IMU isSetupIMU(); // Setup Magnetometer isSetupMag(); // Setup Barometer isSetupBarometer(); // Delay delay( 100 ); // Initialize digital pin iLED as an output pinMode(iLED, OUTPUT); // Outputting high, the LED turns on digitalWrite(iLED, HIGH); // Initialize the LED Green pinMode(iLEDGreen, OUTPUT); // iLEDGreen HIGH digitalWrite(iLEDGreen, HIGH ); // Initialize the Switch pinMode(iSwitch, INPUT); // Don Luc Electronics // Version // EEPROM isDisplayUID(); // Delay 5 Second delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Teacher, Instructor, E-Mentor, R&D and Consulting
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Automation
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- Artificial Intelligence (AI)
- RTOS
- Sensors, eHealth Sensors, Biosensor, and Biometric
- Research & Development (R & D)
- Consulting
Follow Us
Luc Paquin – Curriculum Vitae – 2024
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
LinkedIn: https://www.linkedin.com/in/jlucpaquin/
Don Luc
Project #29 – DFRobot – L3G4200D – Mk18
——
#DonLucElectronics #DonLuc #DFRobot #L3G4200D #HMC5883L #ADXL335 #GPS #FireBeetle2ESP32E #EEPROM #RTC #SD #Display #SparkFun #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
SparkFun Tri-Axis Gyroscope – L3G4200D
This is a breakout board for the L3G4200D low-power three-axis angular rate sensor. The L3G4200D is a MEMS motion sensor and has a full scale of dps and is capable of measuring rates with a user-selectable bandwidth. These work great in gaming and virtual reality input devices, motion control with MMI, GPS navigation systems, appliances and robotics. The L3G4200D is a low-power three-axis angular rate sensor able to provide unprecedented stablility of zero rate level and sensitivity over temperature and time. It includes a sensing element and an IC interface capable of providing the measured angular rate to the external world through a digital interface.
DL2406Mk05
1 x DFRobot FireBeetle 2 ESP32-E
1 x Adafruit SHARP Memory Display
1 x Adafruit MicroSD card breakout board+
1 x MicroSD 16 GB
1 x SparkFun Triple Axis Accelerometer ADXL335
1 x SparkFun Triple Axis Magnetometer HMC5883L
1 x SparkFun Tri-Axis Gyroscope L3G4200D
1 x GPS Receiver – GP-20U7
2 x Switch
1 x 1K Ohm
1 x 1 x Lithium Ion Battery – 1000mAh
1 x Green LED
1 x USB 3.1 Cable A to C
DFRobot FireBeetle 2 ESP32-E
LED – 2
DSCK – 4
DMOSI – 16
DSS – 17
SCK – 22
MOSI – 23
MISO – 19
CS – 13
GPR – 26
GPT – 25
SCL – 21
SDA – 22
LED – 14
SWI – 3
XAC – A0
YAC – A1
ZAC – A2
VIN – +3.3V
GND – GND
——
DL2406Mk05p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #29 - DFRobot - L3G4200D - Mk18 29-18 DL2406Mk05p.ino DL2406Mk05 1 x DFRobot FireBeetle 2 ESP32-E 1 x Adafruit SHARP Memory Display 1 x Adafruit MicroSD card breakout board+ 1 x MicroSD 16 GB 1 x SparkFun Triple Axis Magnetometer HMC5883L 1 x SparkFun Triple Axis Accelerometer ADXL335 1 x SparkFun Tri-Axis Gyroscope L3G4200D 1 x GPS Receiver - GP-20U7 2 x Switch 1 x 1K Ohm 1 x 1 x Lithium Ion Battery - 1000mAh 1 x Green LED 1 x USB 3.1 Cable A to C */ // Include the Library Code // EEPROM Library to Read and Write EEPROM // with Unique ID for Unit #include "EEPROM.h" // Wire #include <Wire.h> // SD Card #include "FS.h" #include "SD.h" #include "SPI.h" // SHARP Memory Display #include <Adafruit_SharpMem.h> #include <Adafruit_GFX.h> // GPS Receiver #include <TinyGPS++.h> // ESP32 Hardware Serial #include <HardwareSerial.h> // Triple Axis Magnetometer #include <HMC5883L.h> // Gyroscope #include <L3G4200D.h> // Gyroscope L3G4200D gyroscope; // Timers unsigned long timer = 0; float timeStep = 0.01; // Pitch, Roll and Yaw values float pitch = 0; float roll = 0; float yaw = 0; // Triple Axis Magnetometer HMC5883L compass; // Triple Axis Magnetometer int mX = 0; int mY = 0; int mZ = 0; // Accelerometer ADXL335 int iX = A0; int iY = A1; int iZ = A2; // Accelerometer int X = 0; int Y = 0; int Z = 0; // ESP32 HardwareSerial HardwareSerial tGPS(2); // GPS Receiver #define gpsRXPIN 26 // This one is unused and doesnt have a conection #define gpsTXPIN 25 // The TinyGPS++ object TinyGPSPlus gps; // Latitude float TargetLat; // Longitude float TargetLon; // GPS Date, Time, Speed, Altitude // GPS Date String TargetDat; // GPS Time String TargetTim; // GPS Speeds M/S String TargetSMS; // GPS Speeds Km/h String TargetSKH; // GPS Altitude Meters String TargetALT; // GPS Status String GPSSt = ""; // MicroSD Card const int chipSelect = 13; String zzzzzz = ""; // SHARP Memory Display #define SHARP_SCK 4 #define SHARP_MOSI 16 #define SHARP_SS 17 // Set the size of the display here, e.g. 144x168! Adafruit_SharpMem display(SHARP_SCK, SHARP_MOSI, SHARP_SS, 144, 168); // The currently-available SHARP Memory Display (144x168 pixels) // requires > 4K of microcontroller RAM; it WILL NOT WORK on Arduino Uno // or other <4K "classic" devices. #define BLACK 0 #define WHITE 1 // LED Green int iLEDGreen = 2; // Define LED int iLED = 14; // Switch int iSwitch = 3; // Variable for reading the Switch status int iSwitchState = 0; // EEPROM Unique ID Information #define EEPROM_SIZE 64 String uid = ""; // Software Version Information String sver = "29-18"; void loop() { // isGPS isGPS(); // Accelerometer ADXL335 isADXL335(); // Magnetometer isMagnetometer(); // Gyroscope isGyroscope(); // Read the state of the Switch value iSwitchState = digitalRead(iSwitch); // The Switch is HIGH: if (iSwitchState == HIGH) { // Display Accelerometer ADXL335 isDisplayADXL335(); } else { // Display GPS isDisplayGPS(); } // MicroSD Card isSD(); // iLED HIGH digitalWrite(iLED, HIGH ); // Delay 5 Second delay(5000); }
getAccelerometer.ino
// Accelerometer ADXL335 // ADXL335 void isADXL335() { // Accelerometer ADXL335 // Accelerometer X, Y, Z // X X = analogRead(iX); // Y Y = analogRead(iY); // Z Z = analogRead(iZ); }
getDisplay.ino
// SHARP Memory Display // SHARP Memory Display - UID void isDisplayUID() { // Text Display // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(3); display.setTextColor(BLACK); // Don Luc Electronics display.setCursor(0,10); display.println( "Don Luc" ); display.setTextSize(2); display.setCursor(0,40); display.println( "Electronics" ); // Version //display.setTextSize(3); display.setCursor(0,70); display.println( "Version" ); //display.setTextSize(2); display.setCursor(0,95); display.println( sver ); // EEPROM display.setCursor(0,120); display.println( "EEPROM" ); display.setCursor(0,140); display.println( uid ); // Refresh display.refresh(); delay( 100 ); } // Display Accelerometer ADXL335 void isDisplayADXL335() { // Text Display // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(1); display.setTextColor(BLACK); // Accelerometer X display.setCursor(0,5); display.print( "AX: " ); display.println( X ); // Accelerometer Y display.setCursor(0,20); display.print( "AY: " ); display.println( Y ); // Accelerometer Z display.setCursor(0,35); display.print( "AZ: " ); display.println( Z ); // Magnetometer X display.setCursor(0,50); display.print( "MX: " ); display.println( mX ); // Magnetometer Y display.setCursor(0,65); display.print( "MY: " ); display.println( mY ); // Magnetometer Z display.setCursor(0,80); display.print( "MZ: " ); display.println( mZ ); // Gyroscope Pitch display.setCursor(0,95); display.print( "Pitch: " ); display.println( pitch ); // Gyroscope Roll display.setCursor(0,110); display.print( "Roll: " ); display.println( roll ); // Gyroscope Yaw display.setCursor(0,125); display.print( "Yaw: " ); display.println( yaw ); // Refresh display.refresh(); delay( 100 ); } // Display GPS void isDisplayGPS() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Latitude display.setCursor(0,5); display.print( "Lat: " ); display.println( TargetLat ); // Longitude display.setCursor(0,30); display.print( "Lon: " ); display.println( TargetLon ); // GPS Date display.setCursor(0,55); display.println( TargetDat ); // GPS Time display.setCursor(0,80); display.println( TargetTim ); // GPS Speed M/S display.setCursor(0,105); display.print( TargetSMS ); display.println( " M/S" ); // GPS Altitude Meters display.setCursor(0,130); display.print( TargetALT ); display.println( " M" ); // Refresh display.refresh(); delay( 100 ); }
getEEPROM.ino
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 7; x++) { uid = uid + char(EEPROM.read(x)); } }
getGPS.ino
// GPS Receiver // Setup GPS void isSetupGPS() { // Setup GPS tGPS.begin( 9600 , SERIAL_8N1 , gpsRXPIN , gpsTXPIN ); } // isGPS void isGPS(){ // Receives NEMA data from GPS receiver // This sketch displays information every time a new sentence is correctly encoded while ( tGPS.available() > 0) if (gps.encode( tGPS.read() )) { // GPS Vector Pointer Target displayInfo(); // GPS Date, Time, Speed, Altitude displayDTS(); } if (millis() > 5000 && gps.charsProcessed() < 10) { while(true); } } // GPS Vector Pointer Target void displayInfo(){ // Location if (gps.location.isValid()) { // Latitude TargetLat = gps.location.lat(); // Longitude TargetLon = gps.location.lng(); // GPS Status 2 GPSSt = "Yes"; } else { // GPS Status 0 GPSSt = "No"; } } // GPS Date, Time, Speed, Altitude void displayDTS(){ // Date TargetDat = ""; if (gps.date.isValid()) { // Date // Year TargetDat += String(gps.date.year(), DEC); TargetDat += "/"; // Month TargetDat += String(gps.date.month(), DEC); TargetDat += "/"; // Day TargetDat += String(gps.date.day(), DEC); } // Time TargetTim = ""; if (gps.time.isValid()) { // Time // Hour TargetTim += String(gps.time.hour(), DEC); TargetTim += ":"; // Minute TargetTim += String(gps.time.minute(), DEC); TargetTim += ":"; // Secound TargetTim += String(gps.time.second(), DEC); } // Speed TargetSMS = ""; TargetSKH = ""; if (gps.speed.isValid()) { // Speed // M/S int x = gps.speed.mps(); TargetSMS = String( x, DEC); // Km/h int y = gps.speed.kmph(); TargetSKH = String( y, DEC); } // Altitude TargetALT = ""; if (gps.altitude.isValid()) { // Altitude // Meters int z = gps.altitude.meters(); TargetALT = String( z, DEC); } }
getGyroscope.ino
// L3G4200D Triple Axis Gyroscope // Setup Gyroscope void isSetupGyroscope() { // Setup Gyroscope // Set scale 2000 dps and 400HZ Output data rate (cut-off 50) while(!gyroscope.begin(L3G4200D_SCALE_2000DPS, L3G4200D_DATARATE_400HZ_50)) { // Could not find a valid L3G4200D sensor, check wiring! delay(500); } // Calibrate gyroscope. The calibration must be at rest. // If you don't want calibrate, comment this line. gyroscope.calibrate(100); } // L3G4200D Gyroscope void isGyroscope(){ // Timer timer = millis(); // Read normalized values Vector norm = gyroscope.readNormalize(); // Calculate Pitch, Roll and Yaw pitch = pitch + norm.YAxis * timeStep; roll = roll + norm.XAxis * timeStep; yaw = yaw + norm.ZAxis * timeStep; }
getMagnetometer.ino
// Magnetometer // Setup Magnetometer void isSetupMagnetometer(){ // Magnetometer Serial // Initialize HMC5883L while (!compass.begin()) { delay(500); } // Set measurement range // +/- 1.30 Ga: HMC5883L_RANGE_1_3GA (default) compass.setRange(HMC5883L_RANGE_1_3GA); // Set measurement mode // Continuous-Measurement: HMC5883L_CONTINOUS (default) compass.setMeasurementMode(HMC5883L_CONTINOUS); // Set data rate // 15.00Hz: HMC5883L_DATARATE_15HZ (default) compass.setDataRate(HMC5883L_DATARATE_15HZ); // Set number of samples averaged // 1 sample: HMC5883L_SAMPLES_1 (default) compass.setSamples(HMC5883L_SAMPLES_1); } // Magnetometer void isMagnetometer(){ // Magnetometer Vector Norm Vector norm = compass.readNormalize(); // Vector X, Y, Z // Magnetometer X Normalize mX = norm.XAxis; // Magnetometer Y Normalize mY = norm.YAxis; // Magnetometer Z Normalize mZ = norm.ZAxis; }
getSD.ino
// MicroSD Card // MicroSD Setup void isSetupSD() { // MicroSD Card pinMode( chipSelect , OUTPUT ); if(!SD.begin( chipSelect )){ ; return; } uint8_t cardType = SD.cardType(); // CARD NONE if(cardType == CARD_NONE){ ; return; } // SD Card Type if(cardType == CARD_MMC){ ; } else if(cardType == CARD_SD){ ; } else if(cardType == CARD_SDHC){ ; } else { ; } // Size uint64_t cardSize = SD.cardSize() / (1024 * 1024); } // MicroSD Card void isSD() { zzzzzz = ""; // DFR|EEPROM Unique ID|Version|Date|Time| //Accelerometer X|Accelerometer Y|Accelerometer Z //Magnetometer X|Magnetometer Y|Magnetometer Z //Gyroscope Pitch|Gyroscope Roll|Gyroscope Yaw //|GPS|Latitude|Longitude|GPS Date|GPS Time|GPS Speed M/S|GPS Altitude|*\r zzzzzz = "DFR|" + uid + "|" + sver + "|" + String(X) + "|" + String(Y) + "|" + String(Z) + "|" + String(mX) + "|" + String(mY) + "|" + String(mZ) + "|" + String(pitch) + "|" + String(roll) + "|" + String(yaw) + "|" + String(GPSSt) + "|" + String(TargetLat) + "|" + String(TargetLon) + "|" + String(TargetDat) + "|" + String(TargetTim) + "|" + String(TargetSMS) + "|" + String(TargetALT)+ "|*\r"; // msg + 1 char msg[zzzzzz.length() + 1]; zzzzzz.toCharArray(msg, zzzzzz.length() + 1); // Append File appendFile(SD, "/dfrdata.txt", msg ); } // List Dir void listDir(fs::FS &fs, const char * dirname, uint8_t levels){ // List Dir dirname; File root = fs.open(dirname); if(!root){ return; } if(!root.isDirectory()){ return; } File file = root.openNextFile(); while(file){ if(file.isDirectory()){ file.name(); if(levels){ listDir(fs, file.name(), levels -1); } } else { file.name(); file.size(); } file = root.openNextFile(); } } // Write File void writeFile(fs::FS &fs, const char * path, const char * message){ // Write File path; File file = fs.open(path, FILE_WRITE); if(!file){ return; } if(file.print(message)){ ; } else { ; } file.close(); } // Append File void appendFile(fs::FS &fs, const char * path, const char * message){ // Append File path; File file = fs.open(path, FILE_APPEND); if(!file){ return; } if(file.print(message)){ ; } else { ; } file.close(); }
setup.ino
// Setup void setup() { // Give display time to power on delay(100); // EEPROM Size EEPROM.begin(EEPROM_SIZE); // EEPROM Unique ID isUID(); // Give display delay(100); // Set up I2C bus Wire.begin(); // Give display delay(100); //MicroSD Card isSetupSD(); // SHARP Display Start & Clear the Display display.begin(); // Clear Display display.clearDisplay(); // Delay delay( 100 ); // GPS Receiver // Setup GPS isSetupGPS(); // Delay delay( 100 ); // Setup Triple Axis Magnetometer isSetupMagnetometer(); // L3G4200D Gyroscope isSetupGyroscope(); // Delay delay( 100 ); // Initialize digital pin iLED as an output pinMode(iLED, OUTPUT); // Outputting high, the LED turns on digitalWrite(iLED, HIGH); // Initialize the LED Green pinMode(iLEDGreen, OUTPUT); // iLEDGreen HIGH digitalWrite(iLEDGreen, HIGH ); // Initialize the Switch pinMode(iSwitch, INPUT); // Don Luc Electronics // Version // EEPROM isDisplayUID(); // Delay 5 Second delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Teacher, Instructor, E-Mentor, R&D and Consulting
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Automation
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- Artificial Intelligence (AI)
- RTOS
- Sensors, eHealth Sensors, Biosensor, and Biometric
- Research & Development (R & D)
- Consulting
Follow Us
Luc Paquin – Curriculum Vitae – 2024
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
LinkedIn: https://www.linkedin.com/in/jlucpaquin/
Don Luc
Project #29 – DFRobot – GPS Receiver – Mk15
——
#DonLucElectronics #DonLuc #DFRobot #GPS #BME280 #CCS811 #FireBeetle2ESP32E #EEPROM #RTC #SD #Display #Adafruit #SparkFun #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Global Positioning System (GPS)
The Global Positioning System (GPS) is a satellite-based radionavigation system owned by the United States government and operated by the United States Space Force. It is one of the global navigation satellite systems (GNSS) that provides geolocation and time information to a GPS receiver anywhere on or near the Earth where there is an unobstructed line of sight to four or more GPS satellites. Obstacles such as mountains and buildings block the relatively weak GPS signals.
GPS Receiver – GP-20U7
The GP-20U7 is a compact GPS receiver with a built-in high performances All-In-One GPS chipset. The GP-20U7 accurately provides position, velocity, and time readings as well possessing high sensitivity and tracking capabilities. Thanks to the low power consumption this receiver requires, the GP-20U7 is ideal for portable applications such as tablet PCs, smart phones, and other devices requiring positioning capability.
DL2406Mk02
1 x DFRobot FireBeetle 2 ESP32-E
1 x Adafruit SHARP Memory Display
1 x Adafruit MicroSD card breakout board+
1 x MicroSD 16 GB
1 x Adafruit DS3231 Precision RTC FeatherWing – RTC
1 x Battery CR1220
1 x SparkFun Environmental Combo CCS811/BME280
1 x GPS Receiver – GP-20U7
3 x Switch
2 x 1K Ohm
1 x 1 x Lithium Ion Battery – 1000mAh
1 x Green LED
1 x USB 3.1 Cable A to C
DFRobot FireBeetle 2 ESP32-E
LED – 2
DSCK – 4
DMOSI – 16
DSS – 17
SCK – 22
MOSI – 23
MISO – 19
CS – 13
GPR – 26
GPT – 25
SCL – 21
SDA – 22
LED – 14
SWI – 3
SWG – 1
VIN – +3.3V
GND – GND
——
DL2406Mk02p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #29 - DFRobot - GPS Receiver - Mk15 29-15 DL2406Mk02p.ino DL2406Mk02 1 x DFRobot FireBeetle 2 ESP32-E 1 x Adafruit SHARP Memory Display 1 x Adafruit MicroSD card breakout board+ 1 x MicroSD 16 GB 1 x Adafruit DS3231 Precision RTC FeatherWing - RTC 1 x Battery CR1220 1 x SparkFun Environmental Combo CCS811/BME280 1 x GPS Receiver - GP-20U7 3 x Switch 2 x 1K Ohm 1 x 1 x Lithium Ion Battery - 1000mAh 1 x Green LED 1 x USB 3.1 Cable A to C */ // Include the Library Code // EEPROM Library to Read and Write EEPROM // with Unique ID for Unit #include "EEPROM.h" // Wire #include <Wire.h> // DS3231 RTC Date and Time #include <RTClib.h> // SD Card #include "FS.h" #include "SD.h" #include "SPI.h" // SHARP Memory Display #include <Adafruit_SharpMem.h> #include <Adafruit_GFX.h> // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure #include <SparkFunBME280.h> // SparkFun CCS811 - eCO2 & tVOC #include <SparkFunCCS811.h> // GPS Receiver #include <TinyGPS++.h> // ESP32 Hardware Serial #include <HardwareSerial.h> // ESP32 HardwareSerial HardwareSerial tGPS(2); // GPS Receiver #define gpsRXPIN 26 // This one is unused and doesnt have a conection #define gpsTXPIN 25 // The TinyGPS++ object TinyGPSPlus gps; // Latitude float TargetLat; // Longitude float TargetLon; // GPS Date, Time, Speed, Altitude // GPS Date String TargetDat; // GPS Time String TargetTim; // GPS Speeds M/S String TargetSMS; // GPS Speeds Km/h String TargetSKH; // GPS Altitude Meters String TargetALT; // GPS Status String GPSSt = ""; // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure BME280 myBME280; // Temperature Celsius float BMEtempC = 0; // Humidity float BMEhumid = 0; // Altitude Meters float BMEaltitudeM = 0; // Barometric Pressure float BMEpressure = 0; // SparkFun CCS811 - eCO2 & tVOC // Default I2C Address #define CCS811_ADDR 0x5B CCS811 myCCS811(CCS811_ADDR); // eCO2 float CCS811CO2 = 0; // TVOC float CCS811TVOC = 0; // DS3231 RTC Date and Time RTC_DS3231 rtc; String sDate; String sTime; // MicroSD Card const int chipSelect = 13; String zzzzzz = ""; // SHARP Memory Display #define SHARP_SCK 4 #define SHARP_MOSI 16 #define SHARP_SS 17 // Set the size of the display here, e.g. 144x168! Adafruit_SharpMem display(SHARP_SCK, SHARP_MOSI, SHARP_SS, 144, 168); // The currently-available SHARP Memory Display (144x168 pixels) // requires > 4K of microcontroller RAM; it WILL NOT WORK on Arduino Uno // or other <4K "classic" devices. #define BLACK 0 #define WHITE 1 // LED Green int iLEDGreen = 2; // Define LED int iLED = 14; // Switch int iSwitch = 3; // Variable for reading the Switch status int iSwitchState = 0; // Switch GPS int iSwitchGPS = 1; // Variable for reading the Switch GPS status int iSwitchGPSState = 0; // EEPROM Unique ID Information #define EEPROM_SIZE 64 String uid = ""; // Software Version Information String sver = "29-15"; void loop() { // DS3231 RTC Date and Time isRTC(); // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure isBME280(); // SparkFun CCS811 - eCO2 & tVOC isCCS811(); // isGPS isGPS(); // Read the state of the Switch value iSwitchState = digitalRead(iSwitch); // The Switch is HIGH: if (iSwitchState == HIGH) { // Display Date, Time, Temperature, Humidity isDisplayDTTH(); } else { // Read the state of the Switch value iSwitchGPSState = digitalRead(iSwitchGPS); if (iSwitchGPSState == HIGH) { // Display GPS isDisplayGPS(); } else { // Display Date, Time, eCO2 Concentration, tVOC Concentration isDisplayDTCOVO(); } } // MicroSD Card isSD(); // iLED HIGH digitalWrite(iLED, HIGH ); // Delay 5 Second delay(5000); }
getBME280.ino
// SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure // isBME280 - Temperature, Humidity, Altitude and Barometric Pressure void isBME280(){ // Temperature Celsius BMEtempC = myBME280.readTempC(); // Humidity BMEhumid = myBME280.readFloatHumidity() ; // Altitude Meters BMEaltitudeM = myBME280.readFloatAltitudeMeters(); // Barometric Pressure BMEpressure = myBME280.readFloatPressure(); }
getCCS811.ino
// CCS811 - eCO2 & tVOC // isCCS811 - eCO2 & tVOC void isCCS811(){ // This sends the temperature & humidity data to the CCS811 myCCS811.setEnvironmentalData(BMEhumid, BMEtempC); // Calling this function updates the global tVOC and eCO2 variables myCCS811.readAlgorithmResults(); // eCO2 Concentration CCS811CO2 = myCCS811.getCO2(); // tVOC Concentration CCS811TVOC = myCCS811.getTVOC(); }
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, Time, Temperature, Humidity, Altitude and Barometric Pressure void isDisplayDTTH() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Date display.setCursor(0,5); display.println( sDate ); // Time display.setCursor(0,30); display.println( sTime ); // Temperature display.setCursor(0,55); display.print( BMEtempC ); display.println( "C" ); // Humidity display.setCursor(0,80); display.print( BMEhumid ); display.println( "%" ); // Altitude Meters display.setCursor(0,105); display.print( BMEaltitudeM ); display.println( "M" ); // Barometric Pressure display.setCursor(0,130); display.println( BMEpressure ); // Refresh display.refresh(); delay( 100 ); } // Display Display Date, Time, eCO2 Concentration, tVOC Concentration void isDisplayDTCOVO() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Date display.setCursor(0,5); display.println( sDate ); // Time display.setCursor(0,30); display.println( sTime ); // eCO2 Concentration display.setCursor(0,55); display.println( "eCO2" ); display.setCursor(0,80); display.println( CCS811CO2 ); // tVOC Concentration display.setCursor(0,105); display.println( "tVOC" ); display.setCursor(0,130); display.println( CCS811TVOC ); // Refresh display.refresh(); delay( 100 ); } // Display GPS void isDisplayGPS() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Latitude display.setCursor(0,5); display.print( "Lat: " ); display.println( TargetLat ); // Longitude display.setCursor(0,30); display.print( "Lon: " ); display.println( TargetLon ); // GPS Date display.setCursor(0,55); display.println( TargetDat ); // GPS Time display.setCursor(0,80); display.println( TargetTim ); // GPS Speed M/S display.setCursor(0,105); display.print( TargetSMS ); display.println( " M/S" ); // GPS Altitude Meters display.setCursor(0,130); display.print( TargetALT ); display.println( " M" ); // Refresh display.refresh(); delay( 100 ); }
getEEPROM.ino
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 7; x++) { uid = uid + char(EEPROM.read(x)); } }
getGPS.ino
// GPS Receiver // Setup GPS void isSetupGPS() { // Setup GPS tGPS.begin( 9600 , SERIAL_8N1 , gpsRXPIN , gpsTXPIN ); } // isGPS void isGPS(){ // Receives NEMA data from GPS receiver // This sketch displays information every time a new sentence is correctly encoded while ( tGPS.available() > 0) if (gps.encode( tGPS.read() )) { // GPS Vector Pointer Target displayInfo(); // GPS Date, Time, Speed, Altitude displayDTS(); } if (millis() > 5000 && gps.charsProcessed() < 10) { while(true); } } // GPS Vector Pointer Target void displayInfo(){ // Location if (gps.location.isValid()) { // Latitude TargetLat = gps.location.lat(); // Longitude TargetLon = gps.location.lng(); // GPS Status 2 GPSSt = "Yes"; } else { // GPS Status 0 GPSSt = "No"; } } // GPS Date, Time, Speed, Altitude void displayDTS(){ // Date TargetDat = ""; if (gps.date.isValid()) { // Date // Year TargetDat += String(gps.date.year(), DEC); TargetDat += "/"; // Month TargetDat += String(gps.date.month(), DEC); TargetDat += "/"; // Day TargetDat += String(gps.date.day(), DEC); } // Time TargetTim = ""; if (gps.time.isValid()) { // Time // Hour TargetTim += String(gps.time.hour(), DEC); TargetTim += ":"; // Minute TargetTim += String(gps.time.minute(), DEC); TargetTim += ":"; // Secound TargetTim += String(gps.time.second(), DEC); } // Speed TargetSMS = ""; TargetSKH = ""; if (gps.speed.isValid()) { // Speed // M/S int x = gps.speed.mps(); TargetSMS = String( x, DEC); // Km/h int y = gps.speed.kmph(); TargetSKH = String( y, DEC); } // Altitude TargetALT = ""; if (gps.altitude.isValid()) { // Altitude // Meters int z = gps.altitude.meters(); TargetALT = String( z, DEC); } }
getRTC.ino
// DS3231 RTC Date and Time // Setup DS3231 RTC void isSetupRTC() { if (! rtc.begin()) { while (1); } if (rtc.lostPower()) { // Following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0)); } } // DS3231 RTC Date and Time void isRTC(){ // Date and Time sDate = ""; sTime = ""; // Date Time DateTime now = rtc.now(); // sData sDate += String(now.year(), DEC); sDate += "/"; sDate += String(now.month(), DEC); sDate += "/"; sDate += String(now.day(), DEC); // sTime sTime += String(now.hour(), DEC); sTime += ":"; sTime += String(now.minute(), DEC); sTime += ":"; sTime += String(now.second(), DEC); }
getSD.ino
// MicroSD Card // MicroSD Setup void isSetupSD() { // MicroSD Card pinMode( chipSelect , OUTPUT ); if(!SD.begin( chipSelect )){ ; return; } uint8_t cardType = SD.cardType(); // CARD NONE if(cardType == CARD_NONE){ ; return; } // SD Card Type if(cardType == CARD_MMC){ ; } else if(cardType == CARD_SD){ ; } else if(cardType == CARD_SDHC){ ; } else { ; } // Size uint64_t cardSize = SD.cardSize() / (1024 * 1024); } // MicroSD Card void isSD() { zzzzzz = ""; // DFR|EEPROM Unique ID|Version|Date|Time|Temperature Celsius|Humidity //|Altitude Meters|Barometric Pressure|eCO2 Concentration|tVOC Concentration //|GPS|Latitude|Longitude|GPS Date|GPS Time|GPS Speed M/S|GPS Altitude|*\r zzzzzz = "DFR|" + uid + "|" + sver + "|" + sDate + "|" + sTime + "|" + String(BMEtempC) + "C|" + String(BMEhumid) + "%|" + String(BMEaltitudeM) + " M|" + String(BMEpressure) + "|" + String(CCS811CO2) + "|" + String(CCS811TVOC) + "|" + String(GPSSt) + "|" + String(TargetLat) + "|" + String(TargetLon) + "|" + String(TargetDat) + "|" + String(TargetTim) + "|" + String(TargetSMS) + "|" + String(TargetALT)+ "|*\r"; // msg + 1 char msg[zzzzzz.length() + 1]; zzzzzz.toCharArray(msg, zzzzzz.length() + 1); // Append File appendFile(SD, "/dfrdata.txt", msg ); } // List Dir void listDir(fs::FS &fs, const char * dirname, uint8_t levels){ // List Dir dirname; File root = fs.open(dirname); if(!root){ return; } if(!root.isDirectory()){ return; } File file = root.openNextFile(); while(file){ if(file.isDirectory()){ file.name(); if(levels){ listDir(fs, file.name(), levels -1); } } else { file.name(); file.size(); } file = root.openNextFile(); } } // Write File void writeFile(fs::FS &fs, const char * path, const char * message){ // Write File path; File file = fs.open(path, FILE_WRITE); if(!file){ return; } if(file.print(message)){ ; } else { ; } file.close(); } // Append File void appendFile(fs::FS &fs, const char * path, const char * message){ // Append File path; File file = fs.open(path, FILE_APPEND); if(!file){ return; } if(file.print(message)){ ; } else { ; } file.close(); }
setup.ino
// Setup void setup() { // Give display time to power on delay(100); // EEPROM Size EEPROM.begin(EEPROM_SIZE); // EEPROM Unique ID isUID(); // Give display delay(100); // Set up I2C bus Wire.begin(); // Give display delay(100); // Setup DS3231 RTC isSetupRTC(); //MicroSD Card isSetupSD(); // SHARP Display Start & Clear the Display display.begin(); // Clear Display display.clearDisplay(); // Delay delay( 100 ); // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure myBME280.begin(); // CCS811 - eCO2 & tVOC myCCS811.begin(); // Delay delay( 100 ); // GPS Receiver // Setup GPS isSetupGPS(); // Initialize digital pin iLED as an output pinMode(iLED, OUTPUT); // Outputting high, the LED turns on digitalWrite(iLED, HIGH); // Initialize the LED Green pinMode(iLEDGreen, OUTPUT); // iLEDGreen HIGH digitalWrite(iLEDGreen, HIGH ); // Initialize the Switch pinMode(iSwitch, INPUT); // Initialize the Switch GPS pinMode(iSwitchGPS, INPUT); // Don Luc Electronics // Version // EEPROM isDisplayUID(); // Delay 5 Second delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Teacher, Instructor, E-Mentor, R&D and Consulting
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Automation
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- Artificial Intelligence (AI)
- RTOS
- Sensors, eHealth Sensors, Biosensor, and Biometric
- Research & Development (R & D)
- Consulting
Follow Us
Luc Paquin – Curriculum Vitae – 2024
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
LinkedIn: https://www.linkedin.com/in/jlucpaquin/
Don Luc
Project #28 – Sensors – HC-SR04 – Mk12
——
#DonLucElectronics #DonLuc #Sensors #LSM9DS1 #IMU #GPSReceiver #Adafruit #SparkFun #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Pololu 5 Volt Step-Up Voltage Regulator U1V10F5
This tiny U1V10F5 switching step-up voltage regulator efficiently generates 5 Volt from input voltages as low as 0.5 Volt. Unlike most boost regulators, the U1V10F5 automatically switches to a linear down-regulation mode when the input voltage exceeds the output.
Ultrasonic Distance Sensor – HC-SR04 (5 Volt)
This is the HC-SR04 ultrasonic distance sensor. This economical sensor provides 2 Centimetres to 400 Centimetres of non-contact measurement functionality with a ranging accuracy that can reach up to 3 Millimetres. Each HC-SR04 module includes an ultrasonic transmitter, a receiver and a control circuit. There are only four pins that you need to worry about on the HC-SR04: VCC (Power), Trig (Trigger), Echo (Receive), and GND (Ground). This sensor has additional control circuitry that can prevent inconsistent “Bouncy” data depending on the application.
DL2310Mk01
1 x SparkFun Thing Plus – ESP32 WROOM
1 x DS3231 Precision RTC FeatherWing
1 x GPS Receiver – GP-20U7 (56 Channel)
1 x SparkFun 9DoF IMU Breakout – LSM9DS1
1 x Ultrasonic Distance Sensor – HC-SR04 (5V)
1 x Pololu 5V Step-Up Voltage Regulator U1V10F5
1 x Rocker Switch – SPST
1 x Resistor 10K Ohm
1 x CR1220 3V Lithium Coin Cell Battery
1 x 1 x Lithium Ion Battery – 1000mAh
1 x Terminal Block Breakout FeatherWing
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
LED – LED_BUILTIN
SDA – Digital 23
SCL – Digital 22
SW1 – Digital 21
GPT – Digital 17
GPR – Digital 16
TRI – Digital 15
ECH – Digital 14
VIN – +3.3V
VIN – +5V
GND – GND
——
DL2310Mk01p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #28 - Sensors - HC-SR04 - Mk12 28-12 DL2310Mk01p.ino 1 x SparkFun Thing Plus - ESP32 WROOM 1 x DS3231 Precision RTC FeatherWing 1 x GPS Receiver - GP-20U7 (56 Channel) 1 x SparkFun 9DoF IMU Breakout - LSM9DS1 1 x Ultrasonic Distance Sensor - HC-SR04 (5V) 1 x Pololu 5V Step-Up Voltage Regulator U1V10F5 1 x Rocker Switch - SPST 1 x Resistor 10K Ohm 1 x Lithium Ion Battery - 1000mAh 1 x CR1220 3V Lithium Coin Cell Battery 1 x Terminal Block Breakout FeatherWing 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Bluetooth LE keyboard #include <BleKeyboard.h> // Two Wire Interface (TWI/I2C) #include <Wire.h> // Serial Peripheral Interface #include <SPI.h> // DS3231 Precision RTC #include <RTClib.h> // GPS Receiver #include <TinyGPS++.h> // ESP32 Hardware Serial #include <HardwareSerial.h> // LSM9DS1 9DOF Sensor #include <SparkFunLSM9DS1.h> // Bluetooth LE Keyboard BleKeyboard bleKeyboard; String sKeyboard = ""; // Send Size byte sendSize = 0; // DS3231 Precision RTC RTC_DS3231 rtc; String dateRTC = ""; String timeRTC = ""; // 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 // GPS Date String TargetDat; // GPS Time String TargetTim; // GPS Status String GPSSt = ""; // ESP32 HardwareSerial HardwareSerial tGPS(2); // LSM9DS1 9DOF Sensor LSM9DS1 imu; #define PRINT_CALCULATED // Earth's magnetic field varies by location. Add or subtract // a declination to get a more accurate heading. Calculate // your's here: http://www.ngdc.noaa.gov/geomag-web/#declination // Declination (degrees) in El Centro, CA #define DECLINATION 10.4 // Gyro float fGyroX; float fGyroY; float fGyroZ; // Accel float fAccelX; float fAccelY; float fAccelZ; // Mag float fMagX; float fMagY; float fMagZ; // Attitude float fRoll; float fPitch; float fHeading; // HC-SR04 Ultrasonic Sensor int iTrig = 15; int iEcho = 14; // Stores the distance measured by the distance sensor float distance = 0; // The number of the Rocker Switch pin int iSwitch = 21; // Variable for reading the button status int SwitchState = 0; // Software Version Information String sver = "28-12"; void loop() { // Date and Time RTC isRTC (); // isGPS isGPS(); // GPS Keyboard isGPSKeyboard(); // Gyro isGyro(); // Accel isAccel(); // Mag isMag(); // Attitude isAttitude(); // HC-SR04 Ultrasonic Sensor isHCSR04(); // Read the state of the Switch value: SwitchState = digitalRead(iSwitch); // Check if the button is pressed. If it is, the SwitchState is HIGH: if (SwitchState == HIGH) { // Bluetooth LE Keyboard isBluetooth(); } // Delay 1 Second delay(1000); }
getBleKeyboard.ino
// Ble Keyboard // Bluetooth // isBluetooth void isBluetooth() { // ESP32 BLE Keyboard if(bleKeyboard.isConnected()) { // Send Size Length sendSize = sKeyboard.length(); // Send Size, charAt for(byte i = 0; i < sendSize+1; i++){ // Write bleKeyboard.write(sKeyboard.charAt(i)); delay(50); } bleKeyboard.write(KEY_RETURN); } }
getGPS.ino
// GPS Receiver // Setup GPS void isSetupGPS() { // Setup GPS //tGPS.begin( 9600 ); // 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 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"; TargetLat = 0; TargetLon = 0; } } // GPS Date, Time 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); } } // GPS Keyboard void isGPSKeyboard(){ // GPS Keyboard // bleKeyboard // GPS Vector Pointer Target sKeyboard = sKeyboard + GPSSt + "|" + String(TargetLat) + "|" + String(TargetLon) + "|"; // bleKeyboard // GPS Date, Time sKeyboard = sKeyboard + TargetDat + "|" + TargetTim + "|"; }
getHC-SR04.ino
// HC-SR04 Ultrasonic Sensor // Setup HC-SR04 void isSetupHCSR04() { // The trigger iTrig will output pulses of electricity pinMode(iTrig, OUTPUT); // The echo iEcho will measure the duration of pulses coming back from the distance sensor pinMode(iEcho, INPUT); } // HC-SR04 void isHCSR04() { // Variable to store the distance measured by the sensor distance = isDistance(); sKeyboard = sKeyboard + String(distance) + " cm|*"; } // Distance float isDistance() { // Variable to store the time it takes for a ping to bounce off an object float echoTime; // Variable to store the distance calculated from the echo time float calculatedDistance; // Send out an ultrasonic pulse that's 10ms long digitalWrite(iTrig, HIGH); delayMicroseconds(10); digitalWrite(iTrig, LOW); // Use the pulseIn command to see how long it takes for the // pulse to bounce back to the sensor echoTime = pulseIn(iEcho, HIGH); // Calculate the distance of the object that reflected the pulse // (half the bounce time multiplied by the speed of sound) // cm = 58.0 calculatedDistance = echoTime / 58.0; // Send back the distance that was calculated return calculatedDistance; }
getLSM9DS1.ino
// LSM9DS1 9DOF Sensor // Gyro void isGyro(){ // Update the sensor values whenever new data is available if ( imu.gyroAvailable() ) { // To read from the gyroscope, first call the // readGyro() function. When it exits, it'll update the // gx, gy, and gz variables with the most current data. imu.readGyro(); // If you want to print calculated values, you can use the // calcGyro helper function to convert a raw ADC value to // DPS. Give the function the value that you want to convert. fGyroX = imu.calcGyro(imu.gx); fGyroY = imu.calcGyro(imu.gy); fGyroZ = imu.calcGyro(imu.gz); // bleKeyboard // Gyro sKeyboard = sKeyboard + String(fGyroX) + "|" + String(fGyroY) + "|" + String(fGyroZ) + "|"; } } // Accel void isAccel(){ // Update the sensor values whenever new data is available if ( imu.accelAvailable() ) { // To read from the accelerometer, first call the // readAccel() function. When it exits, it'll update the // ax, ay, and az variables with the most current data. imu.readAccel(); // If you want to print calculated values, you can use the // calcAccel helper function to convert a raw ADC value to // g's. Give the function the value that you want to convert. fAccelX = imu.calcAccel(imu.ax); fAccelY = imu.calcAccel(imu.ay); fAccelZ = imu.calcAccel(imu.az); // bleKeyboard // Accel sKeyboard = sKeyboard + String(fAccelX) + "|" + String(fAccelY) + "|" + String(fAccelZ) + "|"; } } // Mag void isMag(){ // Update the sensor values whenever new data is available if ( imu.magAvailable() ) { // To read from the magnetometer, first call the // readMag() function. When it exits, it'll update the // mx, my, and mz variables with the most current data. imu.readMag(); // If you want to print calculated values, you can use the // calcMag helper function to convert a raw ADC value to // Gauss. Give the function the value that you want to convert. fMagX = imu.calcMag(imu.mx); fMagY = imu.calcMag(imu.my); fMagZ = imu.calcMag(imu.mz); // bleKeyboard // Mag sKeyboard = sKeyboard + String(fMagX) + "|" + String(fMagY) + "|" + String(fMagZ) + "|"; } } // Attitude void isAttitude(){ // Attitude // Roll fRoll = atan2(fAccelY, fAccelZ); // Pitch fPitch = atan2(-fAccelX, sqrt(fAccelY * fAccelY + fAccelZ * fAccelZ)); // Heading if (fMagY == 0) { fHeading = (fMagX < 0) ? PI : 0; } else { fHeading = atan2(fMagX, fMagY); } fHeading -= DECLINATION * PI / 180; if (fHeading > PI) fHeading -= (2 * PI); else if (fHeading < -PI) fHeading += (2 * PI); // Convert everything from radians to degrees: fHeading *= 180.0 / PI; fPitch *= 180.0 / PI; fRoll *= 180.0 / PI; // bleKeyboard // Attitude sKeyboard = sKeyboard + String(fHeading) + "|" + String(fPitch) + "|" + String(fRoll) + "|"; }
getRTC.ino
// Date & Time // DS3231 Precision RTC void isSetupRTC() { // DS3231 Precision RTC if (! rtc.begin()) { //Serial.println("Couldn't find RTC"); //Serial.flush(); while (1) delay(10); } if (rtc.lostPower()) { //Serial.println("RTC lost power, let's set the time!"); // When time needs to be set on a new device, or after a power loss, the // 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(2023, 8, 10, 11, 0, 0)); } } // Date and Time RTC void isRTC () { // Date and Time dateRTC = ""; timeRTC = ""; DateTime now = rtc.now(); // Date dateRTC = now.year(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.month(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.day(), DEC; // Time timeRTC = now.hour(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.minute(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.second(), DEC; // bleKeyboard sKeyboard = "SEN|" + sver + "|" + String(dateRTC) + "|" + String(timeRTC) + "|"; }
setup.ino
// Setup void setup() { // Give display time to power on delay(100); // Bluetooth LE keyboard bleKeyboard.begin(); // Wire - Inialize I2C Hardware Wire.begin(); // Give display time to power on delay(100); // Date & Time RTC // DS3231 Precision RTC isSetupRTC(); // Give display time to power on delay(100); // GPS Receiver // Setup GPS isSetupGPS(); // LSM9DS1 9DOF Sensor imu.begin(); // Setup HC-SR04 isSetupHCSR04(); // Initialize the Switch pin as an input pinMode(iSwitch, INPUT); // Initialize digital pin LED_BUILTIN as an output pinMode(LED_BUILTIN, OUTPUT); // Turn the LED on HIGH digitalWrite(LED_BUILTIN, HIGH); // Delay 5 Second delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Teacher, Instructor, E-Mentor, R&D and Consulting
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Automation
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- Artificial Intelligence (AI)
- RTOS
- eHealth Sensors, Biosensor, and Biometric
- Research & Development (R & D)
- Consulting
Follow Us
Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #28 – Sensors – LSM9DS1 – Mk11
——
#DonLucElectronics #DonLuc #Sensors #LSM9DS1 #IMU #GPSReceiver #Adafruit #SparkFun #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
SparkFun 9DoF IMU Breakout – LSM9DS1
The SparkFun LSM9DS1 Breakout is a versatile, motion-sensing System-In-A-Chip. It houses a 3-axis accelerometer, 3-axis gyroscope, and 3-axis magnetometer, nine degrees of freedom (9DOF) on a single board. The LSM9DS1 from STMicroelectronics is equipped with a digital interface, but even that is flexible. This IMU-In-A-Chip is so cool we put it on the quarter-sized breakout board you are currently viewing.
The LSM9DS1 is one of only a handful of IC’s that can measure three key properties of movement, angular velocity, acceleration, and heading, in a single IC. By measuring these three properties, you can gain a great deal of knowledge about an object’s movement and orientation. The LSM9DS1 measures each of these movement properties in three dimensions. That means it produces nine pieces of data: acceleration in x/y/z, angular rotation in x/y/z, and magnetic force in x/y/z. The LSM9DS1 Breakout has labels indicating the accelerometer and gyroscope axis orientations, which share a right-hand rule relationship with each other.
DL2309Mk05
1 x SparkFun Thing Plus – ESP32 WROOM
1 x DS3231 Precision RTC FeatherWing
1 x GPS Receiver – GP-20U7 (56 Channel)
1 x SparkFun 9DoF IMU Breakout – LSM9DS1
1 x Rocker Switch – SPST
1 x Resistor 10K Ohm
1 x CR1220 3V Lithium Coin Cell Battery
1 x 1 x Lithium Ion Battery – 1000mAh
1 x Terminal Block Breakout FeatherWing
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
LED – LED_BUILTIN
SDA – Digital 23
SCL – Digital 22
SW1 – Digital 21
GPT – Digital 17
GPR – Digital 16
VIN – +3.3V
GND – GND
——
DL2309Mk05p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #28 - Sensors - LSM9DS1 - Mk11 28-11 DL2309Mk05p.ino 1 x SparkFun Thing Plus - ESP32 WROOM 1 x DS3231 Precision RTC FeatherWing 1 x GPS Receiver - GP-20U7 (56 Channel) 1 x SparkFun 9DoF IMU Breakout - LSM9DS1 1 x Rocker Switch - SPST 1 x Resistor 10K Ohm 1 x Lithium Ion Battery - 1000mAh 1 x CR1220 3V Lithium Coin Cell Battery 1 x Terminal Block Breakout FeatherWing 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Bluetooth LE keyboard #include <BleKeyboard.h> // Two Wire Interface (TWI/I2C) #include <Wire.h> // Serial Peripheral Interface #include <SPI.h> // DS3231 Precision RTC #include <RTClib.h> // GPS Receiver #include <TinyGPS++.h> // ESP32 Hardware Serial #include <HardwareSerial.h> // LSM9DS1 9DOF Sensor #include <SparkFunLSM9DS1.h> // Bluetooth LE Keyboard BleKeyboard bleKeyboard; String sKeyboard = ""; // Send Size byte sendSize = 0; // DS3231 Precision RTC RTC_DS3231 rtc; String dateRTC = ""; String timeRTC = ""; // 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 // GPS Date String TargetDat; // GPS Time String TargetTim; // GPS Status String GPSSt = ""; // ESP32 HardwareSerial HardwareSerial tGPS(2); // LSM9DS1 9DOF Sensor LSM9DS1 imu; #define PRINT_CALCULATED // Earth's magnetic field varies by location. Add or subtract // a declination to get a more accurate heading. Calculate // your's here: http://www.ngdc.noaa.gov/geomag-web/#declination // Declination (degrees) in El Centro, CA #define DECLINATION 10.4 // Gyro float fGyroX; float fGyroY; float fGyroZ; // Accel float fAccelX; float fAccelY; float fAccelZ; // Mag float fMagX; float fMagY; float fMagZ; // Attitude float fRoll; float fPitch; float fHeading; // The number of the Rocker Switch pin int iSwitch = 21; // Variable for reading the button status int SwitchState = 0; // Software Version Information String sver = "28-11"; void loop() { // Date and Time RTC isRTC (); // isGPS isGPS(); // GPS Keyboard isGPSKeyboard(); // Gyro isGyro(); // Accel isAccel(); // Mag isMag(); // Attitude isAttitude(); // Read the state of the Switch value: SwitchState = digitalRead(iSwitch); // Check if the button is pressed. If it is, the SwitchState is HIGH: if (SwitchState == HIGH) { // Bluetooth LE Keyboard isBluetooth(); } // Delay 1 Second delay(1000); }
getBleKeyboard.ino
// Ble Keyboard // Bluetooth // isBluetooth void isBluetooth() { // ESP32 BLE Keyboard if(bleKeyboard.isConnected()) { // Send Size Length sendSize = sKeyboard.length(); // Send Size, charAt for(byte i = 0; i < sendSize+1; i++){ // Write bleKeyboard.write(sKeyboard.charAt(i)); delay(50); } bleKeyboard.write(KEY_RETURN); } }
getGPS.ino
// GPS Receiver // Setup GPS void setupGPS() { // Setup GPS //tGPS.begin( 9600 ); // 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 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"; TargetLat = 0; TargetLon = 0; } } // GPS Date, Time 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); } } // GPS Keyboard void isGPSKeyboard(){ // GPS Keyboard // bleKeyboard // GPS Vector Pointer Target sKeyboard = sKeyboard + GPSSt + "|" + String(TargetLat) + "|" + String(TargetLon) + "|"; // bleKeyboard // GPS Date, Time sKeyboard = sKeyboard + TargetDat + "|" + TargetTim + "|"; }
getLSM9DS1.ino
// LSM9DS1 9DOF Sensor // Gyro void isGyro(){ // Update the sensor values whenever new data is available if ( imu.gyroAvailable() ) { // To read from the gyroscope, first call the // readGyro() function. When it exits, it'll update the // gx, gy, and gz variables with the most current data. imu.readGyro(); // If you want to print calculated values, you can use the // calcGyro helper function to convert a raw ADC value to // DPS. Give the function the value that you want to convert. fGyroX = imu.calcGyro(imu.gx); fGyroY = imu.calcGyro(imu.gy); fGyroZ = imu.calcGyro(imu.gz); // bleKeyboard // Gyro sKeyboard = sKeyboard + String(fGyroX) + "|" + String(fGyroY) + "|" + String(fGyroZ) + "|"; } } // Accel void isAccel(){ // Update the sensor values whenever new data is available if ( imu.accelAvailable() ) { // To read from the accelerometer, first call the // readAccel() function. When it exits, it'll update the // ax, ay, and az variables with the most current data. imu.readAccel(); // If you want to print calculated values, you can use the // calcAccel helper function to convert a raw ADC value to // g's. Give the function the value that you want to convert. fAccelX = imu.calcAccel(imu.ax); fAccelY = imu.calcAccel(imu.ay); fAccelZ = imu.calcAccel(imu.az); // bleKeyboard // Accel sKeyboard = sKeyboard + String(fAccelX) + "|" + String(fAccelY) + "|" + String(fAccelZ) + "|"; } } // Mag void isMag(){ // Update the sensor values whenever new data is available if ( imu.magAvailable() ) { // To read from the magnetometer, first call the // readMag() function. When it exits, it'll update the // mx, my, and mz variables with the most current data. imu.readMag(); // If you want to print calculated values, you can use the // calcMag helper function to convert a raw ADC value to // Gauss. Give the function the value that you want to convert. fMagX = imu.calcMag(imu.mx); fMagY = imu.calcMag(imu.my); fMagZ = imu.calcMag(imu.mz); // bleKeyboard // Mag sKeyboard = sKeyboard + String(fMagX) + "|" + String(fMagY) + "|" + String(fMagZ) + "|"; } } // Attitude void isAttitude(){ // Attitude // Roll fRoll = atan2(fAccelY, fAccelZ); // Pitch fPitch = atan2(-fAccelX, sqrt(fAccelY * fAccelY + fAccelZ * fAccelZ)); // Heading if (fMagY == 0) { fHeading = (fMagX < 0) ? PI : 0; } else { fHeading = atan2(fMagX, fMagY); } fHeading -= DECLINATION * PI / 180; if (fHeading > PI) fHeading -= (2 * PI); else if (fHeading < -PI) fHeading += (2 * PI); // Convert everything from radians to degrees: fHeading *= 180.0 / PI; fPitch *= 180.0 / PI; fRoll *= 180.0 / PI; // bleKeyboard // Attitude sKeyboard = sKeyboard + String(fHeading) + "|" + String(fPitch) + "|" + String(fRoll) + "|*"; }
getRTC.ino
// Date & Time // DS3231 Precision RTC void setupRTC() { // DS3231 Precision RTC if (! rtc.begin()) { //Serial.println("Couldn't find RTC"); //Serial.flush(); while (1) delay(10); } if (rtc.lostPower()) { //Serial.println("RTC lost power, let's set the time!"); // When time needs to be set on a new device, or after a power loss, the // 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(2023, 8, 10, 11, 0, 0)); } } // Date and Time RTC void isRTC () { // Date and Time dateRTC = ""; timeRTC = ""; DateTime now = rtc.now(); // Date dateRTC = now.year(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.month(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.day(), DEC; // Time timeRTC = now.hour(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.minute(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.second(), DEC; // bleKeyboard sKeyboard = "SEN|" + sver + "|" + String(dateRTC) + "|" + String(timeRTC) + "|"; }
setup.ino
// Setup void setup() { // Give display time to power on delay(100); // Bluetooth LE keyboard bleKeyboard.begin(); // Wire - Inialize I2C Hardware Wire.begin(); // Give display time to power on delay(100); // Date & Time RTC // DS3231 Precision RTC setupRTC(); // Give display time to power on delay(100); // GPS Receiver // Setup GPS setupGPS(); // LSM9DS1 9DOF Sensor imu.begin(); // Initialize the Switch pin as an input pinMode(iSwitch, INPUT); // Initialize digital pin LED_BUILTIN as an output pinMode(LED_BUILTIN, OUTPUT); // Turn the LED on HIGH digitalWrite(LED_BUILTIN, HIGH); // Delay 5 Second delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Teacher, Instructor, E-Mentor, R&D and Consulting
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Automation
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- Artificial Intelligence (AI)
- RTOS
- eHealth Sensors, Biosensor, and Biometric
- Research & Development (R & D)
- Consulting
Follow Us
Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #28 – Sensors – GPS Receiver GP-20U7 – Mk10
——
#DonLucElectronics #DonLuc #Sensors #GPSReceiver #Adafruit #SparkFun #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
GPS Receiver – GP-20U7
The GP-20U7 is a compact GPS receiver with a built-in high performances All-In-One GPS chipset. The GP-20U7 accurately provides position, velocity, and time readings as well possessing high sensitivity and tracking capabilities. Thanks to the low power consumption this receiver requires, the GP-20U7 is ideal for portable applications such as tablet PCs, smart phones, and other devices requiring positioning capability. This 56-Channel GPS module, that supports a standard NMEA-0183 and uBlox 7 protocol, has low power consumption of 40mA@3.3V (max), an antenna on board, and -162dBm tracking sensitivity. With 56 channels in search mode and 22 channels “All-In-View” tracking, the GP-20U7 is quite the work horse for its size.
DL2309Mk04
1 x Fio v3 – ATmega32U4
1 x DS3231 Precision RTC FeatherWing
1 x GPS Receiver – GP-20U7 (56 Channel)
1 x Rocker Switch – SPST
1 x Resistor 10K Ohm
1 x CR1220 3V Lithium Coin Cell Battery
1 x SparkFun Cerberus USB Cable
Fio v3 – ATmega32U4
LED – LED_BUILTIN
SDA – Digital 2
SCL – Digital 3
SW1 – Digital 6
GPT – Digital 7
GPR – Digital 9
VIN – +3.3V
GND – GND
——
DL2309Mk04p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #28 - Sensors - GPS Receiver GP-20U7 - Mk10 28-10 DL2309Mk04p.ino 1 x Fio v3 - ATmega32U4 1 x DS3231 Precision RTC FeatherWing 1 x GPS Receiver - GP-20U7 (56 Channel) 1 x Rocker Switch - SPST 1 x Resistor 10K Ohm 1 x CR1220 3V Lithium Coin Cell Battery 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // DS3231 Precision RTC #include <RTClib.h> // Two Wire Interface (TWI/I2C) #include <Wire.h> // Keyboard #include <Keyboard.h> // GPS Receiver #include <TinyGPS++.h> // Software Serial #include <SoftwareSerial.h> // Keyboard String sKeyboard = ""; // DS3231 Precision RTC RTC_DS3231 rtc; String dateRTC = ""; String timeRTC = ""; // GPS Receiver #define gpsRXPIN 9 // This one is unused and doesnt have a conection #define gpsTXPIN 7 // The TinyGPS++ object TinyGPSPlus gps; // Latitude float TargetLat; // Longitude float TargetLon; // GPS Date, Time // GPS Date String TargetDat; // GPS Time String TargetTim; // GPS Status String GPSSt = ""; // The serial connection to the GPS device SoftwareSerial tGPS(gpsRXPIN, gpsTXPIN); // The number of the Rocker Switch pin int iSwitch = 6; // Variable for reading the button status int SwitchState = 0; // Software Version Information String sver = "28-10"; void loop() { // Date and Time RTC isRTC (); // isGPS isGPS(); // GPS Keyboard isGPSKeyboard(); // Read the state of the Switch value: SwitchState = digitalRead(iSwitch); // Check if the button is pressed. If it is, the SwitchState is HIGH: if (SwitchState == HIGH) { Keyboard.println(sKeyboard); } // Delay 1 Second delay(1000); }
getGPS.ino
// GPS Receiver // Setup GPS void setupGPS() { // Setup GPS tGPS.begin( 9600 ); } // 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 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"; TargetLat = 0; TargetLon = 0; } } // GPS Date, Time 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); } } // GPS Keyboard void isGPSKeyboard(){ // GPS Keyboard // Keyboard // GPS Vector Pointer Target sKeyboard = sKeyboard + GPSSt + "|" + String(TargetLat) + "|" + String(TargetLon) + "|"; // Keyboard // GPS Date, Time sKeyboard = sKeyboard + TargetDat + "|" + TargetTim + "|*"; }
getRTC.ino
// Date & Time // DS3231 Precision RTC void setupRTC() { // DS3231 Precision RTC if (! rtc.begin()) { //Serial.println("Couldn't find RTC"); //Serial.flush(); while (1) delay(10); } if (rtc.lostPower()) { //Serial.println("RTC lost power, let's set the time!"); // When time needs to be set on a new device, or after a power loss, the // 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(2023, 8, 10, 11, 0, 0)); } } // Date and Time RTC void isRTC () { // Date and Time dateRTC = ""; timeRTC = ""; DateTime now = rtc.now(); // Date dateRTC = now.year(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.month(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.day(), DEC; // Time timeRTC = now.hour(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.minute(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.second(), DEC; // Keyboard sKeyboard = "SEN|" + sver + "|" + String(dateRTC) + "|" + String(timeRTC) + "|"; }
setup.ino
// Setup void setup() { // Give display time to power on delay(100); // Wire - Inialize I2C Hardware Wire.begin(); // Give display time to power on delay(100); // Date & Time RTC // DS3231 Precision RTC setupRTC(); // Initialize control over the keyboard: Keyboard.begin(); // Give display time to power on delay(100); // GPS Receiver // Setup GPS setupGPS(); // Initialize the Switch pin as an input pinMode(iSwitch, INPUT); // Initialize digital pin LED_BUILTIN as an output pinMode(LED_BUILTIN, OUTPUT); // Turn the LED on HIGH digitalWrite(LED_BUILTIN, HIGH); // Delay 5 Second delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- RTOS
- Research & Development (R & D)
Instructor, E-Mentor, STEAM, and Arts-Based Training
- Programming Language
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #26 – Radio Frequency – Bluetooth GPS Receiver GP-20U7 – Mk24
——
#DonLucElectronics #DonLuc #RadioFrequency #Bluetooth #GPS #SparkFun #BME280 #CCS811 #IMU #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
GPS Receiver – GP-20U7 (56 Channel)
The GP-20U7 is a compact GPS receiver with a built-in high performances all-in-one GPS chipset. The GP-20U7 accurately provides position, velocity, and time readings as well possessing high sensitivity and tracking capabilities. Thanks to the low power consumption this receiver requires, the GP-20U7 is ideal for portable applications such as tablet PCs, smart phones, and other devices requiring positioning capability. With 56 channels in search mode and 22 channels “All-In-View” tracking, the GP-20U7 is quite the work horse for its size.
DL2307Mk05
1 x SparkFun Thing Plus – ESP32 WROOM
1 x Arduino Uno
1 x SparkFun Bluetooth Mate Silver
1 x SparkFun BME280 – Temperature, Humidity, Barometric Pressure, and Altitude
1 x SparkFun Air Quality Breakout – CCS811
1 x Pololu AltIMU-10 v5
1 x GPS Receiver – GP-20U7
1 x Lithium Ion Battery – 850mAh
2 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
LED – LED_BUILTIN
SDA – Digital 23
SCL – Digital 22
GPR – Digital 16
GPT – Digital 17
RX2 – Bluetooth
TX2 – Bluetooth
VIN – +3.3V
GND – GND
——
DL2307Mk05ps.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #26 - Radio Frequency - Bluetooth GPS Receiver GP-20U7 - Mk24 26-24 DL2307Mk05pr.ino 1 x SparkFun Thing Plus - ESP32 WROOM 1 x Arduino Uno 1 x SparkFun Bluetooth Mate Silver 1 x SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude 1 x SparkFun Air Quality Breakout - CCS811 1 x Pololu AltIMU-10 v5 1 x GPS Receiver - GP-20U7 1 x Lithium Ion Battery - 85mAh 2 x SparkFun Cerberus USB Cable */ // Include the Library Code // Bluetooth Serial #include "BluetoothSerial.h" #if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED) #error Bluetooth is not enabled! Please run `make menuconfig` to and enable it #endif // Two Wire Interface (TWI/I2C) #include <Wire.h> // SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude #include <SparkFunBME280.h> // SparkFun CCS811 - eCO2 & tVOC #include <SparkFunCCS811.h> // Includes and variables for IMU integration // STMicroelectronics LSM6DS33 gyroscope and accelerometer #include <LSM6.h> // STMicroelectronics LIS3MDL magnetometer #include <LIS3MDL.h> // STMicroelectronics LPS25H digital barometer #include <LPS.h> // GPS Receiver #include <TinyGPS++.h> // ESP32 Hardware Serial #include <HardwareSerial.h> // Bluetooth Serial BluetoothSerial SerialBT; // SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude BME280 myBME280; float BMEtempC = 0; float BMEhumid = 0; float BMEpressure = 0; float BMEaltitudeM = 0; String FullString = ""; // SparkFun CCS811 - eCO2 & tVOC // Default I2C Address #define CCS811_ADDR 0x5B CCS811 myCCS811(CCS811_ADDR); float CCS811CO2 = 0; float CCS811TVOC = 0; String FullStringA = ""; // 9DoF IMU // STMicroelectronics LSM6DS33 gyroscope and accelerometer LSM6 imu; // Accelerometer and Gyroscopes // Accelerometer int imuAX; int imuAY; int imuAZ; String FullStringB = ""; // Gyroscopes int imuGX; int imuGY; int imuGZ; String FullStringC = ""; // STMicroelectronics LIS3MDL magnetometer LIS3MDL mag; // Magnetometer int magX; int magY; int magZ; String FullStringD = ""; // STMicroelectronics LPS25H digital barometer LPS ps; // Digital Barometer float pressure; float altitude; float temperature; String FullStringF = ""; // 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; String FullStringG = ""; // 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 = ""; String FullStringH = ""; // Software Version Information String sver = "26-24"; void loop() { // SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude isBME280(); // SparkFun CCS811 - eCO2 & tVOC isCCS811(); // Accelerometer and Gyroscopes isIMU(); // Magnetometer isMag(); // Barometer isBarometer(); // isGPS isGPS(); // Delay 1 sec 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; // FullString B FullStringB = "Accelerometer X = " + String(imuAX) + " Accelerometer Y = " + String(imuAY) + " Accelerometer Z = " + String(imuAZ) + "\r\n"; // FullStringB Bluetooth Serial + Serial for(int i = 0; i < FullStringB.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringB.c_str()[i]); // Serial Serial.write(FullStringB.c_str()[i]); } // FullString C FullStringC = "Gyroscopes X = " + String(imuGX) + " Gyroscopes Y = " + String(imuGY) + " Gyroscopes Z = " + String(imuGZ) + "\r\n"; // FullStringC Bluetooth Serial + Serial for(int i = 0; i < FullStringC.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringC.c_str()[i]); // Serial Serial.write(FullStringC.c_str()[i]); } }
getBME280.ino
// SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude // isBME280 - Temperature, Humidity, Barometric Pressure, and Altitude void isBME280(){ // Temperature Celsius BMEtempC = myBME280.readTempC(); // Humidity BMEhumid = myBME280.readFloatHumidity(); // Barometric Pressure BMEpressure = myBME280.readFloatPressure(); // Altitude Meters BMEaltitudeM = (myBME280.readFloatAltitudeMeters(), 2); // FullString FullString = "Temperature = " + String(BMEtempC,2) + " Humidity = " + String(BMEhumid,2) + " Barometric = " + String(BMEpressure,2) + " Altitude Meters = " + String(BMEaltitudeM,2) + "\r\n"; // FullString Bluetooth Serial + Serial for(int i = 0; i < FullString.length(); i++) { // Bluetooth Serial SerialBT.write(FullString.c_str()[i]); // Serial Serial.write(FullString.c_str()[i]); } }
getBarometer.ino
// STMicroelectronics LPS25H digital barometer // Setup Barometer void isSetupBarometer(){ // Setup Barometer ps.init(); // Default ps.enableDefault(); } // Barometer void isBarometer(){ // Barometer pressure = ps.readPressureMillibars(); // Altitude Meters altitude = ps.pressureToAltitudeMeters(pressure); // Temperature Celsius temperature = ps.readTemperatureC(); // FullStringF FullStringF = "Barometer = " + String(pressure,2) + " Altitude Meters = " + String(altitude,2) + " Temperature Celsius = " + String(temperature,2) + "\r\n"; // FullStringF Bluetooth Serial + Serial for(int i = 0; i < FullStringF.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringF.c_str()[i]); // Serial Serial.write(FullStringF.c_str()[i]); } }
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(); // FullStringA FullStringA = "TVOCs = " + String(CCS811TVOC,2) + " eCO2 = " + String(CCS811CO2,2) + "\r\n"; // FullStringA Bluetooth Serial + Serial for(int i = 0; i < FullStringA.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringA.c_str()[i]); // Serial Serial.write(FullStringA.c_str()[i]); } }
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"; // FullStringG FullStringG = "Latitude = " + String(TargetLat) + " Longitude = " + String(TargetLon) + "\r\n"; // FullStringG Bluetooth Serial + Serial for(int i = 0; i < FullStringG.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringG.c_str()[i]); // Serial Serial.write(FullStringG.c_str()[i]); } } 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); // FullStringH FullStringH = "Date = " + String(TargetDat) + "\r\n"; // FullStringH Bluetooth Serial + Serial for(int i = 0; i < FullStringH.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringH.c_str()[i]); // Serial Serial.write(FullStringH.c_str()[i]); } } // 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); // FullStringH FullStringH = "Time = " + String(TargetTim) + "\r\n"; // FullStringH Bluetooth Serial + Serial for(int i = 0; i < FullStringH.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringH.c_str()[i]); // Serial Serial.write(FullStringH.c_str()[i]); } } // 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); // FullStringH FullStringH = "Speed = " + String(TargetSMS) + "\r\n"; // FullStringH Bluetooth Serial + Serial for(int i = 0; i < FullStringH.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringH.c_str()[i]); // Serial Serial.write(FullStringH.c_str()[i]); } } // Altitude TargetALT = ""; if (gps.altitude.isValid()) { // Altitude // Meters int z = gps.altitude.meters(); TargetALT = String( z, DEC); // FullStringH FullStringH = "Altitude = " + String(TargetALT) + "\r\n"; // FullStringH Bluetooth Serial + Serial for(int i = 0; i < FullStringH.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringH.c_str()[i]); // Serial Serial.write(FullStringH.c_str()[i]); } } }
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; // FullString D FullStringD = "Magnetometer X = " + String(magX) + " Magnetometer Y = " + String(magY) + " Magnetometer Z = " + String(magZ) + "\r\n"; // FullStringD Bluetooth Serial + Serial for(int i = 0; i < FullStringD.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringD.c_str()[i]); // Serial Serial.write(FullStringD.c_str()[i]); } }
setup.ino
// Setup void setup() { // Serial Begin Serial.begin(9600); Serial.println("Starting BLE work!"); // Bluetooth Serial SerialBT.begin("Don Luc Electronics"); Serial.println("Bluetooth Started! Ready to pair..."); // Give display time to power on delay(100); // Wire - Inialize I2C Hardware Wire.begin(); // Give display time to power on delay(100); // SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude myBME280.begin(); // CCS811 - eCO2 & tVOC myCCS811.begin(); // Setup IMU setupIMU(); // Setup Magnetometer setupMag(); // Setup Barometer isSetupBarometer(); // GPS Receiver // Setup GPS setupGPS(); // Initialize digital pin LED_BUILTIN as an output pinMode(LED_BUILTIN, OUTPUT); // Turn the LED on HIGH digitalWrite(LED_BUILTIN, HIGH); }
——
Arduino Uno
RX – Digital 3
TX – Digital 2
VIN – +3.3V
GND – GND
——
DL2307Mk05pr.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #26 - Radio Frequency - Bluetooth GPS Receiver GP-20U7 - Mk24 26-24 DL2307Mk05pr.ino 1 x Arduino Uno 1 x SparkFun RedBoard Qwiic 1 x SparkFun Bluetooth Mate Silver 1 x SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude 1 x SparkFun Air Quality Breakout - CCS811 1 x Pololu AltIMU-10 v5 1 x GPS Receiver - GP-20U7 1 x Lithium Ion Battery - 85mAh 2 x SparkFun Cerberus USB Cable */ // Include the Library Code // Software Serial #include <SoftwareSerial.h> // Software Serial // TX-O pin of bluetooth mate, Arduino D2 int bluetoothTx = 2; // RX-I pin of bluetooth mate, Arduino D3 int bluetoothRx = 3; // Bluetooth SoftwareSerial bluetooth(bluetoothTx, bluetoothRx); // BTA //String BTA = "0006664FDC9E"; // Software Version Information String sver = "26-24"; void loop() { // isBluetooth isBluetooth(); }
getBluetooth.ino
// Bluetooth // Setup Bluetooth void isSetupBluetooth(){ // Setup Bluetooth // Begin the serial monitor at 9600bps Serial.begin(9600); // Bluetooth // The Bluetooth Mate defaults to 115200bps bluetooth.begin(115200); // Print three times individually bluetooth.print("$"); bluetooth.print("$"); bluetooth.print("$"); // Enter command mode // Short delay, wait for the Mate to send back CMD delay(100); // Temporarily Change the baudrate to 9600, no parity bluetooth.println("U,9600,N"); // 115200 can be too fast at times for NewSoftSerial to relay the data reliably // Start bluetooth serial at 9600 bluetooth.begin(9600); } // isBluetooth void isBluetooth() { // If the bluetooth sent any characters if(bluetooth.available()) { // Send any characters the bluetooth prints to the serial monitor Serial.print((char)bluetooth.read()); } // If stuff was typed in the serial monitor if(Serial.available()) { // Send any characters the Serial monitor prints to the bluetooth bluetooth.print((char)Serial.read()); } }
setup.ino
// Setup void setup() { // Setup Bluetooth isSetupBluetooth(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- RTOS
- Research & Development (R & D)
Instructor, E-Mentor, STEAM, and Arts-Based Training
- Programming Language
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #26 – Radio Frequency – GPS Receiver – Mk07
——
#DonLucElectronics #DonLuc #RadioFrequency #Moteino #Send #Receive #GPSReceiver #OpenLog #Display #FreeIMU #Magnetometer #Accelerometer #Gyroscope #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
GPS Receiver – GP-20U7 (56 Channel)
The GP-20U7 is a compact GPS receiver with a built-in high performances all-in-one GPS chipset. The GP-20U7 accurately provides position, velocity, and time readings as well possessing high sensitivity and tracking capabilities. Thanks to the low power consumption this receiver requires, the GP-20U7 is ideal for portable applications such as tablet PCs, smart phones, and other devices requiring positioning capability.
This 56-channel GPS module, that supports a standard NMEA-0183 and uBlox 7 protocol, has low power consumption of 40mA@3.3V (Max), an antenna on board, and -162dBm tracking sensitivity. With 56 channels in search mode and 22 channels “All-In-View” tracking, the GP-20U7 is quite the work horse for its size.
DL2212Mk02
2 x Moteino R2 (RFM12B)
1 x GPS Receiver – GP-20U7 (56 Channel)
1 x SparkFun OpenLog
1 x microSD Card – 16GB
1 x SparkFun Micro OLED Breakout (Qwiic)
1 x SparkFun 9 Degrees of Freedom – Sensor Stick
2 x Lithium Ion Battery – 1 Ah
1 x SparkFun Cerberus USB Cable
Moteino R2 (Receive)
TX0 – Digital 1
TR0 – Digital 2
LED – Digital 9
TR1 – Digital 10
TR2 – Digital 11
TR3 – Digital 12
TR4 – Digital 13
SDA – Analog A4
SCL – Analog A5
VIN – +3.3V
GND – GND
——
DL2212Mk02pr.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #26 - Radio Frequency - GPS Receiver - Mk07 26-07 Receive DL2212Mk02pr.ino 2 x Moteino R2 (RFM12B) 1 x GPS Receiver - GP-20U7 (56 Channel) 1 x SparkFun OpenLog 1 x microSD Card - 16GB 1 x SparkFun Micro OLED Breakout (Qwiic) 1 x SparkFun 9 Degrees of Freedom - Sensor Stick 2 x Lithium Ion Battery - 1Ah 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // RFM12B Radio #include <RFM12B.h> // Two Wire Interface (TWI/I2C) #include <Wire.h> // SparkFun Micro OLED #include <SFE_MicroOLED.h> // You will need to initialize the radio by telling it what ID // it has and what network it's on // The NodeID takes values from 1-127, 0 is reserved for sending // broadcast messages (send to all nodes) // The Network ID takes values from 0-255 // By default the SPI-SS line used is D10 on Atmega328. // You can change it by calling .SetCS(pin) where pin can be {8,9,10} // Network ID used for this unit #define NODEID 1 // The network ID we are on #define NETWORKID 99 // Serial #define SERIAL_BAUD 115200 // Encryption is OPTIONAL // to enable encryption you will need to: // - provide a 16-byte encryption KEY (same on all nodes that talk encrypted) // - to call .Encrypt(KEY) to start encrypting // - to stop encrypting call .Encrypt(NULL) uint8_t KEY[] = "ABCDABCDABCDABCD"; // Need an instance of the RFM12B Radio Module RFM12B radio; // Process Message // Message String msg = ""; int firstClosingBracket = 0; // Yaw Pitch Roll String sYaw = ""; String sPitch = ""; String sRoll = ""; float Yaw = 0; float Pitch = 0; float Roll = 0; // LED int iLED = 9; // SparkFun Micro OLED #define PIN_RESET 9 #define DC_JUMPER 1 // I2C declaration MicroOLED oled(PIN_RESET, DC_JUMPER); // Software Version Information String sver = "26-07"; void loop() { // is RFM12B Radio isRFM12BRadio(); // Micro OLED isMicroOLED(); }
getFreeIMU.ino
// FreeIMU // isFreeIMU void isFreeIMU(){ // FreeIMU // msg = "<IMU|Yaw|Pitch|Roll|GPS Status|Latitude|Longitude|Date|Time|*" // msg = "<IMU|" + sYaw + "|" + sPitch + "|" + sRoll + "|" + GPSSt // + "|" + TargetLat + "|" TargetLon + "|" + TargetDat +"|" + TargetTim + "|*" firstClosingBracket = 0; // "<IMU|" firstClosingBracket = msg.indexOf('|'); msg.remove(0, 5); // Yaw firstClosingBracket = msg.indexOf('|'); sYaw = msg; sYaw.remove(firstClosingBracket); Yaw = sYaw.toFloat(); // Pitch firstClosingBracket = firstClosingBracket + 1; msg.remove(0, firstClosingBracket ); firstClosingBracket = msg.indexOf('|'); sPitch = msg; sPitch.remove(firstClosingBracket); Pitch = sPitch.toFloat(); // Roll firstClosingBracket = firstClosingBracket + 1; msg.remove(0, firstClosingBracket ); firstClosingBracket = msg.indexOf('|'); sRoll = msg; sRoll.remove(firstClosingBracket); Roll = sRoll.toFloat(); }
getMicroOLED.ino
// SparkFun Micro OLED // Setup Micro OLED void isSetupMicroOLED() { // Initialize the OLED oled.begin(); // Clear the display's internal memory oled.clear(ALL); // Display what's in the buffer (splashscreen) oled.display(); // Delay 1000 ms delay(1000); // Clear the buffer. oled.clear(PAGE); } // Micro OLED void isMicroOLED() { // Text Display FreeIMU // Clear the display oled.clear(PAGE); // Set cursor to top-left oled.setCursor(0, 0); // Set font to type 0 oled.setFontType(0); // FreeIMU oled.print("FreeIMU"); oled.setCursor(0, 12); // Yaw oled.print("Y: "); oled.print(Yaw); oled.setCursor(0, 25); // Pitch oled.print("P: "); oled.print(Pitch); oled.setCursor(0, 39); // Roll oled.print("R: "); oled.print(Roll); oled.display(); }
getRFM12BRadio.ino
// RFM12B Radio void isSetupRFM12BRadio() { // RFM12B Radio radio.Initialize(NODEID, RF12_433MHZ, NETWORKID); // Encryption radio.Encrypt(KEY); // Transmitting } // is RFM12 BRadio void isRFM12BRadio() { // Receive if (radio.ReceiveComplete()) { // CRC Pass if (radio.CRCPass()) { // Message msg = ""; // Can also use radio.GetDataLen() if you don't like pointers for (byte i = 0; i < *radio.DataLen; i++) { //Serial.print((char)radio.Data[i]); msg = msg + (char)radio.Data[i]; } // Serial Serial.println( msg ); // Turn the LED on HIGH digitalWrite( iLED , HIGH); // FreeIMU // Yaw Pitch Roll isFreeIMU(); // ACK Requested if (radio.ACKRequested()) { // Send ACK radio.SendACK(); } // Turn the LED on LOW digitalWrite( iLED , LOW); } else { // BAD-CRC } } }
setup.ino
// Setup void setup() { // Serial Serial.begin(SERIAL_BAUD); // Give display time to power on delay(100); // Set up I2C bus Wire.begin(); // Setup Micro OLED isSetupMicroOLED(); // LED pinMode( iLED , OUTPUT); // RFM12B Radio isSetupRFM12BRadio(); }
——
Moteino R2 (Send)
TR0 – Digital 2
GPT – Digital 3
GPR – Digital 4
LED – Digital 9
TR1 – Digital 10
TR2 – Digital 11
TR3 – Digital 12
TR4 – Digital 13
SDA – Analog A4
SCL – Analog A5
VIN – +3.3V
GND – GND
——
DL2212Mk02ps.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #26 - Radio Frequency - GPS Receiver - Mk07 26-07 Send DL2212Mk02ps.ino 2 x Moteino R2 (RFM12B) 1 x GPS Receiver - GP-20U7 (56 Channel) 1 x SparkFun OpenLog 1 x microSD Card - 16GB 1 x SparkFun Micro OLED Breakout (Qwiic) 1 x SparkFun 9 Degrees of Freedom - Sensor Stick 2 x Lithium Ion Battery - 1Ah 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // RFM12B Radio #include <RFM12B.h> // Sleep #include <avr/sleep.h> // Two Wire Interface (TWI/I2C) #include <Wire.h> // Includes and variables for IMU integration // Accelerometer #include <ADXL345.h> // Magnetometer #include <HMC58X3.h> // MEMS Gyroscope #include <ITG3200.h> // Debug #include "DebugUtils.h" // FreeIMU #include <CommunicationUtils.h> #include <FreeIMU.h> // GPS Receiver #include <TinyGPS++.h> // Software Serial #include <SoftwareSerial.h> // You will need to initialize the radio by telling it what ID // it has and what network it's on // The NodeID takes values from 1-127, 0 is reserved for sending // broadcast messages (send to all nodes) // The Network ID takes values from 0-255 // By default the SPI-SS line used is D10 on Atmega328. // You can change it by calling .SetCS(pin) where pin can be {8,9,10} // Network ID used for this unit #define NODEID 2 // The network ID we are on #define NETWORKID 99 // The node ID we're sending to #define GATEWAYID 1 // # of ms to wait for an ack #define ACK_TIME 50 // Serial #define SERIAL_BAUD 115200 // Encryption is OPTIONAL // to enable encryption you will need to: // - provide a 16-byte encryption KEY (same on all nodes that talk encrypted) // - to call .Encrypt(KEY) to start encrypting // - to stop encrypting call .Encrypt(NULL) uint8_t KEY[] = "ABCDABCDABCDABCD"; // Wait this many ms between sending packets int interPacketDelay = 1000; // Input char input = 0; // Need an instance of the RFM12B Radio Module RFM12B radio; // Send Size byte sendSize = 0; // Payload char payload[100]; // Request ACK bool requestACK = false; // LED int iLED = 9; // Set the FreeIMU object FreeIMU my3IMU = FreeIMU(); // Yaw Pitch Roll String zzzzzz = ""; String sYaw = ""; String sPitch = ""; String sRoll = ""; float ypr[3]; float Yaw = 0; float Pitch = 0; float Roll = 0; // GPS Receiver #define gpsRXPIN 4 // This one is unused and doesnt have a conection #define gpsTXPIN 3 // The TinyGPS++ object TinyGPSPlus gps; // Latitude float TargetLat; String sLat = ""; // Longitude float TargetLon; String sLon = ""; // GPS Date, Time // GPS Date String TargetDat; // GPS Time String TargetTim; // GPS Status String GPSSt = ""; // The serial connection to the GPS device SoftwareSerial tGPS(gpsRXPIN, gpsTXPIN); // Software Version Information String sver = "26-07"; void loop() { // isGPS isGPS(); // isFreeIMU isFreeIMU(); // is RFM12B Radio isRFM12BRadio(); // Inter Packet Delay delay(interPacketDelay); }
getFreeIMU.ino
// FreeIMU // isFreeIMU void isFreeIMU(){ // FreeIMU // Yaw Pitch Roll my3IMU.getYawPitchRoll(ypr); // Yaw Yaw = ypr[0]; // Pitch Pitch = ypr[1]; // Roll Roll = ypr[2]; }
getGPS.ino
// GPS Receiver // Setup GPS void setupGPS() { // Setup GPS tGPS.begin( 9600 ); } // 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 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 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); } }
getRFM12BRadio.ino
// RFM12B Radio void isSetupRFM12BRadio(){ // RFM12B Radio radio.Initialize(NODEID, RF12_433MHZ, NETWORKID); // Encryption radio.Encrypt(KEY); // Sleep right away to save power radio.Sleep(); // Transmitting Serial.println("Transmitting...\n\n"); } // is RFM12 BRadio void isRFM12BRadio(){ // sYaw, sPitch, sRoll "" sYaw = ""; sPitch = ""; sRoll = ""; // Latitude and Longitude sLat = ""; sLon = ""; // sYaw, sPitch, sRoll concat sYaw.concat(Yaw); sPitch.concat(Pitch); sRoll.concat(Roll); // Latitude and Longitude sLat.concat( TargetLat ); sLon.concat( TargetLon ); // zzzzzz "" zzzzzz = ""; // zzzzzz = "<IMU|Yaw|Pitch|Roll|GPS Status|Latitude|Longitude|Date|Time|*" // zzzzzz = "<IMU|" + sYaw + "|" + sPitch + "|" + sRoll + "|" + GPSSt // + "|" + TargetLat + "|" TargetLon + "|" + TargetDat +"|" + TargetTim + "|*" zzzzzz = "<IMU|" + sYaw + "|" + sPitch + "|" + sRoll + "|" + GPSSt + "|" + sLat + "|" + sLon + "|" + TargetDat + "|" + TargetTim + "|*"; // sendSize Length sendSize = zzzzzz.length(); // sendSize payload[sendSize]; // sendSize, charAt for(byte i = 0; i < sendSize+1; i++){ payload[i] = zzzzzz.charAt(i); } // payload Serial.print(payload); // Request ACK requestACK = sendSize; // Wakeup radio.Wakeup(); // Turn the LED on HIGH digitalWrite( iLED , HIGH); // Send radio.Send(GATEWAYID, payload, sendSize, requestACK); // Request ACK if (requestACK) { Serial.print(" - waiting for ACK..."); if (waitForAck()){ Serial.print("Ok!"); } else Serial.print("nothing..."); } // Turn the LED on LOW digitalWrite( iLED , LOW); // Sleep radio.Sleep(); // Serial Serial.println(); } // Wait a few milliseconds for proper ACK, return true if received static bool waitForAck(){ // Now long now = millis(); // ACK while (millis() - now <= ACK_TIME){ if (radio.ACKReceived(GATEWAYID)){ return true; } } return false; }
setup.ino
// Setup void setup(){ // Serial Serial.begin(SERIAL_BAUD); // GPS Receiver // Setup GPS setupGPS(); // LED pinMode( iLED , OUTPUT); // Set up I2C bus Wire.begin(); // RFM12B Radio isSetupRFM12BRadio(); // Pause delay(5); // Initialize IMU my3IMU.init(); // Pause delay(5); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- RTOS
- Research & Development (R & D)
Instructor, E-Mentor, STEAM, and Arts-Based Training
- Programming Language
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
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 – 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