Arduino
Arduino
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
Project #28 – Sensors – Pololu MinIMU-9 v5 – Mk04
——
#DonLucElectronics #DonLuc #Sensors #MinIMU9 #Pololu #Adafruit #SparkFun #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Pololu MinIMU-9 v5 Gyro, Accelerometer, and Compass (LSM6DS33 and LIS3MDL Carrier)
The Pololu MinIMU-9 v5 is an inertial measurement unit (IMU) that packs an LSM6DS33 3-axis gyro and 3-axis accelerometer and an LIS3MDL 3-axis magnetometer onto a tiny 0.8″ × 0.5″ board. An I²C interface accesses nine independent rotation, acceleration, and magnetic measurements that can be used to calculate the sensor’s absolute orientation. The MinIMU-9 v5 board includes a voltage regulator and a level-shifting circuit that allow operation from 2.5 to 5.5 Volt.
DL2308Mk05
1 x Adafruit METRO M0 Express
1 x DS3231 Precision RTC FeatherWing
1 x Pololu MinIMU-9 v5 Gyro, Accelerometer, and Compass
1 x ProtoScrewShield
1 x Rocker Switch – SPST
1 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
VIN – +3.3V
GND – GND
——
DL2308Mk05p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #28 - Sensors - Pololu MinIMU-9 v5 - Mk04 28-04 DL2308Mk05p.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 ProtoScrewShield 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> // 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; // The number of the pushbutton pin int iButton = 2; // Variable for reading the button status int buttonState = 0; // Software Version Information String sver = "28-04"; void loop() { // Date and Time RTC isRTC (); // Pololu Accelerometer and Gyroscopes isIMU(); // Pololu Magnetometer isMag(); // 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) + "|"; }
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
Project #28 – Sensors – Gyroscope L3G4200D – Mk03
——
#DonLucElectronics #DonLuc #Sensors #L3G4200D #HMC5883L #ADXL335 #Adafruit #SparkFun #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
SparkFun Tri-Axis Gyroscope – L3G4200D
This is a breakout board for the L3G4200D low-power three-axis angular rate sensor. The L3G4200D is a MEMS motion sensor and has a full scale of dps and is capable of measuring rates with a user-selectable bandwidth. These work great in gaming and virtual reality input devices, motion control with MMI, GPS navigation systems, appliances and robotics. The L3G4200D is a low-power three-axis angular rate sensor able to provide unprecedented stablility of zero rate level and sensitivity over temperature and time. It includes a sensing element and an IC interface capable of providing the measured angular rate to the external world through a digital interface.
DL2308Mk04
1 x Adafruit METRO M0 Express
1 x DS3231 Precision RTC FeatherWing
1 x SparkFun Triple Axis Accelerometer ADXL335
1 x SparkFun Triple Axis Magnetometer – HMC5883L
1 x SparkFun Tri-Axis Gyroscope – L3G4200D
1 x Rocker Switch – SPST
1 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
ACX – Analog A0
ACY – Analog A1
ACZ – Analog A2
VIN – +3.3V
GND – GND
——
DL2308Mk04p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #28 - Sensors - Gyroscope L3G4200D - Mk03 28-03 DL2308Mk04p.ino 1 x Adafruit METRO M0 Express 1 x DS3231 Precision RTC FeatherWing 1 x SparkFun Triple Axis Accelerometer ADXL335 1 x SparkFun Tri-Axis Gyroscope - L3G4200D 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> // Triple Axis Magnetometer #include <HMC5883L.h> // Gyroscope #include <L3G4200D.h> // Keyboard String sKeyboard = ""; // DS3231 Precision RTC RTC_DS3231 rtc; String dateRTC = ""; String timeRTC = ""; // Accelerometer int iX = A0; int iY = A1; int iZ = A2; // Accelerometer int X = 0; int Y = 0; int Z = 0; // Triple Axis Magnetometer HMC5883L compass; // Triple Axis Magnetometer int mX = 0; int mY = 0; int mZ = 0; // Gyroscope L3G4200D gyroscope; // Timers unsigned long timer = 0; float timeStep = 0.01; // Pitch, Roll and Yaw values float pitch = 0; float roll = 0; float yaw = 0; // The number of the pushbutton pin int iButton = 2; // Variable for reading the button status int buttonState = 0; // Software Version Information String sver = "28-03"; void loop() { // Date and Time RTC isRTC (); // Accelerometer isAccelerometer(); // Magnetometer isMagnetometer(); // Gyroscope isGyroscope(); // 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); }
getAccelerometer.ino
// Accelerometer // Accelerometer void isAccelerometer(){ // Accelerometer X, Y, Z // X X = analogRead(iX); // Y Y = analogRead(iY); // Z Z = analogRead(iZ); sKeyboard = sKeyboard + String(X) + "|" + String(Y) + "|" + String(Z) + "|"; }
getGyroscope.ino
// L3G4200D Triple Axis Gyroscope // Setup Gyroscope void isSetupGyroscope() { // Setup Gyroscope // Set scale 2000 dps and 400HZ Output data rate (cut-off 50) while(!gyroscope.begin(L3G4200D_SCALE_2000DPS, L3G4200D_DATARATE_400HZ_50)) { // Could not find a valid L3G4200D sensor, check wiring! delay(500); } // Calibrate gyroscope. The calibration must be at rest. // If you don't want calibrate, comment this line. gyroscope.calibrate(100); } // L3G4200D Gyroscope void isGyroscope(){ // Timer timer = millis(); // Read normalized values Vector norm = gyroscope.readNormalize(); // Calculate Pitch, Roll and Yaw pitch = pitch + norm.YAxis * timeStep; roll = roll + norm.XAxis * timeStep; yaw = yaw + norm.ZAxis * timeStep; sKeyboard = sKeyboard + String(pitch) + "|" + String(roll) + "|" + String(yaw) + "|*"; }
getMagnetometer.ino
// Magnetometer // Setup Magnetometer void isSetupMagnetometer(){ // Magnetometer Serial // Initialize HMC5883L while (!compass.begin()) { delay(500); } // Set measurement range // +/- 1.30 Ga: HMC5883L_RANGE_1_3GA (default) compass.setRange(HMC5883L_RANGE_1_3GA); // Set measurement mode // Continuous-Measurement: HMC5883L_CONTINOUS (default) compass.setMeasurementMode(HMC5883L_CONTINOUS); // Set data rate // 15.00Hz: HMC5883L_DATARATE_15HZ (default) compass.setDataRate(HMC5883L_DATARATE_15HZ); // Set number of samples averaged // 1 sample: HMC5883L_SAMPLES_1 (default) compass.setSamples(HMC5883L_SAMPLES_1); } // Magnetometer void isMagnetometer(){ // Vector Norm Vector norm = compass.readNormalize(); // Vector X, Y, Z // X Normalize mX = norm.XAxis; // Y Normalize mY = norm.YAxis; // Z Normalize mZ = norm.ZAxis; sKeyboard = sKeyboard + String(mX) + "|" + String(mY) + "|" + String(mZ) + "|"; }
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(); // Setup Triple Axis Magnetometer isSetupMagnetometer(); // L3G4200D Gyroscope isSetupGyroscope(); // 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
Project #28 – Sensors – Magnetometer HMC5883L – Mk02
——
#DonLucElectronics #DonLuc #Sensors #HMC5883L #ADXL335 #Adafruit #SparkFun #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
SparkFun Triple Axis Magnetometer – HMC5883L
This is a breakout board for Honeywell’s HMC5883L, a 3-axis digital compass. Communication with the HMC5883L is simple and all done through an I2C interface. There is no on-board regulator, so a regulated voltage of 2.16-3.6VDC should be supplied. The Honeywell HMC5883L is a surface-mount, multi-chip module designed for low-field magnetic sensing with a digital interface for applications such as low-cost compassing and magnetometry. Applications for the HMC5883L include Mobile Phones, Netbooks, Consumer Electronics, Auto Navigation Systems, and Personal Navigation Devices.
DL2308Mk03
1 x Adafruit METRO M0 Express
1 x DS3231 Precision RTC FeatherWing
1 x SparkFun Triple Axis Accelerometer ADXL335
1 x SparkFun Triple Axis Magnetometer – HMC5883L
1 x Rocker Switch – SPST
1 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
ACX – Analog A0
ACY – Analog A1
ACZ – Analog A2
VIN – +3.3V
GND – GND
——
DL2308Mk03p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #28 - Sensors - Magnetometer HMC5883L - Mk02 28-02 DL2308Mk03p.ino 1 x Adafruit METRO M0 Express 1 x DS3231 Precision RTC FeatherWing 1 x SparkFun Triple Axis Accelerometer ADXL335 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> // Triple Axis Magnetometer #include <HMC5883L.h> // Keyboard String sKeyboard = ""; // DS3231 Precision RTC RTC_DS3231 rtc; String dateRTC = ""; String timeRTC = ""; // Accelerometer int iX = A0; int iY = A1; int iZ = A2; // Accelerometer int X = 0; int Y = 0; int Z = 0; // Triple Axis Magnetometer HMC5883L compass; // Triple Axis Magnetometer int mX = 0; int mY = 0; int mZ = 0; // The number of the pushbutton pin int iButton = 2; // Variable for reading the pushbutton status int buttonState = 0; // Software Version Information String sver = "28-02"; void loop() { // Date and Time RTC isRTC (); // Accelerometer isAccelerometer(); // Magnetometer isMagnetometer(); // 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 sec delay(1000); }
getAccelerometer.ino
// Accelerometer // Accelerometer void isAccelerometer(){ // Accelerometer X, Y, Z // X X = analogRead(iX); // Y Y = analogRead(iY); // Z Z = analogRead(iZ); sKeyboard = sKeyboard + String(X) + "|" + String(Y) + "|" + String(Z) + "|"; }
getMagnetometer.ino
// Magnetometer // Setup Magnetometer void isSetupMagnetometer(){ // Magnetometer Serial // Initialize HMC5883L while (!compass.begin()) { delay(500); } // Set measurement range // +/- 1.30 Ga: HMC5883L_RANGE_1_3GA (default) compass.setRange(HMC5883L_RANGE_1_3GA); // Set measurement mode // Continuous-Measurement: HMC5883L_CONTINOUS (default) compass.setMeasurementMode(HMC5883L_CONTINOUS); // Set data rate // 15.00Hz: HMC5883L_DATARATE_15HZ (default) compass.setDataRate(HMC5883L_DATARATE_15HZ); // Set number of samples averaged // 1 sample: HMC5883L_SAMPLES_1 (default) compass.setSamples(HMC5883L_SAMPLES_1); } // Magnetometer void isMagnetometer(){ // Vector Norm Vector norm = compass.readNormalize(); // Vector X, Y, Z // X Normalize mX = norm.XAxis; // Y Normalize mY = norm.YAxis; // Z Normalize mZ = norm.ZAxis; sKeyboard = sKeyboard + String(mX) + "|" + String(mY) + "|" + String(mZ) + "|*"; }
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; Serial.print("Date: "); Serial.println(dateRTC); // Time timeRTC = now.hour(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.minute(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.second(), DEC; Serial.print("Time: "); Serial.println(timeRTC); 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(); // Setup Triple Axis Magnetometer isSetupMagnetometer(); // 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( 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 – Accelerometer ADXL335 – Mk01
——
#DonLucElectronics #DonLuc #Sensors #ADXL335 #Adafruit #SparkFun #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Sensor
A sensor is a device that produces an output signal for the purpose of sensing a physical phenomenon. In the broadest definition, a sensor is a device, module, machine, or subsystem that detects events or changes in its environment and sends the information to other electronics, frequently a computer processor.
- Acoustic, sound, vibration
- Automotive
- Chemical
- Electric current, electric potential, magnetic, radio
- Environment, weather, moisture, humidity
- Flow, fluid velocity
- Ionizing radiation, subatomic particles
- Navigation instruments
- Position, angle, displacement, distance, speed, acceleration
- Optical, light, imaging, photon
- Pressure
- Force, density, level
- Thermal, heat, temperature
- Proximity, presence
- Sensor technology
- Speed sensor
- Others
- Etc…
SparkFun Triple Axis Accelerometer Breakout – ADXL335
Breakout board for the 3 axis ADXL335 from Analog Devices. This is the latest in a long, proven line of analog sensors, the holy grail of accelerometers. The ADXL335 is a triple axis MEMS accelerometer with extremely low noise and power consumption.
DL2308Mk02
1 x Adafruit METRO M0 Express
1 x DS3231 Precision RTC FeatherWing
1 x SparkFun Triple Axis Accelerometer ADXL335
1 x Rocker Switch – SPST
1 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
ACX – Analog A0
ACY – Analog A1
ACZ – Analog A2
VIN – +3.3V
GND – GND
——
DL2308Mk02p.ino
/****** Don Luc Electronics © ****** Software Version Information Project #28 - Sensors - Accelerometer ADXL335 - Mk01 28-01 DL2308Mk02p.ino 1 x Adafruit METRO M0 Express 1 x DS3231 Precision RTC FeatherWing 1 x SparkFun Triple Axis Accelerometer ADXL335 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> // Keyboard String sKeyboard = ""; // DS3231 Precision RTC RTC_DS3231 rtc; String dateRTC = ""; String timeRTC = ""; // Accelerometer int iX = A0; int iY = A1; int iZ = A2; // Accelerometer int X = 0; int Y = 0; int Z = 0; // The number of the pushbutton pin int iButton = 2; // Variable for reading the pushbutton status int buttonState = 0; // Software Version Information String sver = "28-01"; void loop() { // Date and Time RTC isRTC (); // Accelerometer isAccelerometer(); // Read the state of the pushbutton value: buttonState = digitalRead(iButton); // Check if the pushbutton is pressed. If it is, the buttonState is HIGH: if (buttonState == HIGH) { Keyboard.println(sKeyboard); } // Delay 1 sec delay(1000); }
getAccelerometer.ino
// Accelerometer // Accelerometer void isAccelerometer(){ // Accelerometer X, Y, Z // X X = analogRead(iX); Serial.print("X: "); Serial.println(X); // Y Y = analogRead(iY); Serial.print("Y: "); Serial.println(Y); // Z Z = analogRead(iZ); Serial.print("Z: "); Serial.println(Z); sKeyboard = sKeyboard + String(X) + "|" + String(Y) + "|" + String(Z) + "|*"; }
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; Serial.print("Date: "); Serial.println(dateRTC); // Time timeRTC = now.hour(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.minute(), DEC; timeRTC = timeRTC + ":"; timeRTC = timeRTC + now.second(), DEC; Serial.print("Time: "); Serial.println(timeRTC); sKeyboard = "SEN|" + sver + "|" + String(dateRTC) + "|" + String(timeRTC) + "|"; }
setup.ino
// Setup void setup() { // Serial Begin Serial.begin(115200); Serial.println("Starting Serial work!"); // 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(); // Initialize the pushbutton 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( 5000 ); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- RTOS
- Research & Development (R & D)
Instructor, E-Mentor, STEAM, and Arts-Based Training
- Programming Language
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #26 – Radio Frequency – Bluetooth Serial Terminal for Windows 10 – Mk25
——
#DonLucElectronics #DonLuc #RadioFrequency #Bluetooth #GPS #SparkFun #BME280 #CCS811 #IMU #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
Bluetooth Serial Terminal for Windows 10
You can use this App to communicate with Serial Bluetooth devices like the RN-42, ESP32, that are used for arduino projects and other custom projects. Make sure to pair the device first in PC Settings.
- Use the rfcomm protocol to communicate with serial bluetooth devices.
- You can send and recieve data in either hex or string format.
- UI more responsive while updating terminal.
- Bytes that do not have proper ascii mapping are converted to space characters.
- Transmit data is displayed on terminal if it is successfully sent.
- Communicate with Serial Bluetooth devices.
DL2307Mk06
1 x SparkFun Thing Plus – ESP32 WROOM
1 x Bluetooth Serial Terminal for Windows 10
1 x SparkFun BME280 – Temperature, Humidity, Barometric Pressure, and Altitude
1 x SparkFun Air Quality Breakout – CCS811
1 x Pololu AltIMU-10 v5
1 x GPS Receiver – GP-20U7
1 x Lithium Ion Battery – 850mAh
1 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
LED – LED_BUILTIN
SDA – Digital 23
SCL – Digital 22
GPR – Digital 16
GPT – Digital 17
RX2 – Bluetooth
TX2 – Bluetooth
VIN – +3.3V
GND – GND
——
DL2307Mk06ps.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #26 - Radio Frequency - Bluetooth Serial Terminal for Windows 10 - Mk25 26-25 DL2307Mk06p.ino 1 x SparkFun Thing Plus - ESP32 WROOM 1 x Bluetooth Serial Terminal for Windows 10 1 x SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude 1 x SparkFun Air Quality Breakout - CCS811 1 x Pololu AltIMU-10 v5 1 x GPS Receiver - GP-20U7 1 x Lithium Ion Battery - 85mAh 1 x SparkFun Cerberus USB Cable */ // Include the Library Code // Bluetooth Serial #include "BluetoothSerial.h" #if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED) #error Bluetooth is not enabled! Please run `make menuconfig` to and enable it #endif // Two Wire Interface (TWI/I2C) #include <Wire.h> // SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude #include <SparkFunBME280.h> // SparkFun CCS811 - eCO2 & tVOC #include <SparkFunCCS811.h> // Includes and variables for IMU integration // STMicroelectronics LSM6DS33 gyroscope and accelerometer #include <LSM6.h> // STMicroelectronics LIS3MDL magnetometer #include <LIS3MDL.h> // STMicroelectronics LPS25H digital barometer #include <LPS.h> // GPS Receiver #include <TinyGPS++.h> // ESP32 Hardware Serial #include <HardwareSerial.h> // Bluetooth Serial BluetoothSerial SerialBT; // SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude BME280 myBME280; float BMEtempC = 0; float BMEhumid = 0; float BMEpressure = 0; float BMEaltitudeM = 0; String FullString = ""; // SparkFun CCS811 - eCO2 & tVOC // Default I2C Address #define CCS811_ADDR 0x5B CCS811 myCCS811(CCS811_ADDR); float CCS811CO2 = 0; float CCS811TVOC = 0; String FullStringA = ""; // 9DoF IMU // STMicroelectronics LSM6DS33 gyroscope and accelerometer LSM6 imu; // Accelerometer and Gyroscopes // Accelerometer int imuAX; int imuAY; int imuAZ; String FullStringB = ""; // Gyroscopes int imuGX; int imuGY; int imuGZ; String FullStringC = ""; // STMicroelectronics LIS3MDL magnetometer LIS3MDL mag; // Magnetometer int magX; int magY; int magZ; String FullStringD = ""; // STMicroelectronics LPS25H digital barometer LPS ps; // Digital Barometer float pressure; float altitude; float temperature; String FullStringF = ""; // ESP32 HardwareSerial HardwareSerial tGPS(2); // GPS Receiver #define gpsRXPIN 16 // This one is unused and doesnt have a conection #define gpsTXPIN 17 // The TinyGPS++ object TinyGPSPlus gps; // Latitude float TargetLat; // Longitude float TargetLon; String FullStringG = ""; // GPS Date, Time, Speed, Altitude // GPS Date String TargetDat; // GPS Time String TargetTim; // GPS Speeds M/S String TargetSMS; // GPS Speeds Km/h String TargetSKH; // GPS Altitude Meters String TargetALT; // GPS Status String GPSSt = ""; String FullStringH = ""; // Software Version Information String sver = "26-25"; void loop() { // SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude isBME280(); // SparkFun CCS811 - eCO2 & tVOC isCCS811(); // Accelerometer and Gyroscopes isIMU(); // Magnetometer isMag(); // Barometer isBarometer(); // isGPS isGPS(); // Delay 1 sec delay(1000); }
getAccelGyro.ino
// Accelerometer and Gyroscopes // Setup IMU void setupIMU() { // Setup IMU imu.init(); // Default imu.enableDefault(); } // Accelerometer and Gyroscopes void isIMU() { // Accelerometer and Gyroscopes imu.read(); // Accelerometer x, y, z imuAX = imu.a.x; imuAY = imu.a.y; imuAZ = imu.a.z; // Gyroscopes x, y, z imuGX = imu.g.x; imuGY = imu.g.y; imuGZ = imu.g.z; // FullString B FullStringB = "Accelerometer X = " + String(imuAX) + " Accelerometer Y = " + String(imuAY) + " Accelerometer Z = " + String(imuAZ) + "\r\n"; // FullStringB Bluetooth Serial + Serial for(int i = 0; i < FullStringB.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringB.c_str()[i]); // Serial Serial.write(FullStringB.c_str()[i]); } // FullString C FullStringC = "Gyroscopes X = " + String(imuGX) + " Gyroscopes Y = " + String(imuGY) + " Gyroscopes Z = " + String(imuGZ) + "\r\n"; // FullStringC Bluetooth Serial + Serial for(int i = 0; i < FullStringC.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringC.c_str()[i]); // Serial Serial.write(FullStringC.c_str()[i]); } }
getBME280.ino
// SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude // isBME280 - Temperature, Humidity, Barometric Pressure, and Altitude void isBME280(){ // Temperature Celsius BMEtempC = myBME280.readTempC(); // Humidity BMEhumid = myBME280.readFloatHumidity(); // Barometric Pressure BMEpressure = myBME280.readFloatPressure(); // Altitude Meters BMEaltitudeM = (myBME280.readFloatAltitudeMeters(), 2); // FullString FullString = "Temperature = " + String(BMEtempC,2) + " Humidity = " + String(BMEhumid,2) + " Barometric = " + String(BMEpressure,2) + " Altitude Meters = " + String(BMEaltitudeM,2) + "\r\n"; // FullString Bluetooth Serial + Serial for(int i = 0; i < FullString.length(); i++) { // Bluetooth Serial SerialBT.write(FullString.c_str()[i]); // Serial Serial.write(FullString.c_str()[i]); } }
getBarometer.ino
// STMicroelectronics LPS25H digital barometer // Setup Barometer void isSetupBarometer(){ // Setup Barometer ps.init(); // Default ps.enableDefault(); } // Barometer void isBarometer(){ // Barometer pressure = ps.readPressureMillibars(); // Altitude Meters altitude = ps.pressureToAltitudeMeters(pressure); // Temperature Celsius temperature = ps.readTemperatureC(); // FullStringF FullStringF = "Barometer = " + String(pressure,2) + " Altitude Meters = " + String(altitude,2) + " Temperature Celsius = " + String(temperature,2) + "\r\n"; // FullStringF Bluetooth Serial + Serial for(int i = 0; i < FullStringF.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringF.c_str()[i]); // Serial Serial.write(FullStringF.c_str()[i]); } }
getCCS811.ino
// CCS811 - eCO2 & tVOC // isCCS811 - eCO2 & tVOC void isCCS811(){ // This sends the temperature & humidity data to the CCS811 myCCS811.setEnvironmentalData(BMEhumid, BMEtempC); // Calling this function updates the global tVOC and eCO2 variables myCCS811.readAlgorithmResults(); // eCO2 Concentration CCS811CO2 = myCCS811.getCO2(); // tVOC Concentration CCS811TVOC = myCCS811.getTVOC(); // FullStringA FullStringA = "TVOCs = " + String(CCS811TVOC,2) + " eCO2 = " + String(CCS811CO2,2) + "\r\n"; // FullStringA Bluetooth Serial + Serial for(int i = 0; i < FullStringA.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringA.c_str()[i]); // Serial Serial.write(FullStringA.c_str()[i]); } }
getGPS.ino
// GPS Receiver // Setup GPS void setupGPS() { // Setup GPS tGPS.begin( 9600 , SERIAL_8N1 , gpsRXPIN , gpsTXPIN ); } // isGPS void isGPS(){ // Receives NEMA data from GPS receiver // This sketch displays information every time a new sentence is correctly encoded while ( tGPS.available() > 0) if (gps.encode( tGPS.read() )) { // GPS Vector Pointer Target displayInfo(); // GPS Date, Time, Speed, Altitude displayDTS(); } if (millis() > 5000 && gps.charsProcessed() < 10) { while(true); } } // GPS Vector Pointer Target void displayInfo(){ // Location if (gps.location.isValid()) { // Latitude TargetLat = gps.location.lat(); // Longitude TargetLon = gps.location.lng(); // GPS Status 2 GPSSt = "Yes"; // FullStringG FullStringG = "Latitude = " + String(TargetLat) + " Longitude = " + String(TargetLon) + "\r\n"; // FullStringG Bluetooth Serial + Serial for(int i = 0; i < FullStringG.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringG.c_str()[i]); // Serial Serial.write(FullStringG.c_str()[i]); } } else { // GPS Status 0 GPSSt = "No"; } } // GPS Date, Time, Speed, Altitude void displayDTS(){ // Date TargetDat = ""; if (gps.date.isValid()) { // Date // Year TargetDat += String(gps.date.year(), DEC); TargetDat += "/"; // Month TargetDat += String(gps.date.month(), DEC); TargetDat += "/"; // Day TargetDat += String(gps.date.day(), DEC); // FullStringH FullStringH = "Date = " + String(TargetDat) + "\r\n"; // FullStringH Bluetooth Serial + Serial for(int i = 0; i < FullStringH.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringH.c_str()[i]); // Serial Serial.write(FullStringH.c_str()[i]); } } // Time TargetTim = ""; if (gps.time.isValid()) { // Time // Hour TargetTim += String(gps.time.hour(), DEC); TargetTim += ":"; // Minute TargetTim += String(gps.time.minute(), DEC); TargetTim += ":"; // Secound TargetTim += String(gps.time.second(), DEC); // FullStringH FullStringH = "Time = " + String(TargetTim) + "\r\n"; // FullStringH Bluetooth Serial + Serial for(int i = 0; i < FullStringH.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringH.c_str()[i]); // Serial Serial.write(FullStringH.c_str()[i]); } } // Speed TargetSMS = ""; TargetSKH = ""; if (gps.speed.isValid()) { // Speed // M/S int x = gps.speed.mps(); TargetSMS = String( x, DEC); // Km/h int y = gps.speed.kmph(); TargetSKH = String( y, DEC); // FullStringH FullStringH = "Speed = " + String(TargetSMS) + "\r\n"; // FullStringH Bluetooth Serial + Serial for(int i = 0; i < FullStringH.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringH.c_str()[i]); // Serial Serial.write(FullStringH.c_str()[i]); } } // Altitude TargetALT = ""; if (gps.altitude.isValid()) { // Altitude // Meters int z = gps.altitude.meters(); TargetALT = String( z, DEC); // FullStringH FullStringH = "Altitude = " + String(TargetALT) + "\r\n"; // FullStringH Bluetooth Serial + Serial for(int i = 0; i < FullStringH.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringH.c_str()[i]); // Serial Serial.write(FullStringH.c_str()[i]); } } }
getMagnetometer.ino
// Magnetometer // Setup Magnetometer void setupMag() { // Setup Magnetometer mag.init(); // Default mag.enableDefault(); } // Magnetometer void isMag() { // Magnetometer mag.read(); // Magnetometer x, y, z magX = mag.m.x; magY = mag.m.y; magZ = mag.m.z; // FullString D FullStringD = "Magnetometer X = " + String(magX) + " Magnetometer Y = " + String(magY) + " Magnetometer Z = " + String(magZ) + "\r\n"; // FullStringD Bluetooth Serial + Serial for(int i = 0; i < FullStringD.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringD.c_str()[i]); // Serial Serial.write(FullStringD.c_str()[i]); } }
setup.ino
// Setup void setup() { // Serial Begin Serial.begin(115200); Serial.println("Starting BLE work!"); // Bluetooth Serial SerialBT.begin("Don Luc Electronics"); Serial.println("Bluetooth Started! Ready to pair..."); // Give display time to power on delay(100); // Wire - Inialize I2C Hardware Wire.begin(); // Give display time to power on delay(100); // SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude myBME280.begin(); // CCS811 - eCO2 & tVOC myCCS811.begin(); // Setup IMU setupIMU(); // Setup Magnetometer setupMag(); // Setup Barometer isSetupBarometer(); // GPS Receiver // Setup GPS setupGPS(); // Initialize digital pin LED_BUILTIN as an output pinMode(LED_BUILTIN, OUTPUT); // Turn the LED on HIGH digitalWrite(LED_BUILTIN, HIGH); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- RTOS
- Research & Development (R & D)
Instructor, E-Mentor, STEAM, and Arts-Based Training
- Programming Language
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #26 – Radio Frequency – Bluetooth GPS Receiver GP-20U7 – Mk24
——
#DonLucElectronics #DonLuc #RadioFrequency #Bluetooth #GPS #SparkFun #BME280 #CCS811 #IMU #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
GPS Receiver – GP-20U7 (56 Channel)
The GP-20U7 is a compact GPS receiver with a built-in high performances all-in-one GPS chipset. The GP-20U7 accurately provides position, velocity, and time readings as well possessing high sensitivity and tracking capabilities. Thanks to the low power consumption this receiver requires, the GP-20U7 is ideal for portable applications such as tablet PCs, smart phones, and other devices requiring positioning capability. With 56 channels in search mode and 22 channels “All-In-View” tracking, the GP-20U7 is quite the work horse for its size.
DL2307Mk05
1 x SparkFun Thing Plus – ESP32 WROOM
1 x Arduino Uno
1 x SparkFun Bluetooth Mate Silver
1 x SparkFun BME280 – Temperature, Humidity, Barometric Pressure, and Altitude
1 x SparkFun Air Quality Breakout – CCS811
1 x Pololu AltIMU-10 v5
1 x GPS Receiver – GP-20U7
1 x Lithium Ion Battery – 850mAh
2 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
LED – LED_BUILTIN
SDA – Digital 23
SCL – Digital 22
GPR – Digital 16
GPT – Digital 17
RX2 – Bluetooth
TX2 – Bluetooth
VIN – +3.3V
GND – GND
——
DL2307Mk05ps.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #26 - Radio Frequency - Bluetooth GPS Receiver GP-20U7 - Mk24 26-24 DL2307Mk05pr.ino 1 x SparkFun Thing Plus - ESP32 WROOM 1 x Arduino Uno 1 x SparkFun Bluetooth Mate Silver 1 x SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude 1 x SparkFun Air Quality Breakout - CCS811 1 x Pololu AltIMU-10 v5 1 x GPS Receiver - GP-20U7 1 x Lithium Ion Battery - 85mAh 2 x SparkFun Cerberus USB Cable */ // Include the Library Code // Bluetooth Serial #include "BluetoothSerial.h" #if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED) #error Bluetooth is not enabled! Please run `make menuconfig` to and enable it #endif // Two Wire Interface (TWI/I2C) #include <Wire.h> // SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude #include <SparkFunBME280.h> // SparkFun CCS811 - eCO2 & tVOC #include <SparkFunCCS811.h> // Includes and variables for IMU integration // STMicroelectronics LSM6DS33 gyroscope and accelerometer #include <LSM6.h> // STMicroelectronics LIS3MDL magnetometer #include <LIS3MDL.h> // STMicroelectronics LPS25H digital barometer #include <LPS.h> // GPS Receiver #include <TinyGPS++.h> // ESP32 Hardware Serial #include <HardwareSerial.h> // Bluetooth Serial BluetoothSerial SerialBT; // SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude BME280 myBME280; float BMEtempC = 0; float BMEhumid = 0; float BMEpressure = 0; float BMEaltitudeM = 0; String FullString = ""; // SparkFun CCS811 - eCO2 & tVOC // Default I2C Address #define CCS811_ADDR 0x5B CCS811 myCCS811(CCS811_ADDR); float CCS811CO2 = 0; float CCS811TVOC = 0; String FullStringA = ""; // 9DoF IMU // STMicroelectronics LSM6DS33 gyroscope and accelerometer LSM6 imu; // Accelerometer and Gyroscopes // Accelerometer int imuAX; int imuAY; int imuAZ; String FullStringB = ""; // Gyroscopes int imuGX; int imuGY; int imuGZ; String FullStringC = ""; // STMicroelectronics LIS3MDL magnetometer LIS3MDL mag; // Magnetometer int magX; int magY; int magZ; String FullStringD = ""; // STMicroelectronics LPS25H digital barometer LPS ps; // Digital Barometer float pressure; float altitude; float temperature; String FullStringF = ""; // ESP32 HardwareSerial HardwareSerial tGPS(2); // GPS Receiver #define gpsRXPIN 16 // This one is unused and doesnt have a conection #define gpsTXPIN 17 // The TinyGPS++ object TinyGPSPlus gps; // Latitude float TargetLat; // Longitude float TargetLon; String FullStringG = ""; // GPS Date, Time, Speed, Altitude // GPS Date String TargetDat; // GPS Time String TargetTim; // GPS Speeds M/S String TargetSMS; // GPS Speeds Km/h String TargetSKH; // GPS Altitude Meters String TargetALT; // GPS Status String GPSSt = ""; String FullStringH = ""; // Software Version Information String sver = "26-24"; void loop() { // SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude isBME280(); // SparkFun CCS811 - eCO2 & tVOC isCCS811(); // Accelerometer and Gyroscopes isIMU(); // Magnetometer isMag(); // Barometer isBarometer(); // isGPS isGPS(); // Delay 1 sec delay(1000); }
getAccelGyro.ino
// Accelerometer and Gyroscopes // Setup IMU void setupIMU() { // Setup IMU imu.init(); // Default imu.enableDefault(); } // Accelerometer and Gyroscopes void isIMU() { // Accelerometer and Gyroscopes imu.read(); // Accelerometer x, y, z imuAX = imu.a.x; imuAY = imu.a.y; imuAZ = imu.a.z; // Gyroscopes x, y, z imuGX = imu.g.x; imuGY = imu.g.y; imuGZ = imu.g.z; // FullString B FullStringB = "Accelerometer X = " + String(imuAX) + " Accelerometer Y = " + String(imuAY) + " Accelerometer Z = " + String(imuAZ) + "\r\n"; // FullStringB Bluetooth Serial + Serial for(int i = 0; i < FullStringB.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringB.c_str()[i]); // Serial Serial.write(FullStringB.c_str()[i]); } // FullString C FullStringC = "Gyroscopes X = " + String(imuGX) + " Gyroscopes Y = " + String(imuGY) + " Gyroscopes Z = " + String(imuGZ) + "\r\n"; // FullStringC Bluetooth Serial + Serial for(int i = 0; i < FullStringC.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringC.c_str()[i]); // Serial Serial.write(FullStringC.c_str()[i]); } }
getBME280.ino
// SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude // isBME280 - Temperature, Humidity, Barometric Pressure, and Altitude void isBME280(){ // Temperature Celsius BMEtempC = myBME280.readTempC(); // Humidity BMEhumid = myBME280.readFloatHumidity(); // Barometric Pressure BMEpressure = myBME280.readFloatPressure(); // Altitude Meters BMEaltitudeM = (myBME280.readFloatAltitudeMeters(), 2); // FullString FullString = "Temperature = " + String(BMEtempC,2) + " Humidity = " + String(BMEhumid,2) + " Barometric = " + String(BMEpressure,2) + " Altitude Meters = " + String(BMEaltitudeM,2) + "\r\n"; // FullString Bluetooth Serial + Serial for(int i = 0; i < FullString.length(); i++) { // Bluetooth Serial SerialBT.write(FullString.c_str()[i]); // Serial Serial.write(FullString.c_str()[i]); } }
getBarometer.ino
// STMicroelectronics LPS25H digital barometer // Setup Barometer void isSetupBarometer(){ // Setup Barometer ps.init(); // Default ps.enableDefault(); } // Barometer void isBarometer(){ // Barometer pressure = ps.readPressureMillibars(); // Altitude Meters altitude = ps.pressureToAltitudeMeters(pressure); // Temperature Celsius temperature = ps.readTemperatureC(); // FullStringF FullStringF = "Barometer = " + String(pressure,2) + " Altitude Meters = " + String(altitude,2) + " Temperature Celsius = " + String(temperature,2) + "\r\n"; // FullStringF Bluetooth Serial + Serial for(int i = 0; i < FullStringF.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringF.c_str()[i]); // Serial Serial.write(FullStringF.c_str()[i]); } }
getCCS811.ino
// CCS811 - eCO2 & tVOC // isCCS811 - eCO2 & tVOC void isCCS811(){ // This sends the temperature & humidity data to the CCS811 myCCS811.setEnvironmentalData(BMEhumid, BMEtempC); // Calling this function updates the global tVOC and eCO2 variables myCCS811.readAlgorithmResults(); // eCO2 Concentration CCS811CO2 = myCCS811.getCO2(); // tVOC Concentration CCS811TVOC = myCCS811.getTVOC(); // FullStringA FullStringA = "TVOCs = " + String(CCS811TVOC,2) + " eCO2 = " + String(CCS811CO2,2) + "\r\n"; // FullStringA Bluetooth Serial + Serial for(int i = 0; i < FullStringA.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringA.c_str()[i]); // Serial Serial.write(FullStringA.c_str()[i]); } }
getGPS.ino
// GPS Receiver // Setup GPS void setupGPS() { // Setup GPS tGPS.begin( 9600 , SERIAL_8N1 , gpsRXPIN , gpsTXPIN ); } // isGPS void isGPS(){ // Receives NEMA data from GPS receiver // This sketch displays information every time a new sentence is correctly encoded while ( tGPS.available() > 0) if (gps.encode( tGPS.read() )) { // GPS Vector Pointer Target displayInfo(); // GPS Date, Time, Speed, Altitude displayDTS(); } if (millis() > 5000 && gps.charsProcessed() < 10) { while(true); } } // GPS Vector Pointer Target void displayInfo(){ // Location if (gps.location.isValid()) { // Latitude TargetLat = gps.location.lat(); // Longitude TargetLon = gps.location.lng(); // GPS Status 2 GPSSt = "Yes"; // FullStringG FullStringG = "Latitude = " + String(TargetLat) + " Longitude = " + String(TargetLon) + "\r\n"; // FullStringG Bluetooth Serial + Serial for(int i = 0; i < FullStringG.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringG.c_str()[i]); // Serial Serial.write(FullStringG.c_str()[i]); } } else { // GPS Status 0 GPSSt = "No"; } } // GPS Date, Time, Speed, Altitude void displayDTS(){ // Date TargetDat = ""; if (gps.date.isValid()) { // Date // Year TargetDat += String(gps.date.year(), DEC); TargetDat += "/"; // Month TargetDat += String(gps.date.month(), DEC); TargetDat += "/"; // Day TargetDat += String(gps.date.day(), DEC); // FullStringH FullStringH = "Date = " + String(TargetDat) + "\r\n"; // FullStringH Bluetooth Serial + Serial for(int i = 0; i < FullStringH.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringH.c_str()[i]); // Serial Serial.write(FullStringH.c_str()[i]); } } // Time TargetTim = ""; if (gps.time.isValid()) { // Time // Hour TargetTim += String(gps.time.hour(), DEC); TargetTim += ":"; // Minute TargetTim += String(gps.time.minute(), DEC); TargetTim += ":"; // Secound TargetTim += String(gps.time.second(), DEC); // FullStringH FullStringH = "Time = " + String(TargetTim) + "\r\n"; // FullStringH Bluetooth Serial + Serial for(int i = 0; i < FullStringH.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringH.c_str()[i]); // Serial Serial.write(FullStringH.c_str()[i]); } } // Speed TargetSMS = ""; TargetSKH = ""; if (gps.speed.isValid()) { // Speed // M/S int x = gps.speed.mps(); TargetSMS = String( x, DEC); // Km/h int y = gps.speed.kmph(); TargetSKH = String( y, DEC); // FullStringH FullStringH = "Speed = " + String(TargetSMS) + "\r\n"; // FullStringH Bluetooth Serial + Serial for(int i = 0; i < FullStringH.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringH.c_str()[i]); // Serial Serial.write(FullStringH.c_str()[i]); } } // Altitude TargetALT = ""; if (gps.altitude.isValid()) { // Altitude // Meters int z = gps.altitude.meters(); TargetALT = String( z, DEC); // FullStringH FullStringH = "Altitude = " + String(TargetALT) + "\r\n"; // FullStringH Bluetooth Serial + Serial for(int i = 0; i < FullStringH.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringH.c_str()[i]); // Serial Serial.write(FullStringH.c_str()[i]); } } }
getMagnetometer.ino
// Magnetometer // Setup Magnetometer void setupMag() { // Setup Magnetometer mag.init(); // Default mag.enableDefault(); } // Magnetometer void isMag() { // Magnetometer mag.read(); // Magnetometer x, y, z magX = mag.m.x; magY = mag.m.y; magZ = mag.m.z; // FullString D FullStringD = "Magnetometer X = " + String(magX) + " Magnetometer Y = " + String(magY) + " Magnetometer Z = " + String(magZ) + "\r\n"; // FullStringD Bluetooth Serial + Serial for(int i = 0; i < FullStringD.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringD.c_str()[i]); // Serial Serial.write(FullStringD.c_str()[i]); } }
setup.ino
// Setup void setup() { // Serial Begin Serial.begin(9600); Serial.println("Starting BLE work!"); // Bluetooth Serial SerialBT.begin("Don Luc Electronics"); Serial.println("Bluetooth Started! Ready to pair..."); // Give display time to power on delay(100); // Wire - Inialize I2C Hardware Wire.begin(); // Give display time to power on delay(100); // SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude myBME280.begin(); // CCS811 - eCO2 & tVOC myCCS811.begin(); // Setup IMU setupIMU(); // Setup Magnetometer setupMag(); // Setup Barometer isSetupBarometer(); // GPS Receiver // Setup GPS setupGPS(); // Initialize digital pin LED_BUILTIN as an output pinMode(LED_BUILTIN, OUTPUT); // Turn the LED on HIGH digitalWrite(LED_BUILTIN, HIGH); }
——
Arduino Uno
RX – Digital 3
TX – Digital 2
VIN – +3.3V
GND – GND
——
DL2307Mk05pr.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #26 - Radio Frequency - Bluetooth GPS Receiver GP-20U7 - Mk24 26-24 DL2307Mk05pr.ino 1 x Arduino Uno 1 x SparkFun RedBoard Qwiic 1 x SparkFun Bluetooth Mate Silver 1 x SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude 1 x SparkFun Air Quality Breakout - CCS811 1 x Pololu AltIMU-10 v5 1 x GPS Receiver - GP-20U7 1 x Lithium Ion Battery - 85mAh 2 x SparkFun Cerberus USB Cable */ // Include the Library Code // Software Serial #include <SoftwareSerial.h> // Software Serial // TX-O pin of bluetooth mate, Arduino D2 int bluetoothTx = 2; // RX-I pin of bluetooth mate, Arduino D3 int bluetoothRx = 3; // Bluetooth SoftwareSerial bluetooth(bluetoothTx, bluetoothRx); // BTA //String BTA = "0006664FDC9E"; // Software Version Information String sver = "26-24"; void loop() { // isBluetooth isBluetooth(); }
getBluetooth.ino
// Bluetooth // Setup Bluetooth void isSetupBluetooth(){ // Setup Bluetooth // Begin the serial monitor at 9600bps Serial.begin(9600); // Bluetooth // The Bluetooth Mate defaults to 115200bps bluetooth.begin(115200); // Print three times individually bluetooth.print("$"); bluetooth.print("$"); bluetooth.print("$"); // Enter command mode // Short delay, wait for the Mate to send back CMD delay(100); // Temporarily Change the baudrate to 9600, no parity bluetooth.println("U,9600,N"); // 115200 can be too fast at times for NewSoftSerial to relay the data reliably // Start bluetooth serial at 9600 bluetooth.begin(9600); } // isBluetooth void isBluetooth() { // If the bluetooth sent any characters if(bluetooth.available()) { // Send any characters the bluetooth prints to the serial monitor Serial.print((char)bluetooth.read()); } // If stuff was typed in the serial monitor if(Serial.available()) { // Send any characters the Serial monitor prints to the bluetooth bluetooth.print((char)Serial.read()); } }
setup.ino
// Setup void setup() { // Setup Bluetooth isSetupBluetooth(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- RTOS
- Research & Development (R & D)
Instructor, E-Mentor, STEAM, and Arts-Based Training
- Programming Language
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc
Project #26 – Radio Frequency – Bluetooth Pololu AltIMU-10 – Mk23
——
#DonLucElectronics #DonLuc #RadioFrequency #Bluetooth #SparkFun #BME280 #CCS811 #IMU #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant
——
——
——
——
AltIMU-10 v5 Gyro, Accelerometer, Compass, and Altimeter
The Pololu AltIMU-10 v5 is an inertial measurement unit (IMU) and altimeter that features the same LSM6DS33 gyro and accelerometer and LIS3MDL magnetometer as the MinIMU-9 v5, and adds an LPS25H digital barometer. An I²C interface accesses ten independent pressure, rotation, acceleration, and magnetic measurements that can be used to calculate the sensor’s altitude and absolute orientation. The Pololu AltIMU-10 v5 is a compact board that combines ST’s LSM6DS33 3-axis gyroscope and 3-axis accelerometer, LIS3MDL 3-axis magnetometer, and LPS25H digital barometer to form an inertial measurement unit (IMU) and altimeter.
DL2307Mk04
1 x SparkFun Thing Plus – ESP32 WROOM
1 x Arduino Uno
1 x SparkFun Bluetooth Mate Silver
1 x SparkFun BME280 – Temperature, Humidity, Barometric Pressure, and Altitude
1 x SparkFun Air Quality Breakout – CCS811
1 x Pololu AltIMU-10 v5
1 x Lithium Ion Battery – 850mAh
2 x SparkFun Cerberus USB Cable
SparkFun Thing Plus – ESP32 WROOM
LED – LED_BUILTIN
SDA – Digital 23
SCL – Digital 22
RX2 – Bluetooth
TX2 – Bluetooth
VIN – +3.3V
GND – GND
——
DL2307Mk04ps.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #26 - Radio Frequency - Bluetooth Pololu AltIMU-10 - Mk23 26-23 DL2307Mk04pr.ino 1 x SparkFun Thing Plus - ESP32 WROOM 1 x Arduino Uno 1 x SparkFun Bluetooth Mate Silver 1 x SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude 1 x SparkFun Air Quality Breakout - CCS811 1 x Pololu AltIMU-10 v5 1 x Lithium Ion Battery - 85mAh 2 x SparkFun Cerberus USB Cable */ // Include the Library Code // Bluetooth Serial #include "BluetoothSerial.h" #if !defined(CONFIG_BT_ENABLED) || !defined(CONFIG_BLUEDROID_ENABLED) #error Bluetooth is not enabled! Please run `make menuconfig` to and enable it #endif // Two Wire Interface (TWI/I2C) #include <Wire.h> // SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude #include <SparkFunBME280.h> // SparkFun CCS811 - eCO2 & tVOC #include <SparkFunCCS811.h> // Includes and variables for IMU integration // STMicroelectronics LSM6DS33 gyroscope and accelerometer #include <LSM6.h> // STMicroelectronics LIS3MDL magnetometer #include <LIS3MDL.h> // STMicroelectronics LPS25H digital barometer #include <LPS.h> // Bluetooth Serial BluetoothSerial SerialBT; // SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude BME280 myBME280; float BMEtempC = 0; float BMEhumid = 0; float BMEpressure = 0; float BMEaltitudeM = 0; String FullString = ""; // SparkFun CCS811 - eCO2 & tVOC // Default I2C Address #define CCS811_ADDR 0x5B CCS811 myCCS811(CCS811_ADDR); float CCS811CO2 = 0; float CCS811TVOC = 0; String FullStringA = ""; // 9DoF IMU // STMicroelectronics LSM6DS33 gyroscope and accelerometer LSM6 imu; // Accelerometer and Gyroscopes // Accelerometer int imuAX; int imuAY; int imuAZ; String FullStringB = ""; // Gyroscopes int imuGX; int imuGY; int imuGZ; String FullStringC = ""; // STMicroelectronics LIS3MDL magnetometer LIS3MDL mag; // Magnetometer int magX; int magY; int magZ; String FullStringD = ""; // STMicroelectronics LPS25H digital barometer LPS ps; // Digital Barometer float pressure; float altitude; float temperature; String FullStringF = ""; // Software Version Information String sver = "26-23"; void loop() { // SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude isBME280(); // SparkFun CCS811 - eCO2 & tVOC isCCS811(); // Accelerometer and Gyroscopes isIMU(); // Magnetometer isMag(); // Barometer isBarometer(); // Delay 1 sec delay(1000); }
getAccelGyro.ino
// Accelerometer and Gyroscopes // Setup IMU void setupIMU() { // Setup IMU imu.init(); // Default imu.enableDefault(); } // Accelerometer and Gyroscopes void isIMU() { // Accelerometer and Gyroscopes imu.read(); // Accelerometer x, y, z imuAX = imu.a.x; imuAY = imu.a.y; imuAZ = imu.a.z; // Gyroscopes x, y, z imuGX = imu.g.x; imuGY = imu.g.y; imuGZ = imu.g.z; // FullString B FullStringB = "Accelerometer X = " + String(imuAX) + " Accelerometer Y = " + String(imuAY) + " Accelerometer Z = " + String(imuAZ) + "\r\n"; // FullStringB Bluetooth Serial + Serial for(int i = 0; i < FullStringB.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringB.c_str()[i]); // Serial Serial.write(FullStringB.c_str()[i]); } // FullString C FullStringC = "Gyroscopes X = " + String(imuGX) + " Gyroscopes Y = " + String(imuGY) + " Gyroscopes Z = " + String(imuGZ) + "\r\n"; // FullStringC Bluetooth Serial + Serial for(int i = 0; i < FullStringC.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringC.c_str()[i]); // Serial Serial.write(FullStringC.c_str()[i]); } }
getBME280.ino
// SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude // isBME280 - Temperature, Humidity, Barometric Pressure, and Altitude void isBME280(){ // Temperature Celsius BMEtempC = myBME280.readTempC(); // Humidity BMEhumid = myBME280.readFloatHumidity(); // Barometric Pressure BMEpressure = myBME280.readFloatPressure(); // Altitude Meters BMEaltitudeM = (myBME280.readFloatAltitudeMeters(), 2); // FullString FullString = "Temperature = " + String(BMEtempC,2) + " Humidity = " + String(BMEhumid,2) + " Barometric = " + String(BMEpressure,2) + " Altitude Meters = " + String(BMEaltitudeM,2) + "\r\n"; // FullString Bluetooth Serial + Serial for(int i = 0; i < FullString.length(); i++) { // Bluetooth Serial SerialBT.write(FullString.c_str()[i]); // Serial Serial.write(FullString.c_str()[i]); } }
getBarometer.ino
// STMicroelectronics LPS25H digital barometer // Setup Barometer void isSetupBarometer(){ // Setup Barometer ps.init(); // Default ps.enableDefault(); } // Barometer void isBarometer(){ // Barometer pressure = ps.readPressureMillibars(); // Altitude Meters altitude = ps.pressureToAltitudeMeters(pressure); // Temperature Celsius temperature = ps.readTemperatureC(); // FullStringF FullStringF = "Barometer = " + String(pressure,2) + " Altitude Meters = " + String(altitude,2) + " Temperature Celsius = " + String(temperature,2) + "\r\n"; // FullStringF Bluetooth Serial + Serial for(int i = 0; i < FullStringF.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringF.c_str()[i]); // Serial Serial.write(FullStringF.c_str()[i]); } }
getCCS811.ino
// CCS811 - eCO2 & tVOC // isCCS811 - eCO2 & tVOC void isCCS811(){ // This sends the temperature & humidity data to the CCS811 myCCS811.setEnvironmentalData(BMEhumid, BMEtempC); // Calling this function updates the global tVOC and eCO2 variables myCCS811.readAlgorithmResults(); // eCO2 Concentration CCS811CO2 = myCCS811.getCO2(); // tVOC Concentration CCS811TVOC = myCCS811.getTVOC(); // FullStringA FullStringA = "TVOCs = " + String(CCS811TVOC,2) + " eCO2 = " + String(CCS811CO2,2) + "\r\n"; // FullStringA Bluetooth Serial + Serial for(int i = 0; i < FullStringA.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringA.c_str()[i]); // Serial Serial.write(FullStringA.c_str()[i]); } }
getMagnetometer.ino
// Magnetometer // Setup Magnetometer void setupMag() { // Setup Magnetometer mag.init(); // Default mag.enableDefault(); } // Magnetometer void isMag() { // Magnetometer mag.read(); // Magnetometer x, y, z magX = mag.m.x; magY = mag.m.y; magZ = mag.m.z; // FullString D FullStringD = "Magnetometer X = " + String(magX) + " Magnetometer Y = " + String(magY) + " Magnetometer Z = " + String(magZ) + "\r\n"; // FullStringD Bluetooth Serial + Serial for(int i = 0; i < FullStringD.length(); i++) { // Bluetooth Serial SerialBT.write(FullStringD.c_str()[i]); // Serial Serial.write(FullStringD.c_str()[i]); } }
setup.ino
// Setup void setup() { // Serial Begin Serial.begin(9600); Serial.println("Starting BLE work!"); // Bluetooth Serial SerialBT.begin("Don Luc Electronics"); Serial.println("Bluetooth Started! Ready to pair..."); // Give display time to power on delay(100); // Wire - Inialize I2C Hardware Wire.begin(); // Give display time to power on delay(100); // SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude myBME280.begin(); // CCS811 - eCO2 & tVOC myCCS811.begin(); // Setup IMU setupIMU(); // Setup Magnetometer setupMag(); // Setup Barometer isSetupBarometer(); // Initialize digital pin LED_BUILTIN as an output pinMode(LED_BUILTIN, OUTPUT); // Turn the LED on HIGH digitalWrite(LED_BUILTIN, HIGH); }
——
Arduino Uno
RX – Digital 3
TX – Digital 2
VIN – +3.3V
GND – GND
——
DL2307Mk04pr.ino
/* ***** Don Luc Electronics © ***** Software Version Information Project #26 - Radio Frequency - Bluetooth Pololu AltIMU-10 - Mk23 26-23 DL2307Mk04pr.ino 1 x Arduino Uno 1 x SparkFun RedBoard Qwiic 1 x SparkFun Bluetooth Mate Silver 1 x SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude 1 x SparkFun Air Quality Breakout - CCS811 1 x Pololu AltIMU-10 v5 1 x Lithium Ion Battery - 85mAh 2 x SparkFun Cerberus USB Cable */ // Include the Library Code // Software Serial #include <SoftwareSerial.h> // Software Serial // TX-O pin of bluetooth mate, Arduino D2 int bluetoothTx = 2; // RX-I pin of bluetooth mate, Arduino D3 int bluetoothRx = 3; // Bluetooth SoftwareSerial bluetooth(bluetoothTx, bluetoothRx); // BTA //String BTA = "0006664FDC9E"; // Software Version Information String sver = "26-23"; void loop() { // isBluetooth isBluetooth(); }
getBluetooth.ino
// Bluetooth // Setup Bluetooth void isSetupBluetooth(){ // Setup Bluetooth // Begin the serial monitor at 9600bps Serial.begin(9600); // Bluetooth // The Bluetooth Mate defaults to 115200bps bluetooth.begin(115200); // Print three times individually bluetooth.print("$"); bluetooth.print("$"); bluetooth.print("$"); // Enter command mode // Short delay, wait for the Mate to send back CMD delay(100); // Temporarily Change the baudrate to 9600, no parity bluetooth.println("U,9600,N"); // 115200 can be too fast at times for NewSoftSerial to relay the data reliably // Start bluetooth serial at 9600 bluetooth.begin(9600); } // isBluetooth void isBluetooth() { // If the bluetooth sent any characters if(bluetooth.available()) { // Send any characters the bluetooth prints to the serial monitor Serial.print((char)bluetooth.read()); } // If stuff was typed in the serial monitor if(Serial.available()) { // Send any characters the Serial monitor prints to the bluetooth bluetooth.print((char)Serial.read()); } }
setup.ino
// Setup void setup() { // Setup Bluetooth isSetupBluetooth(); }
——
People can contact us: https://www.donluc.com/?page_id=1927
Technology Experience
- Programming Language
- Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
- IoT
- Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
- Robotics
- Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
- Unmanned Vehicles Terrestrial and Marine
- Machine Learning
- RTOS
- Research & Development (R & D)
Instructor, E-Mentor, STEAM, and Arts-Based Training
- Programming Language
- IoT
- PIC Microcontrollers
- Arduino
- Raspberry Pi
- Espressif
- Robotics
Follow Us
Luc Paquin – Curriculum Vitae – 2023
https://www.donluc.com/luc/
Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/@thesass2063
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/
Don Luc