Display
Project #25 – Movement – Accelerometer ADXL335 – Mk02
——
#DonLucElectronics #DonLuc #SparkFunRedBoard #Movement #Accelerometer #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Accelerometer
An accelerometer is a tool that measures proper acceleration. Proper acceleration is the acceleration of a body in its own instantaneous rest frame, this is different from coordinate acceleration, which is acceleration in a fixed coordinate system. For example, an accelerometer at rest on the surface of the Earth will measure an acceleration due to Earth’s gravity, straight upwards 9.81 m/s2. By contrast, accelerometers in free fall, falling toward the center of the Earth at a rate of about 9.81 m/s2, will measure zero.
Accelerometers have many uses in industry and science. Highly sensitive accelerometers are used in inertial navigation systems for aircraft and missiles. Vibration in rotating machines is monitored by accelerometers. They are used in tablet computers and digital cameras so that images on screens are always displayed upright. In unmanned aerial vehicles, accelerometers help to stabilise flight. Micromachined microelectromechanical systems accelerometers are increasingly present in portable electronic devices and video-game controllers, to detect changes in the positions of these devices.
SparkFun Triple Axis Accelerometer Breakout – ADXL335
Breakout board for the 3 axis ADXL335 from Analog Devices. This is the latest in a long, proven line of analog sensors, the holy grail of accelerometers. The ADXL335 is a triple axis MEMS accelerometer with extremely low noise and power consumption, only 320uA. The sensor has a full sensing range of +/-3g. There is no on-board regulation, provided power should be between 1.8 and 3.6VDC. Board comes fully assembled and tested with external components installed. The included 0.1uF capacitors set the bandwidth of each axis to 50Hz.
DL2210Mk06
1 x SparkFun RedBoard Qwiic
1 x SparkFun Micro OLED (Qwiic)
1 x Qwiic Cable – 100mm
1 x SparkFun Triple Axis Accelerometer Breakout – ADXL335
1 x SparkFun Cerberus USB Cable
SparkFun RedBoard Qwiic
ACX – Analog A0
ACY – Analog A1
ACZ – Analog A2
SDA – Analog A4
SCL – Analog A5
VIN – +3.3V
GND – GND
——
DL2210Mk06p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #25 - Movement - Accelerometer ADXL335 - Mk02 25-02 DL2210Mk06p.ino 1 x SparkFun RedBoard Qwiic 1 x SparkFun Micro OLED (Qwiic) 1 x Qwiic Cable - 100mm 1 x SparkFun Triple Axis Accelerometer Breakout - ADXL335 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Two Wire Interface (TWI/I2C) #include <Wire.h> // SparkFun Micro OLED #include <SFE_MicroOLED.h> // Accelerometer int iX = A0; int iY = A1; int iZ = A2; // Accelerometer int X = 0; int Y = 0; int Z = 0; // SparkFun Micro OLED #define PIN_RESET 9 #define DC_JUMPER 1 // I2C declaration MicroOLED oled(PIN_RESET, DC_JUMPER); // Software Version Information String sver = "25-02"; void loop() { // Accelerometer isAccelerometer(), // Micro OLED isMicroOLED(); // One delay in between reads delay(1000); }
getAccelerometer.ino
// Accelerometer // Accelerometer void isAccelerometer(){ // Accelerometer X, Y, Z // X X = analogRead(iX); // Y Y = analogRead(iY); // Z Z = analogRead(iZ); }
getMicroOLED.ino
// SparkFun Micro OLED // Setup Micro OLED void isSetupMicroOLED() { // Initialize the OLED oled.begin(); // Clear the display's internal memory oled.clear(ALL); // Display what's in the buffer (splashscreen) oled.display(); // Delay 1000 ms delay(1000); // Clear the buffer. oled.clear(PAGE); } // Micro OLED void isMicroOLED() { // Text Display Accelerometer // Clear the display oled.clear(PAGE); // Set cursor to top-left oled.setCursor(0, 0); // Set font to type 0 oled.setFontType(0); // Magnetometer oled.print("Accel"); oled.setCursor(0, 12); // X oled.print("X: "); oled.print(X); oled.setCursor(0, 25); // Y oled.print("Y: "); oled.print(Y); oled.setCursor(0, 39); // Z oled.print("Z: "); oled.print(Z); oled.display(); }
setup.ino
// Setup void setup() { // Give display time to power on delay(100); // Set up I2C bus Wire.begin(); // Setup Micro OLED isSetupMicroOLED(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- RTOS
- Research & Development (R & D)
Instructor and E-Mentor
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
Luc Paquin – Curriculum Vitae – 2022
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #25 – Movement – Sensors – Mk01
——
#DonLucElectronics #DonLuc #SparkFunRedBoard #Movement #Magnetometer #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Movement
Accelerometers, gyroscopes, and magnetometers are the three main sensors we use for detecting motion and orientation. We can sense motion with an accelerometer.
Accelerometers are used to measure acceleration, that means linear motion in X, Y or Z. They can be used to detect when they are being moved around, detect motion, shock or vibration. They can also be used to detect gravitational pull in order to detect orientation or tilt.
Gyroscopes are used to measure rotational motion in X, Y or Z. They are often paired with accelerometers for inertial guidance systems, 3D motion capture and inverted pendulum type applications.
Magnetometers can sense where the strongest magnetic force is coming from, generally used to detect magnetic north, but can also be used for measuring magnetic fields. When combined with accelerometers and gyroscopes you can stabilize orientation calculations and also determine orientation with respect to the Earth.
Many 6-DoF sensors, which combine accelerometer and gyroscope or compass, accelerometer and magnetometer, and 9-DoF sensors that have 9DoF IMU accelerometers and gyroscopes and magnetometers.
DL2210Mk05
1 x SparkFun RedBoard Qwiic
1 x SparkFun Micro OLED (Qwiic)
1 x Qwiic Cable – 100mm
1 x SparkFun Triple Axis Magnetometer Breakout – HMC5883L
1 x SparkFun Cerberus USB Cable
SparkFun RedBoard Qwiic
SDA – Analog A4
SCL – Analog A5
VIN – +3.3V
GND – GND
DL2210Mk05p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #25 - Movement - Sensors - Mk01 25-01 DL2210Mk05p.ino 1 x SparkFun RedBoard Qwiic 1 x SparkFun Micro OLED (Qwiic) 1 x Qwiic Cable - 100mm 1 x SparkFun Triple Axis Magnetometer Breakout - HMC5883L 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Two Wire Interface (TWI/I2C) #include <Wire.h> // Triple Axis Magnetometer #include <HMC5883L.h> // SparkFun Micro OLED #include <SFE_MicroOLED.h> // Triple Axis Magnetometer HMC5883L compass; // SparkFun Micro OLED #define PIN_RESET 9 #define DC_JUMPER 1 // I2C declaration MicroOLED oled(PIN_RESET, DC_JUMPER); // Triple Axis Magnetometer int X = 0; int Y = 0; int Z = 0; // Software Version Information String sver = "25-01"; void loop() { // Triple Axis Magnetometer isMagnetometer(), // Micro OLED isMicroOLED(); // One delay in between reads delay(1000); }
getMagnetometer.ino
// Magnetometer // Setup Magnetometer void isSetupMagnetometer(){ // Magnetometer Serial // Initialize HMC5883L while (!compass.begin()) { delay(500); } // Set measurement range // +/- 1.30 Ga: HMC5883L_RANGE_1_3GA (default) compass.setRange(HMC5883L_RANGE_1_3GA); // Set measurement mode // Continuous-Measurement: HMC5883L_CONTINOUS (default) compass.setMeasurementMode(HMC5883L_CONTINOUS); // Set data rate // 15.00Hz: HMC5883L_DATARATE_15HZ (default) compass.setDataRate(HMC5883L_DATARATE_15HZ); // Set number of samples averaged // 1 sample: HMC5883L_SAMPLES_1 (default) compass.setSamples(HMC5883L_SAMPLES_1); } // Magnetometer void isMagnetometer(){ // Vector Norm Vector norm = compass.readNormalize(); // Vector X, Y, Z // X Normalize X = norm.XAxis; // Y Normalize Y = norm.YAxis; // Z Normalize Z = norm.ZAxis; }
getMicroOLED.ino
// SparkFun Micro OLED // Setup Micro OLED void isSetupMicroOLED() { // Initialize the OLED oled.begin(); // Clear the display's internal memory oled.clear(ALL); // Display what's in the buffer (splashscreen) oled.display(); // Delay 1000 ms delay(1000); // Clear the buffer. oled.clear(PAGE); } // Micro OLED void isMicroOLED() { // Text Display Magnetometer // Clear the display oled.clear(PAGE); // Set cursor to top-left oled.setCursor(0, 0); // Set font to type 0 oled.setFontType(0); // Magnetometer oled.print("Magneto"); oled.setCursor(0, 12); // X Normalize oled.print("X: "); oled.print(X); oled.setCursor(0, 25); // Y Normalize oled.print("Y: "); oled.print(Y); oled.setCursor(0, 39); // Z Normalize oled.print("Z: "); oled.print(Z); oled.display(); }
setup.ino
// Setup void setup() { // Give display time to power on delay(100); // Set up I2C bus Wire.begin(); // Setup Triple Axis Magnetometer isSetupMagnetometer(); // Setup Micro OLED isSetupMicroOLED(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- RTOS
- Research & Development (R & D)
Instructor and E-Mentor
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
J. Luc Paquin – Curriculum Vitae – 2022 English & Español
https://www.jlpconsultants.com/luc/
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #23: E-Textiles – DS3231 Precision RTC – Mk06
——
#DonLucElectronics #DonLuc #ETextiles #Wearable #FLORA #MicroOLED #BME280 #CCS811 #RTC #Arduino #Project #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
DS3231 Precision RTC FeatherWing
A Feather board without ambition is a Feather board without FeatherWings. This is the DS3231 Precision RTC FeatherWing it adds an extremely accurate I2C-integrated Real Time Clock (RTC) with a Temperature Compensated Crystal Oscillator (TCXO). This RTC is the most precise you can get in a small, low power package.
Most RTCs use an external 32kHz timing crystal that is used to keep time with low current draw. And that’s all well and good, but those crystals have slight drift, particularly when the temperature changes, the temperature changes the oscillation frequency very very very slightly but it does add up. This RTC is in a beefy package because the crystal is inside the chip, and right next to the integrated crystal is a temperature sensor. That sensor compensates for the frequency changes by adding or removing clock ticks so that the timekeeping stays on schedule.
With a CR1220 12mm coin cell plugged into the top of the FeatherWing, you can get years of precision time keeping, even when main power is lost. Great for datalogging and clocks or anything where you need to really know the time.
DL2204Mk06
1 x FLORA – Version 1.0a
1 x SparkFun Micro OLED
1 x SparkFun Environmental Combo CCS811/BME280
1 x DS3231 Precision RTC FeatherWing
1 x CR1220 Coin Cell Battery
1 x RGB Smart NeoPixel
1 x Half-Size Breadboard
1 x SparkFun Cerberus USB Cable
FLORA – Version 1.0a
SDA – Digital 2
SCL – Digital 3
NEO – Digital 6
VIN – +5V
GND – GND
——
DL2204Mk06p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #23: E-Textiles - DS3231 Precision RTC - Mk06 23-06 DL2204Mk06p.ino 1 x FLORA - Version 1.0a 1 x SparkFun Micro OLED 1 x SparkFun Environmental Combo CCS811/BME280 1 x DS3231 Precision RTC FeatherWing 1 x CR1220 Coin Cell Battery 1 x RGB Smart NeoPixel 1 x Half-Size Breadboard 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Wire #include <Wire.h> // NeoPixels #include <Adafruit_NeoPixel.h> // SparkFun Micro OLED #include <SFE_MicroOLED.h> // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure #include <SparkFunBME280.h> // SparkFun CCS811 - eCO2 & tVOC #include <SparkFunCCS811.h> // Date and time DS3231 RTC #include <RTClib.h> // NeoPixels // On digital pin 6 #define PIN 6 // NeoPixels NUMPIXELS = 1 #define NUMPIXELS 1 // Pixels Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); // Red int red = 0; // Green int green = 0; // Blue int blue = 0; // Neopix int iNeo = 0; // Value int zz = 0; // SparkFun Micro OLED #define PIN_RESET 9 #define DC_JUMPER 1 // I2C declaration MicroOLED oled(PIN_RESET, DC_JUMPER); // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure BME280 myBME280; // Temperature Celsius float BMEtempC = 0; // Humidity float BMEhumid = 0; // Altitude Meters float BMEaltitudeM = 0; // Barometric Pressure float BMEpressure = 0; // SparkFun CCS811 - eCO2 & tVOC // Default I2C Address #define CCS811_ADDR 0x5B CCS811 myCCS811(CCS811_ADDR); // eCO2 float CCS811CO2 = 0; // TVOC float CCS811TVOC = 0; // Date and time functions using a DS3231 RTC RTC_DS3231 RTC; String sDate; String sTime; // Software Version Information String sver = "23-06"; void loop() { // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure isBME280(); // SparkFun CCS811 - eCO2 & tVOC isCCS811(); // FLORA isFLORA(); // Dates and Time timeRTC(); // Micro OLED isMicroOLED(); }
getBME280.ino
// SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure // isBME280 - Temperature, Humidity, Altitude and Barometric Pressure void isBME280(){ // Temperature Celsius BMEtempC = myBME280.readTempC(); // Humidity BMEhumid = myBME280.readFloatHumidity() ; // Altitude Meters BMEaltitudeM = myBME280.readFloatAltitudeMeters(); // Barometric Pressure BMEpressure = myBME280.readFloatPressure(); }
getCCS811.ino
// CCS811 - eCO2 & tVOC // isCCS811 - eCO2 & tVOC void isCCS811(){ // This sends the temperature & humidity data to the CCS811 myCCS811.setEnvironmentalData(BMEhumid, BMEtempC); // Calling this function updates the global tVOC and eCO2 variables myCCS811.readAlgorithmResults(); // eCO2 Concentration CCS811CO2 = myCCS811.getCO2(); // tVOC Concentration CCS811TVOC = myCCS811.getTVOC(); }
getFLORA.ino
// FLORA // isFLORA void isFLORA() { // FLORA = Temperature Celsius // BMEtempC // FLORA = Temperature Celsius if ( BMEtempC >= 50 ) { // 40 <= Temperature Celsius < 50~~~ zz = 2; isNUMPIXELS(); } else if ( BMEtempC >= 40 ) { // 30 <= Temperature Celsius < 40 zz = 3; isNUMPIXELS(); } else if ( BMEtempC >= 30 ) { // 20 <= Temperature Celsius < 30 zz = 4; isNUMPIXELS(); } else if ( BMEtempC >= 20 ) { // 10 <= Temperature Celsius < 20 zz = 0; isNUMPIXELS(); } else if ( BMEtempC >= 10 ) { // ~~~0 <= Temperature Celsius < 10 zz = 1; isNUMPIXELS(); } }
getMicroOLED.ino
// SparkFun Micro OLED // Setup Micro OLED void setupMicroOLED() { // Initialize the OLED oled.begin(); // Clear the display's internal memory oled.clear(ALL); // Display what's in the buffer (splashscreen) oled.display(); // Delay 1000 ms delay(1000); // Clear the buffer. oled.clear(PAGE); } // Micro OLED void isMicroOLED() { // Text Display BME280 // Clear the display oled.clear(PAGE); // Set cursor to top-left oled.setCursor(0, 0); // Set font to type 0 oled.setFontType(0); // Temperature Celsius oled.print("T: "); oled.print(BMEtempC, 2); oled.setCursor(0, 10); // Humidity oled.print("H: "); oled.print(BMEhumid, 0); oled.setCursor(0, 20); // Altitude Meters oled.print("A: "); oled.print(BMEaltitudeM, 1); oled.setCursor(0, 30); // Barometric Pressure oled.print("P: "); oled.print(BMEpressure, 0); oled.display(); // Delay delay( 2000 ); // Text Display CCS811 // Clear the display oled.clear(PAGE); // Set cursor to top-left oled.setCursor(0, 0); // Set font to type 0 oled.setFontType(0); // Date oled.setCursor(0, 0); oled.print(sDate); // Time oled.setCursor(0, 10); oled.print(sTime); // eCO2 Concentration oled.setCursor(0, 20); oled.print("C: "); oled.print(CCS811CO2, 0); // tVOC Concentration oled.setCursor(0, 30); oled.print("V: "); oled.print(CCS811TVOC, 0); oled.display(); // Delay delay( 2000 ); }
getNeopix.ino
// NeoPixels // Neopix void isNeopix() { // Pixels pixels.setBrightness( 150 ); // Pixels color takes RGB values, from 0,0,0 up to 255,255,255 pixels.setPixelColor( iNeo, pixels.Color(red,green,blue) ); // This sends the updated pixel color to the hardware pixels.show(); // Delay for a period of time (in milliseconds) delay(50); } // isNUMPIXELS void isNUMPIXELS() { // Neopix Value switch ( zz ) { case 0: // NeoPixels Green // Red red = 0; // Green green = 255; // Blue blue = 0; // Neopix iNeo = 0; isNeopix(); break; case 1: // NeoPixels Blue // Red red = 0; // Green green = 0; // Blue blue = 255; // Neopix iNeo = 0; isNeopix(); break; case 2: // NeoPixels Red // Red red = 255; // Green green = 0; // Blue blue = 0; // Neopix iNeo = 0; isNeopix(); break; case 3: // NeoPixels Yellow // Red red = 255; // Green green = 255; // Blue blue = 0; // Neopix iNeo = 0; isNeopix(); break; case 4: // NeoPixels Magenta // Red red = 255; // Green green = 0; // Blue blue = 255; // Neopix iNeo = 0; isNeopix(); break; case 5: // NeoPixels Cyan // Red red = 0; // Green green = 255; // Blue blue = 255; // Neopix iNeo = 0; isNeopix(); break; case 6: // NeoPixels White // Red red = 255; // Green green = 255; // Blue blue = 255; // Neopix iNeo = 0; isNeopix(); break; } } // isNUMPIXELSoff void isNUMPIXELSoff() { // Black Off // NeoPixels // Red red = 0; // Green green = 0; // Blue blue = 0; isNeopix(); }
getRTCDS3231.ino
// DS3231 Precision RTC // Setup RTC void setupRTC() { // DS3231 Precision RTC RTC.begin(); if (! RTC.begin()) { while (1); } DateTime now = RTC.now(); if (RTC.lostPower()) { // Following line sets the RTC to the date & time this sketch was compiled RTC.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // August 2, 2021 at 13:53:0 you would call: // RTC.adjust(DateTime(2022, 4, 26, 11, 39, 0)); } } // timeRTC void timeRTC() { // DS3231 Precision RTC sDate = ""; sTime = ""; // Date Time DateTime now = RTC.now(); // sData sDate += String(now.year(), DEC); sDate += "/"; sDate += String(now.month(), DEC); sDate += "/"; sDate += String(now.day(), DEC); // sTime sTime += String(now.hour(), DEC); sTime += ":"; sTime += String(now.minute(), DEC); sTime += ":"; sTime += String(now.second(), DEC); }
setup.ino
// Setup void setup() { // NeoPixels // This initializes the NeoPixel library pixels.begin(); // Delay for a period of time (in milliseconds) delay(50); // isNUMPIXELS Off isNUMPIXELSoff(); // Set up I2C bus Wire.begin(); // Delay for a period of time (in milliseconds) delay(50); // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure myBME280.begin(); // CCS811 - eCO2 & tVOC myCCS811.begin(); // Setup RTC setupRTC(); // Setup Micro OLED setupMicroOLED(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Research & Development (R & D)
- Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
- Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
- Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
- Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
- Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
- Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
- eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)
Instructor and E-Mentor
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
Follow Us
J. Luc Paquin – Curriculum Vitae – 2022 English & Español
https://www.jlpconsultants.com/luc/
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #23: E-Textiles – ams CCS811 – Mk05
——
#DonLucElectronics #DonLuc #ETextiles #Wearable #FLORA #MicroOLED #BME280 #CCS811 #Arduino #Project #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
ams CCS811 Ultra-Low Power Digital Gas Sensor for Monitoring Indoor Air Quality
The CCS811 is an ultra-low power digital gas sensor solution which integrates a metal oxide (MOX) gas sensor to detect a wide range of Volatile Organic Compounds (VOCs) for indoor air quality monitoring with a microcontroller unit (MCU), which includes an Analog-to-Digital converter (ADC), and an I²C interface.
CCS811 is based on ams unique micro-hotplate technology which enables a highly reliable solution for gas sensors, very fast cycle times and a significant reduction in average power consumption. The integrated MCU manages the sensor drive modes and raw sensor data measured while detecting VOCs. The I²C digital interface significantly simplifies the hardware and software design, enabling a faster time to market.
CCS811 supports intelligent algorithms to process raw sensor measurements to output a TVOC value or equivalent CO2 (eCO2) levels, where the main cause of VOCs is from humans. CCS811 supports multiple measurement modes that have been optimised for low-power consumption during an active sensor measurement and idle mode extending battery life in portable applications.
Applications
This device can be mainly used for indoor air quality monitoring in:
- Smartphones
- Wearables
- Home and building automation
- Accessories
DL2204Mk05
1 x FLORA – Version 1.0a
1 x SparkFun Micro OLED
1 x SparkFun Environmental Combo CCS811/BME280
1 x RGB Smart NeoPixel
1 x Half-Size Breadboard
1 x SparkFun Cerberus USB Cable
FLORA – Version 1.0a
NEO – Digital 6
SDA – Analog A2
SCL – Analog A3
VIN – +5V
GND – GND
DL2204Mk05p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #23: E-Textiles - ams CCS811 - Mk05 23-05 DL2204Mk05p.ino 1 x FLORA - Version 1.0a 1 x SparkFun Micro OLED 1 x SparkFun Environmental Combo CCS811/BME280 1 x RGB Smart NeoPixel 1 x Half-Size Breadboard 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Wire #include <Wire.h> // NeoPixels #include <Adafruit_NeoPixel.h> // SparkFun Micro OLED #include <SFE_MicroOLED.h> // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure #include <SparkFunBME280.h> // SparkFun CCS811 - eCO2 & tVOC #include <SparkFunCCS811.h> // NeoPixels // On digital pin 6 #define PIN 6 // NeoPixels NUMPIXELS = 1 #define NUMPIXELS 1 // Pixels Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); // Red int red = 0; // Green int green = 0; // Blue int blue = 0; // Neopix int iNeo = 0; // Value int zz = 0; // SparkFun Micro OLED #define PIN_RESET 9 #define DC_JUMPER 1 // I2C declaration MicroOLED oled(PIN_RESET, DC_JUMPER); // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure BME280 myBME280; // Temperature Celsius float BMEtempC = 0; // Humidity float BMEhumid = 0; // Altitude Meters float BMEaltitudeM = 0; // Barometric Pressure float BMEpressure = 0; // SparkFun CCS811 - eCO2 & tVOC // Default I2C Address #define CCS811_ADDR 0x5B CCS811 myCCS811(CCS811_ADDR); // eCO2 float CCS811CO2 = 0; // TVOC float CCS811TVOC = 0; // Software Version Information String sver = "23-05"; void loop() { // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure isBME280(); // SparkFun CCS811 - eCO2 & tVOC isCCS811(); // FLORA isFLORA(); // Micro OLED isMicroOLED(); }
getBME280.ino
// SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure // isBME280 - Temperature, Humidity, Altitude and Barometric Pressure void isBME280(){ // Temperature Celsius BMEtempC = myBME280.readTempC(); // Humidity BMEhumid = myBME280.readFloatHumidity(); // Altitude Meters BMEaltitudeM = myBME280.readFloatAltitudeMeters(); // Barometric Pressure BMEpressure = myBME280.readFloatPressure(); }
getCCS811.ino
// CCS811 - eCO2 & tVOC // isCCS811 - eCO2 & tVOC void isCCS811(){ // This sends the temperature & humidity data to the CCS811 myCCS811.setEnvironmentalData(BMEhumid, BMEtempC); // Calling this function updates the global tVOC and eCO2 variables myCCS811.readAlgorithmResults(); // eCO2 Concentration CCS811CO2 = myCCS811.getCO2(); // tVOC Concentration CCS811TVOC = myCCS811.getTVOC(); }
getFLORA.ino
// FLORA // isFLORA void isFLORA() { // FLORA = Temperature Celsius // BMEtempC // FLORA = Temperature Celsius if ( BMEtempC >= 50 ) { // 40 <= Temperature Celsius < 50~~~ zz = 2; isNUMPIXELS(); } else if ( BMEtempC >= 40 ) { // 30 <= Temperature Celsius < 40 zz = 3; isNUMPIXELS(); } else if ( BMEtempC >= 30 ) { // 20 <= Temperature Celsius < 30 zz = 4; isNUMPIXELS(); } else if ( BMEtempC >= 20 ) { // 10 <= Temperature Celsius < 20 zz = 0; isNUMPIXELS(); } else if ( BMEtempC >= 10 ) { // ~~~0 <= Temperature Celsius < 10 zz = 1; isNUMPIXELS(); } }
getMicroOLED.ino
// SparkFun Micro OLED // Setup Micro OLED void setupMicroOLED() { // Initialize the OLED oled.begin(); // Clear the display's internal memory oled.clear(ALL); // Display what's in the buffer (splashscreen) oled.display(); // Delay 1000 ms delay(1000); // Clear the buffer. oled.clear(PAGE); } // Micro OLED void isMicroOLED() { // Text Display BME280 // Clear the display oled.clear(PAGE); // Set cursor to top-left oled.setCursor(0, 0); // Set font to type 0 oled.setFontType(0); // Temperature Celsius oled.print("T: "); oled.print(BMEtempC); oled.setCursor(0, 10); // Humidity oled.print("H: "); oled.print(BMEhumid); oled.setCursor(0, 20); // Altitude Meters oled.print("A: "); oled.print(BMEaltitudeM); oled.setCursor(0, 30); // Barometric Pressure oled.print("P: "); oled.print(BMEpressure); oled.display(); // Delay delay( 2000 ); // Text Display CCS811 // Clear the display oled.clear(PAGE); // Set cursor to top-left oled.setCursor(0, 0); // Set font to type 0 oled.setFontType(0); // eCO2 Concentration oled.print("eCO2"); oled.setCursor(0, 10); oled.print(CCS811CO2); // tVOC Concentration oled.setCursor(0, 20); oled.print("tVOC"); oled.setCursor(0, 30); oled.print(CCS811TVOC); oled.display(); // Delay delay( 2000 ); }
getNeopix.ino
// NeoPixels // Neopix void isNeopix() { // Pixels pixels.setBrightness( 150 ); // Pixels color takes RGB values, from 0,0,0 up to 255,255,255 pixels.setPixelColor( iNeo, pixels.Color(red,green,blue) ); // This sends the updated pixel color to the hardware pixels.show(); // Delay for a period of time (in milliseconds) delay(50); } // isNUMPIXELS void isNUMPIXELS() { // Neopix Value switch ( zz ) { case 0: // NeoPixels Green // Red red = 0; // Green green = 255; // Blue blue = 0; // Neopix iNeo = 0; isNeopix(); break; case 1: // NeoPixels Blue // Red red = 0; // Green green = 0; // Blue blue = 255; // Neopix iNeo = 0; isNeopix(); break; case 2: // NeoPixels Red // Red red = 255; // Green green = 0; // Blue blue = 0; // Neopix iNeo = 0; isNeopix(); break; case 3: // NeoPixels Yellow // Red red = 255; // Green green = 255; // Blue blue = 0; // Neopix iNeo = 0; isNeopix(); break; case 4: // NeoPixels Magenta // Red red = 255; // Green green = 0; // Blue blue = 255; // Neopix iNeo = 0; isNeopix(); break; case 5: // NeoPixels Cyan // Red red = 0; // Green green = 255; // Blue blue = 255; // Neopix iNeo = 0; isNeopix(); break; case 6: // NeoPixels White // Red red = 255; // Green green = 255; // Blue blue = 255; // Neopix iNeo = 0; isNeopix(); break; } } // isNUMPIXELSoff void isNUMPIXELSoff() { // Black Off // NeoPixels // Red red = 0; // Green green = 0; // Blue blue = 0; isNeopix(); }
setup.ino
// Setup void setup() { // NeoPixels // This initializes the NeoPixel library pixels.begin(); // Delay for a period of time (in milliseconds) delay(50); // isNUMPIXELS Off isNUMPIXELSoff(); // Set up I2C bus Wire.begin(); // Delay for a period of time (in milliseconds) delay(50); // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure myBME280.begin(); // CCS811 - eCO2 & tVOC myCCS811.begin(); // Setup Micro OLED setupMicroOLED(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Research & Development (R & D)
- Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
- Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
- Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
- Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
- Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
- Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
- eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)
Instructor and E-Mentor
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
Follow Us
J. Luc Paquin – Curriculum Vitae – 2022 English & Español
https://www.jlpconsultants.com/luc/
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #23: E-Textiles – Bosch Sensortec BME280 – Mk04
——
#DonLucElectronics #DonLuc #ETextiles #Wearable #FLORA #MicroOLED #BME280 #Arduino #Project #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Bosch Sensortec BME280 – Combined Humidity And Pressure Sensor
The BME280 is as combined digital humidity, pressure and temperature sensor based on proven sensing principles. Its small dimensions and its low power consumption allow the implementation in battery driven devices such as handsets, GPS modules or watches. The BME280 is register and performance compatible to the Bosch Sensortec BMP280 digital pressure sensor. The BME280 achieves high performance in all applications requiring humidity and pressure measurement. These emerging applications of home automation control, in-door navigation, E-Textiles, fitness as well as GPS refinement require a high accuracy and a low TCO at the same time. The humidity sensor provides an extremely fast response time for fast context awareness applications and high overall accuracy over a wide temperature range. The integrated temperature sensor has been optimized for lowest noise and highest resolution. Its output is used for temperature compensation of the pressure and humidity sensors and can also be used for estimation of the ambient temperature. The sensor provides both SPI and I²C interfaces.
Typical Application
- Context awareness, e.g. skin detection, room change detection
- Fitness monitoring / well-being
- Warning regarding dryness or high temperatures
- Measurement of volume and air flow
- Home automation control
- Control heating, venting, air conditioning (HVAC)
- Internet of Things
- GPS enhancement (e.g. time-to-first-fix improvement, dead reckoning, slope detection)
- Indoor navigation (e.g. change of floor detection, elevator detection)
- Outdoor navigation, leisure and sports applications
- Weather forecast
- Vertical velocity indication (rise/sink speed)
- E-Textiles and Wearable
Target Devices
- Handsets such as mobile phones, tablet PCs, GPS devices
- Navigation systems
- Gaming (e.g flying toys)
- Camera (DSC, video)
- Home weather stations
- Flying toys
- Watches
- E-Textiles
- Wearable
DL2204Mk04
1 x FLORA – Version 1.0a
1 x SparkFun Micro OLED
1 x SparkFun Environmental Combo CCS811/BME280
1 x RGB Smart NeoPixel
1 x Half-Size Breadboard
1 x SparkFun Cerberus USB Cable
FLORA – Version 1.0a
NEO – Digital 6
SDA – Analog A2
SCL – Analog A3
VIN – +5V
GND – GND
DL2204Mk04p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #23: E-Textiles - BME280 - Mk04 23-04 DL2204Mk04p.ino 1 x FLORA - Version 1.0a 1 x SparkFun Micro OLED 1 x SparkFun Environmental Combo CCS811/BME280 1 x RGB Smart NeoPixel 1 x Half-Size Breadboard 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Wire #include <Wire.h> // NeoPixels #include <Adafruit_NeoPixel.h> // SparkFun Micro OLED #include <SFE_MicroOLED.h> // SparkFun BME280 - Humidity, Temperature, Altitude and Barometric Pressure #include <SparkFunBME280.h> // NeoPixels // On digital pin 6 #define PIN 6 // NeoPixels NUMPIXELS = 1 #define NUMPIXELS 1 // Pixels Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); // Red int red = 0; // Green int green = 0; // Blue int blue = 0; // Neopix int iNeo = 0; // Value int zz = 0; // SparkFun Micro OLED #define PIN_RESET 9 #define DC_JUMPER 1 // I2C declaration MicroOLED oled(PIN_RESET, DC_JUMPER); // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure BME280 myBME280; // Temperature Celsius float BMEtempC = 0; // Humidity float BMEhumid = 0; // Altitude Meters float BMEaltitudeM = 0; // Barometric Pressure float BMEpressure = 0; // Software Version Information String sver = "23-04"; void loop() { // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure isBME280(); // FLORA isFLORA(); // Micro OLED isMicroOLED(); // Delay delay( 1000 ); }
getBME280.ino
// SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure // isBME280 - Temperature, Humidity, Altitude and Barometric Pressure void isBME280(){ // Temperature Celsius BMEtempC = myBME280.readTempC(); // Humidity BMEhumid = myBME280.readFloatHumidity(); // Altitude Meters BMEaltitudeM = myBME280.readFloatAltitudeMeters(); // Barometric Pressure BMEpressure = myBME280.readFloatPressure(); }
getFLORA.ino
// FLORA // isFLORA void isFLORA() { // FLORA = Temperature Celsius // BMEtempC // FLORA = Temperature Celsius if ( BMEtempC >= 50 ) { // 40 <= Temperature Celsius < 50~~~ zz = 2; isNUMPIXELS(); } else if ( BMEtempC >= 40 ) { // 30 <= Temperature Celsius < 40 zz = 3; isNUMPIXELS(); } else if ( BMEtempC >= 30 ) { // 20 <= Temperature Celsius < 30 zz = 4; isNUMPIXELS(); } else if ( BMEtempC >= 20 ) { // 10 <= Temperature Celsius < 20 zz = 0; isNUMPIXELS(); } else if ( BMEtempC >= 10 ) { // ~~~0 <= Temperature Celsius < 10 zz = 1; isNUMPIXELS(); } }
getMicroOLED.ino
// SparkFun Micro OLED // Setup Micro OLED void setupMicroOLED() { // Initialize the OLED oled.begin(); // Clear the display's internal memory oled.clear(ALL); // Display what's in the buffer (splashscreen) oled.display(); // Delay 1000 ms delay(1000); // Clear the buffer. oled.clear(PAGE); } // Micro OLED void isMicroOLED() { // Text Display BME280 // Clear the display oled.clear(PAGE); // Set cursor to top-left oled.setCursor(0, 0); // Set font to type 0 oled.setFontType(0); // Temperature Celsius oled.print("T: "); oled.print(BMEtempC); oled.setCursor(0, 10); // Humidity oled.print("H: "); oled.print(BMEhumid); oled.setCursor(0, 20); // Altitude Meters oled.print("A: "); oled.print(BMEaltitudeM); oled.setCursor(0, 30); // Barometric Pressure oled.print("P: "); oled.print(BMEpressure); oled.display(); }
getNeopix.ino
// NeoPixels // Neopix void isNeopix() { // Pixels pixels.setBrightness( 150 ); // Pixels color takes RGB values, from 0,0,0 up to 255,255,255 pixels.setPixelColor( iNeo, pixels.Color(red,green,blue) ); // This sends the updated pixel color to the hardware pixels.show(); // Delay for a period of time (in milliseconds) delay(50); } // isNUMPIXELS void isNUMPIXELS() { // Neopix Value switch ( zz ) { case 0: // NeoPixels Green // Red red = 0; // Green green = 255; // Blue blue = 0; // Neopix iNeo = 0; isNeopix(); break; case 1: // NeoPixels Blue // Red red = 0; // Green green = 0; // Blue blue = 255; // Neopix iNeo = 0; isNeopix(); break; case 2: // NeoPixels Red // Red red = 255; // Green green = 0; // Blue blue = 0; // Neopix iNeo = 0; isNeopix(); break; case 3: // NeoPixels Yellow // Red red = 255; // Green green = 255; // Blue blue = 0; // Neopix iNeo = 0; isNeopix(); break; case 4: // NeoPixels Magenta // Red red = 255; // Green green = 0; // Blue blue = 255; // Neopix iNeo = 0; isNeopix(); break; case 5: // NeoPixels Cyan // Red red = 0; // Green green = 255; // Blue blue = 255; // Neopix iNeo = 0; isNeopix(); break; case 6: // NeoPixels White // Red red = 255; // Green green = 255; // Blue blue = 255; // Neopix iNeo = 0; isNeopix(); break; } } // isNUMPIXELSoff void isNUMPIXELSoff() { // Black Off // NeoPixels // Red red = 0; // Green green = 0; // Blue blue = 0; isNeopix(); }
setup.ino
// Setup void setup() { // NeoPixels // This initializes the NeoPixel library pixels.begin(); // Delay for a period of time (in milliseconds) delay(50); // isNUMPIXELS Off isNUMPIXELSoff(); // Set up I2C bus Wire.begin(); // Delay for a period of time (in milliseconds) delay(50); // SparkFun BME280 - Temperature, Humidity, Altitude and Barometric Pressure myBME280.begin(); // Setup Micro OLED setupMicroOLED(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Research & Development (R & D)
- Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
- Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
- Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
- Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
- Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
- Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
- eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)
Instructor and E-Mentor
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
Follow Us
J. Luc Paquin – Curriculum Vitae – 2022 English & Español
https://www.jlpconsultants.com/luc/
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #23: E-Textiles – SparkFun Micro OLED – Mk03
——
#DonLucElectronics #DonLuc #ETextiles #Wearable #FLORA #MicroOLED #Arduino #Project #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
SparkFun Micro OLED Breakout (Qwiic)
The SparkFun Qwiic Micro OLED Breakout is a Qwiic-enabled version of our popular Micro OLED display. The small monochrome, blue-on-black OLED screen presents incredibly clear images for your viewing pleasure. It’s micro, but it still packs a punch the OLED display is crisp, and you can fit a deceivingly large amount of graphics on there. This breakout is perfect for adding graphics to your next project and displaying diagnostic information without resorting to a serial output, all with the ease of use of our own Qwiic Connect System.
This version of the Micro OLED Breakout is exactly the size of its non-Qwiic sibling, featuring a screen that is 64 pixels wide and 48 pixels tall and measuring 0.66 inch across. But it has also been equipped with two Qwiic connectors, making it ideal for I2C operations. We’ve also added two mounting holes and a convenient Qwiic cable holder incorporated into a detachable tab on the board that can be easily removed thanks to a v-scored edge. We’ve even made sure to include an I2C pull-up jumper and ADDR jumper on the back of the board, so if you have your own I2C pull-ups or need to change the I2C address of the board, you have options.
DL2204Mk03
1 x FLORA – Version 1.0a
1 x SparkFun Micro OLED
1 x RGB Smart NeoPixel
1 x Half-Size Breadboard
1 x SparkFun Cerberus USB Cable
FLORA – Version 1.0a
NEO – Digital 6
SDA – Analog A2
SCL – Analog A3
VIN – +5V
GND – GND
——
DL2204Mk03p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #23: E-Textiles - SparkFun Micro OLED - Mk03 23-03 DL2204Mk03p.ino 1 x FLORA - Version 1.0a 1 x SparkFun Micro OLED 1 x RGB Smart NeoPixel 1 x Half-Size Breadboard 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Wire #include <Wire.h> // NeoPixels #include <Adafruit_NeoPixel.h> // SparkFun Micro OLED #include <SFE_MicroOLED.h> // FLORA // Color String sVal; // NeoPixels // On digital pin 6 #define PIN 6 // NeoPixels NUMPIXELS = 1 #define NUMPIXELS 1 // Pixels Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800); // Red int red = 0; // Green int green = 0; // Blue int blue = 0; // Neopix int iNeo = 0; // Value int zz = 0; // SparkFun Micro OLED #define PIN_RESET 9 #define DC_JUMPER 1 // I2C declaration MicroOLED oled(PIN_RESET, DC_JUMPER); // Software Version Information String sver = "23-03"; void loop() { // FLORA isFLORA(); // Micro OLED isMicroOLED(); // Delay delay( 3000 ); }
getFLORA.ino
// FLORA // isFLORA void isFLORA() { // FLORA = zz => Neopix // FLORA = sVal => Color if ( zz == 0 ) { sVal = "Green"; isNUMPIXELS(); zz = 1; } else if ( zz == 1 ) { sVal = "Blue"; isNUMPIXELS(); zz = 2; } else if ( zz == 2 ) { sVal = "Red"; isNUMPIXELS(); zz = 3; } else if ( zz == 3 ) { sVal = "Yellow"; isNUMPIXELS(); zz = 4; } else if ( zz == 4 ) { sVal = "Magenta"; isNUMPIXELS(); zz = 5; } else if ( zz == 5 ) { sVal = "Cyan"; isNUMPIXELS(); zz = 6; } else if ( zz == 6 ) { sVal = "White"; isNUMPIXELS(); zz = 0; } }
getMicroOLED.ino
// SparkFun Micro OLED // Setup Micro OLED void setupMicroOLED() { // Initialize the OLED oled.begin(); // Clear the display's internal memory oled.clear(ALL); // Display what's in the buffer (splashscreen) oled.display(); // Delay 1000 ms delay(1000); // Clear the buffer. oled.clear(PAGE); } // Micro OLED void isMicroOLED() { // Clear the display oled.clear(PAGE); // Set cursor to top-left oled.setCursor(0, 0); // Set font to type 1 oled.setFontType(1); // Print sVal oled.print(sVal); oled.display(); }
getNeopix.ino
// NeoPixels // Neopix void isNeopix() { // Pixels pixels.setBrightness( 255 ); // Pixels color takes RGB values, from 0,0,0 up to 255,255,255 pixels.setPixelColor( iNeo, pixels.Color(red,green,blue) ); // This sends the updated pixel color to the hardware pixels.show(); // Delay for a period of time (in milliseconds) delay(50); } // isNUMPIXELS void isNUMPIXELS() { // Neopix Value switch ( zz ) { case 0: // NeoPixels Green // Red red = 0; // Green green = 255; // Blue blue = 0; // Neopix iNeo = 0; isNeopix(); break; case 1: // NeoPixels Blue // Red red = 0; // Green green = 0; // Blue blue = 255; // Neopix iNeo = 0; isNeopix(); break; case 2: // NeoPixels Red // Red red = 255; // Green green = 0; // Blue blue = 0; // Neopix iNeo = 0; isNeopix(); break; case 3: // NeoPixels Yellow // Red red = 255; // Green green = 255; // Blue blue = 0; // Neopix iNeo = 0; isNeopix(); break; case 4: // NeoPixels Magenta // Red red = 255; // Green green = 0; // Blue blue = 255; // Neopix iNeo = 0; isNeopix(); break; case 5: // NeoPixels Cyan // Red red = 0; // Green green = 255; // Blue blue = 255; // Neopix iNeo = 0; isNeopix(); break; case 6: // NeoPixels White // Red red = 255; // Green green = 255; // Blue blue = 255; // Neopix iNeo = 0; isNeopix(); break; } } // isNUMPIXELSoff void isNUMPIXELSoff() { // Black Off // NeoPixels // Red red = 0; // Green green = 0; // Blue blue = 0; isNeopix(); }
setup.ino
// Setup void setup() { // NeoPixels // This initializes the NeoPixel library pixels.begin(); // Delay for a period of time (in milliseconds) delay(50); // isNUMPIXELS Off isNUMPIXELSoff(); // Set up I2C bus Wire.begin(); // Delay for a period of time (in milliseconds) delay(50); // Setup Micro OLED setupMicroOLED(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Research & Development (R & D)
- Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
- Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
- Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
- Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
- Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
- Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
- eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)
Instructor and E-Mentor
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
Follow Us
J. Luc Paquin – Curriculum Vitae – 2022 English & Español
https://www.jlpconsultants.com/luc/
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #15: Environment – MQ, PIR, HCSR04, RHT03, RTC and MicroSD – Mk19
——
#DonLucElectronics #DonLuc #Environment #MQ #PIR #HCSR04 #RHT03 #RTC #MicroSD #ArduinoUNO #Arduino #PowerBoost #Project #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
——
——
Project enclosure for protecting your electronic. You’ve got too much stuff to fit into a so you need an upgrade and here it is.
- Arduino UNO
- ProtoScrewShield
- RGB LCD Character
- HC-SR04 Ultrasonic Sensor
- ChronoDot – Real Time Clock, Batteries
- MicroSD Card Board, MicroSD 2.0 GB
- Adafruit PowerBoost 500 Shield, Lithium Ion Battery – 3.7v 2000mAh
- Hydrogen Gas Sensor
- Carbon Monoxide & Flammable Gas Sensor
- Carbon Monoxide Gas Sensor
- Alcohol Gas Sensor
- Temperature and Humidity Sensor
- PIR Motion Sensor
- Breadboard Solderables, Acrylics, Wood, Rocker Switch, LED Green, Resistors, USB Cable, Etc…
DL2111Mk01
1 x Arduino UNO – R3
1 x ProtoScrewShield
1 x RGB LCD Shield 16×2 Character Negative Display
1 x HC-SR04 Ultrasonic Sensor
1 x ChronoDot – Ultra-Precise Real Time Clock – v2.1
1 x CR1632 Batteries
1 x MicroSD Card Breakout Board+
1 x MicroSD 2.0 GB
1 x Rocker Switch – SPST (Round)
1 x 10K Ohm
1 x LED Green
1 x 220 Ohm
1 x Adafruit PowerBoost 500 Shield
1 x Lithium Ion Battery – 3.7v 2000mAh
4 x Pololu Carrier for MQ Gas Sensors
1 x SparkFun Hydrogen Gas Sensor – MQ-8
1 x 4.7K Ohm
1 x Pololu Carbon Monoxide & Flammable Gas Sensor – MQ-9
1 x 22k Ohm
1 x SparkFun Carbon Monoxide Gas Sensor – MQ-7
1 x 10K Ohm
1 x SparkFun Alcohol Gas Sensor – MQ-3
1 x 220k Ohm
1 x Temperature and Humidity Sensor- RHT03
1 x PIR Motion Sensor (JST)
1 x SparkFun Solderable Half-Breadboard
1 x Breadboard Solderable
1 x Adafruit Perma-Prote Half-Size Breadboard
1 x Acrylic Blue 5.75 inches x 3.75 inches x 1/8 inch
1 x Acrylic Ivory 5.75 inches x 3.75 inches x 1/8 inch
1 x Wood
2 x Union Squad – 1 Inch
4 x Screw 6-32, Flat Washer, Lock Washer, Hex Nut
28 x Screw – 4-40
14 x Standoff – Metal 4-40 – 3/8″
8 x Standoff – Metal 4-40 – 1″
1 x SparkFun Cerberus USB Cable
Arduino UNO – R3
CLK – Digital 13
DO – Digital 12
DI – Digital 11
CS – Digital 10
ECH – Digital 9
TIR – Digital 8
PIR – Digital 7
RHT – Digital 5
RS0 – Digital 3
LEG – Digital 2
MQ8 – Analog 0
MQ9 – Analog 1
MQ7 – Analog 2
MQ3 – Analog 3
SDA – Analog 4
SCL – Analog 5
VIN – +5V
GND – GND
DL2111Mk01p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #15: Environment – MQ, PIR, HCSR04, RHT03, RTC and MicroSD – Mk19 11-01 DL2111Mk01p.ino 1 x Arduino UNO - R3 1 x ProtoScrewShield 1 x RGB LCD Shield 16x2 Character Negative Display 1 x HC-SR04 Ultrasonic Sensor 1 x ChronoDot - Ultra-Precise Real Time Clock - v2.1 1 x CR1632 Batteries 1 x MicroSD Card Breakout Board+ 1 x MicroSD 2.0 GB 1 x Rocker Switch - SPST (Round) 1 x 10K Ohm 1 x LED Green 1 x 220 Ohm 1 x Adafruit PowerBoost 500 Shield 1 x Lithium Ion Battery - 3.7v 2000mAh 4 x Pololu Carrier for MQ Gas Sensors 1 x SparkFun Hydrogen Gas Sensor - MQ-8 1 x 4.7K Ohm 1 x Pololu Carbon Monoxide & Flammable Gas Sensor - MQ-9 1 x 22k Ohm 1 x SparkFun Carbon Monoxide Gas Sensor - MQ-7 1 x 10K Ohm 1 x SparkFun Alcohol Gas Sensor - MQ-3 1 x 220k Ohm 1 x Temperature and Humidity Sensor - RHT03 1 x PIR Motion Sensor (JST) 1 x SparkFun Solderable Half-Breadboard 1 x Breadboard Solderable 1 x Adafruit Perma-Prote Half-Size Breadboard 1 x Acrylic Blue 5.75 inches x 3.75 inches x 1/8 inch 1 x Acrylic Ivory 5.75 inches x 3.75 inches x 1/8 inch 1 x Wood 2 x Union Squad - 1 Inch 4 x Screw 6-32, Flat Washer, Lock Washer, Hex Nut 28 x Screw - 4-40 14 x Standoff - Metal 4-40 - 3/8" 8 x Standoff - Metal 4-40 - 1"d 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // EEPROM Library to Read and Write EEPROM with Unique ID for Unit #include <EEPROM.h> // RHT Temperature and Humidity Sensor #include <SparkFun_RHT03.h> // Adafruit RGB LCD Shield 16x2 #include <Adafruit_RGBLCDShield.h> // Wire #include <Wire.h> // DS3231 RTC Date and Time #include <RTClib.h> // SD Card #include <SPI.h> #include <SD.h> // RHT Temperature and Humidity Sensor // RHT03 data pin Digital 5 const int RHT03_DATA_PIN = 5; // This creates a RTH03 object, which we'll use to interact with the sensor RHT03 rht; float latestHumidity; float latestTempC; // Gas Sensors MQ // Hydrogen Gas Sensor - MQ-8 int iMQ8 = A0; int iMQ8Raw = 0; int iMQ8ppm = 0; // Two points are taken from the curve in datasheet. // With these two points, a line is formed which is // "approximately equivalent" to the original curve. float H2Curve[3] = {2.3, 0.93,-1.44}; // Carbon Monoxide & Flammable Gas Sensor - MQ-9 int iMQ9 = A1; int iMQ9Raw = 0; int iMQ9ppm = 0; // Carbon Monoxide Gas Sensor - MQ-7 int iMQ7 = A2; int iMQ7Raw = 0; int iMQ7ppm = 0; // Alcohol Gas Sensor - MQ-3 int iMQ3 = A3; int iMQ3Raw = 0; int iMQ3ppm = 0; // PIR Motion // Motion detector const int iMotion = 7; // Proximity int proximity = LOW; String Det = ""; // Adafruit RGB LCD Shield Adafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield(); // These #defines make it easy to set the backlight color #define OFF 0x0 #define RED 0x1 #define YELLOW 0x3 #define GREEN 0x2 #define TEAL 0x6 #define BLUE 0x4 #define VIOLET 0x5 #define WHITE 0x7 // Momentary Button int yy = 0; uint8_t momentaryButton = 0; // DS3231 RTC Date and Time RTC_DS3231 rtc; String sDate; String sTime; // SD Card const int chipSelect = 10; String zzzzzz = ""; // LED Green int iLEDGreen = 2; // Rocker Switch - SPST (Round) int iSS1 = 3; // State int iSS1State = 0; // HC-SR04 Ultrasonic Sensor int iTrig = 8; int iEcho = 9; // Stores the distance measured by the distance sensor float distance = 0; // Software Version Information String uid = ""; // Version String sver = "15-19"; void loop() { // Adafruit RGB LCD Shield // Clear RGBLCDShield.clear(); // iLEDGreen LOW digitalWrite(iLEDGreen, LOW ); // RHT Temperature and Humidity Sensor isRHT03(); // Gas Sensors MQ isGasSensor(); // isPIR Motion isPIR(); // DS3231 RTC Date and Time isRTC(); // HC-SR04 Ultrasonic Sensor isHCSR04(); // Adafruit RGB LCD Shield // Display isDisplay(); // Slide Switch // Read the state of the iSS1 value iSS1State = digitalRead(iSS1); // If it is the Slide Switch State is HIGH if (iSS1State == HIGH) { // iLEDGreen HIGH digitalWrite(iLEDGreen, HIGH ); // MicroSD Card isSD(); } else { // iLEDGreen LOW digitalWrite(iLEDGreen, LOW ); } // Delay delay( 500 ); }
getEEPROM.ino
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getGasSensorMQ.ino
// Gas Sensors MQ // Gas Sensor void isGasSensor() { // Read in analog value from each gas sensors // Hydrogen Gas Sensor - MQ-8 iMQ8Raw = analogRead( iMQ8 ); // Carbon Monoxide & Flammable Gas Sensor - MQ-9 iMQ9Raw = analogRead( iMQ9 ); // Carbon Monoxide Gas Sensor - MQ-7 iMQ7Raw = analogRead( iMQ7 ); // Alcohol Gas Sensor - MQ-3 iMQ3Raw = analogRead( iMQ3 ); // Caclulate the PPM of each gas sensors // Hydrogen Gas Sensor - MQ-8 iMQ8ppm = isMQ8( iMQ8Raw ); // Carbon Monoxide & Flammable Gas Sensor - MQ-9 iMQ9ppm = isMQ9( iMQ9Raw ); // Carbon Monoxide Gas Sensor - MQ-7 iMQ7ppm = isMQ7( iMQ7Raw ); // Alcohol Gas Sensor - MQ-3 iMQ3ppm = isMQ3( iMQ3Raw ); } // Hydrogen Gas Sensor - MQ-8 - PPM int isMQ8(double rawValue) { // RvRo double RvRo = rawValue * (3.3 / 1023); return (pow(4.7,( ((log(RvRo)-H2Curve[1])/H2Curve[2]) + H2Curve[0]))); } // Carbon Monoxide & Flammable Gas Sensor - MQ-9 int isMQ9(double rawValue) { double RvRo = rawValue * 3.3 / 4095; double ppm = 3.027*exp(1.0698*( RvRo )); return ppm; } // Carbon Monoxide Gas Sensor - MQ-7 int isMQ7(double rawValue) { double RvRo = rawValue * 3.3 / 4095; double ppm = 3.027*exp(1.0698*( RvRo )); return ppm; } // Alcohol Gas Sensor - MQ-3 int isMQ3(double rawValue) { double RvRo = rawValue * 3.3 / 4095; double bac = RvRo * 0.21; return bac; }
getHC-SR04.ino
// HC-SR04 Ultrasonic Sensor // Setup HC-SR04 void setupHCSR04() { // The trigger iTrig will output pulses of electricity pinMode(iTrig, OUTPUT); // The echo iEcho will measure the duration of pulses coming back from the distance sensor pinMode(iEcho, INPUT); } // HC-SR04 void isHCSR04() { // Variable to store the distance measured by the sensor distance = isDistance(); } // Distance float isDistance() { // Variable to store the time it takes for a ping to bounce off an object float echoTime; // Variable to store the distance calculated from the echo time float calculatedDistance; // Send out an ultrasonic pulse that's 10ms long digitalWrite(iTrig, HIGH); delayMicroseconds(10); digitalWrite(iTrig, LOW); // Use the pulseIn command to see how long it takes for the // pulse to bounce back to the sensor echoTime = pulseIn(iEcho, HIGH); // Calculate the distance of the object that reflected the pulse // (half the bounce time multiplied by the speed of sound) // cm = 58.0 calculatedDistance = echoTime / 58.0; // Send back the distance that was calculated return calculatedDistance; }
getPIR.ino
// PIR Motion // Setup PIR void setupPIR() { // Setup PIR Montion pinMode(iMotion, INPUT_PULLUP); } // isPIR Motion void isPIR() { // Proximity proximity = digitalRead(iMotion); if (proximity == LOW) { // PIR Motion Sensor's LOW, Motion is detected Det = "Motion Yes"; } else { // PIR Motion Sensor's HIGH Det = "No"; } }
getRGBLCDShield.ino
// Adafruit RGB LCD Shield // Setup RGB LCD Shield void isSetupRGBLCDShield() { // Adafruit RGB LCD Shield // Set up the LCD's number of columns and rows: RGBLCDShield.begin(16, 2); // Set the cursor to column 0, line 0 RGBLCDShield.setBacklight(RED); // Don luc RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Don Luc"); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Electronics RGBLCDShield.print("Electronics"); // Delay delay(5000); // Clear RGBLCDShield.clear(); // Set the cursor to column 0, line 0 RGBLCDShield.setBacklight(TEAL); // Version RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Version: " + sver); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Unit ID RGBLCDShield.print("Unit ID: " + uid); // Delay delay(5000); // Clear RGBLCDShield.clear(); } // isDisplay void isDisplay() { // Momentary Button momentaryButton = RGBLCDShield.readButtons(); switch ( yy ) { case 1: // RHT Temperature and Humidity Sensor // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); // Temperature C RGBLCDShield.print( "Temp C: " ); RGBLCDShield.print( latestTempC ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Humidity RGBLCDShield.print( "Humidity: " ); RGBLCDShield.print( latestHumidity ); break; case 2: // Set the cursor to column 0, line 0 // PIR Motion Sensor RGBLCDShield.setCursor(0,0); RGBLCDShield.print( "PIR: " ); RGBLCDShield.print( Det ); // Set the cursor to column 0, line 1 // HC-SR04 Ultrasonic Sensor RGBLCDShield.setCursor(0, 1); RGBLCDShield.print( "HC-SR04: " ); RGBLCDShield.print( distance ); break; case 3: // Gas Sensors 1 // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); // Hydrogen Gas Sensor - MQ-8 RGBLCDShield.print( "MQ-8: " ); RGBLCDShield.print( iMQ8ppm ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Carbon Monoxide & Flammable Gas Sensor - MQ-9 RGBLCDShield.print( "MQ-9: " ); RGBLCDShield.print( iMQ9ppm ); break; case 4: // Gas Sensors 2 // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); // Carbon Monoxide Gas Sensor - MQ-7 RGBLCDShield.print( "MQ-7: " ); RGBLCDShield.print( iMQ7ppm ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Alcohol Gas Sensor - MQ-3 RGBLCDShield.print( "MQ-3: " ); RGBLCDShield.print( iMQ3ppm ); break; case 5: // DS3231 RTC Date and Time // Date and Time DateTime now = rtc.now(); // Set the cursor to column 0, line 0 // Date RGBLCDShield.setCursor(0,0); RGBLCDShield.print( sDate ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Time RGBLCDShield.print( sTime ); break; default: // Don luc Electronics yy = 5; RGBLCDShield.setBacklight(RED); // Set the cursor to column 0, line 0 // Don luc RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Don Luc"); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Electronics RGBLCDShield.print("Electronics"); } if ( momentaryButton ) { if ( momentaryButton & BUTTON_UP ) { yy = 1; // RHT Temperature and Humidity Sensor RGBLCDShield.setBacklight(GREEN); } if ( momentaryButton & BUTTON_DOWN ) { yy = 2; // PIR Motion Sensor RGBLCDShield.setBacklight(VIOLET); } if ( momentaryButton & BUTTON_LEFT ) { yy = 3; // Gas Sensors 1 RGBLCDShield.setBacklight(TEAL); } if ( momentaryButton & BUTTON_RIGHT ) { yy = 4; // Gas Sensors 2 RGBLCDShield.setBacklight(YELLOW); } if ( momentaryButton & BUTTON_SELECT ) { yy = 5; // DS3231 RTC Date and Time RGBLCDShield.setBacklight(WHITE); } } }
getRHT.ino
// RHT Temperature and Humidity Sensor // setup RHT Temperature and Humidity Sensor void setupRTH03() { // RHT Temperature and Humidity Sensor // Call rht.begin() to initialize the sensor and our data pin rht.begin(RHT03_DATA_PIN); } // RHT Temperature and Humidity Sensor void isRHT03(){ // Call rht.update() to get new humidity and temperature values from the sensor. int updateRet = rht.update(); // The humidity(), tempC(), and tempF() functions can be called -- after // a successful update() -- to get the last humidity and temperature value latestHumidity = rht.humidity(); latestTempC = rht.tempC(); }
getRTC.ino
// DS3231 RTC Date and Time // Setup DS3231 RTC void isSetupRTC() { if (! rtc.begin()) { while (1); } if (rtc.lostPower()) { // Following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0)); } } // DS3231 RTC Date and Time void isRTC(){ // Date and Time sDate = ""; sTime = ""; // Date Time DateTime now = rtc.now(); // sData sDate += String(now.year(), DEC); sDate += "/"; sDate += String(now.month(), DEC); sDate += "/"; sDate += String(now.day(), DEC); // sTime sTime += String(now.hour(), DEC); sTime += ":"; sTime += String(now.minute(), DEC); sTime += ":"; sTime += String(now.second(), DEC); }
getSD.ino
// MicroSD Card // MicroSD Setup void setupSD() { // MicroSD Card if (!SD.begin(chipSelect)) { while (true); } } // MicroSD Card void isSD() { zzzzzz = ""; // Don Luc Electronics © (1983-2021) // Arduino Data // EEPROM Unique ID // Version // Date // Time // Temperature Celsius // Humidity // Hydrogen Gas Sensor - MQ-8 // Carbon Monoxide & Flammable Gas Sensor - MQ-9 // Carbon Monoxide Gas Sensor - MQ-7 // Alcohol Gas Sensor - MQ-3 // PIR Motion // HC-SR04 Ultrasonic Sensor // EEPROM Unique ID|Version|Date|Time|Temperature Celsius|Humidity|MQ-8|MQ-9|MQ-7|MQ-3|PIR Motion|HC-SR04| zzzzzz = uid + "|" + sver + "|" + sDate + "|" + sTime + "|" + latestTempC + "|" + latestHumidity + "|" + iMQ8ppm + "|" + iMQ9ppm + "|" + iMQ7ppm + "|" + iMQ3ppm + "|" + Det + "|" + distance + "|"; // Open the file. Note that only one file can be open at a time, // so you have to close this one before opening another. File dataFile = SD.open("arddata.txt", FILE_WRITE); // If the file is available, write to it: if ( dataFile ) { dataFile.println( zzzzzz ); dataFile.close(); } }
setup.ino
// Setup void setup() { // EEPROM Unique ID isUID(); // RHT Temperature and Humidity Sensor // Setup RTH03 Temperature and Humidity Sensor setupRTH03(); // PIR Motion // Setup PIR setupPIR(); // Setup DS3231 RTC isSetupRTC(); //MicroSD Card setupSD(); // Initialize the LED Green pinMode(iLEDGreen, OUTPUT); // iLEDGreen LOW digitalWrite(iLEDGreen, LOW ); // Slide Switch pinMode(iSS1, INPUT); // Setup HC-SR04 setupHCSR04(); // Adafruit RGB LCD Shield isSetupRGBLCDShield(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Research & Development (R & D)
- Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
- Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
- Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
- Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
- Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
- Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
- eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)
Instructor and E-Mentor
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
Follow Us
J. Luc Paquin – Curriculum Vitae – 2021 English & Español
https://www.jlpconsultants.com/luc/
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #15: Environment – HC-SR04 Ultrasonic Sensor – Mk18
——
#DonLucElectronics #DonLuc #Environment #MQ #PIR #HCSR04 #RHT03 #RTC #ArduinoUNO #Arduino #AdafruitPowerBoost #Project #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
——
HC-SR04 Ultrasonic Sensor
This is the HC-SR04 ultrasonic distance sensor. This economical sensor provides 2cm to 400cm of non-contact measurement functionality with a ranging accuracy that can reach up to 3mm. Each HC-SR04 module includes an ultrasonic transmitter, a receiver and a control circuit.
There are only four pins that you need to worry about on the HC-SR04: VCC (Power), Trig (Trigger), Echo (Receive), and GND (Ground). You will find this sensor very easy to set up and use for your next range-finding project. This sensor has additional control circuitry that can prevent inconsistent “bouncy” data depending on the application.
DL2110Mk05
1 x Arduino UNO – R3
1 x ProtoScrewShield
1 x RGB LCD Shield 16×2 Character Negative Display
1 x HC-SR04 Ultrasonic Sensor
1 x ChronoDot – Ultra-Precise Real Time Clock – v2.1
1 x CR1632 Batteries
1 x MicroSD Card Breakout Board+
1 x MicroSD 2.0 GB
1 x Rocker Switch – SPST (Round)
1 x 10K Ohm
1 x LED Green
1 x 220 Ohm
1 x Adafruit PowerBoost 500 Shield
1 x Lithium Ion Battery – 3.7v 2000mAh
4 x Pololu Carrier for MQ Gas Sensors
1 x SparkFun Hydrogen Gas Sensor – MQ-8
1 x 4.7K Ohm
1 x Pololu Carbon Monoxide & Flammable Gas Sensor – MQ-9
1 x 22k Ohm
1 x SparkFun Carbon Monoxide Gas Sensor – MQ-7
1 x 10K Ohm
1 x SparkFun Alcohol Gas Sensor – MQ-3
1 x 220k Ohm
1 x Temperature and Humidity Sensor- RHT03
1 x PIR Motion Sensor (JST)
1 x SparkFun Solderable Half-Breadboard
1 x Half-Breadboard
1 x SparkFun Cerberus USB Cable
Arduino UNO – R3
CLK – Digital 13
DO – Digital 12
DI – Digital 11
CS – Digital 10
ECH – Digital 9
TIR – Digital 8
PIR – Digital 7
RHT – Digital 5
RS0 – Digital 3
LEG – Digital 2
MQ8 – Analog 0
MQ9 – Analog 1
MQ7 – Analog 2
MQ3 – Analog 3
SDA – Analog 4
SCL – Analog 5
VIN – +5V
GND – GND
DL2110Mk05p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #15: Environment – HC-SR04 Ultrasonic Sensor – Mk18 10-05 DL2110Mk05p.ino 1 x Arduino UNO - R3 1 x ProtoScrewShield 1 x RGB LCD Shield 16x2 Character Negative Display 1 x HC-SR04 Ultrasonic Sensor 1 x ChronoDot - Ultra-Precise Real Time Clock - v2.1 1 x CR1632 Batteries 1 x MicroSD Card Breakout Board+ 1 x MicroSD 2.0 GB 1 x Rocker Switch - SPST (Round) 1 x 10K Ohm 1 x LED Green 1 x 220 Ohm 1 x Adafruit PowerBoost 500 Shield 1 x Lithium Ion Battery - 3.7v 2000mAh 4 x Pololu Carrier for MQ Gas Sensors 1 x SparkFun Hydrogen Gas Sensor - MQ-8 1 x 4.7K Ohm 1 x Pololu Carbon Monoxide & Flammable Gas Sensor - MQ-9 1 x 22k Ohm 1 x SparkFun Carbon Monoxide Gas Sensor - MQ-7 1 x 10K Ohm 1 x SparkFun Alcohol Gas Sensor - MQ-3 1 x 220k Ohm 1 x Temperature and Humidity Sensor - RHT03 1 x PIR Motion Sensor (JST) 1 x SparkFun Solderable Half-Breadboard 1 x Half-Breadboard 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // EEPROM Library to Read and Write EEPROM with Unique ID for Unit #include <EEPROM.h> // RHT Temperature and Humidity Sensor #include <SparkFun_RHT03.h> // Adafruit RGB LCD Shield 16x2 #include <Adafruit_RGBLCDShield.h> // Wire #include <Wire.h> // DS3231 RTC Date and Time #include <RTClib.h> // SD Card #include <SPI.h> #include <SD.h> // RHT Temperature and Humidity Sensor // RHT03 data pin Digital 5 const int RHT03_DATA_PIN = 5; // This creates a RTH03 object, which we'll use to interact with the sensor RHT03 rht; float latestHumidity; float latestTempC; // Gas Sensors MQ // Hydrogen Gas Sensor - MQ-8 int iMQ8 = A0; int iMQ8Raw = 0; int iMQ8ppm = 0; // Two points are taken from the curve in datasheet. // With these two points, a line is formed which is // "approximately equivalent" to the original curve. float H2Curve[3] = {2.3, 0.93,-1.44}; // Carbon Monoxide & Flammable Gas Sensor - MQ-9 int iMQ9 = A1; int iMQ9Raw = 0; int iMQ9ppm = 0; // Carbon Monoxide Gas Sensor - MQ-7 int iMQ7 = A2; int iMQ7Raw = 0; int iMQ7ppm = 0; // Alcohol Gas Sensor - MQ-3 int iMQ3 = A3; int iMQ3Raw = 0; int iMQ3ppm = 0; // PIR Motion // Motion detector const int iMotion = 7; // Proximity int proximity = LOW; String Det = ""; // Adafruit RGB LCD Shield Adafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield(); // These #defines make it easy to set the backlight color #define OFF 0x0 #define RED 0x1 #define YELLOW 0x3 #define GREEN 0x2 #define TEAL 0x6 #define BLUE 0x4 #define VIOLET 0x5 #define WHITE 0x7 // Momentary Button int yy = 0; uint8_t momentaryButton = 0; // DS3231 RTC Date and Time RTC_DS3231 rtc; String sDate; String sTime; // SD Card const int chipSelect = 10; String zzzzzz = ""; // LED Green int iLEDGreen = 2; // Rocker Switch - SPST (Round) int iSS1 = 3; // State int iSS1State = 0; // HC-SR04 Ultrasonic Sensor int iTrig = 8; int iEcho = 9; // Stores the distance measured by the distance sensor float distance = 0; // Software Version Information String uid = ""; // Version String sver = "15-18"; void loop() { // Adafruit RGB LCD Shield // Clear RGBLCDShield.clear(); // iLEDGreen LOW digitalWrite(iLEDGreen, LOW ); // RHT Temperature and Humidity Sensor isRHT03(); // Gas Sensors MQ isGasSensor(); // isPIR Motion isPIR(); // DS3231 RTC Date and Time isRTC(); // HC-SR04 Ultrasonic Sensor isHCSR04(); // Adafruit RGB LCD Shield // Display isDisplay(); // Slide Switch // Read the state of the iSS1 value iSS1State = digitalRead(iSS1); // If it is the Slide Switch State is HIGH if (iSS1State == HIGH) { // iLEDGreen HIGH digitalWrite(iLEDGreen, HIGH ); // MicroSD Card isSD(); } else { // iLEDGreen LOW digitalWrite(iLEDGreen, LOW ); } // Delay delay( 500 ); }
getEEPROM.ino
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getGasSensorMQ.ino
// Gas Sensors MQ // Gas Sensor void isGasSensor() { // Read in analog value from each gas sensors // Hydrogen Gas Sensor - MQ-8 iMQ8Raw = analogRead( iMQ8 ); // Carbon Monoxide & Flammable Gas Sensor - MQ-9 iMQ9Raw = analogRead( iMQ9 ); // Carbon Monoxide Gas Sensor - MQ-7 iMQ7Raw = analogRead( iMQ7 ); // Alcohol Gas Sensor - MQ-3 iMQ3Raw = analogRead( iMQ3 ); // Caclulate the PPM of each gas sensors // Hydrogen Gas Sensor - MQ-8 iMQ8ppm = isMQ8( iMQ8Raw ); // Carbon Monoxide & Flammable Gas Sensor - MQ-9 iMQ9ppm = isMQ9( iMQ9Raw ); // Carbon Monoxide Gas Sensor - MQ-7 iMQ7ppm = isMQ7( iMQ7Raw ); // Alcohol Gas Sensor - MQ-3 iMQ3ppm = isMQ3( iMQ3Raw ); } // Hydrogen Gas Sensor - MQ-8 - PPM int isMQ8(double rawValue) { // RvRo double RvRo = rawValue * (3.3 / 1023); return (pow(4.7,( ((log(RvRo)-H2Curve[1])/H2Curve[2]) + H2Curve[0]))); } // Carbon Monoxide & Flammable Gas Sensor - MQ-9 int isMQ9(double rawValue) { double RvRo = rawValue * 3.3 / 4095; double ppm = 3.027*exp(1.0698*( RvRo )); return ppm; } // Carbon Monoxide Gas Sensor - MQ-7 int isMQ7(double rawValue) { double RvRo = rawValue * 3.3 / 4095; double ppm = 3.027*exp(1.0698*( RvRo )); return ppm; } // Alcohol Gas Sensor - MQ-3 int isMQ3(double rawValue) { double RvRo = rawValue * 3.3 / 4095; double bac = RvRo * 0.21; return bac; }
getHC-SR04.ino
// HC-SR04 Ultrasonic Sensor // Setup HC-SR04 void setupHCSR04() { // The trigger iTrig will output pulses of electricity pinMode(iTrig, OUTPUT); // The echo iEcho will measure the duration of pulses coming back from the distance sensor pinMode(iEcho, INPUT); } // HC-SR04 void isHCSR04() { // Variable to store the distance measured by the sensor distance = isDistance(); } // Distance float isDistance() { // Variable to store the time it takes for a ping to bounce off an object float echoTime; // Variable to store the distance calculated from the echo time float calculatedDistance; // Send out an ultrasonic pulse that's 10ms long digitalWrite(iTrig, HIGH); delayMicroseconds(10); digitalWrite(iTrig, LOW); // Use the pulseIn command to see how long it takes for the // pulse to bounce back to the sensor echoTime = pulseIn(iEcho, HIGH); // Calculate the distance of the object that reflected the pulse // (half the bounce time multiplied by the speed of sound) // cm = 58.0 calculatedDistance = echoTime / 58.0; // Send back the distance that was calculated return calculatedDistance; }
getPIR.ino
// PIR Motion // Setup PIR void setupPIR() { // Setup PIR Montion pinMode(iMotion, INPUT_PULLUP); } // isPIR Motion void isPIR() { // Proximity proximity = digitalRead(iMotion); if (proximity == LOW) { // PIR Motion Sensor's LOW, Motion is detected Det = "Motion Yes"; } else { // PIR Motion Sensor's HIGH Det = "No"; } }
getRGBLCDShield.ino
// Adafruit RGB LCD Shield // Setup RGB LCD Shield void isSetupRGBLCDShield() { // Adafruit RGB LCD Shield // Set up the LCD's number of columns and rows: RGBLCDShield.begin(16, 2); // Set the cursor to column 0, line 0 RGBLCDShield.setBacklight(RED); // Don luc RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Don Luc"); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Electronics RGBLCDShield.print("Electronics"); // Delay delay(5000); // Clear RGBLCDShield.clear(); // Set the cursor to column 0, line 0 RGBLCDShield.setBacklight(TEAL); // Version RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Version: " + sver); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Unit ID RGBLCDShield.print("Unit ID: " + uid); // Delay delay(5000); // Clear RGBLCDShield.clear(); } // isDisplay void isDisplay() { // Momentary Button momentaryButton = RGBLCDShield.readButtons(); switch ( yy ) { case 1: // RHT Temperature and Humidity Sensor // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); // Temperature C RGBLCDShield.print( "Temp C: " ); RGBLCDShield.print( latestTempC ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Humidity RGBLCDShield.print( "Humidity: " ); RGBLCDShield.print( latestHumidity ); break; case 2: // Set the cursor to column 0, line 0 // PIR Motion Sensor RGBLCDShield.setCursor(0,0); RGBLCDShield.print( "PIR: " ); RGBLCDShield.print( Det ); // Set the cursor to column 0, line 1 // HC-SR04 Ultrasonic Sensor RGBLCDShield.setCursor(0, 1); RGBLCDShield.print( "HC-SR04: " ); RGBLCDShield.print( distance ); break; case 3: // Gas Sensors 1 // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); // Hydrogen Gas Sensor - MQ-8 RGBLCDShield.print( "MQ-8: " ); RGBLCDShield.print( iMQ8ppm ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Carbon Monoxide & Flammable Gas Sensor - MQ-9 RGBLCDShield.print( "MQ-9: " ); RGBLCDShield.print( iMQ9ppm ); break; case 4: // Gas Sensors 2 // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); // Carbon Monoxide Gas Sensor - MQ-7 RGBLCDShield.print( "MQ-7: " ); RGBLCDShield.print( iMQ7ppm ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Alcohol Gas Sensor - MQ-3 RGBLCDShield.print( "MQ-3: " ); RGBLCDShield.print( iMQ3ppm ); break; case 5: // DS3231 RTC Date and Time // Date and Time DateTime now = rtc.now(); // Set the cursor to column 0, line 0 // Date RGBLCDShield.setCursor(0,0); RGBLCDShield.print( sDate ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Time RGBLCDShield.print( sTime ); break; default: // Don luc Electronics yy = 5; RGBLCDShield.setBacklight(RED); // Set the cursor to column 0, line 0 // Don luc RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Don Luc"); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Electronics RGBLCDShield.print("Electronics"); } if ( momentaryButton ) { if ( momentaryButton & BUTTON_UP ) { yy = 1; // RHT Temperature and Humidity Sensor RGBLCDShield.setBacklight(GREEN); } if ( momentaryButton & BUTTON_DOWN ) { yy = 2; // PIR Motion Sensor RGBLCDShield.setBacklight(VIOLET); } if ( momentaryButton & BUTTON_LEFT ) { yy = 3; // Gas Sensors 1 RGBLCDShield.setBacklight(TEAL); } if ( momentaryButton & BUTTON_RIGHT ) { yy = 4; // Gas Sensors 2 RGBLCDShield.setBacklight(YELLOW); } if ( momentaryButton & BUTTON_SELECT ) { yy = 5; // DS3231 RTC Date and Time RGBLCDShield.setBacklight(WHITE); } } }
getRHT.ino
// RHT Temperature and Humidity Sensor // setup RHT Temperature and Humidity Sensor void setupRTH03() { // RHT Temperature and Humidity Sensor // Call rht.begin() to initialize the sensor and our data pin rht.begin(RHT03_DATA_PIN); } // RHT Temperature and Humidity Sensor void isRHT03(){ // Call rht.update() to get new humidity and temperature values from the sensor. int updateRet = rht.update(); // The humidity(), tempC(), and tempF() functions can be called -- after // a successful update() -- to get the last humidity and temperature value latestHumidity = rht.humidity(); latestTempC = rht.tempC(); }
getRTC.ino
// DS3231 RTC Date and Time // Setup DS3231 RTC void isSetupRTC() { if (! rtc.begin()) { while (1); } if (rtc.lostPower()) { // Following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0)); } } // DS3231 RTC Date and Time void isRTC(){ // Date and Time sDate = ""; sTime = ""; // Date Time DateTime now = rtc.now(); // sData sDate += String(now.year(), DEC); sDate += "/"; sDate += String(now.month(), DEC); sDate += "/"; sDate += String(now.day(), DEC); // sTime sTime += String(now.hour(), DEC); sTime += ":"; sTime += String(now.minute(), DEC); sTime += ":"; sTime += String(now.second(), DEC); }
getSD.ino
// MicroSD Card // MicroSD Setup void setupSD() { // MicroSD Card if (!SD.begin(chipSelect)) { while (true); } } // MicroSD Card void isSD() { zzzzzz = ""; // Don Luc Electronics © (1983-2021) // Arduino Data // EEPROM Unique ID // Version // Date // Time // Temperature Celsius // Humidity // Hydrogen Gas Sensor - MQ-8 // Carbon Monoxide & Flammable Gas Sensor - MQ-9 // Carbon Monoxide Gas Sensor - MQ-7 // Alcohol Gas Sensor - MQ-3 // PIR Motion // HC-SR04 Ultrasonic Sensor // EEPROM Unique ID|Version|Date|Time|Temperature Celsius|Humidity|MQ-8|MQ-9|MQ-7|MQ-3|PIR Motion|HC-SR04| zzzzzz = uid + "|" + sver + "|" + sDate + "|" + sTime + "|" + latestTempC + "|" + latestHumidity + "|" + iMQ8ppm + "|" + iMQ9ppm + "|" + iMQ7ppm + "|" + iMQ3ppm + "|" + Det + "|" + distance + "|"; // Open the file. Note that only one file can be open at a time, // so you have to close this one before opening another. File dataFile = SD.open("arddata.txt", FILE_WRITE); // If the file is available, write to it: if ( dataFile ) { dataFile.println( zzzzzz ); dataFile.close(); } }
setup.ino
// Setup void setup() { // EEPROM Unique ID isUID(); // RHT Temperature and Humidity Sensor // Setup RTH03 Temperature and Humidity Sensor setupRTH03(); // PIR Motion // Setup PIR setupPIR(); // Setup DS3231 RTC isSetupRTC(); //MicroSD Card setupSD(); // Initialize the LED Green pinMode(iLEDGreen, OUTPUT); // iLEDGreen LOW digitalWrite(iLEDGreen, LOW ); // Slide Switch pinMode(iSS1, INPUT); // Setup HC-SR04 setupHCSR04(); // Adafruit RGB LCD Shield isSetupRGBLCDShield(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Research & Development (R & D)
- Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
- Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
- Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
- Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
- Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
- Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
- eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)
Instructor and E-Mentor
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
Follow Us
J. Luc Paquin – Curriculum Vitae – 2021 English & Español
https://www.jlpconsultants.com/luc/
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #15: Environment – MicroSD Card – Mk17
——
#DonLucElectronics #DonLuc #Environment #MQ #PIR #RHT03 #RTC #ArduinoUNO #Arduino #AdafruitPowerBoost #Project #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
——
MicroSD Card Breakout Board+
Not just a simple breakout board, this microSD adapter goes the extra mile – designed for ease of use.
- -Onboard 5v->3v regulator provides 150mA for power-hungry cards
- -3v level shifting means you can use this with ease on either 3v or 5v systems
- -Uses a proper level shifting chip, not resistors: less problems, and faster read/write access
- -Use 3 or 4 digital pins to read and write 2Gb+ of storage
- -Activity LED lights up when the SD card is being read or written
- -Push-push socket with card slightly over the edge of the PCB so its easy to insert and remove
- -Comes with 0.1″ header so you can get it on a breadboard or use wires
To use with an Arduino, connect GND to ground, 5V to 5V, CLK to pin 13, DO to pin 12, DI to pin 11, and CS to pin 10.
DL2110Mk04
1 x Arduino UNO – R3
1 x ProtoScrewShield
1 x RGB LCD Shield 16×2 Character Negative Display
1 x ChronoDot – Ultra-Precise Real Time Clock – v2.1
1 x MicroSD Card Breakout Board+
1 x MicroSD 2.0 GB
1 x Rocker Switch – SPST (Round)
1 x 10K Ohm
1 x LED Green
1 x 220 Ohm
1 x Adafruit PowerBoost 500 Shield
1 x Lithium Ion Battery – 3.7v 2000mAh
4 x Pololu Carrier for MQ Gas Sensors
1 x SparkFun Hydrogen Gas Sensor – MQ-8
1 x 4.7K Ohm
1 x Pololu Carbon Monoxide & Flammable Gas Sensor – MQ-9
1 x 22k Ohm
1 x SparkFun Carbon Monoxide Gas Sensor – MQ-7
1 x 10K Ohm
1 x SparkFun Alcohol Gas Sensor – MQ-3
1 x 220k Ohm
1 x Temperature and Humidity Sensor- RHT03
1 x PIR Motion Sensor (JST)
1 x SparkFun Solderable Half-Breadboard
1 x Half-Breadboard
1 x SparkFun Cerberus USB Cable
Arduino UNO – R3
CLK – Digital 13
DO – Digital 12
DI – Digital 11
CS – Digital 10
PIR – Digital 7
RHT – Digital 5
RS0 – Digital 3
LEG – Digital 2
MQ8 – Analog 0
MQ9 – Analog 1
MQ7 – Analog 2
MQ3 – Analog 3
SDA – Analog 4
SCL – Analog 5
VIN – +5V
GND – GND
——
DL2110Mk04p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #15: Environment – MicroSD Card – Mk17 10-04 DL2110Mk04p.ino 1 x Arduino UNO - R3 1 x ProtoScrewShield 1 x RGB LCD Shield 16x2 Character Negative Display 1 x ChronoDot - Ultra-Precise Real Time Clock - v2.1 1 x MicroSD Card Breakout Board+ 1 x MicroSD 2.0 GB 1 x Rocker Switch - SPST (Round) 1 x 10K Ohm 1 x LED Green 1 x 220 Ohm 1 x Adafruit PowerBoost 500 Shield 1 x Lithium Ion Battery - 3.7v 2000mAh 4 x Pololu Carrier for MQ Gas Sensors 1 x SparkFun Hydrogen Gas Sensor - MQ-8 1 x 4.7K Ohm 1 x Pololu Carbon Monoxide & Flammable Gas Sensor - MQ-9 1 x 22k Ohm 1 x SparkFun Carbon Monoxide Gas Sensor - MQ-7 1 x 10K Ohm 1 x SparkFun Alcohol Gas Sensor - MQ-3 1 x 220k Ohm 1 x Temperature and Humidity Sensor - RHT03 1 x PIR Motion Sensor (JST) 1 x SparkFun Solderable Half-Breadboard 1 x Half-Breadboard 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // EEPROM Library to Read and Write EEPROM with Unique ID for Unit #include <EEPROM.h> // RHT Temperature and Humidity Sensor #include <SparkFun_RHT03.h> // Adafruit RGB LCD Shield 16x2 #include <Adafruit_RGBLCDShield.h> // Wire #include <Wire.h> // DS3231 RTC Date and Time #include <RTClib.h> // SD Card #include <SPI.h> #include <SD.h> // RHT Temperature and Humidity Sensor // RHT03 data pin Digital 5 const int RHT03_DATA_PIN = 5; // This creates a RTH03 object, which we'll use to interact with the sensor RHT03 rht; float latestHumidity; float latestTempC; // Gas Sensors MQ // Hydrogen Gas Sensor - MQ-8 int iMQ8 = A0; int iMQ8Raw = 0; int iMQ8ppm = 0; // Two points are taken from the curve in datasheet. // With these two points, a line is formed which is // "approximately equivalent" to the original curve. float H2Curve[3] = {2.3, 0.93,-1.44}; // Carbon Monoxide & Flammable Gas Sensor - MQ-9 int iMQ9 = A1; int iMQ9Raw = 0; int iMQ9ppm = 0; // Carbon Monoxide Gas Sensor - MQ-7 int iMQ7 = A2; int iMQ7Raw = 0; int iMQ7ppm = 0; // Alcohol Gas Sensor - MQ-3 int iMQ3 = A3; int iMQ3Raw = 0; int iMQ3ppm = 0; // PIR Motion // Motion detector const int iMotion = 7; // Proximity int proximity = LOW; String Det = ""; // Adafruit RGB LCD Shield Adafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield(); // These #defines make it easy to set the backlight color #define OFF 0x0 #define RED 0x1 #define YELLOW 0x3 #define GREEN 0x2 #define TEAL 0x6 #define BLUE 0x4 #define VIOLET 0x5 #define WHITE 0x7 // Momentary Button int yy = 0; uint8_t momentaryButton = 0; // DS3231 RTC Date and Time RTC_DS3231 rtc; String sDate; String sTime; // SD Card const int chipSelect = 10; String zzzzzz = ""; // LED Green int iLEDGreen = 2; // Rocker Switch - SPST (Round) int iSS1 = 3; // State int iSS1State = 0; // Software Version Information String uid = ""; // Version String sver = "15-17"; void loop() { // Adafruit RGB LCD Shield // Clear RGBLCDShield.clear(); // iLEDGreen LOW digitalWrite(iLEDGreen, LOW ); // RHT Temperature and Humidity Sensor isRHT03(); // Gas Sensors MQ isGasSensor(); // isPIR Motion isPIR(); // DS3231 RTC Date and Time isRTC(); // Adafruit RGB LCD Shield // Display isDisplay(); // Slide Switch // Read the state of the iSS1 value iSS1State = digitalRead(iSS1); // If it is the Slide Switch State is HIGH if (iSS1State == HIGH) { // iLEDGreen HIGH digitalWrite(iLEDGreen, HIGH ); // MicroSD Card isSD(); } else { // iLEDGreen LOW digitalWrite(iLEDGreen, LOW ); } // Delay delay( 1000 ); }
getEEPROM.ino
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getGasSensorMQ.ino
// Gas Sensors MQ // Gas Sensor void isGasSensor() { // Read in analog value from each gas sensors // Hydrogen Gas Sensor - MQ-8 iMQ8Raw = analogRead( iMQ8 ); // Carbon Monoxide & Flammable Gas Sensor - MQ-9 iMQ9Raw = analogRead( iMQ9 ); // Carbon Monoxide Gas Sensor - MQ-7 iMQ7Raw = analogRead( iMQ7 ); // Alcohol Gas Sensor - MQ-3 iMQ3Raw = analogRead( iMQ3 ); // Caclulate the PPM of each gas sensors // Hydrogen Gas Sensor - MQ-8 iMQ8ppm = isMQ8( iMQ8Raw ); // Carbon Monoxide & Flammable Gas Sensor - MQ-9 iMQ9ppm = isMQ9( iMQ9Raw ); // Carbon Monoxide Gas Sensor - MQ-7 iMQ7ppm = isMQ7( iMQ7Raw ); // Alcohol Gas Sensor - MQ-3 iMQ3ppm = isMQ3( iMQ3Raw ); } // Hydrogen Gas Sensor - MQ-8 - PPM int isMQ8(double rawValue) { // RvRo double RvRo = rawValue * (3.3 / 1023); return (pow(4.7,( ((log(RvRo)-H2Curve[1])/H2Curve[2]) + H2Curve[0]))); } // Carbon Monoxide & Flammable Gas Sensor - MQ-9 int isMQ9(double rawValue) { double RvRo = rawValue * 3.3 / 4095; double ppm = 3.027*exp(1.0698*( RvRo )); return ppm; } // Carbon Monoxide Gas Sensor - MQ-7 int isMQ7(double rawValue) { double RvRo = rawValue * 3.3 / 4095; double ppm = 3.027*exp(1.0698*( RvRo )); return ppm; } // Alcohol Gas Sensor - MQ-3 int isMQ3(double rawValue) { double RvRo = rawValue * 3.3 / 4095; double bac = RvRo * 0.21; return bac; }
getPIR.ino
// PIR Motion // Setup PIR void setupPIR() { // Setup PIR Montion pinMode(iMotion, INPUT_PULLUP); } // isPIR Motion void isPIR() { // Proximity proximity = digitalRead(iMotion); if (proximity == LOW) { // PIR Motion Sensor's LOW, Motion is detected Det = "Motion Yes"; } else { // PIR Motion Sensor's HIGH Det = "No"; } }
getRGBLCDShield.ino
// Adafruit RGB LCD Shield // Setup RGB LCD Shield void isSetupRGBLCDShield() { // Adafruit RGB LCD Shield // Set up the LCD's number of columns and rows: RGBLCDShield.begin(16, 2); // Set the cursor to column 0, line 0 RGBLCDShield.setBacklight(RED); // Don luc RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Don Luc"); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Electronics RGBLCDShield.print("Electronics"); // Delay delay(5000); // Clear RGBLCDShield.clear(); // Set the cursor to column 0, line 0 RGBLCDShield.setBacklight(TEAL); // Version RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Version: " + sver); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Unit ID RGBLCDShield.print("Unit ID: " + uid); // Delay delay(5000); // Clear RGBLCDShield.clear(); } // isDisplay void isDisplay() { // Momentary Button momentaryButton = RGBLCDShield.readButtons(); switch ( yy ) { case 1: // RHT Temperature and Humidity Sensor // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); // Temperature C RGBLCDShield.print( "Temp C: " ); RGBLCDShield.print( latestTempC ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Humidity RGBLCDShield.print( "Humidity: " ); RGBLCDShield.print( latestHumidity ); break; case 2: // PIR Motion Sensor // Set the cursor to column 0, line 0 // PIR Motion Sensor RGBLCDShield.setCursor(0,0); RGBLCDShield.print( "PIR Motion" ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Det RGBLCDShield.print( Det ); break; case 3: // Gas Sensors 1 // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); // Hydrogen Gas Sensor - MQ-8 RGBLCDShield.print( "MQ-8: " ); RGBLCDShield.print( iMQ8ppm ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Carbon Monoxide & Flammable Gas Sensor - MQ-9 RGBLCDShield.print( "MQ-9: " ); RGBLCDShield.print( iMQ9ppm ); break; case 4: // Gas Sensors 2 // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); // Carbon Monoxide Gas Sensor - MQ-7 RGBLCDShield.print( "MQ-7: " ); RGBLCDShield.print( iMQ7ppm ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Alcohol Gas Sensor - MQ-3 RGBLCDShield.print( "MQ-3: " ); RGBLCDShield.print( iMQ3ppm ); break; case 5: // DS3231 RTC Date and Time // Date and Time DateTime now = rtc.now(); // Set the cursor to column 0, line 0 // Date RGBLCDShield.setCursor(0,0); RGBLCDShield.print( sDate ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Time RGBLCDShield.print( sTime ); break; default: // Don luc Electronics yy = 5; RGBLCDShield.setBacklight(RED); // Set the cursor to column 0, line 0 // Don luc RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Don Luc"); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Electronics RGBLCDShield.print("Electronics"); } if ( momentaryButton ) { if ( momentaryButton & BUTTON_UP ) { yy = 1; // RHT Temperature and Humidity Sensor RGBLCDShield.setBacklight(GREEN); } if ( momentaryButton & BUTTON_DOWN ) { yy = 2; // PIR Motion Sensor RGBLCDShield.setBacklight(VIOLET); } if ( momentaryButton & BUTTON_LEFT ) { yy = 3; // Gas Sensors 1 RGBLCDShield.setBacklight(TEAL); } if ( momentaryButton & BUTTON_RIGHT ) { yy = 4; // Gas Sensors 2 RGBLCDShield.setBacklight(YELLOW); } if ( momentaryButton & BUTTON_SELECT ) { yy = 5; // DS3231 RTC Date and Time RGBLCDShield.setBacklight(WHITE); } } }
getRHT.ino
// RHT Temperature and Humidity Sensor // setup RHT Temperature and Humidity Sensor void setupRTH03() { // RHT Temperature and Humidity Sensor // Call rht.begin() to initialize the sensor and our data pin rht.begin(RHT03_DATA_PIN); } // RHT Temperature and Humidity Sensor void isRHT03(){ // Call rht.update() to get new humidity and temperature values from the sensor. int updateRet = rht.update(); // The humidity(), tempC(), and tempF() functions can be called -- after // a successful update() -- to get the last humidity and temperature value latestHumidity = rht.humidity(); latestTempC = rht.tempC(); }
getRTC.ino
// DS3231 RTC Date and Time // Setup DS3231 RTC void isSetupRTC() { if (! rtc.begin()) { while (1); } if (rtc.lostPower()) { // Following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0)); } } // DS3231 RTC Date and Time void isRTC(){ // Date and Time sDate = ""; sTime = ""; // Date Time DateTime now = rtc.now(); // sData sDate += String(now.year(), DEC); sDate += "/"; sDate += String(now.month(), DEC); sDate += "/"; sDate += String(now.day(), DEC); // sTime sTime += String(now.hour(), DEC); sTime += ":"; sTime += String(now.minute(), DEC); sTime += ":"; sTime += String(now.second(), DEC); }
getSD.ino
// MicroSD Card // MicroSD Setup void setupSD() { // MicroSD Card if (!SD.begin(chipSelect)) { while (true); } } // MicroSD Card void isSD() { zzzzzz = ""; // Don Luc Electronics © (1983-2021) // Arduino Data // EEPROM Unique ID // Version // Date // Time // Temperature Celsius // Humidity // Hydrogen Gas Sensor - MQ-8 // Carbon Monoxide & Flammable Gas Sensor - MQ-9 // Carbon Monoxide Gas Sensor - MQ-7 // Alcohol Gas Sensor - MQ-3 // PIR Motion // EEPROM Unique ID|Version|Date|Time|Temperature Celsius|Humidity|MQ-8|MQ-9|MQ-7|MQ-3|PIR Motion|\r zzzzzz = uid + "|" + sver + "|" + sDate + "|" + sTime + "|" + latestTempC + "|" + latestHumidity + "|" + iMQ8ppm + "|" + iMQ9ppm + "|" + iMQ7ppm + "|" + iMQ3ppm + "|" + Det + "|"; // Open the file. Note that only one file can be open at a time, // so you have to close this one before opening another. File dataFile = SD.open("arddata.txt", FILE_WRITE); // If the file is available, write to it: if ( dataFile ) { dataFile.println( zzzzzz ); dataFile.close(); } }
setup.ino
// Setup void setup() { // EEPROM Unique ID isUID(); // RHT Temperature and Humidity Sensor // Setup RTH03 Temperature and Humidity Sensor setupRTH03(); // PIR Motion // Setup PIR setupPIR(); // Setup DS3231 RTC isSetupRTC(); //MicroSD Card setupSD(); // Initialize the LED Green pinMode(iLEDGreen, OUTPUT); // iLEDGreen LOW digitalWrite(iLEDGreen, LOW ); // Slide Switch pinMode(iSS1, INPUT); // Adafruit RGB LCD Shield isSetupRGBLCDShield(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Research & Development (R & D)
- Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
- Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
- Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
- Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
- Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
- Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
- eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)
Instructor and E-Mentor
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
Follow Us
J. Luc Paquin – Curriculum Vitae – 2021 English & Español
https://www.jlpconsultants.com/luc/
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #15: Environment – ChronoDot – Mk16
——
#DonLucElectronics #DonLuc #Environment #MQ #PIR #RHT03 #RTC #ArduinoUNO #Arduino #AdafruitPowerBoost #Project #Programming #Electronics #Microcontrollers #Consultant #VideoBlog
——
——
——
——
——
ChronoDot – Ultra-Precise Real Time Clock – v2.1
The ChronoDot RTC is an extremely accurate real time clock module, based on the DS3231 temperature compensated RTC. It includes a CR1632 battery, which should last at least 8 years if the I2C interface is only used while the device has 5V power available. No external crystal or tuning capacitors are required.
The top side of the Chronodot now features a battery holder for 16mm 3V lithium coin cells. It pairs particularly well with CR1632 batteries. The DS3231 has an internal crystal and a switched bank of tuning capacitors. The temperature of the crystal is continously monitored, and the capacitors are adjusted to maintain a stable frequency. Other RTC solutions may drift minutes per month, especially in extreme temperature ranges…the ChronoDot will drift less than a minute per year. This makes the ChronoDot very well suited for time critical applications that cannot be regularly synchronized to an external clock.
DL2110Mk03
1 x Arduino UNO – R3
1 x ProtoScrewShield
1 x RGB LCD Shield 16×2 Character Negative Display
1 x ChronoDot – Ultra-Precise Real Time Clock – v2.1
1 x Adafruit PowerBoost 500 Shield
1 x Lithium Ion Battery – 3.7v 2000mAh
4 x Pololu Carrier for MQ Gas Sensors
1 x SparkFun Hydrogen Gas Sensor – MQ-8
1 x 4.7K Ohm
1 x Pololu Carbon Monoxide & Flammable Gas Sensor – MQ-9
1 x 22k Ohm
1 x SparkFun Carbon Monoxide Gas Sensor – MQ-7
1 x 10K Ohm
1 x SparkFun Alcohol Gas Sensor – MQ-3
1 x 220k Ohm
1 x Temperature and Humidity Sensor- RHT03
1 x PIR Motion Sensor (JST)
1 x SparkFun Solderable Half-Breadboard
1 x Half-Breadboard
1 x SparkFun Cerberus USB Cable
Arduino UNO – R3
RHT – Digital 5
PIR – Digital 7
MQ8 – Analog 0
MQ9 – Analog 1
MQ7 – Analog 2
MQ3 – Analog 3
SDA – Analog 4
SCL – Analog 5
VIN – +5V
GND – GND
——
DL2110Mk03p.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #15: Environment – ChronoDot – Mk16 10-03 DL2110Mk03p.ino 1 x Arduino UNO - R3 1 x ProtoScrewShield 1 x RGB LCD Shield 16x2 Character Negative Display 1 x ChronoDot - Ultra-Precise Real Time Clock - v2.1 1 x Adafruit PowerBoost 500 Shield 1 x Lithium Ion Battery - 3.7v 2000mAh 4 x Pololu Carrier for MQ Gas Sensors 1 x SparkFun Hydrogen Gas Sensor - MQ-8 1 x 4.7K Ohm 1 x Pololu Carbon Monoxide & Flammable Gas Sensor - MQ-9 1 x 22k Ohm 1 x SparkFun Carbon Monoxide Gas Sensor - MQ-7 1 x 10K Ohm 1 x SparkFun Alcohol Gas Sensor - MQ-3 1 x 220k Ohm 1 x Temperature and Humidity Sensor - RHT03 1 x PIR Motion Sensor (JST) 1 x SparkFun Solderable Half-Breadboard 1 x Half-Breadboard 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // EEPROM Library to Read and Write EEPROM with Unique ID for Unit #include <EEPROM.h> // RHT Temperature and Humidity Sensor #include <SparkFun_RHT03.h> // Adafruit RGB LCD Shield 16x2 #include <Adafruit_RGBLCDShield.h> // Wire #include <Wire.h> // DS3231 RTC Date and Time #include <RTClib.h> // RHT Temperature and Humidity Sensor // RHT03 data pin Digital 5 const int RHT03_DATA_PIN = 5; // This creates a RTH03 object, which we'll use to interact with the sensor RHT03 rht; float latestHumidity; float latestTempC; // Gas Sensors MQ // Hydrogen Gas Sensor - MQ-8 int iMQ8 = A0; int iMQ8Raw = 0; int iMQ8ppm = 0; // Two points are taken from the curve in datasheet. // With these two points, a line is formed which is // "approximately equivalent" to the original curve. float H2Curve[3] = {2.3, 0.93,-1.44}; // Carbon Monoxide & Flammable Gas Sensor - MQ-9 int iMQ9 = A1; int iMQ9Raw = 0; int iMQ9ppm = 0; // Carbon Monoxide Gas Sensor - MQ-7 int iMQ7 = A2; int iMQ7Raw = 0; int iMQ7ppm = 0; // Alcohol Gas Sensor - MQ-3 int iMQ3 = A3; int iMQ3Raw = 0; int iMQ3ppm = 0; // PIR Motion // Motion detector const int iMotion = 7; // Proximity int proximity = LOW; String Det = ""; // Adafruit RGB LCD Shield Adafruit_RGBLCDShield RGBLCDShield = Adafruit_RGBLCDShield(); // These #defines make it easy to set the backlight color #define OFF 0x0 #define RED 0x1 #define YELLOW 0x3 #define GREEN 0x2 #define TEAL 0x6 #define BLUE 0x4 #define VIOLET 0x5 #define WHITE 0x7 // Momentary Button int yy = 0; uint8_t momentaryButton = 0; // DS3231 RTC Date and Time RTC_DS3231 rtc; String sDate; String sTime; // Software Version Information String uid = ""; // Version String sver = "15-16"; void loop() { // Adafruit RGB LCD Shield // Clear RGBLCDShield.clear(); // RHT Temperature and Humidity Sensor isRHT03(); // Gas Sensors MQ isGasSensor(); // isPIR Motion isPIR(); // DS3231 RTC Date and Time isRTC(); // Adafruit RGB LCD Shield // Display isDisplay(); // Delay // Turn the LED on HIGH is the voltage level digitalWrite(LED_BUILTIN, HIGH); // Wait for a 0.5 second delay( 500 ); // Turn the LED off by making the voltage LOW digitalWrite(LED_BUILTIN, LOW); // Wait for a 0.5 second delay( 500 ); }
getEEPROM.ino
// EEPROM // isUID EEPROM Unique ID void isUID() { // Is Unit ID uid = ""; for (int x = 0; x < 5; x++) { uid = uid + char(EEPROM.read(x)); } }
getGasSensorMQ.ino
// Gas Sensors MQ // Gas Sensor void isGasSensor() { // Read in analog value from each gas sensors // Hydrogen Gas Sensor - MQ-8 iMQ8Raw = analogRead( iMQ8 ); // Carbon Monoxide & Flammable Gas Sensor - MQ-9 iMQ9Raw = analogRead( iMQ9 ); // Carbon Monoxide Gas Sensor - MQ-7 iMQ7Raw = analogRead( iMQ7 ); // Alcohol Gas Sensor - MQ-3 iMQ3Raw = analogRead( iMQ3 ); // Caclulate the PPM of each gas sensors // Hydrogen Gas Sensor - MQ-8 iMQ8ppm = isMQ8( iMQ8Raw ); // Carbon Monoxide & Flammable Gas Sensor - MQ-9 iMQ9ppm = isMQ9( iMQ9Raw ); // Carbon Monoxide Gas Sensor - MQ-7 iMQ7ppm = isMQ7( iMQ7Raw ); // Alcohol Gas Sensor - MQ-3 iMQ3ppm = isMQ3( iMQ3Raw ); } // Hydrogen Gas Sensor - MQ-8 - PPM int isMQ8(double rawValue) { // RvRo double RvRo = rawValue * (3.3 / 1023); return (pow(4.7,( ((log(RvRo)-H2Curve[1])/H2Curve[2]) + H2Curve[0]))); } // Carbon Monoxide & Flammable Gas Sensor - MQ-9 int isMQ9(double rawValue) { double RvRo = rawValue * 3.3 / 4095; double ppm = 3.027*exp(1.0698*( RvRo )); return ppm; } // Carbon Monoxide Gas Sensor - MQ-7 int isMQ7(double rawValue) { double RvRo = rawValue * 3.3 / 4095; double ppm = 3.027*exp(1.0698*( RvRo )); return ppm; } // Alcohol Gas Sensor - MQ-3 int isMQ3(double rawValue) { double RvRo = rawValue * 3.3 / 4095; double bac = RvRo * 0.21; return bac; }
getPIR.ino
// PIR Motion // Setup PIR void setupPIR() { // Setup PIR Montion pinMode(iMotion, INPUT_PULLUP); } // isPIR Motion void isPIR() { // Proximity proximity = digitalRead(iMotion); if (proximity == LOW) { // PIR Motion Sensor's LOW, Motion is detected Det = "Motion Yes"; } else { // PIR Motion Sensor's HIGH Det = "No"; } }
getRGBLCDShield.ino
// Adafruit RGB LCD Shield // Setup RGB LCD Shield void isSetupRGBLCDShield() { // Adafruit RGB LCD Shield // Set up the LCD's number of columns and rows: RGBLCDShield.begin(16, 2); // Set the cursor to column 0, line 0 RGBLCDShield.setBacklight(RED); // Don luc RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Don Luc"); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Electronics RGBLCDShield.print("Electronics"); // Delay delay(5000); // Clear RGBLCDShield.clear(); // Set the cursor to column 0, line 0 RGBLCDShield.setBacklight(TEAL); // Version RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Version: " + sver); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Unit ID RGBLCDShield.print("Unit ID: " + uid); // Delay delay(5000); // Clear RGBLCDShield.clear(); } // isDisplay void isDisplay() { // Momentary Button momentaryButton = RGBLCDShield.readButtons(); switch ( yy ) { case 1: // RHT Temperature and Humidity Sensor // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); // Temperature C RGBLCDShield.print( "Temp C: " ); RGBLCDShield.print( latestTempC ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Humidity RGBLCDShield.print( "Humidity: " ); RGBLCDShield.print( latestHumidity ); break; case 2: // PIR Motion Sensor // Set the cursor to column 0, line 0 // PIR Motion Sensor RGBLCDShield.setCursor(0,0); RGBLCDShield.print( "PIR Motion" ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Det RGBLCDShield.print( Det ); break; case 3: // Gas Sensors 1 // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); // Hydrogen Gas Sensor - MQ-8 RGBLCDShield.print( "MQ-8: " ); RGBLCDShield.print( iMQ8ppm ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Carbon Monoxide & Flammable Gas Sensor - MQ-9 RGBLCDShield.print( "MQ-9: " ); RGBLCDShield.print( iMQ9ppm ); break; case 4: // Gas Sensors 2 // Set the cursor to column 0, line 0 RGBLCDShield.setCursor(0,0); // Carbon Monoxide Gas Sensor - MQ-7 RGBLCDShield.print( "MQ-7: " ); RGBLCDShield.print( iMQ7ppm ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Alcohol Gas Sensor - MQ-3 RGBLCDShield.print( "MQ-3: " ); RGBLCDShield.print( iMQ3ppm ); break; case 5: // DS3231 RTC Date and Time // Date and Time DateTime now = rtc.now(); // Set the cursor to column 0, line 0 // Date RGBLCDShield.setCursor(0,0); RGBLCDShield.print( sDate ); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Time RGBLCDShield.print( sTime ); break; default: // Don luc Electronics yy = 5; RGBLCDShield.setBacklight(RED); // Set the cursor to column 0, line 0 // Don luc RGBLCDShield.setCursor(0,0); RGBLCDShield.print("Don Luc"); // Set the cursor to column 0, line 1 RGBLCDShield.setCursor(0, 1); // Electronics RGBLCDShield.print("Electronics"); } if ( momentaryButton ) { if ( momentaryButton & BUTTON_UP ) { yy = 1; // RHT Temperature and Humidity Sensor RGBLCDShield.setBacklight(GREEN); } if ( momentaryButton & BUTTON_DOWN ) { yy = 2; // PIR Motion Sensor RGBLCDShield.setBacklight(VIOLET); } if ( momentaryButton & BUTTON_LEFT ) { yy = 3; // Gas Sensors 1 RGBLCDShield.setBacklight(TEAL); } if ( momentaryButton & BUTTON_RIGHT ) { yy = 4; // Gas Sensors 2 RGBLCDShield.setBacklight(YELLOW); } if ( momentaryButton & BUTTON_SELECT ) { yy = 5; // DS3231 RTC Date and Time RGBLCDShield.setBacklight(WHITE); } } }
getRHT.ino
// RHT Temperature and Humidity Sensor // setup RHT Temperature and Humidity Sensor void setupRTH03() { // RHT Temperature and Humidity Sensor // Call rht.begin() to initialize the sensor and our data pin rht.begin(RHT03_DATA_PIN); } // RHT Temperature and Humidity Sensor void isRHT03(){ // Call rht.update() to get new humidity and temperature values from the sensor. int updateRet = rht.update(); // The humidity(), tempC(), and tempF() functions can be called -- after // a successful update() -- to get the last humidity and temperature value latestHumidity = rht.humidity(); latestTempC = rht.tempC(); }
getRTC.ino
// DS3231 RTC Date and Time // Setup DS3231 RTC void isSetupRTC() { if (! rtc.begin()) { while (1); } if (rtc.lostPower()) { // Following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: // rtc.adjust(DateTime(2014, 1, 21, 3, 0, 0)); } } // DS3231 RTC Date and Time void isRTC(){ // Date and Time sDate = ""; sTime = ""; // Date Time DateTime now = rtc.now(); // sData sDate += String(now.year(), DEC); sDate += "/"; sDate += String(now.month(), DEC); sDate += "/"; sDate += String(now.day(), DEC); // sTime sTime += String(now.hour(), DEC); sTime += ":"; sTime += String(now.minute(), DEC); sTime += ":"; sTime += String(now.second(), DEC); }
setup.ino
// Setup void setup() { // EEPROM Unique ID isUID(); // RHT Temperature and Humidity Sensor // Setup RTH03 Temperature and Humidity Sensor setupRTH03(); // PIR Motion // Setup PIR setupPIR(); // Setup DS3231 RTC isSetupRTC(); // Initialize digital pin LED_BUILTIN as an output. pinMode(LED_BUILTIN, OUTPUT); // Adafruit RGB LCD Shield isSetupRGBLCDShield(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Research & Development (R & D)
- Desktop Applications (Windows, OSX, Linux, Multi-OS, Multi-Tier, etc…)
- Mobile Applications (Android, iOS, Blackberry, Windows Mobile, Windows CE, etc…)
- Web Applications (LAMP, Scripting, Java, ASP, ASP.NET, RoR, Wakanda, etc…)
- Social Media Programming & Integration (Facebook, Twitter, YouTube, Pinterest, etc…)
- Content Management Systems (WordPress, Drupal, Joomla, Moodle, etc…)
- Bulletin Boards (phpBB, SMF, Vanilla, jobberBase, etc…)
- eCommerce (WooCommerce, OSCommerce, ZenCart, PayPal Shopping Cart, etc…)
Instructor and E-Mentor
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
- DOS, Windows, OSX, Linux, iOS, Android, Multi-OS
- Linux-Apache-PHP-MySQL
Follow Us
J. Luc Paquin – Curriculum Vitae – 2021 English & Español
https://www.jlpconsultants.com/luc/
Web: https://www.donluc.com/
Web: https://www.jlpconsultants.com/
Web: https://www.donluc.com/DLE/
Web: https://www.donluc.com/DLHackster/
Web: https://www.hackster.io/neosteam-labs
Web: https://zoom.us/
Patreon: https://www.patreon.com/DonLucElectronics
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc