#28 – Sensors
Project #28 – Sensors – MMA7361 – Mk14
——
#DonLucElectronics #DonLuc #Sensors #MMA7361 #Adafruit #SparkFun #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
SparkFun Triple Axis Accelerometer Breakout – MMA7361
This is a breakout board for Freescale’s MMA7361L three-axis analog MEMS accelerometer. The sensor requires a very low amount of power and has a g-select input which switches the accelerometer between ±1.5g and ±6g measurement ranges. Other features include a sleep mode, signal conditioning, a 1-pole low pass filter, temperature compensation, self test, and 0g-detect which detects linear freefall. Zero-g offset and sensitivity are factory set and require no external devices.
This breadboard friendly board breaks out every pin of the MMA7361L to a 9-pin, 0.1″ pitch header. The sensor works on power between 2.2 and 3.6VDC (3.3 Volt optimal), and typically consumes just 400µA of current. All three axes have their own analog output.
- Two selectable measuring ranges (±1.5g, ±6g)
- Breadboard friendly – 0.1″ pitch header
- Low current consumption: 400 µA
- Sleep mode: 3 µA
- Low voltage operation: 2.2 Volt – 3.6 Volt
- High sensitivity (800 mV/g at 1.5g)
- Fast turn on time (0.5 ms enable response time)
- Self test for freefall detect diagnosis
- 0g-Detect for freefall protection
- Signal conditioning with low pass filter
- Robust design, high shocks survivability
DL2401Mk04
1 x SparkFun Thing Plus – ESP32 WROOM
1 x DS3231 Precision RTC FeatherWing
1 x SparkFun Triple Axis Accelerometer Breakout – MMA7361
1 x Rocker Switch – SPST
1 x Resistor 10K Ohm
1 x CR1220 3V Lithium Coin Cell Battery
1 x 1 x Lithium Ion Battery – 1000mAh
1 x Terminal Block Breakout FeatherWing
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
LED – LED_BUILTIN
SDA – Digital 23
SCL – Digital 22
SW1 – Digital 21
XAC – Analog A0
YAC – Analog A1
ZAC – Analog A2
VIN – +3.3V
GND – GND
——
DL2401Mk04p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #28 - Sensors - MMA7361 - Mk14 28-14 DL2401Mk04p.ino 1 x SparkFun Thing Plus - ESP32 WROOM 1 x DS3231 Precision RTC FeatherWing 1 x SparkFun Triple Axis Accelerometer Breakout - MMA7361 1 x Rocker Switch - SPST 1 x Resistor 10K Ohm 1 x Lithium Ion Battery - 1000mAh 1 x CR1220 3V Lithium Coin Cell Battery 1 x Terminal Block Breakout FeatherWing 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Bluetooth LE keyboard #include <BleKeyboard.h> // Two Wire Interface (TWI/I2C) #include <Wire.h> // Serial Peripheral Interface #include <SPI.h> // DS3231 Precision RTC #include <RTClib.h> // Bluetooth LE Keyboard BleKeyboard bleKeyboard; String sKeyboard = ""; // Send Size byte sendSize = 0; // DS3231 Precision RTC RTC_DS3231 rtc; String dateRTC = ""; String timeRTC = ""; // Accelerometer MMA7361 int XAc = A0; int YAc = A1; int ZAc = A2; // Read int x = 0; int y = 0; int z = 0; // The number of the Rocker Switch pin int iSwitch = 21; // Variable for reading the button status int SwitchState = 0; // Software Version Information String sver = "28-14"; void loop() { // Date and Time RTC isRTC (); // Accelerometer MMA7361 isMMA7361(); // Read the state of the Switch value: SwitchState = digitalRead(iSwitch); // Check if the button is pressed. If it is, the SwitchState is HIGH: if (SwitchState == HIGH) { // Bluetooth LE Keyboard isBluetooth(); } // Delay 1 Second delay(1000); }
getAccelerometer.ino
// Accelerometer MMA7361 // isMMA7361 void isMMA7361(){ // Accelerometer Read x = analogRead(XAc); y = analogRead(YAc); z = analogRead(ZAc); sKeyboard = sKeyboard + String(x) + "|" + String(y) + "|" + String(z) + "|*"; }
getBleKeyboard.ino
// Ble Keyboard // Bluetooth // isBluetooth void isBluetooth() { // ESP32 BLE Keyboard if(bleKeyboard.isConnected()) { // Send Size Length sendSize = sKeyboard.length(); // Send Size, charAt for(byte i = 0; i < sendSize+1; i++){ // Write bleKeyboard.write(sKeyboard.charAt(i)); delay(50); } bleKeyboard.write(KEY_RETURN); } }
getRTC.ino
// Date & Time // DS3231 Precision RTC void isSetupRTC() { // DS3231 Precision RTC if (! rtc.begin()) { //Serial.println("Couldn't find RTC"); //Serial.flush(); while (1) delay(10); } if (rtc.lostPower()) { //Serial.println("RTC lost power, let's set the time!"); // When time needs to be set on a new device, or after a power loss, the // following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: //rtc.adjust(DateTime(2023, 8, 10, 11, 0, 0)); } } // Date and Time RTC void isRTC () { // Date and Time dateRTC = ""; timeRTC = ""; DateTime now = rtc.now(); // Date dateRTC = now.year(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.month(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.day(), DEC; // Time timeRTC = now.hour(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.minute(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.second(), DEC; // bleKeyboard sKeyboard = "SEN|" + sver + "|" + String(dateRTC) + "|" + String(timeRTC) + "|"; }
setup.ino
// Setup void setup() { // Give display time to power on delay(100); // Bluetooth LE keyboard bleKeyboard.begin(); // Wire - Inialize I2C Hardware Wire.begin(); // Give display time to power on delay(100); // Date & Time RTC // DS3231 Precision RTC isSetupRTC(); // Give display time to power on delay(100); // Initialize the Switch pin as an input pinMode(iSwitch, INPUT); // Initialize digital pin LED_BUILTIN as an output pinMode(LED_BUILTIN, OUTPUT); // Turn the LED on HIGH digitalWrite(LED_BUILTIN, HIGH); // Delay 5 Second delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Teacher, Instructor, E-Mentor, R&D and Consulting
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Automation
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- Artificial Intelligence (AI)
- RTOS
- eHealth Sensors, Biosensor, and Biometric
- Research & Development (R & D)
- Consulting
Follow Us
Luc Paquin – Curriculum Vitae – 2024
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #28 – Sensors – PIR Motion Sensor – Mk13
——
#DonLucElectronics #DonLuc #Sensors #PIR #Adafruit #SparkFun #Pololu #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
PIR Motion Sensor (JST)
This is a simple to use motion sensor. Power it up and wait 1-2 seconds for the sensor to get a snapshot of the still room. If anything moves after that period, the “Alarm” pin will go low. This unit works great from 5 to 12 Volt. The alarm pin is an open collector meaning you will need a pull up resistor on the alarm pin. The open drain setup allows multiple motion sensors to be connected on a single input pin. If any of the motion sensors go off, the input pin will be pulled low.
At their most fundamental level, PIR sensor’s are infrared-sensitive light detectors. By monitoring light in the infrared spectrum, PIR sensors can sense subtle changes in temperature across the area they’re viewing. When a human or some other object comes into the PIR’s field-of-view, the radiation pattern changes, and the PIR interprets that change as movement. All that’s left for us to connect is three pins: power, ground, and the output signal.
DL2401Mk02
1 x SparkFun Thing Plus – ESP32 WROOM
1 x DS3231 Precision RTC FeatherWing
1 x PIR Motion Sensor
1 x Pololu 5V Step-Up Voltage Regulator U1V10F5
1 x Rocker Switch – SPST
1 x Resistor 10K Ohm
1 x CR1220 3V Lithium Coin Cell Battery
1 x 1 x Lithium Ion Battery – 1000mAh
1 x Terminal Block Breakout FeatherWing
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
LED – LED_BUILTIN
SDA – Digital 23
SCL – Digital 22
SW1 – Digital 21
PIR – Digital 14
VIN – +3.3V
VIN – +5V
GND – GND
——
DL2401Mk01p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #28 - Sensors - PIR Motion Sensor - Mk13 28-13 DL2401Mk01p.ino 1 x SparkFun Thing Plus - ESP32 WROOM 1 x DS3231 Precision RTC FeatherWing 1 x PIR Motion Sensor 1 x Pololu 5V Step-Up Voltage Regulator U1V10F5 1 x Rocker Switch - SPST 1 x Resistor 10K Ohm 1 x Lithium Ion Battery - 1000mAh 1 x CR1220 3V Lithium Coin Cell Battery 1 x Terminal Block Breakout FeatherWing 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Bluetooth LE keyboard #include <BleKeyboard.h> // Two Wire Interface (TWI/I2C) #include <Wire.h> // Serial Peripheral Interface #include <SPI.h> // DS3231 Precision RTC #include <RTClib.h> // Bluetooth LE Keyboard BleKeyboard bleKeyboard; String sKeyboard = ""; // Send Size byte sendSize = 0; // DS3231 Precision RTC RTC_DS3231 rtc; String dateRTC = ""; String timeRTC = ""; // PIR Motion // Motion detector const int iMotion = 14; // Proximity int proximity = LOW; String Det = ""; // The number of the Rocker Switch pin int iSwitch = 21; // Variable for reading the button status int SwitchState = 0; // Software Version Information String sver = "28-13"; void loop() { // Date and Time RTC isRTC (); // isPIR Motion isPIR(); // Read the state of the Switch value: SwitchState = digitalRead(iSwitch); // Check if the button is pressed. If it is, the SwitchState is HIGH: if (SwitchState == HIGH) { // Bluetooth LE Keyboard isBluetooth(); } // Delay 1 Second delay(1000); }
getBleKeyboard.ino
// Ble Keyboard // Bluetooth // isBluetooth void isBluetooth() { // ESP32 BLE Keyboard if(bleKeyboard.isConnected()) { // Send Size Length sendSize = sKeyboard.length(); // Send Size, charAt for(byte i = 0; i < sendSize+1; i++){ // Write bleKeyboard.write(sKeyboard.charAt(i)); delay(50); } bleKeyboard.write(KEY_RETURN); } }
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"; } sKeyboard = sKeyboard + String(Det) + "|*"; }
getRTC.ino
// Date & Time // DS3231 Precision RTC void isSetupRTC() { // DS3231 Precision RTC if (! rtc.begin()) { //Serial.println("Couldn't find RTC"); //Serial.flush(); while (1) delay(10); } if (rtc.lostPower()) { //Serial.println("RTC lost power, let's set the time!"); // When time needs to be set on a new device, or after a power loss, the // following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: //rtc.adjust(DateTime(2023, 8, 10, 11, 0, 0)); } } // Date and Time RTC void isRTC () { // Date and Time dateRTC = ""; timeRTC = ""; DateTime now = rtc.now(); // Date dateRTC = now.year(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.month(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.day(), DEC; // Time timeRTC = now.hour(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.minute(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.second(), DEC; // bleKeyboard sKeyboard = "SEN|" + sver + "|" + String(dateRTC) + "|" + String(timeRTC) + "|"; }
setup.ino
// Setup void setup() { // Give display time to power on delay(100); // Bluetooth LE keyboard bleKeyboard.begin(); // Wire - Inialize I2C Hardware Wire.begin(); // Give display time to power on delay(100); // Date & Time RTC // DS3231 Precision RTC isSetupRTC(); // Give display time to power on delay(100); // PIR Motion // Setup PIR setupPIR(); // Initialize the Switch pin as an input pinMode(iSwitch, INPUT); // Initialize digital pin LED_BUILTIN as an output pinMode(LED_BUILTIN, OUTPUT); // Turn the LED on HIGH digitalWrite(LED_BUILTIN, HIGH); // Delay 5 Second delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Teacher, Instructor, E-Mentor, R&D and Consulting
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Automation
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- Artificial Intelligence (AI)
- RTOS
- eHealth Sensors, Biosensor, and Biometric
- Research & Development (R & D)
- Consulting
Follow Us
Luc Paquin – Curriculum Vitae – 2024
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #28 – Sensors – HC-SR04 – Mk12
——
#DonLucElectronics #DonLuc #Sensors #LSM9DS1 #IMU #GPSReceiver #Adafruit #SparkFun #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Pololu 5 Volt Step-Up Voltage Regulator U1V10F5
This tiny U1V10F5 switching step-up voltage regulator efficiently generates 5 Volt from input voltages as low as 0.5 Volt. Unlike most boost regulators, the U1V10F5 automatically switches to a linear down-regulation mode when the input voltage exceeds the output.
Ultrasonic Distance Sensor – HC-SR04 (5 Volt)
This is the HC-SR04 ultrasonic distance sensor. This economical sensor provides 2 Centimetres to 400 Centimetres of non-contact measurement functionality with a ranging accuracy that can reach up to 3 Millimetres. Each HC-SR04 module includes an ultrasonic transmitter, a receiver and a control circuit. There are only four pins that you need to worry about on the HC-SR04: VCC (Power), Trig (Trigger), Echo (Receive), and GND (Ground). This sensor has additional control circuitry that can prevent inconsistent “Bouncy” data depending on the application.
DL2310Mk01
1 x SparkFun Thing Plus – ESP32 WROOM
1 x DS3231 Precision RTC FeatherWing
1 x GPS Receiver – GP-20U7 (56 Channel)
1 x SparkFun 9DoF IMU Breakout – LSM9DS1
1 x Ultrasonic Distance Sensor – HC-SR04 (5V)
1 x Pololu 5V Step-Up Voltage Regulator U1V10F5
1 x Rocker Switch – SPST
1 x Resistor 10K Ohm
1 x CR1220 3V Lithium Coin Cell Battery
1 x 1 x Lithium Ion Battery – 1000mAh
1 x Terminal Block Breakout FeatherWing
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
LED – LED_BUILTIN
SDA – Digital 23
SCL – Digital 22
SW1 – Digital 21
GPT – Digital 17
GPR – Digital 16
TRI – Digital 15
ECH – Digital 14
VIN – +3.3V
VIN – +5V
GND – GND
——
DL2310Mk01p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #28 - Sensors - HC-SR04 - Mk12 28-12 DL2310Mk01p.ino 1 x SparkFun Thing Plus - ESP32 WROOM 1 x DS3231 Precision RTC FeatherWing 1 x GPS Receiver - GP-20U7 (56 Channel) 1 x SparkFun 9DoF IMU Breakout - LSM9DS1 1 x Ultrasonic Distance Sensor - HC-SR04 (5V) 1 x Pololu 5V Step-Up Voltage Regulator U1V10F5 1 x Rocker Switch - SPST 1 x Resistor 10K Ohm 1 x Lithium Ion Battery - 1000mAh 1 x CR1220 3V Lithium Coin Cell Battery 1 x Terminal Block Breakout FeatherWing 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Bluetooth LE keyboard #include <BleKeyboard.h> // Two Wire Interface (TWI/I2C) #include <Wire.h> // Serial Peripheral Interface #include <SPI.h> // DS3231 Precision RTC #include <RTClib.h> // GPS Receiver #include <TinyGPS++.h> // ESP32 Hardware Serial #include <HardwareSerial.h> // LSM9DS1 9DOF Sensor #include <SparkFunLSM9DS1.h> // Bluetooth LE Keyboard BleKeyboard bleKeyboard; String sKeyboard = ""; // Send Size byte sendSize = 0; // DS3231 Precision RTC RTC_DS3231 rtc; String dateRTC = ""; String timeRTC = ""; // GPS Receiver #define gpsRXPIN 16 // This one is unused and doesnt have a conection #define gpsTXPIN 17 // The TinyGPS++ object TinyGPSPlus gps; // Latitude float TargetLat; // Longitude float TargetLon; // GPS Date, Time // GPS Date String TargetDat; // GPS Time String TargetTim; // GPS Status String GPSSt = ""; // ESP32 HardwareSerial HardwareSerial tGPS(2); // LSM9DS1 9DOF Sensor LSM9DS1 imu; #define PRINT_CALCULATED // Earth's magnetic field varies by location. Add or subtract // a declination to get a more accurate heading. Calculate // your's here: http://www.ngdc.noaa.gov/geomag-web/#declination // Declination (degrees) in El Centro, CA #define DECLINATION 10.4 // Gyro float fGyroX; float fGyroY; float fGyroZ; // Accel float fAccelX; float fAccelY; float fAccelZ; // Mag float fMagX; float fMagY; float fMagZ; // Attitude float fRoll; float fPitch; float fHeading; // HC-SR04 Ultrasonic Sensor int iTrig = 15; int iEcho = 14; // Stores the distance measured by the distance sensor float distance = 0; // The number of the Rocker Switch pin int iSwitch = 21; // Variable for reading the button status int SwitchState = 0; // Software Version Information String sver = "28-12"; void loop() { // Date and Time RTC isRTC (); // isGPS isGPS(); // GPS Keyboard isGPSKeyboard(); // Gyro isGyro(); // Accel isAccel(); // Mag isMag(); // Attitude isAttitude(); // HC-SR04 Ultrasonic Sensor isHCSR04(); // Read the state of the Switch value: SwitchState = digitalRead(iSwitch); // Check if the button is pressed. If it is, the SwitchState is HIGH: if (SwitchState == HIGH) { // Bluetooth LE Keyboard isBluetooth(); } // Delay 1 Second delay(1000); }
getBleKeyboard.ino
// Ble Keyboard // Bluetooth // isBluetooth void isBluetooth() { // ESP32 BLE Keyboard if(bleKeyboard.isConnected()) { // Send Size Length sendSize = sKeyboard.length(); // Send Size, charAt for(byte i = 0; i < sendSize+1; i++){ // Write bleKeyboard.write(sKeyboard.charAt(i)); delay(50); } bleKeyboard.write(KEY_RETURN); } }
getGPS.ino
// GPS Receiver // Setup GPS void isSetupGPS() { // Setup GPS //tGPS.begin( 9600 ); // Setup GPS tGPS.begin( 9600 , SERIAL_8N1 , gpsRXPIN , gpsTXPIN ); } // isGPS void isGPS(){ // Receives NEMA data from GPS receiver // This sketch displays information every time a new sentence is correctly encoded while ( tGPS.available() > 0) if (gps.encode( tGPS.read() )) { // GPS Vector Pointer Target displayInfo(); // GPS Date, Time displayDTS(); } if (millis() > 5000 && gps.charsProcessed() < 10) { while(true); } } // GPS Vector Pointer Target void displayInfo(){ // Location if (gps.location.isValid()) { // Latitude TargetLat = gps.location.lat(); // Longitude TargetLon = gps.location.lng(); // GPS Status 2 GPSSt = "Yes"; } else { // GPS Status 0 GPSSt = "No"; TargetLat = 0; TargetLon = 0; } } // GPS Date, Time void displayDTS(){ // Date TargetDat = ""; if (gps.date.isValid()) { // Date // Year TargetDat += String(gps.date.year(), DEC); TargetDat += "/"; // Month TargetDat += String(gps.date.month(), DEC); TargetDat += "/"; // Day TargetDat += String(gps.date.day(), DEC); } // Time TargetTim = ""; if (gps.time.isValid()) { // Time // Hour TargetTim += String(gps.time.hour(), DEC); TargetTim += ":"; // Minute TargetTim += String(gps.time.minute(), DEC); TargetTim += ":"; // Secound TargetTim += String(gps.time.second(), DEC); } } // GPS Keyboard void isGPSKeyboard(){ // GPS Keyboard // bleKeyboard // GPS Vector Pointer Target sKeyboard = sKeyboard + GPSSt + "|" + String(TargetLat) + "|" + String(TargetLon) + "|"; // bleKeyboard // GPS Date, Time sKeyboard = sKeyboard + TargetDat + "|" + TargetTim + "|"; }
getHC-SR04.ino
// HC-SR04 Ultrasonic Sensor // Setup HC-SR04 void isSetupHCSR04() { // The trigger iTrig will output pulses of electricity pinMode(iTrig, OUTPUT); // The echo iEcho will measure the duration of pulses coming back from the distance sensor pinMode(iEcho, INPUT); } // HC-SR04 void isHCSR04() { // Variable to store the distance measured by the sensor distance = isDistance(); sKeyboard = sKeyboard + String(distance) + " cm|*"; } // Distance float isDistance() { // Variable to store the time it takes for a ping to bounce off an object float echoTime; // Variable to store the distance calculated from the echo time float calculatedDistance; // Send out an ultrasonic pulse that's 10ms long digitalWrite(iTrig, HIGH); delayMicroseconds(10); digitalWrite(iTrig, LOW); // Use the pulseIn command to see how long it takes for the // pulse to bounce back to the sensor echoTime = pulseIn(iEcho, HIGH); // Calculate the distance of the object that reflected the pulse // (half the bounce time multiplied by the speed of sound) // cm = 58.0 calculatedDistance = echoTime / 58.0; // Send back the distance that was calculated return calculatedDistance; }
getLSM9DS1.ino
// LSM9DS1 9DOF Sensor // Gyro void isGyro(){ // Update the sensor values whenever new data is available if ( imu.gyroAvailable() ) { // To read from the gyroscope, first call the // readGyro() function. When it exits, it'll update the // gx, gy, and gz variables with the most current data. imu.readGyro(); // If you want to print calculated values, you can use the // calcGyro helper function to convert a raw ADC value to // DPS. Give the function the value that you want to convert. fGyroX = imu.calcGyro(imu.gx); fGyroY = imu.calcGyro(imu.gy); fGyroZ = imu.calcGyro(imu.gz); // bleKeyboard // Gyro sKeyboard = sKeyboard + String(fGyroX) + "|" + String(fGyroY) + "|" + String(fGyroZ) + "|"; } } // Accel void isAccel(){ // Update the sensor values whenever new data is available if ( imu.accelAvailable() ) { // To read from the accelerometer, first call the // readAccel() function. When it exits, it'll update the // ax, ay, and az variables with the most current data. imu.readAccel(); // If you want to print calculated values, you can use the // calcAccel helper function to convert a raw ADC value to // g's. Give the function the value that you want to convert. fAccelX = imu.calcAccel(imu.ax); fAccelY = imu.calcAccel(imu.ay); fAccelZ = imu.calcAccel(imu.az); // bleKeyboard // Accel sKeyboard = sKeyboard + String(fAccelX) + "|" + String(fAccelY) + "|" + String(fAccelZ) + "|"; } } // Mag void isMag(){ // Update the sensor values whenever new data is available if ( imu.magAvailable() ) { // To read from the magnetometer, first call the // readMag() function. When it exits, it'll update the // mx, my, and mz variables with the most current data. imu.readMag(); // If you want to print calculated values, you can use the // calcMag helper function to convert a raw ADC value to // Gauss. Give the function the value that you want to convert. fMagX = imu.calcMag(imu.mx); fMagY = imu.calcMag(imu.my); fMagZ = imu.calcMag(imu.mz); // bleKeyboard // Mag sKeyboard = sKeyboard + String(fMagX) + "|" + String(fMagY) + "|" + String(fMagZ) + "|"; } } // Attitude void isAttitude(){ // Attitude // Roll fRoll = atan2(fAccelY, fAccelZ); // Pitch fPitch = atan2(-fAccelX, sqrt(fAccelY * fAccelY + fAccelZ * fAccelZ)); // Heading if (fMagY == 0) { fHeading = (fMagX < 0) ? PI : 0; } else { fHeading = atan2(fMagX, fMagY); } fHeading -= DECLINATION * PI / 180; if (fHeading > PI) fHeading -= (2 * PI); else if (fHeading < -PI) fHeading += (2 * PI); // Convert everything from radians to degrees: fHeading *= 180.0 / PI; fPitch *= 180.0 / PI; fRoll *= 180.0 / PI; // bleKeyboard // Attitude sKeyboard = sKeyboard + String(fHeading) + "|" + String(fPitch) + "|" + String(fRoll) + "|"; }
getRTC.ino
// Date & Time // DS3231 Precision RTC void isSetupRTC() { // DS3231 Precision RTC if (! rtc.begin()) { //Serial.println("Couldn't find RTC"); //Serial.flush(); while (1) delay(10); } if (rtc.lostPower()) { //Serial.println("RTC lost power, let's set the time!"); // When time needs to be set on a new device, or after a power loss, the // following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: //rtc.adjust(DateTime(2023, 8, 10, 11, 0, 0)); } } // Date and Time RTC void isRTC () { // Date and Time dateRTC = ""; timeRTC = ""; DateTime now = rtc.now(); // Date dateRTC = now.year(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.month(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.day(), DEC; // Time timeRTC = now.hour(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.minute(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.second(), DEC; // bleKeyboard sKeyboard = "SEN|" + sver + "|" + String(dateRTC) + "|" + String(timeRTC) + "|"; }
setup.ino
// Setup void setup() { // Give display time to power on delay(100); // Bluetooth LE keyboard bleKeyboard.begin(); // Wire - Inialize I2C Hardware Wire.begin(); // Give display time to power on delay(100); // Date & Time RTC // DS3231 Precision RTC isSetupRTC(); // Give display time to power on delay(100); // GPS Receiver // Setup GPS isSetupGPS(); // LSM9DS1 9DOF Sensor imu.begin(); // Setup HC-SR04 isSetupHCSR04(); // Initialize the Switch pin as an input pinMode(iSwitch, INPUT); // Initialize digital pin LED_BUILTIN as an output pinMode(LED_BUILTIN, OUTPUT); // Turn the LED on HIGH digitalWrite(LED_BUILTIN, HIGH); // Delay 5 Second delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Teacher, Instructor, E-Mentor, R&D and Consulting
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Automation
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- Artificial Intelligence (AI)
- RTOS
- eHealth Sensors, Biosensor, and Biometric
- Research & Development (R & D)
- Consulting
Follow Us
Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #28 – Sensors – LSM9DS1 – Mk11
——
#DonLucElectronics #DonLuc #Sensors #LSM9DS1 #IMU #GPSReceiver #Adafruit #SparkFun #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
SparkFun 9DoF IMU Breakout – LSM9DS1
The SparkFun LSM9DS1 Breakout is a versatile, motion-sensing System-In-A-Chip. It houses a 3-axis accelerometer, 3-axis gyroscope, and 3-axis magnetometer, nine degrees of freedom (9DOF) on a single board. The LSM9DS1 from STMicroelectronics is equipped with a digital interface, but even that is flexible. This IMU-In-A-Chip is so cool we put it on the quarter-sized breakout board you are currently viewing.
The LSM9DS1 is one of only a handful of IC’s that can measure three key properties of movement, angular velocity, acceleration, and heading, in a single IC. By measuring these three properties, you can gain a great deal of knowledge about an object’s movement and orientation. The LSM9DS1 measures each of these movement properties in three dimensions. That means it produces nine pieces of data: acceleration in x/y/z, angular rotation in x/y/z, and magnetic force in x/y/z. The LSM9DS1 Breakout has labels indicating the accelerometer and gyroscope axis orientations, which share a right-hand rule relationship with each other.
DL2309Mk05
1 x SparkFun Thing Plus – ESP32 WROOM
1 x DS3231 Precision RTC FeatherWing
1 x GPS Receiver – GP-20U7 (56 Channel)
1 x SparkFun 9DoF IMU Breakout – LSM9DS1
1 x Rocker Switch – SPST
1 x Resistor 10K Ohm
1 x CR1220 3V Lithium Coin Cell Battery
1 x 1 x Lithium Ion Battery – 1000mAh
1 x Terminal Block Breakout FeatherWing
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
LED – LED_BUILTIN
SDA – Digital 23
SCL – Digital 22
SW1 – Digital 21
GPT – Digital 17
GPR – Digital 16
VIN – +3.3V
GND – GND
——
DL2309Mk05p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #28 - Sensors - LSM9DS1 - Mk11 28-11 DL2309Mk05p.ino 1 x SparkFun Thing Plus - ESP32 WROOM 1 x DS3231 Precision RTC FeatherWing 1 x GPS Receiver - GP-20U7 (56 Channel) 1 x SparkFun 9DoF IMU Breakout - LSM9DS1 1 x Rocker Switch - SPST 1 x Resistor 10K Ohm 1 x Lithium Ion Battery - 1000mAh 1 x CR1220 3V Lithium Coin Cell Battery 1 x Terminal Block Breakout FeatherWing 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Bluetooth LE keyboard #include <BleKeyboard.h> // Two Wire Interface (TWI/I2C) #include <Wire.h> // Serial Peripheral Interface #include <SPI.h> // DS3231 Precision RTC #include <RTClib.h> // GPS Receiver #include <TinyGPS++.h> // ESP32 Hardware Serial #include <HardwareSerial.h> // LSM9DS1 9DOF Sensor #include <SparkFunLSM9DS1.h> // Bluetooth LE Keyboard BleKeyboard bleKeyboard; String sKeyboard = ""; // Send Size byte sendSize = 0; // DS3231 Precision RTC RTC_DS3231 rtc; String dateRTC = ""; String timeRTC = ""; // GPS Receiver #define gpsRXPIN 16 // This one is unused and doesnt have a conection #define gpsTXPIN 17 // The TinyGPS++ object TinyGPSPlus gps; // Latitude float TargetLat; // Longitude float TargetLon; // GPS Date, Time // GPS Date String TargetDat; // GPS Time String TargetTim; // GPS Status String GPSSt = ""; // ESP32 HardwareSerial HardwareSerial tGPS(2); // LSM9DS1 9DOF Sensor LSM9DS1 imu; #define PRINT_CALCULATED // Earth's magnetic field varies by location. Add or subtract // a declination to get a more accurate heading. Calculate // your's here: http://www.ngdc.noaa.gov/geomag-web/#declination // Declination (degrees) in El Centro, CA #define DECLINATION 10.4 // Gyro float fGyroX; float fGyroY; float fGyroZ; // Accel float fAccelX; float fAccelY; float fAccelZ; // Mag float fMagX; float fMagY; float fMagZ; // Attitude float fRoll; float fPitch; float fHeading; // The number of the Rocker Switch pin int iSwitch = 21; // Variable for reading the button status int SwitchState = 0; // Software Version Information String sver = "28-11"; void loop() { // Date and Time RTC isRTC (); // isGPS isGPS(); // GPS Keyboard isGPSKeyboard(); // Gyro isGyro(); // Accel isAccel(); // Mag isMag(); // Attitude isAttitude(); // Read the state of the Switch value: SwitchState = digitalRead(iSwitch); // Check if the button is pressed. If it is, the SwitchState is HIGH: if (SwitchState == HIGH) { // Bluetooth LE Keyboard isBluetooth(); } // Delay 1 Second delay(1000); }
getBleKeyboard.ino
// Ble Keyboard // Bluetooth // isBluetooth void isBluetooth() { // ESP32 BLE Keyboard if(bleKeyboard.isConnected()) { // Send Size Length sendSize = sKeyboard.length(); // Send Size, charAt for(byte i = 0; i < sendSize+1; i++){ // Write bleKeyboard.write(sKeyboard.charAt(i)); delay(50); } bleKeyboard.write(KEY_RETURN); } }
getGPS.ino
// GPS Receiver // Setup GPS void setupGPS() { // Setup GPS //tGPS.begin( 9600 ); // Setup GPS tGPS.begin( 9600 , SERIAL_8N1 , gpsRXPIN , gpsTXPIN ); } // isGPS void isGPS(){ // Receives NEMA data from GPS receiver // This sketch displays information every time a new sentence is correctly encoded while ( tGPS.available() > 0) if (gps.encode( tGPS.read() )) { // GPS Vector Pointer Target displayInfo(); // GPS Date, Time displayDTS(); } if (millis() > 5000 && gps.charsProcessed() < 10) { while(true); } } // GPS Vector Pointer Target void displayInfo(){ // Location if (gps.location.isValid()) { // Latitude TargetLat = gps.location.lat(); // Longitude TargetLon = gps.location.lng(); // GPS Status 2 GPSSt = "Yes"; } else { // GPS Status 0 GPSSt = "No"; TargetLat = 0; TargetLon = 0; } } // GPS Date, Time void displayDTS(){ // Date TargetDat = ""; if (gps.date.isValid()) { // Date // Year TargetDat += String(gps.date.year(), DEC); TargetDat += "/"; // Month TargetDat += String(gps.date.month(), DEC); TargetDat += "/"; // Day TargetDat += String(gps.date.day(), DEC); } // Time TargetTim = ""; if (gps.time.isValid()) { // Time // Hour TargetTim += String(gps.time.hour(), DEC); TargetTim += ":"; // Minute TargetTim += String(gps.time.minute(), DEC); TargetTim += ":"; // Secound TargetTim += String(gps.time.second(), DEC); } } // GPS Keyboard void isGPSKeyboard(){ // GPS Keyboard // bleKeyboard // GPS Vector Pointer Target sKeyboard = sKeyboard + GPSSt + "|" + String(TargetLat) + "|" + String(TargetLon) + "|"; // bleKeyboard // GPS Date, Time sKeyboard = sKeyboard + TargetDat + "|" + TargetTim + "|"; }
getLSM9DS1.ino
// LSM9DS1 9DOF Sensor // Gyro void isGyro(){ // Update the sensor values whenever new data is available if ( imu.gyroAvailable() ) { // To read from the gyroscope, first call the // readGyro() function. When it exits, it'll update the // gx, gy, and gz variables with the most current data. imu.readGyro(); // If you want to print calculated values, you can use the // calcGyro helper function to convert a raw ADC value to // DPS. Give the function the value that you want to convert. fGyroX = imu.calcGyro(imu.gx); fGyroY = imu.calcGyro(imu.gy); fGyroZ = imu.calcGyro(imu.gz); // bleKeyboard // Gyro sKeyboard = sKeyboard + String(fGyroX) + "|" + String(fGyroY) + "|" + String(fGyroZ) + "|"; } } // Accel void isAccel(){ // Update the sensor values whenever new data is available if ( imu.accelAvailable() ) { // To read from the accelerometer, first call the // readAccel() function. When it exits, it'll update the // ax, ay, and az variables with the most current data. imu.readAccel(); // If you want to print calculated values, you can use the // calcAccel helper function to convert a raw ADC value to // g's. Give the function the value that you want to convert. fAccelX = imu.calcAccel(imu.ax); fAccelY = imu.calcAccel(imu.ay); fAccelZ = imu.calcAccel(imu.az); // bleKeyboard // Accel sKeyboard = sKeyboard + String(fAccelX) + "|" + String(fAccelY) + "|" + String(fAccelZ) + "|"; } } // Mag void isMag(){ // Update the sensor values whenever new data is available if ( imu.magAvailable() ) { // To read from the magnetometer, first call the // readMag() function. When it exits, it'll update the // mx, my, and mz variables with the most current data. imu.readMag(); // If you want to print calculated values, you can use the // calcMag helper function to convert a raw ADC value to // Gauss. Give the function the value that you want to convert. fMagX = imu.calcMag(imu.mx); fMagY = imu.calcMag(imu.my); fMagZ = imu.calcMag(imu.mz); // bleKeyboard // Mag sKeyboard = sKeyboard + String(fMagX) + "|" + String(fMagY) + "|" + String(fMagZ) + "|"; } } // Attitude void isAttitude(){ // Attitude // Roll fRoll = atan2(fAccelY, fAccelZ); // Pitch fPitch = atan2(-fAccelX, sqrt(fAccelY * fAccelY + fAccelZ * fAccelZ)); // Heading if (fMagY == 0) { fHeading = (fMagX < 0) ? PI : 0; } else { fHeading = atan2(fMagX, fMagY); } fHeading -= DECLINATION * PI / 180; if (fHeading > PI) fHeading -= (2 * PI); else if (fHeading < -PI) fHeading += (2 * PI); // Convert everything from radians to degrees: fHeading *= 180.0 / PI; fPitch *= 180.0 / PI; fRoll *= 180.0 / PI; // bleKeyboard // Attitude sKeyboard = sKeyboard + String(fHeading) + "|" + String(fPitch) + "|" + String(fRoll) + "|*"; }
getRTC.ino
// Date & Time // DS3231 Precision RTC void setupRTC() { // DS3231 Precision RTC if (! rtc.begin()) { //Serial.println("Couldn't find RTC"); //Serial.flush(); while (1) delay(10); } if (rtc.lostPower()) { //Serial.println("RTC lost power, let's set the time!"); // When time needs to be set on a new device, or after a power loss, the // following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: //rtc.adjust(DateTime(2023, 8, 10, 11, 0, 0)); } } // Date and Time RTC void isRTC () { // Date and Time dateRTC = ""; timeRTC = ""; DateTime now = rtc.now(); // Date dateRTC = now.year(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.month(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.day(), DEC; // Time timeRTC = now.hour(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.minute(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.second(), DEC; // bleKeyboard sKeyboard = "SEN|" + sver + "|" + String(dateRTC) + "|" + String(timeRTC) + "|"; }
setup.ino
// Setup void setup() { // Give display time to power on delay(100); // Bluetooth LE keyboard bleKeyboard.begin(); // Wire - Inialize I2C Hardware Wire.begin(); // Give display time to power on delay(100); // Date & Time RTC // DS3231 Precision RTC setupRTC(); // Give display time to power on delay(100); // GPS Receiver // Setup GPS setupGPS(); // LSM9DS1 9DOF Sensor imu.begin(); // Initialize the Switch pin as an input pinMode(iSwitch, INPUT); // Initialize digital pin LED_BUILTIN as an output pinMode(LED_BUILTIN, OUTPUT); // Turn the LED on HIGH digitalWrite(LED_BUILTIN, HIGH); // Delay 5 Second delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Teacher, Instructor, E-Mentor, R&D and Consulting
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi, Arm, Silicon Labs, Espressif, Etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Automation
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- Artificial Intelligence (AI)
- RTOS
- eHealth Sensors, Biosensor, and Biometric
- Research & Development (R & D)
- Consulting
Follow Us
Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #28 – Sensors – GPS Receiver GP-20U7 – Mk10
——
#DonLucElectronics #DonLuc #Sensors #GPSReceiver #Adafruit #SparkFun #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
GPS Receiver – GP-20U7
The GP-20U7 is a compact GPS receiver with a built-in high performances All-In-One GPS chipset. The GP-20U7 accurately provides position, velocity, and time readings as well possessing high sensitivity and tracking capabilities. Thanks to the low power consumption this receiver requires, the GP-20U7 is ideal for portable applications such as tablet PCs, smart phones, and other devices requiring positioning capability. This 56-Channel GPS module, that supports a standard NMEA-0183 and uBlox 7 protocol, has low power consumption of 40mA@3.3V (max), an antenna on board, and -162dBm tracking sensitivity. With 56 channels in search mode and 22 channels “All-In-View” tracking, the GP-20U7 is quite the work horse for its size.
DL2309Mk04
1 x Fio v3 – ATmega32U4
1 x DS3231 Precision RTC FeatherWing
1 x GPS Receiver – GP-20U7 (56 Channel)
1 x Rocker Switch – SPST
1 x Resistor 10K Ohm
1 x CR1220 3V Lithium Coin Cell Battery
1 x SparkFun Cerberus USB Cable
Fio v3 – ATmega32U4
LED – LED_BUILTIN
SDA – Digital 2
SCL – Digital 3
SW1 – Digital 6
GPT – Digital 7
GPR – Digital 9
VIN – +3.3V
GND – GND
——
DL2309Mk04p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #28 - Sensors - GPS Receiver GP-20U7 - Mk10 28-10 DL2309Mk04p.ino 1 x Fio v3 - ATmega32U4 1 x DS3231 Precision RTC FeatherWing 1 x GPS Receiver - GP-20U7 (56 Channel) 1 x Rocker Switch - SPST 1 x Resistor 10K Ohm 1 x CR1220 3V Lithium Coin Cell Battery 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // DS3231 Precision RTC #include <RTClib.h> // Two Wire Interface (TWI/I2C) #include <Wire.h> // Keyboard #include <Keyboard.h> // GPS Receiver #include <TinyGPS++.h> // Software Serial #include <SoftwareSerial.h> // Keyboard String sKeyboard = ""; // DS3231 Precision RTC RTC_DS3231 rtc; String dateRTC = ""; String timeRTC = ""; // GPS Receiver #define gpsRXPIN 9 // This one is unused and doesnt have a conection #define gpsTXPIN 7 // The TinyGPS++ object TinyGPSPlus gps; // Latitude float TargetLat; // Longitude float TargetLon; // GPS Date, Time // GPS Date String TargetDat; // GPS Time String TargetTim; // GPS Status String GPSSt = ""; // The serial connection to the GPS device SoftwareSerial tGPS(gpsRXPIN, gpsTXPIN); // The number of the Rocker Switch pin int iSwitch = 6; // Variable for reading the button status int SwitchState = 0; // Software Version Information String sver = "28-10"; void loop() { // Date and Time RTC isRTC (); // isGPS isGPS(); // GPS Keyboard isGPSKeyboard(); // Read the state of the Switch value: SwitchState = digitalRead(iSwitch); // Check if the button is pressed. If it is, the SwitchState is HIGH: if (SwitchState == HIGH) { Keyboard.println(sKeyboard); } // Delay 1 Second delay(1000); }
getGPS.ino
// GPS Receiver // Setup GPS void setupGPS() { // Setup GPS tGPS.begin( 9600 ); } // isGPS void isGPS(){ // Receives NEMA data from GPS receiver // This sketch displays information every time a new sentence is correctly encoded while ( tGPS.available() > 0) if (gps.encode( tGPS.read() )) { // GPS Vector Pointer Target displayInfo(); // GPS Date, Time displayDTS(); } if (millis() > 5000 && gps.charsProcessed() < 10) { while(true); } } // GPS Vector Pointer Target void displayInfo(){ // Location if (gps.location.isValid()) { // Latitude TargetLat = gps.location.lat(); // Longitude TargetLon = gps.location.lng(); // GPS Status 2 GPSSt = "Yes"; } else { // GPS Status 0 GPSSt = "No"; TargetLat = 0; TargetLon = 0; } } // GPS Date, Time void displayDTS(){ // Date TargetDat = ""; if (gps.date.isValid()) { // Date // Year TargetDat += String(gps.date.year(), DEC); TargetDat += "/"; // Month TargetDat += String(gps.date.month(), DEC); TargetDat += "/"; // Day TargetDat += String(gps.date.day(), DEC); } // Time TargetTim = ""; if (gps.time.isValid()) { // Time // Hour TargetTim += String(gps.time.hour(), DEC); TargetTim += ":"; // Minute TargetTim += String(gps.time.minute(), DEC); TargetTim += ":"; // Secound TargetTim += String(gps.time.second(), DEC); } } // GPS Keyboard void isGPSKeyboard(){ // GPS Keyboard // Keyboard // GPS Vector Pointer Target sKeyboard = sKeyboard + GPSSt + "|" + String(TargetLat) + "|" + String(TargetLon) + "|"; // Keyboard // GPS Date, Time sKeyboard = sKeyboard + TargetDat + "|" + TargetTim + "|*"; }
getRTC.ino
// Date & Time // DS3231 Precision RTC void setupRTC() { // DS3231 Precision RTC if (! rtc.begin()) { //Serial.println("Couldn't find RTC"); //Serial.flush(); while (1) delay(10); } if (rtc.lostPower()) { //Serial.println("RTC lost power, let's set the time!"); // When time needs to be set on a new device, or after a power loss, the // following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: //rtc.adjust(DateTime(2023, 8, 10, 11, 0, 0)); } } // Date and Time RTC void isRTC () { // Date and Time dateRTC = ""; timeRTC = ""; DateTime now = rtc.now(); // Date dateRTC = now.year(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.month(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.day(), DEC; // Time timeRTC = now.hour(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.minute(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.second(), DEC; // Keyboard sKeyboard = "SEN|" + sver + "|" + String(dateRTC) + "|" + String(timeRTC) + "|"; }
setup.ino
// Setup void setup() { // Give display time to power on delay(100); // Wire - Inialize I2C Hardware Wire.begin(); // Give display time to power on delay(100); // Date & Time RTC // DS3231 Precision RTC setupRTC(); // Initialize control over the keyboard: Keyboard.begin(); // Give display time to power on delay(100); // GPS Receiver // Setup GPS setupGPS(); // Initialize the Switch pin as an input pinMode(iSwitch, INPUT); // Initialize digital pin LED_BUILTIN as an output pinMode(LED_BUILTIN, OUTPUT); // Turn the LED on HIGH digitalWrite(LED_BUILTIN, HIGH); // Delay 5 Second delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- RTOS
- Research & Development (R & D)
Instructor, E-Mentor, STEAM, and Arts-Based Training
- Programming Language
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #28 – Sensors – SparkFun Environmental Combo CCS811/BME280 – Mk09
——
#DonLucElectronics #DonLuc #Sensors #CCS811 #BME280 #TSOP85 #TMP102 #LineSensor #AlcoholGasSensor #MinIMU9 #Pololu #Adafruit #SparkFun #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
SparkFun Environmental Combo – CCS811/BME280
The SparkFun CCS811/BME280 Environmental Combo Breakout takes care of all your atmospheric-quality sensing needs with the popular CCS811 and BME280 ICs. This unique breakout provides a variety of environmental data, including barometric pressure, humidity, temperature, TVOCs and equivalent eCO2 levels.
The CCS811 is an exceedingly popular sensor, providing readings for equivalent eCO2 in the parts per million (PPM) and total volatile organic compounds in the parts per billion (PPB). The CCS811 also has a feature that allows it to fine-tune its readings if it has access to the current humidity and temperature. Luckily for us, the BME280 provides humidity, temperature and barometric pressure. This allows the sensors to work together to give us more accurate readings than they’d be able to provide on their own. We also made it easy to interface with them via I2C.
DL2309Mk03
1 x Adafruit METRO M0 Express
1 x DS3231 Precision RTC FeatherWing
1 x Pololu MinIMU-9 v5 Gyro, Accelerometer, and Compass
1 x Pololu Carrier for MQ Gas Sensors
1 x Alcohol Gas Sensor – MQ-3
1 x SparkFun Line Sensor – QRE1113
1 x SparkFun Digital Temperature Sensor – TMP102
1 x SparkFun IR Receiver – TSOP85
1 x SparkFun Environmental Combo – CCS811/BME280
1 x LED Red
1 x ProtoScrewShield
1 x Rocker Switch – SPST
2 x Resistor 10K Ohm
1 x CR1220 3V Lithium Coin Cell Battery
1 x SparkFun Cerberus USB Cable
Adafruit METRO M0 Express
LED – LED_BUILTIN
SDA – Digital 20
SCL – Digital 21
IRR – Digital 11
LER – Digital 3
SW1 – Digital 2
MQ3 – Analog 0
LSB – Analog 1
ALE = Analog 3
VIN – +3.3V
VIN – +5V
GND – GND
——
DL2309Mk03p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #28 - Sensors - SparkFun Environmental Combo CCS811/BME280 - Mk09 28-09 DL2309Mk03p.ino 1 x Adafruit METRO M0 Express 1 x DS3231 Precision RTC FeatherWing 1 x Pololu MinIMU-9 v5 Gyro, Accelerometer, and Compass 1 x Pololu Carrier for MQ Gas Sensors 1 x Alcohol Gas Sensor - MQ-3 1 x SparkFun Line Sensor - QRE1113 1 x SparkFun Digital Temperature Sensor - TMP102 1 x SparkFun IR Receiver - TSOP85 1 x SparkFun Environmental Combo - CCS811/BME280 1 x LED Red 1 x ProtoScrewShield 1 x Rocker Switch - SPST 2 x Resistor 10K Ohm 1 x CR1220 3V Lithium Coin Cell Battery 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // DS3231 Precision RTC #include <RTClib.h> // Two Wire Interface (TWI/I2C) #include <Wire.h> // Keyboard #include <Keyboard.h> // Includes and variables for IMU integration // STMicroelectronics LSM6DS33 Gyroscope and Accelerometer #include <LSM6.h> // STMicroelectronics LIS3MDL Magnetometer #include <LIS3MDL.h> // SparkFun Digital Temperature Sensor TMP102 #include <SparkFunTMP102.h> // SparkFun IR Receiver - TSOP85 #include <IRremote.h> // SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude #include <SparkFunBME280.h> // SparkFun CCS811 - eCO2 & tVOC #include <SparkFunCCS811.h> // Keyboard String sKeyboard = ""; // DS3231 Precision RTC RTC_DS3231 rtc; String dateRTC = ""; String timeRTC = ""; // Pololu 9DoF IMU // STMicroelectronics LSM6DS33 Gyroscope and Accelerometer LSM6 imu; // Accelerometer and Gyroscopes // Accelerometer int imuAX; int imuAY; int imuAZ; // Gyroscopes int imuGX; int imuGY; int imuGZ; // STMicroelectronics LIS3MDL Magnetometer LIS3MDL mag; // Magnetometer int magX; int magY; int magZ; // Gas Sensors MQ // Alcohol Gas Sensor - MQ-3 int iMQ3 = A0; int iMQ3Raw = 0; int iMQ3ppm = 0; // SparkFun Line Sensor - QRE1113 (Analog) int iLine = A1; int iLineSensor = 0; // SparkFun Digital Temperature Sensor TMP102 const int ALERT_PIN = A3; TMP102 sensor0; float temperature; boolean alertPinState; boolean alertRegisterState; // SparkFun IR Receiver - TSOP85 int RECV_PIN = 11; IRrecv irrecv(RECV_PIN); decode_results results; String IRValue = ""; int iLEDRed = 3; // SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude BME280 myBME280; float BMEtempC = 0; float BMEhumid = 0; float BMEpressure = 0; float BMEaltitudeM = 0; // SparkFun CCS811 - eCO2 & tVOC // Default I2C Address #define CCS811_ADDR 0x5B CCS811 myCCS811(CCS811_ADDR); float CCS811CO2 = 0; float CCS811TVOC = 0; // The number of the Rocker Switch pin int iSwitch = 2; // Variable for reading the button status int SwitchState = 0; // Software Version Information String sver = "28-09"; void loop() { // Date and Time RTC isRTC (); // Pololu Accelerometer and Gyroscopes isIMU(); // Pololu Magnetometer isMag(); // Gas Sensors MQ isGasSensor(); // SparkFun Line Sensor isLineSensor(); // SparkFun Temperature TMP102 isTMP102(); // SparkFun IR Receiver - TSOP85 isIR(); // SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude isBME280(); // SparkFun CCS811 - eCO2 & tVOC isCCS811(); // Read the state of the Switch value: SwitchState = digitalRead(iSwitch); // Check if the button is pressed. If it is, the SwitchState is HIGH: if (SwitchState == HIGH) { Keyboard.println(sKeyboard); } // Delay 1 Second delay(1000); }
getAccelGyro.ino
// Accelerometer and Gyroscopes // Setup IMU void setupIMU() { // Setup IMU imu.init(); // Default imu.enableDefault(); } // Accelerometer and Gyroscopes void isIMU() { // Accelerometer and Gyroscopes imu.read(); // Accelerometer x, y, z imuAX = imu.a.x; imuAY = imu.a.y; imuAZ = imu.a.z; // Gyroscopes x, y, z imuGX = imu.g.x; imuGY = imu.g.y; imuGZ = imu.g.z; // Keyboard sKeyboard = sKeyboard + String(imuAX) + "|" + String(imuAY) + "|" + String(imuAZ) + "|"; sKeyboard = sKeyboard + String(imuGX) + "|" + String(imuGY) + "|" + String(imuGZ) + "|"; }
getBME280.ino
// SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude // isBME280 - Temperature, Humidity, Barometric Pressure, and Altitude void isBME280(){ // Temperature Celsius BMEtempC = myBME280.readTempC(); // Humidity BMEhumid = myBME280.readFloatHumidity(); // Barometric Pressure BMEpressure = myBME280.readFloatPressure(); // Altitude Meters BMEaltitudeM = (myBME280.readFloatAltitudeMeters(), 2); // Keyboard sKeyboard = sKeyboard + String(BMEtempC) + "|" + String(BMEhumid) + "|" + String(BMEpressure) + "|" + String(BMEaltitudeM) + "|"; }
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(); // Keyboard sKeyboard = sKeyboard + String(CCS811CO2) + "|" + String(CCS811TVOC) + "|*"; }
getGasSensorMQ.ino
// Gas Sensors MQ // Gas Sensor void isGasSensor() { // Read in analog value from each gas sensors // Alcohol Gas Sensor - MQ-3 iMQ3ppm = isMQ3( iMQ3Raw ); // Keyboard sKeyboard = sKeyboard + String(iMQ3ppm) + "|"; } // Alcohol Gas Sensor - MQ-3 int isMQ3(double rawValue) { double RvRo = rawValue; // % BAC = breath mg/L * 0.21 double bac = RvRo * 0.21; return bac; }
getIMUMagnetometer.ino
// IMU Magnetometer // Setup Magnetometer void setupMag() { // Setup Magnetometer mag.init(); // Default mag.enableDefault(); } // Magnetometer void isMag() { // Magnetometer mag.read(); // Magnetometer x, y, z magX = mag.m.x; magY = mag.m.y; magZ = mag.m.z; // Keyboard sKeyboard = sKeyboard + String(magX) + "|" + String(magY) + "|" + String(magZ) + "|"; }
getIRRemote.ino
// SparkFun IR Receiver - TSOP85 // Setup void isSetupIR(){ // Initialize digital pin LED Red as an output pinMode(iLEDRed, OUTPUT); // Start the receiver irrecv.enableIRIn(); } // void isIR(){ if (irrecv.decode(&results)) { // LED Red HIGH digitalWrite(iLEDRed, HIGH); //Serial.print("IR RECV Code = 0x "); //Serial.println(results.value, HEX); IRValue = "0x "; IRValue = IRValue + String(results.value, HEX); // LED Red LOW digitalWrite(iLEDRed, LOW); // IR Resume irrecv.resume(); } else { IRValue = "0"; } // Keyboard sKeyboard = sKeyboard + String(IRValue) + "|"; }
getLineSensor.ino
// Line Sensor // isLine Sensor void isLineSensor(){ // Line Sensor iLineSensor = analogRead(iLine); // Keyboard sKeyboard = sKeyboard + String(iLineSensor) + "|"; }
getRTC.ino
// Date & Time // DS3231 Precision RTC void setupRTC() { // DS3231 Precision RTC if (! rtc.begin()) { //Serial.println("Couldn't find RTC"); //Serial.flush(); while (1) delay(10); } if (rtc.lostPower()) { //Serial.println("RTC lost power, let's set the time!"); // When time needs to be set on a new device, or after a power loss, the // following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: //rtc.adjust(DateTime(2023, 8, 10, 11, 0, 0)); } } // Date and Time RTC void isRTC () { // Date and Time dateRTC = ""; timeRTC = ""; DateTime now = rtc.now(); // Date dateRTC = now.year(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.month(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.day(), DEC; // Time timeRTC = now.hour(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.minute(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.second(), DEC; // Keyboard sKeyboard = "SEN|" + sver + "|" + String(dateRTC) + "|" + String(timeRTC) + "|"; }
getTempTMP102.ino
// SparkFun Digital Temperature Sensor TMP102 // Setup TMP102 void isSetupTMP102(){ // Declare alertPin as an input pinMode(ALERT_PIN,INPUT); // Begin //It will return true on success or false on failure to communicate if(!sensor0.begin()) { while(1); } // set the Conversion Rate //0-3: 0:0.25Hz, 1:1Hz, 2:4Hz, 3:8Hz sensor0.setConversionRate(2); //set Extended Mode. //0:12-bit Temperature(-55C to +128C) 1:13-bit Temperature(-55C to +150C) sensor0.setExtendedMode(0); // Set T_HIGH, the upper limit to trigger the alert on // Set T_HIGH in C sensor0.setHighTempC(29.4); // Set T_LOW, the lower limit to shut turn off the alert // set T_LOW in C sensor0.setLowTempC(27.67); } // is TMP102 void isTMP102(){ // Turn sensor on to start temperature measurement. // Current consumtion typically ~10uA. sensor0.wakeup(); // read temperature data C temperature = sensor0.readTempC(); // Check for Alert // Read the Alert from pin alertPinState = digitalRead(ALERT_PIN); // Read the Alert from register alertRegisterState = sensor0.alert(); // Place sensor in sleep mode to save power. // Current consumtion typically <0.5uA. sensor0.sleep(); // Keyboard sKeyboard = sKeyboard + String(temperature) + "|" + String(alertPinState) + "|" + String(alertRegisterState) + "|"; }
setup.ino
// Setup void setup() { // Give display time to power on delay(100); // Wire - Inialize I2C Hardware Wire.begin(); // Give display time to power on delay(100); // Date & Time RTC // DS3231 Precision RTC setupRTC(); // Initialize control over the keyboard: Keyboard.begin(); // Pololu Setup IMU setupIMU(); // Pololu Setup Magnetometer setupMag(); // Setup TMP102 isSetupTMP102(); // SetupTSOP85 isSetupIR(); // SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude myBME280.begin(); // CCS811 - eCO2 & tVOC myCCS811.begin(); // Initialize the Switch pin as an input pinMode(iSwitch, INPUT); // Initialize digital pin LED_BUILTIN as an output pinMode(LED_BUILTIN, OUTPUT); // Turn the LED on HIGH digitalWrite(LED_BUILTIN, HIGH); // Delay 5 Second delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- RTOS
- Research & Development (R & D)
Instructor, E-Mentor, STEAM, and Arts-Based Training
- Programming Language
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #28 – Sensors – SparkFun IR Receiver TSOP85 – Mk08
——
#DonLucElectronics #DonLuc #Sensors #TMP102 #LineSensor #AlcoholGasSensor #MinIMU9 #Pololu #Adafruit #SparkFun #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
SparkFun IR Receiver – TSOP85
This is a very small infrared receiver based on the TSOP85 receiver from Vishay. This receiver has all the filtering and 38kHz demodulation built into the unit. Simply point a IR remote at the receiver, hit a button, and you’ll see a stream of 1s and 0s out of the data pin.
DL2309Mk02
1 x Adafruit METRO M0 Express
1 x DS3231 Precision RTC FeatherWing
1 x Pololu MinIMU-9 v5 Gyro, Accelerometer, and Compass
1 x Pololu Carrier for MQ Gas Sensors
1 x Alcohol Gas Sensor – MQ-3
1 x SparkFun Line Sensor – QRE1113
1 x SparkFun Digital Temperature Sensor – TMP102
1 x SparkFun IR Receiver – TSOP85
1 x LED Red
1 x ProtoScrewShield
1 x Rocker Switch – SPST
2 x Resistor 10K Ohm
1 x CR1220 3V Lithium Coin Cell Battery
1 x SparkFun Cerberus USB Cable
Adafruit METRO M0 Express
LED – LED_BUILTIN
SDA – Digital 20
SCL – Digital 21
IRR – Digital 11
LER – Digital 3
SW1 – Digital 2
MQ3 – Analog 0
LSB – Analog 1
ALE = Analog 3
VIN – +3.3V
VIN – +5V
GND – GND
——
DL2309Mk02p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #28 - Sensors - SparkFun IR Receiver TSOP85 - Mk08 28-08 DL2309Mk02p.ino 1 x Adafruit METRO M0 Express 1 x DS3231 Precision RTC FeatherWing 1 x Pololu MinIMU-9 v5 Gyro, Accelerometer, and Compass 1 x Pololu Carrier for MQ Gas Sensors 1 x Alcohol Gas Sensor - MQ-3 1 x SparkFun Line Sensor - QRE1113 1 x SparkFun Digital Temperature Sensor - TMP102 1 x SparkFun IR Receiver - TSOP85 1 x LED Red 1 x ProtoScrewShield 1 x Rocker Switch - SPST 2 x Resistor 10K Ohm 1 x CR1220 3V Lithium Coin Cell Battery 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // DS3231 Precision RTC #include <RTClib.h> // Two Wire Interface (TWI/I2C) #include <Wire.h> // Keyboard #include <Keyboard.h> // Includes and variables for IMU integration // STMicroelectronics LSM6DS33 Gyroscope and Accelerometer #include <LSM6.h> // STMicroelectronics LIS3MDL Magnetometer #include <LIS3MDL.h> // SparkFun Digital Temperature Sensor TMP102 #include <SparkFunTMP102.h> // SparkFun IR Receiver - TSOP85 #include <IRremote.h> // Keyboard String sKeyboard = ""; // DS3231 Precision RTC RTC_DS3231 rtc; String dateRTC = ""; String timeRTC = ""; // Pololu 9DoF IMU // STMicroelectronics LSM6DS33 Gyroscope and Accelerometer LSM6 imu; // Accelerometer and Gyroscopes // Accelerometer int imuAX; int imuAY; int imuAZ; // Gyroscopes int imuGX; int imuGY; int imuGZ; // STMicroelectronics LIS3MDL Magnetometer LIS3MDL mag; // Magnetometer int magX; int magY; int magZ; // Gas Sensors MQ // Alcohol Gas Sensor - MQ-3 int iMQ3 = A0; int iMQ3Raw = 0; int iMQ3ppm = 0; // SparkFun Line Sensor - QRE1113 (Analog) int iLine = A1; int iLineSensor = 0; // SparkFun Digital Temperature Sensor TMP102 const int ALERT_PIN = A3; TMP102 sensor0; float temperature; boolean alertPinState; boolean alertRegisterState; // SparkFun IR Receiver - TSOP85 int RECV_PIN = 11; IRrecv irrecv(RECV_PIN); decode_results results; String IRValue = ""; int iLEDRed = 3; // The number of the Rocker Switch pin int iSwitch = 2; // Variable for reading the button status int SwitchState = 0; // Software Version Information String sver = "28-08"; void loop() { // Date and Time RTC isRTC (); // Pololu Accelerometer and Gyroscopes isIMU(); // Pololu Magnetometer isMag(); // Gas Sensors MQ isGasSensor(); // SparkFun Line Sensor isLineSensor(); // SparkFun Temperature TMP102 isTMP102(); // SparkFun IR Receiver - TSOP85 isIR(); // Read the state of the Switch value: SwitchState = digitalRead(iSwitch); // Check if the button is pressed. If it is, the SwitchState is HIGH: if (SwitchState == HIGH) { Keyboard.println(sKeyboard); } // Delay 1 Second delay(1000); }
getAccelGyro.ino
// Accelerometer and Gyroscopes // Setup IMU void setupIMU() { // Setup IMU imu.init(); // Default imu.enableDefault(); } // Accelerometer and Gyroscopes void isIMU() { // Accelerometer and Gyroscopes imu.read(); // Accelerometer x, y, z imuAX = imu.a.x; imuAY = imu.a.y; imuAZ = imu.a.z; // Gyroscopes x, y, z imuGX = imu.g.x; imuGY = imu.g.y; imuGZ = imu.g.z; // Keyboard sKeyboard = sKeyboard + String(imuAX) + "|" + String(imuAY) + "|" + String(imuAZ) + "|"; sKeyboard = sKeyboard + String(imuGX) + "|" + String(imuGY) + "|" + String(imuGZ) + "|"; }
getGasSensorMQ.ino
// Gas Sensors MQ // Gas Sensor void isGasSensor() { // Read in analog value from each gas sensors // Alcohol Gas Sensor - MQ-3 iMQ3ppm = isMQ3( iMQ3Raw ); // Keyboard sKeyboard = sKeyboard + String(iMQ3ppm) + "|"; } // Alcohol Gas Sensor - MQ-3 int isMQ3(double rawValue) { double RvRo = rawValue; // % BAC = breath mg/L * 0.21 double bac = RvRo * 0.21; return bac; }
getIMUMagnetometer.ino
// IMU Magnetometer // Setup Magnetometer void setupMag() { // Setup Magnetometer mag.init(); // Default mag.enableDefault(); } // Magnetometer void isMag() { // Magnetometer mag.read(); // Magnetometer x, y, z magX = mag.m.x; magY = mag.m.y; magZ = mag.m.z; // Keyboard sKeyboard = sKeyboard + String(magX) + "|" + String(magY) + "|" + String(magZ) + "|"; }
getIRRemote.ino
// SparkFun IR Receiver - TSOP85 // Setup void isSetupIR(){ // Initialize digital pin LED Red as an output pinMode(iLEDRed, OUTPUT); // Start the receiver irrecv.enableIRIn(); } // void isIR(){ if (irrecv.decode(&results)) { // LED Red HIGH digitalWrite(iLEDRed, HIGH); //Serial.print("IR RECV Code = 0x "); //Serial.println(results.value, HEX); IRValue = "0x "; IRValue = IRValue + String(results.value, HEX); // LED Red LOW digitalWrite(iLEDRed, LOW); // IR Resume irrecv.resume(); } else { IRValue = "0"; } // Keyboard sKeyboard = sKeyboard + String(IRValue) + "|*"; }
getLineSensor.ino
// Line Sensor // isLine Sensor void isLineSensor(){ // Line Sensor iLineSensor = analogRead(iLine); // Keyboard sKeyboard = sKeyboard + String(iLineSensor) + "|"; }
getRTC.ino
// Date & Time // DS3231 Precision RTC void setupRTC() { // DS3231 Precision RTC if (! rtc.begin()) { //Serial.println("Couldn't find RTC"); //Serial.flush(); while (1) delay(10); } if (rtc.lostPower()) { //Serial.println("RTC lost power, let's set the time!"); // When time needs to be set on a new device, or after a power loss, the // following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: //rtc.adjust(DateTime(2023, 8, 10, 11, 0, 0)); } } // Date and Time RTC void isRTC () { // Date and Time dateRTC = ""; timeRTC = ""; DateTime now = rtc.now(); // Date dateRTC = now.year(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.month(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.day(), DEC; // Time timeRTC = now.hour(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.minute(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.second(), DEC; // Keyboard sKeyboard = "SEN|" + sver + "|" + String(dateRTC) + "|" + String(timeRTC) + "|"; }
getTempTMP102.ino
// SparkFun Digital Temperature Sensor TMP102 // Setup TMP102 void isSetupTMP102(){ // Declare alertPin as an input pinMode(ALERT_PIN,INPUT); // Begin //It will return true on success or false on failure to communicate if(!sensor0.begin()) { while(1); } // set the Conversion Rate //0-3: 0:0.25Hz, 1:1Hz, 2:4Hz, 3:8Hz sensor0.setConversionRate(2); //set Extended Mode. //0:12-bit Temperature(-55C to +128C) 1:13-bit Temperature(-55C to +150C) sensor0.setExtendedMode(0); // Set T_HIGH, the upper limit to trigger the alert on // Set T_HIGH in C sensor0.setHighTempC(29.4); // Set T_LOW, the lower limit to shut turn off the alert // set T_LOW in C sensor0.setLowTempC(27.67); } // is TMP102 void isTMP102(){ // Turn sensor on to start temperature measurement. // Current consumtion typically ~10uA. sensor0.wakeup(); // read temperature data C temperature = sensor0.readTempC(); // Check for Alert // Read the Alert from pin alertPinState = digitalRead(ALERT_PIN); // Read the Alert from register alertRegisterState = sensor0.alert(); // Place sensor in sleep mode to save power. // Current consumtion typically <0.5uA. sensor0.sleep(); // Keyboard sKeyboard = sKeyboard + String(temperature) + "|" + String(alertPinState) + "|" + String(alertRegisterState) + "|"; }
setup.ino
// Setup void setup() { // Give display time to power on delay(100); // Wire - Inialize I2C Hardware Wire.begin(); // Give display time to power on delay(100); // Date & Time RTC // DS3231 Precision RTC setupRTC(); // Initialize control over the keyboard: Keyboard.begin(); // Pololu Setup IMU setupIMU(); // Pololu Setup Magnetometer setupMag(); // Setup TMP102 isSetupTMP102(); // SetupTSOP85 isSetupIR(); // Initialize the Switch pin as an input pinMode(iSwitch, INPUT); // Initialize digital pin LED_BUILTIN as an output pinMode(LED_BUILTIN, OUTPUT); // Turn the LED on HIGH digitalWrite(LED_BUILTIN, HIGH); // Delay 5 Second delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- RTOS
- Research & Development (R & D)
Instructor, E-Mentor, STEAM, and Arts-Based Training
- Programming Language
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #28 – Sensors – Digital Temperature Sensor TMP102 – Mk07
——
#DonLucElectronics #DonLuc #Sensors #TMP102 #LineSensor #AlcoholGasSensor #MinIMU9 #Pololu #Adafruit #SparkFun #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
SparkFun Digital Temperature Sensor – TMP102
The TMP102 is an easy-to-use digital temperature sensor from Texas Instruments. The TMP102 breakout allows you to easily incorporate the digital temperature sensor into your project. While some temperature sensors use an analog voltage to represent the temperature, the TMP102 uses the I2C bus of the Arduino to communicate the temperature. Needless to say, this is a very handy sensor that doesn’t require much setup.
The TMP102 is capable of reading temperatures to a resolution of 0.0625°C, and is accurate up to 0.5°C. The breakout has built-in 4.7k Ohm pull-up resistors for I2C communications and runs from 1.4V to 3.6V. I2C communication uses an open drain signaling, so there is no need to use level shifting.
DL2309Mk01
1 x Adafruit METRO M0 Express
1 x DS3231 Precision RTC FeatherWing
1 x Pololu MinIMU-9 v5 Gyro, Accelerometer, and Compass
1 x Pololu Carrier for MQ Gas Sensors
1 x Alcohol Gas Sensor – MQ-3
1 x SparkFun Line Sensor – QRE1113
1 x SparkFun Digital Temperature Sensor – TMP102
1 x ProtoScrewShield
1 x Rocker Switch – SPST
2 x Resistor 10K Ohm
1 x CR1220 3V Lithium Coin Cell Battery
1 x SparkFun Cerberus USB Cable
Adafruit METRO M0 Express
LED – LED_BUILTIN
SDA – Digital 20
SCL – Digital 21
SW1 – Digital 2
MQ3 – Analog 0
LSB – Analog 1
ALE = Analog 3
VIN – +3.3V
VIN – +5V
GND – GND
——
DL2309Mk01p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #28 - Sensors - Digital Temperature Sensor TMP102 - Mk07 28-07 DL2309Mk01p.ino 1 x Adafruit METRO M0 Express 1 x DS3231 Precision RTC FeatherWing 1 x Pololu MinIMU-9 v5 Gyro, Accelerometer, and Compass 1 x Pololu Carrier for MQ Gas Sensors 1 x Alcohol Gas Sensor - MQ-3 1 x SparkFun Line Sensor - QRE1113 1 x SparkFun Digital Temperature Sensor - TMP102 1 x ProtoScrewShield 1 x Rocker Switch - SPST 2 x Resistor 10K Ohm 1 x CR1220 3V Lithium Coin Cell Battery 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // DS3231 Precision RTC #include <RTClib.h> // Two Wire Interface (TWI/I2C) #include <Wire.h> // Keyboard #include <Keyboard.h> // Includes and variables for IMU integration // STMicroelectronics LSM6DS33 Gyroscope and Accelerometer #include <LSM6.h> // STMicroelectronics LIS3MDL Magnetometer #include <LIS3MDL.h> // SparkFun Digital Temperature Sensor TMP102 #include <SparkFunTMP102.h> // Keyboard String sKeyboard = ""; // DS3231 Precision RTC RTC_DS3231 rtc; String dateRTC = ""; String timeRTC = ""; // Pololu 9DoF IMU // STMicroelectronics LSM6DS33 Gyroscope and Accelerometer LSM6 imu; // Accelerometer and Gyroscopes // Accelerometer int imuAX; int imuAY; int imuAZ; // Gyroscopes int imuGX; int imuGY; int imuGZ; // STMicroelectronics LIS3MDL Magnetometer LIS3MDL mag; // Magnetometer int magX; int magY; int magZ; // Gas Sensors MQ // Alcohol Gas Sensor - MQ-3 int iMQ3 = A0; int iMQ3Raw = 0; int iMQ3ppm = 0; // SparkFun Line Sensor - QRE1113 (Analog) int iLine = A1; int iLineSensor = 0; // SparkFun Digital Temperature Sensor TMP102 const int ALERT_PIN = A3; TMP102 sensor0; float temperature; boolean alertPinState; boolean alertRegisterState; // The number of the Rocker Switch pin int iSwitch = 2; // Variable for reading the button status int SwitchState = 0; // Software Version Information String sver = "28-07"; void loop() { // Date and Time RTC isRTC (); // Pololu Accelerometer and Gyroscopes isIMU(); // Pololu Magnetometer isMag(); // Gas Sensors MQ isGasSensor(); // SparkFun Line Sensor isLineSensor(); // SparkFun Temperature TMP102 isTMP102(); // Read the state of the Switch value: SwitchState = digitalRead(iSwitch); // Check if the button is pressed. If it is, the SwitchState is HIGH: if (SwitchState == HIGH) { Keyboard.println(sKeyboard); } // Delay 1 Second delay(1000); }
getAccelGyro.ino
// Accelerometer and Gyroscopes // Setup IMU void setupIMU() { // Setup IMU imu.init(); // Default imu.enableDefault(); } // Accelerometer and Gyroscopes void isIMU() { // Accelerometer and Gyroscopes imu.read(); // Accelerometer x, y, z imuAX = imu.a.x; imuAY = imu.a.y; imuAZ = imu.a.z; // Gyroscopes x, y, z imuGX = imu.g.x; imuGY = imu.g.y; imuGZ = imu.g.z; // Keyboard sKeyboard = sKeyboard + String(imuAX) + "|" + String(imuAY) + "|" + String(imuAZ) + "|"; sKeyboard = sKeyboard + String(imuGX) + "|" + String(imuGY) + "|" + String(imuGZ) + "|"; }
getGasSensorMQ.ino
// Gas Sensors MQ // Gas Sensor void isGasSensor() { // Read in analog value from each gas sensors // Alcohol Gas Sensor - MQ-3 iMQ3ppm = isMQ3( iMQ3Raw ); // Keyboard sKeyboard = sKeyboard + String(iMQ3ppm) + "|"; } // Alcohol Gas Sensor - MQ-3 int isMQ3(double rawValue) { double RvRo = rawValue; // % BAC = breath mg/L * 0.21 double bac = RvRo * 0.21; return bac; }
getIMUMagnetometer.ino
// IMU Magnetometer // Setup Magnetometer void setupMag() { // Setup Magnetometer mag.init(); // Default mag.enableDefault(); } // Magnetometer void isMag() { // Magnetometer mag.read(); // Magnetometer x, y, z magX = mag.m.x; magY = mag.m.y; magZ = mag.m.z; // Keyboard sKeyboard = sKeyboard + String(magX) + "|" + String(magY) + "|" + String(magZ) + "|"; }
getLineSensor.ino
// Line Sensor // isLine Sensor void isLineSensor(){ // Line Sensor iLineSensor = analogRead(iLine); // Keyboard sKeyboard = sKeyboard + String(iLineSensor) + "|"; }
getRTC.ino
// Date & Time // DS3231 Precision RTC void setupRTC() { // DS3231 Precision RTC if (! rtc.begin()) { //Serial.println("Couldn't find RTC"); //Serial.flush(); while (1) delay(10); } if (rtc.lostPower()) { //Serial.println("RTC lost power, let's set the time!"); // When time needs to be set on a new device, or after a power loss, the // following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: //rtc.adjust(DateTime(2023, 8, 10, 11, 0, 0)); } } // Date and Time RTC void isRTC () { // Date and Time dateRTC = ""; timeRTC = ""; DateTime now = rtc.now(); // Date dateRTC = now.year(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.month(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.day(), DEC; // Time timeRTC = now.hour(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.minute(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.second(), DEC; // Keyboard sKeyboard = "SEN|" + sver + "|" + String(dateRTC) + "|" + String(timeRTC) + "|"; }
getTempTMP102.ino
// SparkFun Digital Temperature Sensor TMP102 // Setup TMP102 void isSetupTMP102(){ // Declare alertPin as an input pinMode(ALERT_PIN,INPUT); // Begin //It will return true on success or false on failure to communicate if(!sensor0.begin()) { while(1); } // set the Conversion Rate //0-3: 0:0.25Hz, 1:1Hz, 2:4Hz, 3:8Hz sensor0.setConversionRate(2); //set Extended Mode. //0:12-bit Temperature(-55C to +128C) 1:13-bit Temperature(-55C to +150C) sensor0.setExtendedMode(0); // Set T_HIGH, the upper limit to trigger the alert on // Set T_HIGH in C sensor0.setHighTempC(29.4); // Set T_LOW, the lower limit to shut turn off the alert // set T_LOW in C sensor0.setLowTempC(27.67); } // is TMP102 void isTMP102(){ // Turn sensor on to start temperature measurement. // Current consumtion typically ~10uA. sensor0.wakeup(); // read temperature data C temperature = sensor0.readTempC(); // Check for Alert // Read the Alert from pin alertPinState = digitalRead(ALERT_PIN); // Read the Alert from register alertRegisterState = sensor0.alert(); // Place sensor in sleep mode to save power. // Current consumtion typically <0.5uA. sensor0.sleep(); // Keyboard sKeyboard = sKeyboard + String(temperature) + "|" + String(alertPinState) + "|" + String(alertRegisterState) + "|*"; }
setup.ino
// Setup void setup() { // Give display time to power on delay(100); // Wire - Inialize I2C Hardware Wire.begin(); // Give display time to power on delay(100); // Date & Time RTC // DS3231 Precision RTC setupRTC(); // Initialize control over the keyboard: Keyboard.begin(); // Pololu Setup IMU setupIMU(); // Pololu Setup Magnetometer setupMag(); // Setup TMP102 isSetupTMP102(); // Initialize the Switch pin as an input pinMode(iSwitch, INPUT); // Initialize digital pin LED_BUILTIN as an output pinMode(LED_BUILTIN, OUTPUT); // Turn the LED on HIGH digitalWrite(LED_BUILTIN, HIGH); // Delay 5 Second delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- RTOS
- Research & Development (R & D)
Instructor, E-Mentor, STEAM, and Arts-Based Training
- Programming Language
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #28 – Sensors – SparkFun Line Sensor QRE1113 – Mk06
——
#DonLucElectronics #DonLuc #Sensors #LineSensor #AlcoholGasSensor #MinIMU9 #Pololu #Adafruit #SparkFun #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
SparkFun Line Sensor QRE1113 (Analog)
This version of the QRE1113 breakout board features an easy-to-use analog output, which will vary depending on the amount of IR light reflected back to the sensor. This tiny board is perfect for line sensing applications and can be used in both 3.3V and 5V systems.
The board’s QRE1113 IR reflectance sensor is comprised of two parts – an IR emitting LED and an IR sensitive phototransistor. When you apply power to the VCC and GND pins the IR LED inside the sensor will illuminate. A 100 Ohm resistor is on-board and placed in series with the LED to limit current. A 10k Ohm resistor pulls the output pin high, but when the light from the LED is reflected back onto the phototransistor the output will begin to go lower. The more IR light sensed by the phototransistor, the lower the output voltage of the breakout board.
These sensors are widely used in line following robots, white surfaces reflect much more light than black, so, when directed towards a white surface, the voltage output will be lower than that on a black surface.
DL2308Mk07
1 x Adafruit METRO M0 Express
1 x DS3231 Precision RTC FeatherWing
1 x Pololu MinIMU-9 v5 Gyro, Accelerometer, and Compass
1 x Pololu Carrier for MQ Gas Sensors
1 x Alcohol Gas Sensor – MQ-3
1 x SparkFun Line Sensor – QRE1113
1 x ProtoScrewShield
1 x Rocker Switch – SPST
2 x Resistor 10K Ohm
1 x CR1220 3V Lithium Coin Cell Battery
1 x SparkFun Cerberus USB Cable
Adafruit METRO M0 Express
LED – LED_BUILTIN
SDA – Digital 20
SCL – Digital 21
SW1 – Digital 2
MQ3 – Analog 0
LSB – Analog 1
VIN – +3.3V
VIN – +5V
GND – GND
——
DL2308Mk07p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #28 - Sensors - SparkFun Line Sensor QRE1113 - Mk06 28-06 DL2308Mk07p.ino 1 x Adafruit METRO M0 Express 1 x DS3231 Precision RTC FeatherWing 1 x Pololu MinIMU-9 v5 Gyro, Accelerometer, and Compass 1 x Pololu Carrier for MQ Gas Sensors 1 x Alcohol Gas Sensor - MQ-3 1 x SparkFun Line Sensor - QRE1113 1 x ProtoScrewShield 1 x Rocker Switch - SPST 2 x Resistor 10K Ohm 1 x CR1220 3V Lithium Coin Cell Battery 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // DS3231 Precision RTC #include <RTClib.h> // Two Wire Interface (TWI/I2C) #include <Wire.h> // Keyboard #include <Keyboard.h> // Includes and variables for IMU integration // STMicroelectronics LSM6DS33 Gyroscope and Accelerometer #include <LSM6.h> // STMicroelectronics LIS3MDL Magnetometer #include <LIS3MDL.h> // Keyboard String sKeyboard = ""; // DS3231 Precision RTC RTC_DS3231 rtc; String dateRTC = ""; String timeRTC = ""; // Pololu 9DoF IMU // STMicroelectronics LSM6DS33 Gyroscope and Accelerometer LSM6 imu; // Accelerometer and Gyroscopes // Accelerometer int imuAX; int imuAY; int imuAZ; // Gyroscopes int imuGX; int imuGY; int imuGZ; // STMicroelectronics LIS3MDL Magnetometer LIS3MDL mag; // Magnetometer int magX; int magY; int magZ; // Gas Sensors MQ // Alcohol Gas Sensor - MQ-3 int iMQ3 = A0; int iMQ3Raw = 0; int iMQ3ppm = 0; // SparkFun Line Sensor - QRE1113 (Analog) int iLine = A1; int iLineSensor = 0; // The number of the Rocker Switch pin int iSwitch = 2; // Variable for reading the button status int SwitchState = 0; // Software Version Information String sver = "28-06"; void loop() { // Date and Time RTC isRTC (); // Pololu Accelerometer and Gyroscopes isIMU(); // Pololu Magnetometer isMag(); // Gas Sensors MQ isGasSensor(); // SparkFun Line Sensor isLineSensor(); // Read the state of the Switch value: SwitchState = digitalRead(iSwitch); // Check if the button is pressed. If it is, the SwitchState is HIGH: if (SwitchState == HIGH) { Keyboard.println(sKeyboard); } // Delay 1 Second delay(1000); }
getAccelGyro.ino
// Accelerometer and Gyroscopes // Setup IMU void setupIMU() { // Setup IMU imu.init(); // Default imu.enableDefault(); } // Accelerometer and Gyroscopes void isIMU() { // Accelerometer and Gyroscopes imu.read(); // Accelerometer x, y, z imuAX = imu.a.x; imuAY = imu.a.y; imuAZ = imu.a.z; // Gyroscopes x, y, z imuGX = imu.g.x; imuGY = imu.g.y; imuGZ = imu.g.z; // Keyboard sKeyboard = sKeyboard + String(imuAX) + "|" + String(imuAY) + "|" + String(imuAZ) + "|"; sKeyboard = sKeyboard + String(imuGX) + "|" + String(imuGY) + "|" + String(imuGZ) + "|"; }
getGasSensorMQ.ino
// Gas Sensors MQ // Gas Sensor void isGasSensor() { // Read in analog value from each gas sensors // Alcohol Gas Sensor - MQ-3 iMQ3ppm = isMQ3( iMQ3Raw ); // Keyboard sKeyboard = sKeyboard + String(iMQ3ppm) + "|"; } // Alcohol Gas Sensor - MQ-3 int isMQ3(double rawValue) { double RvRo = rawValue; // % BAC = breath mg/L * 0.21 double bac = RvRo * 0.21; return bac; }
getIMUMagnetometer.ino
// IMU Magnetometer // Setup Magnetometer void setupMag() { // Setup Magnetometer mag.init(); // Default mag.enableDefault(); } // Magnetometer void isMag() { // Magnetometer mag.read(); // Magnetometer x, y, z magX = mag.m.x; magY = mag.m.y; magZ = mag.m.z; // Keyboard sKeyboard = sKeyboard + String(magX) + "|" + String(magY) + "|" + String(magZ) + "|"; }
getLineSensor.ino
// Line Sensor // isLine Sensor void isLineSensor(){ // Line Sensor iLineSensor = analogRead(iLine); // Keyboard sKeyboard = sKeyboard + String(iLineSensor) + "|*"; }
getRTC.ino
// Date & Time // DS3231 Precision RTC void setupRTC() { // DS3231 Precision RTC if (! rtc.begin()) { //Serial.println("Couldn't find RTC"); //Serial.flush(); while (1) delay(10); } if (rtc.lostPower()) { //Serial.println("RTC lost power, let's set the time!"); // When time needs to be set on a new device, or after a power loss, the // following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: //rtc.adjust(DateTime(2023, 8, 10, 11, 0, 0)); } } // Date and Time RTC void isRTC () { // Date and Time dateRTC = ""; timeRTC = ""; DateTime now = rtc.now(); // Date dateRTC = now.year(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.month(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.day(), DEC; // Time timeRTC = now.hour(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.minute(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.second(), DEC; // Keyboard sKeyboard = "SEN|" + sver + "|" + String(dateRTC) + "|" + String(timeRTC) + "|"; }
setup.ino
// Setup void setup() { // Give display time to power on delay(100); // Wire - Inialize I2C Hardware Wire.begin(); // Give display time to power on delay(100); // Date & Time RTC // DS3231 Precision RTC setupRTC(); // Initialize control over the keyboard: Keyboard.begin(); // Pololu Setup IMU setupIMU(); // Pololu Setup Magnetometer setupMag(); // Initialize the Switch pin as an input pinMode(iSwitch, INPUT); // Initialize digital pin LED_BUILTIN as an output pinMode(LED_BUILTIN, OUTPUT); // Turn the LED on HIGH digitalWrite(LED_BUILTIN, HIGH); // Delay 5 Second delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- RTOS
- Research & Development (R & D)
Instructor, E-Mentor, STEAM, and Arts-Based Training
- Programming Language
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #28 – Sensors – Alcohol Gas Sensor MQ-3 – Mk05
——
#DonLucElectronics #DonLuc #Sensors #AlcoholGasSensor #MinIMU9 #Pololu #Adafruit #SparkFun #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Pololu Carrier for MQ Gas Sensors
This carrier board is designed to work with any of the MQ-series gas sensors, simplifying the interface from 6 to 3 pins—ground, power and analog voltage output—that are broken out with a 0.1″ spacing, making the board compatible with 0.1″ headers and standard breadboards and perfboards. This board has two mounting holes and provides convenient pads for mounting the gas sensor’s required sensitivity-setting resistor.
Alcohol Gas Sensor – MQ-3
This alcohol sensor is suitable for detecting alcohol concentration on your breath, just like your common breathalyzer. It has a high sensitivity and fast response time. Sensor provides an analog resistive output based on alcohol concentration.
How does this relate to the breath? It turns out that there is a standard conversion from breath alcohol content to BAC that is employed by commercial breathalyzers. Our formula for calculating BAC from the alcohol measured in the breath is:
% BAC = Breath mg/L * 0.21
DL2308Mk06
1 x Adafruit METRO M0 Express
1 x DS3231 Precision RTC FeatherWing
1 x Pololu MinIMU-9 v5 Gyro, Accelerometer, and Compass
1 x Pololu Carrier for MQ Gas Sensors
1 x Alcohol Gas Sensor – MQ-3
1 x ProtoScrewShield
1 x Rocker Switch – SPST
2 x Resistor 10K Ohm
1 x CR1220 3V Lithium Coin Cell Battery
1 x SparkFun Cerberus USB Cable
Adafruit METRO M0 Express
LED – LED_BUILTIN
SDA – Digital 20
SCL – Digital 21
SW1 – Digital 2
MQ3 – Analog 0
VIN – +3.3V
VIN – +5V
GND – GND
——
DL2308Mk06p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #28 - Sensors - Alcohol Gas Sensor MQ-3 - Mk05 28-05 DL2308Mk06p.ino 1 x Adafruit METRO M0 Express 1 x DS3231 Precision RTC FeatherWing 1 x Pololu MinIMU-9 v5 Gyro, Accelerometer, and Compass 1 x Pololu Carrier for MQ Gas Sensors 1 x Alcohol Gas Sensor - MQ-3 1 x ProtoScrewShield 1 x Rocker Switch - SPST 2 x Resistor 10K Ohm 1 x CR1220 3V Lithium Coin Cell Battery 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // DS3231 Precision RTC #include <RTClib.h> // Two Wire Interface (TWI/I2C) #include <Wire.h> // Keyboard #include <Keyboard.h> // Includes and variables for IMU integration // STMicroelectronics LSM6DS33 Gyroscope and Accelerometer #include <LSM6.h> // STMicroelectronics LIS3MDL Magnetometer #include <LIS3MDL.h> // Keyboard String sKeyboard = ""; // DS3231 Precision RTC RTC_DS3231 rtc; String dateRTC = ""; String timeRTC = ""; // Pololu 9DoF IMU // STMicroelectronics LSM6DS33 Gyroscope and Accelerometer LSM6 imu; // Accelerometer and Gyroscopes // Accelerometer int imuAX; int imuAY; int imuAZ; // Gyroscopes int imuGX; int imuGY; int imuGZ; // STMicroelectronics LIS3MDL Magnetometer LIS3MDL mag; // Magnetometer int magX; int magY; int magZ; // Gas Sensors MQ // Alcohol Gas Sensor - MQ-3 int iMQ3 = A0; int iMQ3Raw = 0; int iMQ3ppm = 0; // The number of the button pin int iButton = 2; // Variable for reading the button status int buttonState = 0; // Software Version Information String sver = "28-05"; void loop() { // Date and Time RTC isRTC (); // Pololu Accelerometer and Gyroscopes isIMU(); // Pololu Magnetometer isMag(); // Gas Sensors MQ isGasSensor(); // Read the state of the button value: buttonState = digitalRead(iButton); // Check if the button is pressed. If it is, the buttonState is HIGH: if (buttonState == HIGH) { Keyboard.println(sKeyboard); } // Delay 1 Second delay(1000); }
getAccelGyro.ino
// Accelerometer and Gyroscopes // Setup IMU void setupIMU() { // Setup IMU imu.init(); // Default imu.enableDefault(); } // Accelerometer and Gyroscopes void isIMU() { // Accelerometer and Gyroscopes imu.read(); // Accelerometer x, y, z imuAX = imu.a.x; imuAY = imu.a.y; imuAZ = imu.a.z; // Gyroscopes x, y, z imuGX = imu.g.x; imuGY = imu.g.y; imuGZ = imu.g.z; sKeyboard = sKeyboard + String(imuAX) + "|" + String(imuAY) + "|" + String(imuAZ) + "|"; sKeyboard = sKeyboard + String(imuGX) + "|" + String(imuGY) + "|" + String(imuGZ) + "|"; }
getGasSensorMQ.ino
// Gas Sensors MQ // Gas Sensor void isGasSensor() { // Read in analog value from each gas sensors // Alcohol Gas Sensor - MQ-3 iMQ3ppm = isMQ3( iMQ3Raw ); sKeyboard = sKeyboard + String(iMQ3ppm) + "|*"; } // Alcohol Gas Sensor - MQ-3 int isMQ3(double rawValue) { double RvRo = rawValue; // % BAC = breath mg/L * 0.21 double bac = RvRo * 0.21; return bac; }
getIMUMagnetometer.ino
// IMU Magnetometer // Setup Magnetometer void setupMag() { // Setup Magnetometer mag.init(); // Default mag.enableDefault(); } // Magnetometer void isMag() { // Magnetometer mag.read(); // Magnetometer x, y, z magX = mag.m.x; magY = mag.m.y; magZ = mag.m.z; sKeyboard = sKeyboard + String(magX) + "|" + String(magY) + "|" + String(magZ) + "|"; }
getRTC.ino
// Date & Time // DS3231 Precision RTC void setupRTC() { // DS3231 Precision RTC if (! rtc.begin()) { //Serial.println("Couldn't find RTC"); //Serial.flush(); while (1) delay(10); } if (rtc.lostPower()) { //Serial.println("RTC lost power, let's set the time!"); // When time needs to be set on a new device, or after a power loss, the // following line sets the RTC to the date & time this sketch was compiled rtc.adjust(DateTime(F(__DATE__), F(__TIME__))); // This line sets the RTC with an explicit date & time, for example to set // January 21, 2014 at 3am you would call: //rtc.adjust(DateTime(2023, 8, 10, 11, 0, 0)); } } // Date and Time RTC void isRTC () { // Date and Time dateRTC = ""; timeRTC = ""; DateTime now = rtc.now(); // Date dateRTC = now.year(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.month(), DEC; dateRTC = dateRTC + "/"; dateRTC = dateRTC + now.day(), DEC; // Time timeRTC = now.hour(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.minute(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.second(), DEC; sKeyboard = "SEN|" + sver + "|" + String(dateRTC) + "|" + String(timeRTC) + "|"; }
setup.ino
// Setup void setup() { // Give display time to power on delay(100); // Wire - Inialize I2C Hardware Wire.begin(); // Give display time to power on delay(100); // Date & Time RTC // DS3231 Precision RTC setupRTC(); // Initialize control over the keyboard: Keyboard.begin(); // Pololu Setup IMU setupIMU(); // Pololu Setup Magnetometer setupMag(); // Initialize the button pin as an input pinMode(iButton, INPUT); // Initialize digital pin LED_BUILTIN as an output pinMode(LED_BUILTIN, OUTPUT); // Turn the LED on HIGH digitalWrite(LED_BUILTIN, HIGH); // Delay 5 Second delay( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- RTOS
- Research & Development (R & D)
Instructor, E-Mentor, STEAM, and Arts-Based Training
- Programming Language
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc