Bluetooth
Project #25 – Movement – HMC5883L – Mk08
——
#DonLucElectronics #DonLuc #HMC5883L #ADXL345 #Accelerometer #Movement #ESP32 #Bluetooth #Elecrow #DFRobot #Arduino #Project #Patreon #Electronics #Microcontrollers #IoT #Fritzing #Programming #Consultant
——
——
——
——
Crowtail – 3-Axis Digital Compass
Crowtail-3-Axis Compass module, a member of Crowtail family uses I²C based Honeywell HMC5883L digital compass. This ASIC is equipped with high resolution HMC118X magneto-resistive sensors and a 12-bit ADC. It provides compass heading accuracy up to 1° to 2°. Signal conditioning like amplification, automatic degaussing strap drivers and offset cancellation are inbuilt. This Crowtail module also includes a XC6206P332MR for power supply requirement. Hence user can connect any 3.3V to 6V DC power supply.
- -Crowtail compatible interface
- -3-Axis Magneto-resistive type sensors
- -I²C serial interface
- -1° to 2° Degree heading accuracy
- -Up to 116 Hz Maximum output rate
- -Built-In self test
- -Low cost compassing
- -Magnetometry
- -Pedestrian navigation
- -Hobby auto navigation
- -Compassing support for mobile devices and portable computers
DL2501Mk05
1 x DFRobot FireBeetle 2 ESP32-E
1 x Fermion: 2.0″ 320×240 IPS TFT LCD
1 x GDL Line 10 CM
1 x Crowtail – I2C Hub 2.0
1 x Crowtail – 3-Axis Digital Compass
1 x Crowtail – 3-Axis Digital Accelerometer
1 x Lithium Ion Battery – 1000mAh
1 x Switch
1 x Bluetooth Serial Terminal
1 x USB 3.1 Cable A to C
FireBeetle 2 ESP32-E
SCL – 22
SDA – 21
DC – D2
CS – D6
RST – D3
RX2 – Bluetooth
TX2 – Bluetooth
VIN – +3.3V
GND – GND
DL2501Mk05p
DL2501Mk05p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #25 - Movement - HMC5883L - Mk08 25-08 DL2501Mk05p.ino DL2501Mk05 1 x DFRobot FireBeetle 2 ESP32-E 1 x Fermion: 2.0" 320x240 IPS TFT LCD 1 x GDL Line 10 CM 1 x Crowtail - I2C Hub 2.0 1 x Crowtail - 3-Axis Digital Compass 1 x Crowtail - 3-Axis Digital Accelerometer 1 x Lithium Ion Battery - 1000mAh 1 x Switch 1 x Bluetooth Serial Terminal 1 x USB 3.1 Cable A to C */ // Include the Library Code // Arduino #include <Arduino.h> // Wire #include <Wire.h> // DFRobot Display GDL API #include <DFRobot_GDL.h> // 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 // Accelemeter ADXL345 #include <ADXL345.h> // Compass HMC5883L #include <HMC5883L.h> // Compass HMC5883L HMC5883L compass; // Heading float heading; // Heading Degrees float headingDegrees; // Variable ADXL345 library ADXL345 adxl; // Accelerometer ADXL345 // x, y, z int x; int y; int z; // Standard Gravity // xyz double xyz[3]; double ax; double ay; double az; // FullString String FullString = ""; // Bluetooth Serial BluetoothSerial SerialBT; // Defined ESP32 #define TFT_DC D2 #define TFT_CS D6 #define TFT_RST D3 /*dc=*/ /*cs=*/ /*rst=*/ // DFRobot Display 240x320 DFRobot_ST7789_240x320_HW_SPI screen(TFT_DC, TFT_CS, TFT_RST); // Software Version Information String sver = "25-08"; void loop() { // Accelemeter ADXL345 isADXL345(); // Compass HMC5883L isHMC5883L(); // Accelemeter ADXL345 Compass HMC5883L Display isDisplayADXL345HMC5883L(); // Delay 0.5 Second delay( 500 ); }
getAccelemeterADXL345.ino
// Accelemeter ADXL345 // Setup Accelemeter ADXL345 void isSetupADXL345(){ // Power On adxl.powerOn(); // Set activity inactivity thresholds (0-255) // 62.5mg per increment adxl.setActivityThreshold(75); // 62.5mg per increment adxl.setInactivityThreshold(75); // How many seconds of no activity is inactive? adxl.setTimeInactivity(10); //look of activity movement on this axes - 1 == on; 0 == off adxl.setActivityX(1); adxl.setActivityY(1); adxl.setActivityZ(1); //look of inactivity movement on this axes - 1 == on; 0 == off adxl.setInactivityX(1); adxl.setInactivityY(1); adxl.setInactivityZ(1); // Look of tap movement on this axes - 1 == on; 0 == off adxl.setTapDetectionOnX(0); adxl.setTapDetectionOnY(0); adxl.setTapDetectionOnZ(1); // Set values for what is a tap, and what is a double tap (0-255) // 62.5mg per increment adxl.setTapThreshold(50); // 625us per increment adxl.setTapDuration(15); // 1.25ms per increment adxl.setDoubleTapLatency(80); // 1.25ms per increment adxl.setDoubleTapWindow(200); // set values for what is considered freefall (0-255) // (5 - 9) recommended - 62.5mg per increment adxl.setFreeFallThreshold(7); // (20 - 70) recommended - 5ms per increment adxl.setFreeFallDuration(45); // Setting all interrupts to take place on int pin 1 // I had issues with int pin 2, was unable to reset it adxl.setInterruptMapping( ADXL345_INT_SINGLE_TAP_BIT, ADXL345_INT1_PIN ); adxl.setInterruptMapping( ADXL345_INT_DOUBLE_TAP_BIT, ADXL345_INT1_PIN ); adxl.setInterruptMapping( ADXL345_INT_FREE_FALL_BIT, ADXL345_INT1_PIN ); adxl.setInterruptMapping( ADXL345_INT_ACTIVITY_BIT, ADXL345_INT1_PIN ); adxl.setInterruptMapping( ADXL345_INT_INACTIVITY_BIT, ADXL345_INT1_PIN ); // Register interrupt actions - 1 == on; 0 == off adxl.setInterrupt( ADXL345_INT_SINGLE_TAP_BIT, 1); adxl.setInterrupt( ADXL345_INT_DOUBLE_TAP_BIT, 1); adxl.setInterrupt( ADXL345_INT_FREE_FALL_BIT, 1); adxl.setInterrupt( ADXL345_INT_ACTIVITY_BIT, 1); adxl.setInterrupt( ADXL345_INT_INACTIVITY_BIT, 1); } // Accelemeter ADXL345 void isADXL345(){ // Read the accelerometer values and store them in variables x,y,z adxl.readXYZ(&x, &y, &z); // Output // FullString // ************ FullString = "************\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]); } // FullString FullString = "Values of X , Y , Z: " + String(x) + " , " + String(y) + " , " + String(z) + + "\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]); } // Standard Gravity // Acceleration adxl.getAcceleration(xyz); // Output ax = xyz[0]; ay = xyz[1]; az = xyz[2]; // FullString // ************ FullString = "************\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]); } // FullString // xg FullString = "X = " + String(ax) + " g" + "\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]); } // yg FullString = "y = " + String(ay) + " g" + "\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]); } // zg FullString = "z = " + String(az) + " g" + "\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]); } }
getCompassHMC5883L.ino
// HMC5883L Triple Axis Digital Compass // Setup HMC5883L void isSetupHMC5883L(){ // Initialize Initialize HMC5883L compass.begin(); // Set measurement range compass.setRange(HMC5883L_RANGE_1_3GA); // Set measurement mode compass.setMeasurementMode(HMC5883L_CONTINOUS); // Set data rate compass.setDataRate(HMC5883L_DATARATE_30HZ); // Set number of samples averaged compass.setSamples(HMC5883L_SAMPLES_8); // Set calibration offset compass.setOffset(0, 0); } // Compass HMC5883L void isHMC5883L(){ // Vector norm Vector norm = compass.readNormalize(); // Calculate heading heading = atan2(norm.YAxis, norm.XAxis); // Set declination angle on your location and fix heading // You can find your declination on: http://magnetic-declination.com/ // (+) Positive or (-) for negative // Latitude: 32° 39' 7.9" N // Longitude: 115° 28' 6.2" W // Magnetic Declination: +10° 35' // Declination is POSITIVE (EAST) // Inclination: 58° 4' // Magnetic field strength: 45759.1 nT // Formula: (deg + (min / 60.0)) / (180 / M_PI); float declinationAngle = (10.0 + (35.0 / 60.0)) / (180 / M_PI); heading += declinationAngle; // Correct for heading < 0deg and heading > 360deg if (heading < 0) { heading += 2 * PI; } if (heading > 2 * PI) { heading -= 2 * PI; } // Convert to degrees headingDegrees = heading * 180/M_PI; // Output // FullString // ************ FullString = "************\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]); } // FullString // Heading FullString = "Heading = " + String( heading ) + "\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]); } // FullString // Degress FullString = "Degress = " + String( headingDegrees ) + "\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]); } }
getDisplay.ino
// DFRobot Display 240x320 // DFRobot Display 240x320 - UID void isDisplayUID(){ // DFRobot Display 240x320 // Text Display // Text Wrap screen.setTextWrap(false); // Rotation screen.setRotation(3); // Fill Screen => black screen.fillScreen(0x0000); // Text Color => white screen.setTextColor(0xffff); // Font => Free Sans Bold 12pt screen.setFont(&FreeSansBold12pt7b); // TextSize => 1.5 screen.setTextSize(1.5); // Don Luc Electronics screen.setCursor(0, 30); screen.println("Don Luc Electronics"); // Accelemeter ADXL345 screen.setCursor(0, 60); screen.println("Compass HMC5883L"); // Version screen.setCursor(0, 90); screen.println("Version"); screen.setCursor(0, 120); screen.println( sver ); } // Accelemeter ADXL345 void isDisplayADXL345HMC5883L(){ // DFRobot Display 240x320 // Text Display // Text Wrap screen.setTextWrap(false); // Rotation screen.setRotation(3); // Fill Screen => white screen.fillScreen(0xffff); // Text Color => blue screen.setTextColor(0x001F); // Font => Free Sans Bold 12pt screen.setFont(&FreeSansBold12pt7b); // TextSize => 1.5 screen.setTextSize(1.5); // Accelemeter ADXL345 screen.setCursor(0, 30); screen.println("Accelemeter ADXL345"); // Accelemeter ADXL345 X screen.setCursor(0, 60); screen.println("X: "); screen.setCursor(40, 60); screen.println( x ); // Accelemeter ADXL345 Y screen.setCursor(0, 90); screen.println( "Y: " ); screen.setCursor(40, 90); screen.println( y ); // Accelemeter ADXL345 Z screen.setCursor(0, 120); screen.println( "Z: " ); screen.setCursor(40, 120); screen.println( z ); // Compass HMC5883L screen.setCursor(0, 150); screen.println( "Compass HMC5883L" ); // Heading screen.setCursor(0, 180); screen.println( "Heading = " ); screen.setCursor(130, 180); screen.println( heading ); // Degress screen.setCursor(0, 210); screen.println( "Degress = " ); screen.setCursor(130, 210); screen.println( headingDegrees ); }
setup.ino
// Setup void setup() { // Serial Begin Serial.begin(115200); Serial.println("Starting BLE work!"); // Bluetooth Serial SerialBT.begin("DL2501Mk05"); Serial.println("Bluetooth Started! Ready to pair..."); // Delay delay(100); // DFRobot Display 240x320 screen.begin(); // Delay delay(100); // Setup Accelemeter ADXL345 isSetupADXL345(); // Setup HMC5883L isSetupHMC5883L(); // DFRobot Display 240x320 - UID // Don Luc Electronics // Version isDisplayUID(); // Delay 5 Second delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Electronics, IoT, Teacher, Instructor, R&D and Consultant
- 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 – 2025
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Patreon: https://patreon.com/DonLucElectronics59
DFRobot: https://learn.dfrobot.com/user-10186.html
Hackster.io: https://www.hackster.io/neosteam-labs
Elecrow: https://www.elecrow.com/share/sharepj/center/no/760816d385ebb1edc0732fd873bfbf13
TikTok: https://www.tiktok.com/@luc.paquin8
Twitch: https://www.twitch.tv/lucpaquin
LinkedIn: https://www.linkedin.com/in/jlucpaquin/
Don Luc
Project #25 – Movement – ADXL345 – Mk07
——
#DonLucElectronics #DonLuc #ADXL345 #Accelerometer #Movement #ESP32 #Bluetooth #Elecrow #DFRobot #Arduino #Project #Patreon #Electronics #Microcontrollers #IoT #Fritzing #Programming #Consultant
——
——
——
——
Crowtail – 3-Axis Digital Accelerometer
Crowtail – 3-Axis Digital Accelerometer with specific Crowtail interface, It’s base on an advanced 3-axis IC ADXL345. This is a high resolution digital accelerometer providing you at max 3.9mg/LSB resolution and large ±16g measurement range. Have no worry to implement it into your free-fall detection project, cause it’s robust enough to survive up to 10,000g shock. Meanwhile, it’s agile enough to detect single and double taps. It’s ideal for motion detection, gesture detection as well as robotics. This digital 3-axis accelerometer has excellent EMI protection.
Its variable output makes it suitable for a wide range of applications:
- 1. HDD shock protection
- 2. Vibration sensor
- 3. Game controller input
- 4. Robotics
- 5. Smart vehicles
- 6. Anywhere you need to obtain motion-sensing and orientation information.
- 7. The excellent sensitivity provide high-precision output up to ±16g.
DL2501Mk03
1 x DFRobot FireBeetle 2 ESP32-E
1 x Fermion: 2.0″ 320×240 IPS TFT LCD
1 x GDL Line 10 CM
1 x Crowtail – I2C Hub 2.0
1 x Crowtail – 3-Axis Digital Accelerometer
1 x Lithium Ion Battery – 1000mAh
1 x Switch
1 x Bluetooth Serial Terminal
1 x USB 3.1 Cable A to C
FireBeetle 2 ESP32-E
SCL – 22
SDA – 21
DC – D2
CS – D6
RST – D3
RX2 – Bluetooth
TX2 – Bluetooth
VIN – +3.3V
GND – GND
DL2501Mk03p
DL2501Mk03p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #25 - Movement - ADXL345 - Mk07 25-07 DL2501Mk03p.ino DL2501Mk03 1 x DFRobot FireBeetle 2 ESP32-E 1 x Fermion: 2.0" 320x240 IPS TFT LCD 1 x GDL Line 10 CM 1 x Crowtail - I2C Hub 2.0 1 x Crowtail - 3-Axis Digital Accelerometer 1 x Lithium Ion Battery - 1000mAh 1 x Switch 1 x Bluetooth Serial Terminal 1 x USB 3.1 Cable A to C */ // Include the Library Code // Arduino #include <Arduino.h> // Wire #include <Wire.h> // DFRobot Display GDL API #include <DFRobot_GDL.h> // 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 // Accelemeter ADXL345 #include <ADXL345.h> // Variable ADXL345 library ADXL345 adxl; // Accelerometer ADXL345 // x, y, z int x; int y; int z; // Standard Gravity // xyz double xyz[3]; double ax; double ay; double az; // FullString String FullString = ""; // Bluetooth Serial BluetoothSerial SerialBT; // Defined ESP32 #define TFT_DC D2 #define TFT_CS D6 #define TFT_RST D3 /*dc=*/ /*cs=*/ /*rst=*/ // DFRobot Display 240x320 DFRobot_ST7789_240x320_HW_SPI screen(TFT_DC, TFT_CS, TFT_RST); // Software Version Information String sver = "25-07"; void loop() { // Accelemeter ADXL345 isADXL345(); // Delay 0.5 Second delay( 500 ); }
getAccelemeterADXL345.ino
// Accelemeter ADXL345 // Setup Accelemeter ADXL345 void isSetupADXL345(){ // Power On adxl.powerOn(); // Set activity inactivity thresholds (0-255) // 62.5mg per increment adxl.setActivityThreshold(75); // 62.5mg per increment adxl.setInactivityThreshold(75); // How many seconds of no activity is inactive? adxl.setTimeInactivity(10); //look of activity movement on this axes - 1 == on; 0 == off adxl.setActivityX(1); adxl.setActivityY(1); adxl.setActivityZ(1); //look of inactivity movement on this axes - 1 == on; 0 == off adxl.setInactivityX(1); adxl.setInactivityY(1); adxl.setInactivityZ(1); // Look of tap movement on this axes - 1 == on; 0 == off adxl.setTapDetectionOnX(0); adxl.setTapDetectionOnY(0); adxl.setTapDetectionOnZ(1); // Set values for what is a tap, and what is a double tap (0-255) // 62.5mg per increment adxl.setTapThreshold(50); // 625us per increment adxl.setTapDuration(15); // 1.25ms per increment adxl.setDoubleTapLatency(80); // 1.25ms per increment adxl.setDoubleTapWindow(200); // set values for what is considered freefall (0-255) // (5 - 9) recommended - 62.5mg per increment adxl.setFreeFallThreshold(7); // (20 - 70) recommended - 5ms per increment adxl.setFreeFallDuration(45); // Setting all interrupts to take place on int pin 1 // I had issues with int pin 2, was unable to reset it adxl.setInterruptMapping( ADXL345_INT_SINGLE_TAP_BIT, ADXL345_INT1_PIN ); adxl.setInterruptMapping( ADXL345_INT_DOUBLE_TAP_BIT, ADXL345_INT1_PIN ); adxl.setInterruptMapping( ADXL345_INT_FREE_FALL_BIT, ADXL345_INT1_PIN ); adxl.setInterruptMapping( ADXL345_INT_ACTIVITY_BIT, ADXL345_INT1_PIN ); adxl.setInterruptMapping( ADXL345_INT_INACTIVITY_BIT, ADXL345_INT1_PIN ); // Register interrupt actions - 1 == on; 0 == off adxl.setInterrupt( ADXL345_INT_SINGLE_TAP_BIT, 1); adxl.setInterrupt( ADXL345_INT_DOUBLE_TAP_BIT, 1); adxl.setInterrupt( ADXL345_INT_FREE_FALL_BIT, 1); adxl.setInterrupt( ADXL345_INT_ACTIVITY_BIT, 1); adxl.setInterrupt( ADXL345_INT_INACTIVITY_BIT, 1); } // Accelemeter ADXL345 void isADXL345(){ // Read the accelerometer values and store them in variables x,y,z adxl.readXYZ(&x, &y, &z); // Output x,y,z values Serial.print("Values of X , Y , Z: "); Serial.print(x); Serial.print(" , "); Serial.print(y); Serial.print(" , "); Serial.println(z); // FullString FullString = "Values of X , Y , Z: " + String(x) + " , " + String(y) + " , " + String(z) + + "\r\n"; // Accelemeter ADXL345 isDisplayADXL345(); // 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]); } // Standard Gravity // Acceleration adxl.getAcceleration(xyz); ax = xyz[0]; ay = xyz[1]; az = xyz[2]; Serial.print("X="); Serial.print(ax); Serial.println(" g"); Serial.print("Y="); Serial.print(ay); Serial.println(" g"); Serial.print("Z="); Serial.println(az); Serial.println(" g"); Serial.println("**********************"); // FullString // xg FullString = "X = " + String(ax) + " g" + "\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]); } // yg FullString = "y = " + String(ay) + " g" + "\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]); } // zg FullString = "z = " + String(az) + " g" + "\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]); } }
getDisplay.ino
// DFRobot Display 240x320 // DFRobot Display 240x320 - UID void isDisplayUID(){ // DFRobot Display 240x320 // Text Display // Text Wrap screen.setTextWrap(false); // Rotation screen.setRotation(3); // Fill Screen => black screen.fillScreen(0x0000); // Text Color => white screen.setTextColor(0xffff); // Font => Free Mono 9pt screen.setFont(&FreeMono9pt7b); // TextSize => 1.5 screen.setTextSize(1.5); // Don Luc Electronics screen.setCursor(0, 30); screen.println("Don Luc Electronics"); // Accelemeter ADXL345 screen.setCursor(0, 60); screen.println("Accelemeter ADXL345"); // Version screen.setCursor(0, 90); screen.println("Version"); screen.setCursor(0, 120); screen.println( sver ); } // Accelemeter ADXL345 void isDisplayADXL345(){ // DFRobot Display 240x320 // Text Display // Text Wrap screen.setTextWrap(false); // Rotation screen.setRotation(3); // Fill Screen => black screen.fillScreen(0x0000); // Text Color => white screen.setTextColor(0xffff); // Font => Free Mono 9pt screen.setFont(&FreeMono9pt7b); // TextSize => 1.5 screen.setTextSize(1.5); // Accelemeter ADXL345 screen.setCursor(0, 30); screen.println("Accelemeter ADXL345"); // Accelemeter ADXL345 X screen.setCursor(0, 60); screen.println("X: "); screen.setCursor(30, 60); screen.println( x ); // Accelemeter ADXL345 Y screen.setCursor(0, 90); screen.println( "Y: " ); screen.setCursor(30, 90); screen.println( y ); // Accelemeter ADXL345 Z screen.setCursor(0, 120); screen.println( "Z: " ); screen.setCursor(30, 120); screen.println( z ); // Standard Gravity // Accelemeter ADXL345 Xg screen.setCursor(0, 150); screen.println( "Xg: " ); screen.setCursor(40, 150); screen.println( ax ); // Accelemeter ADXL345 Yg screen.setCursor(0, 180); screen.println( "Yg: " ); screen.setCursor(40, 180); screen.println( ay ); // Accelemeter ADXL345 Zg screen.setCursor(0, 210); screen.println( "Zg: " ); screen.setCursor(40, 210); screen.println( az ); }
setup.ino
// Setup void setup() { // Serial Begin Serial.begin(115200); Serial.println("Starting BLE work!"); // Bluetooth Serial SerialBT.begin("DL2501Mk03"); Serial.println("Bluetooth Started! Ready to pair..."); // Delay delay(100); // DFRobot Display 240x320 screen.begin(); // Delay delay(100); // Setup Accelemeter ADXL345 isSetupADXL345(); // DFRobot Display 240x320 - UID // Don Luc Electronics // Version isDisplayUID(); // Delay 5 Second delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Electronics, IoT, Teacher, Instructor, R&D and Consultant
- 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 – 2025
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Patreon: https://patreon.com/DonLucElectronics59
DFRobot: https://learn.dfrobot.com/user-10186.html
Hackster.io: https://www.hackster.io/neosteam-labs
Elecrow: https://www.elecrow.com/share/sharepj/center/no/760816d385ebb1edc0732fd873bfbf13
TikTok: https://www.tiktok.com/@luc.paquin8
Twitch: https://www.twitch.tv/lucpaquin
LinkedIn: https://www.linkedin.com/in/jlucpaquin/
Don Luc
Project #11: ESP32 – Bluetooth IoT – Mk12
——
#DonLucElectronics #DonLuc #ESP32 #Bluetooth #Elecrow #DFRobot #Arduino #Project #Patreon #Electronics #Microcontrollers #IoT #Fritzing #Programming #Consultant
——
——
——
——
Bluetooth
Bluetooth is a short-range wireless technology standard that is used for exchanging data between fixed and mobile devices over short distances and building personal area networks. In the most widely used mode, transmission power is limited to 2.5 milliwatts, giving it a very short range of up to 10 metres. It employs UHF radio waves in the ISM bands, from 2.402 GHz to 2.48 GHz.
You can pair all kinds of Bluetooth devices with your PC, including keyboards, mice, phones, speakers, IoT, and a whole lot more. To do this, your PC needs to have Bluetooth. Some PCs, such as laptops and tablets, have Bluetooth built in. If your PC doesn’t, you can plug a USB Bluetooth adapter into the USB port on your PC to get it.
DL2501Mk01
1 x DFRobot FireBeetle 2 ESP32-E
1 x Fermion: 2.0″ 320×240 IPS TFT LCD
1 x GDL Line 10 CM
1 x Crowtail- Rotary Angle Sensor 2.0 – 10K Ohm
1 x Crowtail- LED 2.0 – Yellow
1 x Crowtail- LED 2.0 – Green
1 x Lithium Ion Battery – 1000mAh
1 x Switch
1 x Bluetooth Serial Terminal for Windows 10
1 x USB 3.1 Cable A to C
FireBeetle 2 ESP32-E
POT – A0
LEG – 16
LEY – 17
DC – D2
CS – D6
RST – D3
RX2 – Bluetooth
TX2 – Bluetooth
VIN – +3.3V
GND – GND
DL2501Mk01p
DL2501Mk01p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #11: ESP32 - Bluetooth IoT - Mk12 11-12 DL2501Mk01p.ino DL2501Mk01 1 x DFRobot FireBeetle 2 ESP32-E 1 x Fermion: 2.0" 320x240 IPS TFT LCD 1 x GDL Line 10 CM 1 x Crowtail- Rotary Angle Sensor 2.0 - 10K Ohm 1 x Crowtail- LED 2.0 - Yellow 1 x Crowtail- LED 2.0 - Green 1 x Lithium Ion Battery - 1000mAh 1 x Switch 1 x Bluetooth Serial Terminal for Windows 10 1 x USB 3.1 Cable A to C */ // Include the Library Code // Arduino #include <Arduino.h> // Wire #include <Wire.h> // DFRobot Display GDL API #include <DFRobot_GDL.h> // 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 // Bluetooth Serial BluetoothSerial SerialBT; // Defined ESP32 #define TFT_DC D2 #define TFT_CS D6 #define TFT_RST D3 /*dc=*/ /*cs=*/ /*rst=*/ // DFRobot Display 240x320 DFRobot_ST7789_240x320_HW_SPI screen(TFT_DC, TFT_CS, TFT_RST); // Potentiometer int iPot = A0; int iPotVal = 0; // Change Your Threshold Here int Threshold = 2000; // Full String String FullString = ""; // LED Yellow int iLEDY = 17; // LED Green int iLEDG = 16; // Software Version Information String sver = "11-12"; void loop() { // Potentiometer isPotentiometer(); // Delay 2 Second delay( 2000 ); }
getDisplay.ino
// DFRobot Display 240x320 // DFRobot Display 240x320 - UID void isDisplayUID(){ // DFRobot Display 240x320 // Text Display // Text Wrap screen.setTextWrap(false); // Rotation screen.setRotation(3); // Fill Screen => black screen.fillScreen(0x0000); // Text Color => white screen.setTextColor(0xffff); // Font => Free Mono 9pt screen.setFont(&FreeMono9pt7b); // TextSize => 1.5 screen.setTextSize(1.5); // DFRobot Display screen.setCursor(0, 30); screen.println("Don Luc Electronics"); // Don Luc Electronics screen.setCursor(0, 60); screen.println("DFRobot Display"); // Version screen.setCursor(0, 90); screen.println("Version"); screen.setCursor(0, 120); screen.println( sver ); } // isDisplay Green void isDisplayG(){ // DFRobot Display 240x320 // Text Display // Text Wrap screen.setTextWrap(false); // Rotation screen.setRotation(3); // Fill Screen => black screen.fillScreen(0x0000); // Text Color => white screen.setTextColor(0xffff); // Font => Free Mono 9pt screen.setFont(&FreeMono9pt7b); // TextSize => 1.5 screen.setTextSize(1.5); // Don Luc Electronics screen.setCursor(0, 30); screen.println("Don Luc Electronics"); // LED Yellow screen.setCursor(0, 60); screen.println("LED Green"); // Potentiometer Value screen.setCursor(0, 90); screen.println( iPotVal ); } // isDisplay Yellow void isDisplayY(){ // DFRobot Display 240x320 // Text Display // Text Wrap screen.setTextWrap(false); // Rotation screen.setRotation(3); // Fill Screen => black screen.fillScreen(0x0000); // Text Color => white screen.setTextColor(0xffff); // Font => Free Mono 9pt screen.setFont(&FreeMono9pt7b); // TextSize => 1.5 screen.setTextSize(1.5); // Don Luc Electronics screen.setCursor(0, 30); screen.println("Don Luc Electronics"); // LED Yellow screen.setCursor(0, 60); screen.println("LED Yellow"); // Potentiometer Value screen.setCursor(0, 90); screen.println( iPotVal ); }
getPotentiometer.ino
// Potentiometer // Potentiometer void isPotentiometer(){ // Connect Potentiometer to Analog 0 iPotVal = analogRead( iPot ); // Threshold if (iPotVal > Threshold) { // LED Yellow digitalWrite(iLEDY, LOW); // isDisplay Green isDisplayG(); // LED Green digitalWrite(iLEDG, HIGH); // FullString FullString = "LED Green = " + String(iPotVal) + "\r\n"; } else { // LED Green digitalWrite(iLEDG, LOW); // isDisplay Yellow isDisplayY(); // LED Yellow digitalWrite(iLEDY, HIGH); // FullString FullString = "LED Yellow = " + String(iPotVal) + "\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]); } }
setup.ino
// Setup void setup() { // Serial Begin Serial.begin(115200); Serial.println("Starting BLE work!"); // Bluetooth Serial SerialBT.begin("Don Luc Electronics"); Serial.println("Bluetooth Started! Ready to pair..."); // Delay delay(100); // DFRobot Display 240x320 screen.begin(); // Delay delay(100); // Initialize the LED Yellow pinMode(iLEDY, OUTPUT); // Initialize the LED Green pinMode(iLEDG, OUTPUT); // DFRobot Display 240x320 - UID // Don Luc Electronics // Version isDisplayUID(); // Delay 5 Second delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Electronics, IoT, Teacher, Instructor, R&D and Consulting
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Automation
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- Artificial Intelligence (AI)
- RTOS
- Sensors, eHealth Sensors, Biosensor, and Biometric
- Research & Development (R & D)
- Consulting
Follow Us
Luc Paquin – Curriculum Vitae – 2024
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Patreon: https://patreon.com/DonLucElectronics59
DFRobot: https://learn.dfrobot.com/user-10186.html
Hackster.io: https://www.hackster.io/neosteam-labs
Elecrow: https://www.elecrow.com/share/sharepj/center/no/760816d385ebb1edc0732fd873bfbf13
TikTok: https://www.tiktok.com/@luc.paquin8
Twitch: https://www.twitch.tv/lucpaquin
LinkedIn: https://www.linkedin.com/in/jlucpaquin/
Don Luc
Project #29 – DFRobot – RHT And MQ – Mk13
——
#DonLucElectronics #DonLuc #DFRobot #BLESensorBeacon #AmbientLight #SoilMoisture #SHT40 #FireBeetle2ESP32E #EEPROM #RTC #SD #Display #Adafruit #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Humidity and Temperature Sensor – RHT03
The RHT03 (also known by DHT-22) is a low cost humidity and temperature sensor with a single wire digital interface. The sensor is calibrated and doesn’t require extra components so you can get right to measuring relative humidity and temperature.
MQ Series Gas Sensor
The description of each MQ series gas sensor and its uses that follows will be helpful to anybody who wants to understand the foundations of gas sensing technology. The MQ Series Gas Sensor is a revolutionary technology designed for the detection of combustible gases, such as those used in industry and manufacturing. MQ sensor working principle involves detecting changes in electrical conductivity when specific gases come into contact with the sensor’s sensing element. This variety of semiconductor gas sensors makes it possible to measure concentrations of gasses such as alcohol, methane, propane, butane, and carbon monoxide.
Pololu Carrier for MQ Gas Sensors
This carrier board is designed to work with any of the MQ-series gas sensors, simplifying the interface from 6 to 3 pins—ground, power and analog voltage output +3-5 Volt. This board has two mounting holes and provides convenient pads for mounting the gas sensor’s required sensitivity-setting resistor.
DL2405Mk03
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
4 x Pololu Carrier for MQ Gas Sensors
1 x SparkFun Hydrogen Gas Sensor – MQ-8
1 x 4.7K Ohm
1 x Pololu Carbon Monoxide & Flammable Gas Sensor – MQ-9
1 x 22k Ohm
1 x SparkFun Carbon Monoxide Gas Sensor – MQ-7
1 x 10K Ohm
1 x SparkFun Alcohol Gas Sensor – MQ-3
1 x 220k Ohm
1 x Temperature and Humidity Sensor – RHT03
1 x PIR Motion Sensor (JST)
1 x Switch
1 x 1K Ohm
1 x Gravity: Analog Soil Moisture Sensor
1 x Gravity: Analog Ambient Light Sensor
1 x Fermion: SHT40 Temperature & Humidity Sensor
3 x Fermion: BLE Sensor Beacon
3 x CR2032 Coin Cell Battery
1 x 1 x Lithium Ion Battery – 1000mAh
1 x Green LED
1 x Slide Switch
1 x SparkFun Serial Basic Breakout – CH340G
1 x SparkFun Cerberus USB Cable
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
SCL – 21
SDA – 22
LED – 14
RHT – 25
PIR – 26
SWI – 3
MQ8 = A0
MQ9 = A1
MQ7 = A2
MQ3 = A3
VIN – +3.3V
GND – GND
——
DL2405Mk03p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #29 - DFRobot - RHT And MQ - Mk13 29-13 DL2404Mk03p.ino 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 4 x Pololu Carrier for MQ Gas Sensors 1 x SparkFun Hydrogen Gas Sensor - MQ-8 1 x 4.7K Ohm 1 x Pololu Carbon Monoxide & Flammable Gas Sensor - MQ-9 1 x 22k Ohm 1 x SparkFun Carbon Monoxide Gas Sensor - MQ-7 1 x 10K Ohm 1 x SparkFun Alcohol Gas Sensor - MQ-3 1 x 220k Ohm 1 x Temperature and Humidity Sensor - RHT03 1 x PIR Motion Sensor (JST) 1 x Switch 1 x 1K Ohm 1 x Gravity: Analog Soil Moisture Sensor 1 x Gravity: Analog Ambient Light Sensor 1 x Fermion: SHT40 Temperature & Humidity Sensor 3 x Fermion: BLE Sensor Beacon 3 x CR2032 Coin Cell Battery 1 x 1 x Lithium Ion Battery - 1000mAh 1 x Green LED 1 x SparkFun Serial Basic Breakout - CH340G 1 x SparkFun Cerberus USB Cable 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> // Arduino #include <Arduino.h> // BLE Device #include <BLEDevice.h> // BLE Utils #include <BLEUtils.h> // BLEScan #include <BLEScan.h> // BLE Advertised Device #include <BLEAdvertisedDevice.h> // BLE Eddystone URL #include <BLEEddystoneURL.h> // BLE Eddystone TLM #include <BLEEddystoneTLM.h> // BLE Beacon #include <BLEBeacon.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> // RHT Temperature and Humidity Sensor #include <SparkFun_RHT03.h> // ENDIAN_CHANGE #define ENDIAN_CHANGE_U16(x) ((((x)&0xFF00) >> 8) + (((x)&0xFF) << 8)) // 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; // Fermion: SHT40 Temperature & Humidity Sensor // Temperature float TemperatureData; float Temperature; // Humidity float HumidityData; float Humidity; // Gravity: Analog Ambient Light Sensor float Sensor_Data; // SData => 1~6000 Lux float SData; // Gravity: Analog Soil Moisture Sensor float SensorSM; float SDataSM; // In seconds int scanTime = 5; // BLE Scan BLEScan *pBLEScan; // RHT Temperature and Humidity Sensor // RHT03 data pin Digital 25 const int RHT03_DATA_PIN = 25; // This creates a RTH03 object, which we'll use to interact with the sensor RHT03 rht; float latestHumidity; float latestTempC; // Gas Sensors MQ // Hydrogen Gas Sensor - MQ-8 int iMQ8 = A0; int iMQ8Raw = 0; int iMQ8ppm = 0; // Two points are taken from the curve in datasheet. // With these two points, a line is formed which is // "approximately equivalent" to the original curve. float H2Curve[3] = {2.3, 0.93,-1.44}; // Carbon Monoxide & Flammable Gas Sensor - MQ-9 int iMQ9 = A1; int iMQ9Raw = 0; int iMQ9ppm = 0; // Carbon Monoxide Gas Sensor - MQ-7 int iMQ7 = A2; int iMQ7Raw = 0; int iMQ7ppm = 0; // Alcohol Gas Sensor - MQ-3 int iMQ3 = A3; int iMQ3Raw = 0; int iMQ3ppm = 0; // PIR Motion // Motion detector const int iMotion = 26; // Proximity int proximity = LOW; String Det = ""; // Switch int iSwitch = 3; // Variable for reading the Switch status int iSwitchState = 0; // My Advertised Device Callbacks class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks { // onResult void onResult(BLEAdvertisedDevice advertisedDevice) { // Advertised Device if (advertisedDevice.haveName()) { // Name: Fermion: Sensor Beacon if(String(advertisedDevice.getName().c_str()) == "SHT40"){ // strManufacturerData std::string strManufacturerData = advertisedDevice.getManufacturerData(); uint8_t cManufacturerData[100]; strManufacturerData.copy((char *)cManufacturerData, strManufacturerData.length(), 0); // strManufacturerData.length for (int i = 0; i < strManufacturerData.length(); i++) { // cManufacturerData[i] cManufacturerData[i]; } // TemperatureData TemperatureData = int(cManufacturerData[2]<<8 | cManufacturerData[3]); // HumidityData HumidityData = int(cManufacturerData[5]<<8 | cManufacturerData[6]); } // Name: Fermion: Sensor Beacon if(String(advertisedDevice.getName().c_str()) == "Fermion: Sensor Beacon"){ // strManufacturerData std::string strManufacturerData = advertisedDevice.getManufacturerData(); uint8_t cManufacturerData[100]; strManufacturerData.copy((char *)cManufacturerData, strManufacturerData.length(), 0); // strManufacturerData.length for (int i = 0; i < strManufacturerData.length(); i++) { // cManufacturerData[i] cManufacturerData[i]; } // Sensor_Data Sensor_Data = int(cManufacturerData[2]<<8 | cManufacturerData[3]); } // Name: Fermion: Sensor Beacon if(String(advertisedDevice.getName().c_str()) == "Soil Moisture"){ // strManufacturerData std::string strManufacturerData = advertisedDevice.getManufacturerData(); uint8_t cManufacturerData[100]; strManufacturerData.copy((char *)cManufacturerData, strManufacturerData.length(), 0); // strManufacturerData.length for (int i = 0; i < strManufacturerData.length(); i++) { // cManufacturerData[i] cManufacturerData[i]; } // SensorSM SensorSM = int(cManufacturerData[2]<<8 | cManufacturerData[3]); } } } }; // EEPROM Unique ID Information #define EEPROM_SIZE 64 String uid = ""; // Software Version Information String sver = "29-13"; void loop() { // DS3231 RTC Date and Time isRTC(); // RHT Temperature and Humidity Sensor isRHT03(); // Gas Sensors MQ isGasSensor(); // isPIR Motion isPIR(); // ScanResults isBLEScanResults(); // Fermion: SHT40 Temperature & Humidity Sensor isSHT40(); // Gravity: Analog Ambient Light Sensor isAmbientLight(); // Soil Moisture isSoilMoisture(); // Delay 4 Second delay(4000); // Read the state of the Switch value iSwitchState = digitalRead(iSwitch); // The Switch is HIGH: if (iSwitchState == HIGH) { // Display Date, Time, Temperature, Humidity isDisplayDTTH(); } else { // Display Temperature, Humidity, MQ, PIR isDisplayDTMQPIR(); } // MicroSD Card isSD(); // iLED HIGH digitalWrite(iLED, HIGH ); // Delay 1 Second delay(1000); }
getAmbientLight.ino
// Gravity: Analog Ambient Light Sensor // Ambient Light void isAmbientLight(){ // Analog Ambient Light Sensor // SData => 1~6000 Lux SData = map(Sensor_Data, 1, 3000, 1, 6000); }
getBLEScan.ino
// getBLEScan // Setup BLE Scan void isSetupBLEScan(){ // BLE Device BLEDevice::init(""); // Create new scan pBLEScan = BLEDevice::getScan(); // Set Advertised Device Callbacks pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks()); // Active scan uses more power, but get results faster pBLEScan->setActiveScan(true); // Set Interval pBLEScan->setInterval(100); // Less or equal setInterval value pBLEScan->setWindow(99); } // BLE Scan Results void isBLEScanResults(){ // Put your main code here, to run repeatedly: BLEScanResults foundDevices = pBLEScan->start(scanTime, false); // Delete results fromBLEScan buffer to release memory pBLEScan->clearResults(); }
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, Ambient Light, Soil Moisture 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( Temperature ); display.println( "C" ); // Humidity display.setCursor(0,80); display.print( Humidity ); display.println( "%" ); // Lux display.setCursor(0,105); display.println( SData ); // Soil Moisture display.setCursor(0,130); display.println( SDataSM ); // Refresh display.refresh(); delay( 100 ); } // Display Temperature, Humidity, MQ, PIR void isDisplayDTMQPIR() { // Text Display Date // Clear Display display.clearDisplay(); display.setRotation(4); display.setTextSize(2); display.setTextColor(BLACK); // Temperature display.setCursor(0,5); display.print( latestTempC ); display.println( "C" ); // Humidity display.setCursor(0,30); display.print( latestHumidity ); display.println( "%" ); // MQ-8 display.setCursor(0,55); display.print( "MQ-8: " ); display.print( iMQ8ppm ); display.println( " PPM" ); // MQ-9 display.setCursor(0,80); display.print( "MQ-9: " ); display.print( iMQ9ppm ); display.println( " PPM" ); // MQ-7 display.setCursor(0,105); display.print( "MQ-7: " ); display.print( iMQ7ppm ); display.println( " PPM" ); // MQ-3 display.setCursor(0,130); display.print( "MQ-3: " ); display.print( iMQ3ppm ); display.println( "%" ); // PIR display.setCursor(0,145); display.println( Det ); // 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)); } }
getGasSensorMQ.ino
// Gas Sensors MQ // Gas Sensor void isGasSensor() { // Read in analog value from each gas sensors // Hydrogen Gas Sensor - MQ-8 iMQ8Raw = analogRead( iMQ8 ); // Carbon Monoxide & Flammable Gas Sensor - MQ-9 iMQ9Raw = analogRead( iMQ9 ); // Carbon Monoxide Gas Sensor - MQ-7 iMQ7Raw = analogRead( iMQ7 ); // Alcohol Gas Sensor - MQ-3 iMQ3Raw = analogRead( iMQ3 ); // Caclulate the PPM of each gas sensors // Hydrogen Gas Sensor - MQ-8 iMQ8ppm = isMQ8( iMQ8Raw ); // Carbon Monoxide & Flammable Gas Sensor - MQ-9 iMQ9ppm = isMQ9( iMQ9Raw ); // Carbon Monoxide Gas Sensor - MQ-7 iMQ7ppm = isMQ7( iMQ7Raw ); // Alcohol Gas Sensor - MQ-3 iMQ3ppm = isMQ3( iMQ3Raw ); } // Hydrogen Gas Sensor - MQ-8 - PPM int isMQ8(double rawValue) { // RvRo double RvRo = rawValue * (3.3 / 4095); double ppm = 3.027*exp(1.0698*( RvRo )); return ppm; //return (pow(4.7,( ((log(RvRo)-H2Curve[1])/H2Curve[2]) + H2Curve[0]))); } // Carbon Monoxide & Flammable Gas Sensor - MQ-9 int isMQ9(double rawValue) { double RvRo = rawValue * 3.3 / 4095; double ppm = 3.027*exp(1.0698*( RvRo )); return ppm; } // Carbon Monoxide Gas Sensor - MQ-7 int isMQ7(double rawValue) { double RvRo = rawValue * 3.3 / 4095; double ppm = 3.027*exp(1.0698*( RvRo )); return ppm; } // Alcohol Gas Sensor - MQ-3 int isMQ3(double rawValue) { double RvRo = rawValue * 3.3 / 4095; double bac = RvRo * 0.21; return bac; }
getPIR.ino
// PIR Motion // Setup PIR void isSetupPIR() { // Setup PIR Montion pinMode(iMotion, INPUT_PULLUP); } // isPIR Motion void isPIR() { // Proximity proximity = digitalRead(iMotion); if (proximity == LOW) { // PIR Motion Sensor's LOW, Motion is detected Det = "Motion Yes"; } else { // PIR Motion Sensor's HIGH Det = "No"; } }
getRHT.ino
// RHT Temperature and Humidity Sensor // Setup RHT Temperature and Humidity Sensor void isSetupRTH03() { // RHT Temperature and Humidity Sensor // Call rht.begin() to initialize the sensor and our data pin rht.begin(RHT03_DATA_PIN); } // RHT Temperature and Humidity Sensor void isRHT03(){ // Call rht.update() to get new humidity and temperature values from the sensor. int updateRet = rht.update(); // The humidity(), tempC(), and tempF() functions can be called -- after // a successful update() -- to get the last humidity and temperature value latestHumidity = rht.humidity(); latestTempC = rht.tempC(); }
getRTC.ino
// DS3231 RTC Date and Time // Setup DS3231 RTC void isSetupRTC() { if (! rtc.begin()) { while (1); } if (rtc.lostPower()) { // Following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0)); } } // DS3231 RTC Date and Time void isRTC(){ // Date and Time sDate = ""; sTime = ""; // Date Time DateTime now = rtc.now(); // sData sDate += String(now.year(), DEC); sDate += "/"; sDate += String(now.month(), DEC); sDate += "/"; sDate += String(now.day(), DEC); // sTime sTime += String(now.hour(), DEC); sTime += ":"; sTime += String(now.minute(), DEC); sTime += ":"; sTime += String(now.second(), DEC); }
getSD.ino
// MicroSD Card // MicroSD Setup void setupSD() { // MicroSD Card 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|Humidity|Lux| // Soil Moisture|Temperature|Humidity|MQ8|MQ9|MQ7|MQ3|PIR|*\r zzzzzz = "DFR|" + uid + "|" + sver + "|" + sDate + "|" + sTime + "|" + String(Temperature) + "C|" + String(Humidity) + "%|" + String(SData) + "|" + String(SDataSM) + "|" + String(latestTempC) + "C|" + String(latestHumidity) + "%|" + String(iMQ8ppm) + " PPM|" + String(iMQ9ppm) + " PPM|" + String(iMQ7ppm) + " PPM|" + String(iMQ3ppm) + "%|" + String(Det) + "|*\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(); }
getSHT40.ino
// Fermion: SHT40 Temperature & Humidity Sensor // SHT40 Temperature & Humidity void isSHT40(){ // Fermion: SHT40 Temperature & Humidity Sensor // Temperature Temperature = (175 * TemperatureData/65535) - 45; // Humidity Humidity = (125 * HumidityData/65535) - 6; }
getSoilMoisture.ino
// Gravity: Analog Soil Moisture Sensor // Soil Moisture void isSoilMoisture(){ // SDataSM => 0~900 Soil Moisture SDataSM = map( SensorSM, 1, 3000, 0, 900); }
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 BLE Scan isSetupBLEScan(); // Setup DS3231 RTC isSetupRTC(); //MicroSD Card setupSD(); // RHT Temperature and Humidity Sensor // Setup RTH03 Temperature and Humidity Sensor isSetupRTH03(); // PIR Motion // Setup PIR isSetupPIR(); // SHARP Display Start & Clear the Display display.begin(); // Clear Display display.clearDisplay(); // 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 – Display – Mk11
——
#DonLucElectronics #DonLuc #DFRobot #SHT40 #FireBeetle2ESP32E #EEPROM #RTC #SD #Display #Adafruit #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Adafruit SHARP Memory Display Breakout – 1.3″ 168×144 Monochrome
The 1.3″ 168×144 SHARP Memory LCD display is a cross between an eInk (e-Paper) display and an LCD. It has the ultra-low power usage of eInk and the fast-refresh rates of an LCD. This model has a gray background, and pixels show up as black-on-gray for a nice e-Reader type display. It does not have a backlight, but it is daylight readable. For dark/night reading you may need to illuminate the LCD area with external LEDs.
The bare display is 3 Volt powered and 3 Volt logic, so we placed it on a fully assembled & tested breakout board with a 3 Volt regulator and level shifting circuitry. Now you can use it safely with 3 Volt or 5 Volt power and logic. There are four mounting holes so you can easily attach it to a box.
The display is “Write Only” which means that it only needs 3 pins to send data. However, the downside of a write-only display is that the entire 168×144 bits must be buffered by the microcontroller driver. That means you cannot use this with an ATmega328 or ATmega32u4. You must use a high-RAM chip such as ATSAMD21, Teensy 3, ESP8266, ESP32, etc. On those chips, this display works great and looks wonderful.
DL2405Mk01
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 Fermion: SHT40 Temperature & Humidity Sensor
1 x Fermion: BLE Sensor Beacon
1 x CR2032 Coin Cell Battery
1 x 1 x Lithium Ion Battery – 1000mAh
1 x Green LED
1 x SparkFun Serial Basic Breakout – CH340G
1 x SparkFun Cerberus USB Cable
1 x USB 3.1 Cable A to C
DFRobot FireBeetle 2 ESP32-E
LED – 2
DSCK – 12
DMOSI – 4
DSS – 16
SCK – 22
MOSI – 23
MISO – 19
CS – 13
SCL – 21
SDA – 22
LED – 14
VIN – +3.3V
GND – GND
——
DL2405Mk01p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #29 - DFRobot - Display - Mk11 29-11 DL2404Mk01p.ino 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 Fermion: SHT40 Temperature & Humidity Sensor 1 x Fermion: BLE Sensor Beacon 1 x CR2032 Coin Cell Battery 1 x 1 x Lithium Ion Battery - 1000mAh 1 x Green LED 1 x SparkFun Serial Basic Breakout - CH340G 1 x SparkFun Cerberus USB Cable 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> // Arduino #include <Arduino.h> // BLE Device #include <BLEDevice.h> // BLE Utils #include <BLEUtils.h> // BLEScan #include <BLEScan.h> // BLE Advertised Device #include <BLEAdvertisedDevice.h> // BLE Eddystone URL #include <BLEEddystoneURL.h> // BLE Eddystone TLM #include <BLEEddystoneTLM.h> // BLE Beacon #include <BLEBeacon.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> // ENDIAN_CHANGE #define ENDIAN_CHANGE_U16(x) ((((x)&0xFF00) >> 8) + (((x)&0xFF) << 8)) // 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 12 #define SHARP_MOSI 4 #define SHARP_SS 16 // 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; // Fermion: SHT40 Temperature & Humidity Sensor // Temperature float TemperatureData; float Temperature; // Humidity float HumidityData; float Humidity; // In seconds int scanTime = 5; // BLE Scan BLEScan *pBLEScan; // My Advertised Device Callbacks class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks { // onResult void onResult(BLEAdvertisedDevice advertisedDevice) { // Advertised Device if (advertisedDevice.haveName()) { // Name: Fermion: Sensor Beacon if(String(advertisedDevice.getName().c_str()) == "SHT40"){ // strManufacturerData std::string strManufacturerData = advertisedDevice.getManufacturerData(); uint8_t cManufacturerData[100]; strManufacturerData.copy((char *)cManufacturerData, strManufacturerData.length(), 0); // strManufacturerData.length for (int i = 0; i < strManufacturerData.length(); i++) { // cManufacturerData[i] cManufacturerData[i]; } // TemperatureData TemperatureData = int(cManufacturerData[2]<<8 | cManufacturerData[3]); // HumidityData HumidityData = int(cManufacturerData[5]<<8 | cManufacturerData[6]); } } } }; // EEPROM Unique ID Information #define EEPROM_SIZE 64 String uid = ""; // Software Version Information String sver = "29-11"; void loop() { // DS3231 RTC Date and Time isRTC(); // ScanResults isBLEScanResults(); // Fermion: SHT40 Temperature & Humidity Sensor isSHT40(); // Delay 3 Second delay(3000); // Display Date, Time, Temperature, Humidity isDisplayDTTH(); // MicroSD Card isSD(); // iLED HIGH digitalWrite(iLED, HIGH ); // Delay 1 Second delay(1000); }
getBLEScan.ino
// getBLEScan // Setup BLE Scan void isSetupBLEScan(){ // BLE Device BLEDevice::init(""); // Create new scan pBLEScan = BLEDevice::getScan(); // Set Advertised Device Callbacks pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks()); // Active scan uses more power, but get results faster pBLEScan->setActiveScan(true); // Set Interval pBLEScan->setInterval(100); // Less or equal setInterval value pBLEScan->setWindow(99); } // BLE Scan Results void isBLEScanResults(){ // Put your main code here, to run repeatedly: BLEScanResults foundDevices = pBLEScan->start(scanTime, false); // Delete results fromBLEScan buffer to release memory pBLEScan->clearResults(); }
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 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( Temperature ); display.println( "C" ); // Humidity display.setCursor(0,80); display.print( Humidity ); display.println( "%" ); // 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)); } }
getRTC.ino
// DS3231 RTC Date and Time // Setup DS3231 RTC void isSetupRTC() { if (! rtc.begin()) { while (1); } if (rtc.lostPower()) { // Following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0)); } } // DS3231 RTC Date and Time void isRTC(){ // Date and Time sDate = ""; sTime = ""; // Date Time DateTime now = rtc.now(); // sData sDate += String(now.year(), DEC); sDate += "/"; sDate += String(now.month(), DEC); sDate += "/"; sDate += String(now.day(), DEC); // sTime sTime += String(now.hour(), DEC); sTime += ":"; sTime += String(now.minute(), DEC); sTime += ":"; sTime += String(now.second(), DEC); }
getSD.ino
// MicroSD Card // MicroSD Setup void setupSD() { // MicroSD Card 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|Humidity|*\r zzzzzz = "DFR|" + uid + "|" + sver + "|" + sDate + "|" + sTime + "|" + String(Temperature) + "C|" + String(Humidity) + "%|*\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(); }
getSHT40.ino
// Fermion: SHT40 Temperature & Humidity Sensor // SHT40 Temperature & Humidity void isSHT40(){ // Fermion: SHT40 Temperature & Humidity Sensor // Temperature Temperature = (175 * TemperatureData/65535) - 45; // Humidity Humidity = (125 * HumidityData/65535) - 6; }
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 BLE Scan isSetupBLEScan(); // Setup DS3231 RTC isSetupRTC(); //MicroSD Card setupSD(); // SHARP Display Start & Clear the Display display.begin(); // Clear Display display.clearDisplay(); // 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 ); // 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 – EEPROM, RTC, SD – Mk010
——
#DonLucElectronics #DonLuc #DFRobot #SHT40 #FireBeetle2ESP32E #EEPROM #RTC #SD #Adafruit #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
EEPROM
EEPROM is a type of non-volatile memory. It is used in computers, usually integrated in microcontrollers such as smart cards and remote keyless systems, or as a separate chip device, to store relatively small amounts of data by allowing individual bytes to be erased and reprogrammed.
RTC
A real-time clock (RTC) is an electronic device, most often in the form of an integrated circuit, that measures the passage of time. Although the term often refers to the devices in personal computers, servers and embedded systems, RTCs are present in almost any electronic device which needs to keep accurate time of day.
Micro SD Card Breakout Board
If you have a project with any audio, video, graphics, data logging, etc in it, you’ll find that having a removable storage option is essential. Most microcontrollers have extremely limited built-in storage. If you’re doing any sort of data logging, graphics or audio, you’ll need at least a megabyte of storage, and gigabytes. To get that kind of storage we’re going to use the same type that’s in every digital camera and mp3 player: flash cards. Often called microSD cards, they can pack gigabytes into a space smaller than a coin. They’re also available in every electronics shop so you can easily get more and best of all, many computers have microSD card readers built in so you can move data back.
DL2404Mk01
1 x DFRobot FireBeetle 2 ESP32-E
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 Fermion: SHT40 Temperature & Humidity Sensor
1 x Fermion: BLE Sensor Beacon
1 x CR2032 Coin Cell Battery
1 x 1 x Lithium Ion Battery – 1000mAh
1 x Green LED
1 x SparkFun Serial Basic Breakout – CH340G
1 x SparkFun Cerberus USB Cable
1 x USB 3.1 Cable A to C
DFRobot FireBeetle 2 ESP32-E
LED – 2
SCK – 22
MOSI – 23
MISO – 19
CS – 13
SCL – 21
SDA – 22
LED – 14
VIN – +3.3V
GND – GND
——
DL2404Mk01p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #29 - DFRobot - RTC SD - Mk10 29-10 DL2404Mk01p.ino 1 x DFRobot FireBeetle 2 ESP32-E 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 Fermion: SHT40 Temperature & Humidity Sensor 1 x Fermion: BLE Sensor Beacon 1 x CR2032 Coin Cell Battery 1 x 1 x Lithium Ion Battery - 1000mAh 1 x Green LED 1 x SparkFun Serial Basic Breakout - CH340G 1 x SparkFun Cerberus USB Cable 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> // Arduino #include <Arduino.h> // BLE Device #include <BLEDevice.h> // BLE Utils #include <BLEUtils.h> // BLEScan #include <BLEScan.h> // BLE Advertised Device #include <BLEAdvertisedDevice.h> // BLE Eddystone URL #include <BLEEddystoneURL.h> // BLE Eddystone TLM #include <BLEEddystoneTLM.h> // BLE Beacon #include <BLEBeacon.h> // DS3231 RTC Date and Time #include <RTClib.h> // SD Card #include "FS.h" #include "SD.h" #include "SPI.h" // ENDIAN_CHANGE #define ENDIAN_CHANGE_U16(x) ((((x)&0xFF00) >> 8) + (((x)&0xFF) << 8)) // DS3231 RTC Date and Time RTC_DS3231 rtc; String sDate; String sTime; // MicroSD Card const int chipSelect = 13; String zzzzzz = ""; // LED Green int iLEDGreen = 2; // Define LED int iLED = 14; // Fermion: SHT40 Temperature & Humidity Sensor // Temperature float TemperatureData; float Temperature; // Humidity float HumidityData; float Humidity; // In seconds int scanTime = 5; // BLE Scan BLEScan *pBLEScan; // My Advertised Device Callbacks class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks { // onResult void onResult(BLEAdvertisedDevice advertisedDevice) { // Advertised Device if (advertisedDevice.haveName()) { // Name: Fermion: Sensor Beacon if(String(advertisedDevice.getName().c_str()) == "SHT40"){ // strManufacturerData std::string strManufacturerData = advertisedDevice.getManufacturerData(); uint8_t cManufacturerData[100]; strManufacturerData.copy((char *)cManufacturerData, strManufacturerData.length(), 0); // strManufacturerData.length for (int i = 0; i < strManufacturerData.length(); i++) { // cManufacturerData[i] cManufacturerData[i]; } // TemperatureData TemperatureData = int(cManufacturerData[2]<<8 | cManufacturerData[3]); // HumidityData HumidityData = int(cManufacturerData[5]<<8 | cManufacturerData[6]); } } } }; // EEPROM Unique ID Information #define EEPROM_SIZE 64 String uid = ""; // Software Version Information String sver = "29-10"; void loop() { // DS3231 RTC Date and Time isRTC(); // ScanResults isBLEScanResults(); // Fermion: SHT40 Temperature & Humidity Sensor isSHT40(); // Delay 3 Second delay(3000); // MicroSD Card isSD(); // iLED HIGH digitalWrite(iLED, HIGH ); // Delay 1 Second delay(1000); }
getBLEScan.ino
// getBLEScan // Setup BLE Scan void isSetupBLEScan(){ // BLE Device BLEDevice::init(""); // Create new scan pBLEScan = BLEDevice::getScan(); // Set Advertised Device Callbacks pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks()); // Active scan uses more power, but get results faster pBLEScan->setActiveScan(true); // Set Interval pBLEScan->setInterval(100); // Less or equal setInterval value pBLEScan->setWindow(99); } // BLE Scan Results void isBLEScanResults(){ // Put your main code here, to run repeatedly: BLEScanResults foundDevices = pBLEScan->start(scanTime, false); // Delete results fromBLEScan buffer to release memory pBLEScan->clearResults(); }
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)); } }
getRTC.ino
// DS3231 RTC Date and Time // Setup DS3231 RTC void isSetupRTC() { if (! rtc.begin()) { while (1); } if (rtc.lostPower()) { // Following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0)); } } // DS3231 RTC Date and Time void isRTC(){ // Date and Time sDate = ""; sTime = ""; // Date Time DateTime now = rtc.now(); // sData sDate += String(now.year(), DEC); sDate += "/"; sDate += String(now.month(), DEC); sDate += "/"; sDate += String(now.day(), DEC); // sTime sTime += String(now.hour(), DEC); sTime += ":"; sTime += String(now.minute(), DEC); sTime += ":"; sTime += String(now.second(), DEC); }
getSD.ino
// MicroSD Card // MicroSD Setup void setupSD() { // MicroSD Card 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|Humidity|*\r zzzzzz = "DFR|" + uid + "|" + sver + "|" + sDate + "|" + sTime + "|" + String(Temperature) + "C|" + String(Humidity) + "%|*\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(); }
getSHT40.ino
// Fermion: SHT40 Temperature & Humidity Sensor // SHT40 Temperature & Humidity void isSHT40(){ // Fermion: SHT40 Temperature & Humidity Sensor // Temperature Temperature = (175 * TemperatureData/65535) - 45; // Humidity Humidity = (125 * HumidityData/65535) - 6; }
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 BLE Scan isSetupBLEScan(); // Setup DS3231 RTC isSetupRTC(); //MicroSD Card setupSD(); // 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 ); // 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 – Temperature Humidity – Mk09
——
#DonLucElectronics #DonLuc #DFRobot #SHT40 #FireBeetle2ESP32E #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Temperature Humidity Relationship
Temperature is something that tells us about the coldness or warmness of any object which is generally measured in Celsius. It determines the intensity of the heat whereas if we talk about humidity, it talks about the water content that is present in the air, or simply we can say it determines the moisture of the air. These two concepts are different but show a great impact on each other. We will see the relation between temperature and humidity further below. Before that, let’s understand more about humidity and its types.
Absolute Humidity and Relative Humidity
There are generally two types of humidity ie. absolute and relative. The former tells the humidity present in a parcel of air without taking temperature into consideration whereas the latter tells the humidity present in the air concerning the temperature of the air. The former defines the amount of water content by dividing the weight of the parcel by its volume whereas the latter is calculated by dividing the amount of water content present divided by the total capacity of the parcel of the air to hold multiplied by 100. The former decreases with height whereas the latter when reaching 100%, the air gets saturated.
Relation Between Relative Humidity and Temperature
We have already learned what is temperature and what is humidity and we have also learned two types of humidity. As we know, both these two concepts ie. Temperature and Humidity are different but they are related to each other. The relation between humidity and temperature formula simply says they are inversely proportional. If temperature increases it will lead to a decrease in relative humidity, thus the air will become drier whereas when temperature decreases, the air will become wet means the relative humidity will increase.
DL2403Mk05
1 x DFRobot FireBeetle 2 ESP32-E
1 x Fermion: SHT40 Temperature & Humidity Sensor
1 x Fermion: BLE Sensor Beacon
1 x CR2032 Coin Cell Battery
1 x 1 x Lithium Ion Battery – 1000mAh
1 x Rocker Switch – SPST
1 x Resistor 10K Ohm
1 x SparkFun Serial Basic Breakout – CH340G
1 x SparkFun Cerberus USB Cable
1 x USB 3.1 Cable A to C
DFRobot FireBeetle 2 ESP32-E
LED – 2
RSW – 17
VIN – +3.3V
GND – GND
——
DL2403Mk05p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #29 - DFRobot - Temperature Humidity - Mk09 29-09 DL2403Mk05p.ino 1 x DFRobot FireBeetle 2 ESP32-E 1 x Fermion: SHT40 Temperature & Humidity Sensor 1 x Fermion: BLE Sensor Beacon 1 x CR2032 Coin Cell Battery 1 x 1 x Lithium Ion Battery - 1000mAh 1 x Rocker Switch - SPST 1 x Resistor 10K Ohm 1 x SparkFun Serial Basic Breakout - CH340G 1 x SparkFun Cerberus USB Cable 1 x USB 3.1 Cable A to C */ // Include the Library Code // Bluetooth LE keyboard #include <BleKeyboard.h> // Arduino #include <Arduino.h> // BLE Device #include <BLEDevice.h> // BLE Utils #include <BLEUtils.h> // BLEScan #include <BLEScan.h> // BLE Advertised Device #include <BLEAdvertisedDevice.h> // BLE Eddystone URL #include <BLEEddystoneURL.h> // BLE Eddystone TLM #include <BLEEddystoneTLM.h> // BLE Beacon #include <BLEBeacon.h> // ENDIAN_CHANGE #define ENDIAN_CHANGE_U16(x) ((((x)&0xFF00) >> 8) + (((x)&0xFF) << 8)) // Bluetooth LE Keyboard BleKeyboard bleKeyboard; String sKeyboard = ""; // Send Size byte sendSize = 0; // Fermion: SHT40 Temperature & Humidity Sensor // Temperature float TemperatureData; float Temperature; // Humidity float HumidityData; float Humidity; // In seconds int scanTime = 5; // BLE Scan BLEScan *pBLEScan; // My Advertised Device Callbacks class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks { // onResult void onResult(BLEAdvertisedDevice advertisedDevice) { // Advertised Device if (advertisedDevice.haveName()) { // Name: Fermion: Sensor Beacon if(String(advertisedDevice.getName().c_str()) == "SHT40"){ // strManufacturerData std::string strManufacturerData = advertisedDevice.getManufacturerData(); uint8_t cManufacturerData[100]; strManufacturerData.copy((char *)cManufacturerData, strManufacturerData.length(), 0); // strManufacturerData.length for (int i = 0; i < strManufacturerData.length(); i++) { // cManufacturerData[i] cManufacturerData[i]; } // TemperatureData TemperatureData = int(cManufacturerData[2]<<8 | cManufacturerData[3]); // HumidityData HumidityData = int(cManufacturerData[5]<<8 | cManufacturerData[6]); } } } }; // The number of the Rocker Switch pin int iSwitch = 17; // Variable for reading the button status int SwitchState = 0; // Define LED int iLED = 2; // Software Version Information String sver = "29-09"; void loop() { // ScanResults isBLEScanResults(); // Fermion: SHT40 Temperature & Humidity Sensor isSHT40(); // 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 2 Second delay(2000); }
getBLEScan.ino
// getBLEScan // Setup BLE Scan void isSetupBLEScan(){ // BLE Device BLEDevice::init(""); // Create new scan pBLEScan = BLEDevice::getScan(); // Set Advertised Device Callbacks pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks()); // Active scan uses more power, but get results faster pBLEScan->setActiveScan(true); // Set Interval pBLEScan->setInterval(100); // Less or equal setInterval value pBLEScan->setWindow(99); } // BLE Scan Results void isBLEScanResults(){ // Put your main code here, to run repeatedly: BLEScanResults foundDevices = pBLEScan->start(scanTime, false); // Delete results fromBLEScan buffer to release memory pBLEScan->clearResults(); }
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); } }
getSHT40.ino
// Fermion: SHT40 Temperature & Humidity Sensor // SHT40 Temperature & Humidity void isSHT40(){ // Fermion: SHT40 Temperature & Humidity Sensor // Temperature Temperature = (175 * TemperatureData/65535) - 45; // Humidity Humidity = (125 * HumidityData/65535) - 6; // DFR|Version|Temperature|Humidity|* sKeyboard = "DFR|" + sver + "|" + String(Temperature) + "C|" + String(Humidity) + "%|*"; }
setup.ino
// Setup void setup() { // Give display time to power on delay(100); // Bluetooth LE keyboard bleKeyboard.begin(); // Give display time to power on delay(100); // Setup BLE Scan isSetupBLEScan(); // Initialize the Switch pin as an input pinMode(iSwitch, INPUT); // Initialize digital pin iLED as an output pinMode(iLED, OUTPUT); // Outputting high, the LED turns on digitalWrite(iLED, 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
- 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 – SHT40 – Mk08
——
#DonLucElectronics #DonLuc #DFRobot #SHT40 #FireBeetle2ESP32E #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Fermion: SHT40 Temperature And Humidity Sensor
The SHT4X is the 4th generation digital temperature and humidity sensor from Sensirion. In line with Sensirion’s industry-proven humidity and temperature sensors, the SHT40 offers consistent high accuracy within measuring range. The SHT40 sensor covers a humidity measurement range of 0 to 100%RH and a temperature detection range of -40°C to 125°C. The internal variable power heater enables the device to work properly under extreme operating conditions like condensing environment.
The board supply voltage of 3.3V to 5V and an current consumption below 0.15mA in low power mode make the SHT40 perfectly suitable for mobile or wireless battery-driven applications. It is suitable for urban environment monitoring, intelligent buildings, industrial automation, smart home and other Internet of Things applications.
DL2403Mk04
1 x DFRobot FireBeetle 2 ESP32-E
1 x Fermion: SHT40 Temperature & Humidity Sensor
1 x 1 x Lithium Ion Battery – 1000mAh
1 x Rocker Switch – SPST
1 x Resistor 10K Ohm
1 x USB 3.1 Cable A to C
DFRobot FireBeetle 2 ESP32-E
LED – 2
RSW – 17
SDA – 21
SCL – 22
VIN – +3.3V
GND – GND
——
DL2403Mk04p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #29 - DFRobot - SHT40 - Mk08 29-08 DL2403Mk04p.ino DL2403Mk04 1 x DFRobot FireBeetle 2 ESP32-E 1 x Fermion: SHT40 Temperature & Humidity Sensor 1 x 1 x Lithium Ion Battery - 1000mAh 1 x Rocker Switch - SPST 1 x Resistor 10K Ohm 1 x USB 3.1 Cable A to C */ // Include the Library Code // Bluetooth LE keyboard #include <BleKeyboard.h> // Fermion: SHT40 Temperature & Humidity Sensor #include "Adafruit_SHT4x.h" // Bluetooth LE Keyboard BleKeyboard bleKeyboard; String sKeyboard = ""; // Send Size byte sendSize = 0; // Fermion: SHT40 Temperature & Humidity Sensor Adafruit_SHT4x sht4 = Adafruit_SHT4x(); // Temperature float T; // Humidity float H; // The number of the Rocker Switch pin int iSwitch = 17; // Variable for reading the button status int SwitchState = 0; // Define LED int iLED = 2; // Software Version Information String sver = "29-08"; void loop() { // Fermion: SHT40 Temperature & Humidity Sensor isSHT40(); // 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); } }
getSHT40.ino
// Fermion: SHT40 Temperature & Humidity Sensor // SHT40 Temperature & Humidity void isSHT40(){ // Fermion: SHT40 Temperature & Humidity Sensor // Sensors Event sensors_event_t humidity, temp; // Populate temp and humidity objects sht4.getEvent(&humidity, &temp); // Temperature T = temp.temperature; // Humidity H = humidity.relative_humidity; // DFR|Version|Temperature|Humidity|* sKeyboard = "DFR|" + sver + "|" + String(T) + "C|" + String(H) + "% rH|*"; }
setup.ino
// Setup void setup() { // Give display time to power on delay(100); // Bluetooth LE keyboard bleKeyboard.begin(); // Give display time to power on delay(100); // Fermion: SHT40 Temperature & Humidity Sensor sht4.begin(); // You can have 3 different precisions, higher precision takes longer sht4.setPrecision(SHT4X_HIGH_PRECISION); // You can have 6 different heater settings sht4.setHeater(SHT4X_NO_HEATER); // Give display time to power on delay(100); // Initialize the Switch pin as an input pinMode(iSwitch, INPUT); // Initialize digital pin iLED as an output pinMode(iLED, OUTPUT); // Outputting high, the LED turns on digitalWrite(iLED, 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
- 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 – Smoke – Mk07
——
#DonLucElectronics #DonLuc #DFRobot #FermionBLESensorBeacon #MEMSSmokeGas #FireBeetle2ESP32E #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Smoke
Smoke is a suspension of airborne particulates and gases emitted when a material undergoes combustion or pyrolysis, together with the quantity of air that is entrained or otherwise mixed into the mass. It is commonly an unwanted by-product of fires, but may also be used for pest control, communication, defensive and offensive capabilities in the military, cooking, or smoking. It is used in rituals where incense, sage, or resin is burned to produce a smell for spiritual or magical purposes. It can also be a flavoring agent and preservative.
Smoke inhalation is the primary cause of death in victims of indoor fires. The smoke kills by a combination of thermal damage, poisoning and pulmonary irritation caused by carbon monoxide, hydrogen cyanide and other combustion products. Smoke is an aerosol of solid particles and liquid droplets that are close to the ideal range of sizes for Mie scattering of visible light.
DL2403Mk03
1 x DFRobot FireBeetle 2 ESP32-E
1 x Fermion: MEMS Smoke Gas Detection Sensor
1 x Fermion: BLE Sensor Beacon
1 x CR2032 Coin Cell Battery
1 x 1 x Lithium Ion Battery – 1000mAh
1 x Rocker Switch – SPST
1 x Resistor 10K Ohm
1 x SparkFun Serial Basic Breakout – CH340G
1 x SparkFun Cerberus USB Cable
1 x USB 3.1 Cable A to C
DFRobot FireBeetle 2 ESP32-E
LED – 2
RSW – 17
VIN – +3.3V
GND – GND
——
DL2403Mk03p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #29 - DFRobot - Smoke - Mk07 29-07 DL2403Mk03p.ino 1 x DFRobot FireBeetle 2 ESP32-E 1 x Fermion: MEMS Smoke Gas Detection Sensor 1 x Fermion: BLE Sensor Beacon 1 x CR2032 Coin Cell Battery 1 x 1 x Lithium Ion Battery - 1000mAh 1 x Rocker Switch - SPST 1 x Resistor 10K Ohm 1 x SparkFun Serial Basic Breakout - CH340G 1 x SparkFun Cerberus USB Cable 1 x USB 3.1 Cable A to C */ // Include the Library Code // Bluetooth LE keyboard #include <BleKeyboard.h> // Arduino #include <Arduino.h> // BLE Device #include <BLEDevice.h> // BLE Utils #include <BLEUtils.h> // BLEScan #include <BLEScan.h> // BLE Advertised Device #include <BLEAdvertisedDevice.h> // BLE Eddystone URL #include <BLEEddystoneURL.h> // BLE Eddystone TLM #include <BLEEddystoneTLM.h> // BLE Beacon #include <BLEBeacon.h> // ENDIAN_CHANGE #define ENDIAN_CHANGE_U16(x) ((((x)&0xFF00) >> 8) + (((x)&0xFF) << 8)) // Bluetooth LE Keyboard BleKeyboard bleKeyboard; String sKeyboard = ""; // Send Size byte sendSize = 0; // Fermion: MEMS Smoke Gas Detection Sensor float Sensor_Data; // In seconds int scanTime = 5; // BLE Scan BLEScan *pBLEScan; // My Advertised Device Callbacks class MyAdvertisedDeviceCallbacks : public BLEAdvertisedDeviceCallbacks { // onResult void onResult(BLEAdvertisedDevice advertisedDevice) { // Advertised Device if (advertisedDevice.haveName()) { // Name: Fermion: Sensor Beacon if(String(advertisedDevice.getName().c_str()) == "Smoke Gas"){ // strManufacturerData std::string strManufacturerData = advertisedDevice.getManufacturerData(); uint8_t cManufacturerData[100]; strManufacturerData.copy((char *)cManufacturerData, strManufacturerData.length(), 0); // strManufacturerData.length for (int i = 0; i < strManufacturerData.length(); i++) { // cManufacturerData[i] cManufacturerData[i]; } // Sensor_Data Sensor_Data = int(cManufacturerData[2]<<8 | cManufacturerData[3]); } } } }; // The number of the Rocker Switch pin int iSwitch = 17; // Variable for reading the button status int SwitchState = 0; // Define LED int iLED = 2; // Software Version Information String sver = "29-07"; void loop() { // ScanResults isBLEScanResults(); // Fermion: MEMS Smoke Gas Detection Sensor isSmokeGas(); // 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 2 Second delay(2000); }
getBLEScan.ino
// getBLEScan // Setup BLE Scan void isSetupBLEScan(){ // BLE Device BLEDevice::init(""); // Create new scan pBLEScan = BLEDevice::getScan(); // Set Advertised Device Callbacks pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks()); // Active scan uses more power, but get results faster pBLEScan->setActiveScan(true); // Set Interval pBLEScan->setInterval(100); // Less or equal setInterval value pBLEScan->setWindow(99); } // BLE Scan Results void isBLEScanResults(){ // Put your main code here, to run repeatedly: BLEScanResults foundDevices = pBLEScan->start(scanTime, false); // Delete results fromBLEScan buffer to release memory pBLEScan->clearResults(); }
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); } }
getSmokeGas.ino
// Fermion: MEMS Smoke Gas Detection Sensor // Smoke Gas void isSmokeGas(){ // bleKeyboard (10-1000ppm) // DFR|Version|Smoke Gas Detection|* sKeyboard = "DFR|" + sver + "|" + String(Sensor_Data) + "|*"; }
setup.ino
// Setup void setup() { // Give display time to power on delay(100); // Bluetooth LE keyboard bleKeyboard.begin(); // Give display time to power on delay(100); // Setup BLE Scan isSetupBLEScan(); // Initialize the Switch pin as an input pinMode(iSwitch, INPUT); // Initialize digital pin iLED as an output pinMode(iLED, OUTPUT); // Outputting high, the LED turns on digitalWrite(iLED, 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
- 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 – Fermion MEMS Smoke Gas – Mk06
——
#DonLucElectronics #DonLuc #DFRobot #MEMSSmokeGas #FireBeetle2ESP32E #ESP32 #IoT #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Fermion: MEMS Smoke Gas Detection Sensor
Fermion: MEMS Smoke Gas Detection Sensor employs state-of-the-art microelectromechanical system (MEMS) technology, endowing the sensor with compact dimensions, low power consumption, minimal heat generation, short preheating time, and swift response recovery. The sensor can measure smoke concentration qualitatively and is suitable for smoke alarm and other application scenarios.
Precautions for use:
- Kindly remove the protective film before usage.
- To prevent exposure to volatile silicon compounds vapors.
- Refrain from prolonged exposure to extreme environments.
- Avoid contact with water, condensation, and freezing.
- Minimize excessive vibration, impact, and dropping.
- For extended periods of non-usage, it is advisable to preheat the module for at least 24 hours.
DL2403Mk02
1 x DFRobot FireBeetle 2 ESP32-E
1 x Fermion: MEMS Smoke Gas Detection Sensor
1 x 1 x Lithium Ion Battery – 1000mAh
1 x Rocker Switch – SPST
1 x Resistor 10K Ohm
1 x USB 3.1 Cable A to C
DFRobot FireBeetle 2 ESP32-E
LED – 2
RSW – 17
SMO – A0
VIN – +3.3V
GND – GND
——
DL2403Mk02p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #29 - DFRobot - Fermion MEMS Smoke Gas - Mk06 29-06 DL2403Mk02p.ino 1 x DFRobot FireBeetle 2 ESP32-E 1 x Fermion: MEMS Smoke Gas Detection Sensor 1 x 1 x Lithium Ion Battery - 1000mAh 1 x Rocker Switch - SPST 1 x Resistor 10K Ohm 1 x USB 3.1 Cable A to C */ // Include the Library Code // Bluetooth LE keyboard #include <BleKeyboard.h> // Bluetooth LE Keyboard BleKeyboard bleKeyboard; String sKeyboard = ""; // Send Size byte sendSize = 0; // Fermion: MEMS Smoke Gas Detection Sensor int iSmokeGas = A0; int iSmokeGasVal = 0; // The number of the Rocker Switch pin int iSwitch = 17; // Variable for reading the button status int SwitchState = 0; // Define LED int iLED = 2; // Software Version Information String sver = "29-06"; void loop() { // Fermion: MEMS Smoke Gas Detection Sensor isSmokeGas(); // 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); } }
getSmokeGas.ino
// Fermion: MEMS Smoke Gas Detection Sensor // Smoke Gas void isSmokeGas(){ // Connect Smoke Gas Sensor to Analog 0 iSmokeGasVal = analogRead( iSmokeGas ); // bleKeyboard (10-1000ppm) // DFR|Version|Smoke Gas Detection|* sKeyboard = "DFR|" + sver + "|" + String(iSmokeGasVal) + "|*"; }
setup.ino
// Setup void setup() { // Give display time to power on delay(100); // Bluetooth LE keyboard bleKeyboard.begin(); // Give display time to power on delay(100); // Initialize the Switch pin as an input pinMode(iSwitch, INPUT); // Initialize digital pin iLED as an output pinMode(iLED, OUTPUT); // Outputting high, the LED turns on digitalWrite(iLED, 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
- 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/
Don Luc