The Alpha Geek – Geeking Out

Program Arduino

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

——

Pololu MinIMU-9 v5

——

Pololu MinIMU-9 v5

——

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

——

Gyroscope L3G4200D

——

Gyroscope L3G4200D

——

Gyroscope L3G4200D

——

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 – Accelerometer ADXL335 – Mk01

——

#DonLucElectronics #DonLuc #Sensors #ADXL335 #Adafruit #SparkFun #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

Accelerometer ADXL335

——

Accelerometer ADXL335

——

Accelerometer ADXL335

——

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 GPS Receiver GP-20U7 – Mk24

——

#DonLucElectronics #DonLuc #RadioFrequency #Bluetooth #GPS #SparkFun #BME280 #CCS811 #IMU #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

Bluetooth GPS Receiver GP-20U7

——

Bluetooth GPS Receiver GP-20U7

——

Bluetooth GPS Receiver GP-20U7

——

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

——

Bluetooth Pololu AltIMU-10

——

Bluetooth Pololu AltIMU-10

——

Bluetooth Pololu AltIMU-10

——

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

Project #26 – Radio Frequency – Bluetooth CCS811 – Mk22

——

#DonLucElectronics #DonLuc #RadioFrequency #Bluetooth #SparkFun #BME280 #CCS811 #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

Bluetooth CCS811

——

Bluetooth CCS811

——

Bluetooth CCS811

——

SparkFun Air Quality Breakout – CCS811

The CCS811 Air Quality Breakout is a digital gas sensor solution that senses a wide range of Total Volatile Organic Compounds (TVOCs), including equivalent carbon dioxide (eCO2) and metal oxide (MOX) levels. VOCs are often categorized as pollutants and or sensory irritants and can come from a variety of sources like construction materials, machines and even people. This breakout is intended for indoor air quality monitoring in personal devices such as watches and phone.

DL2307Mk03

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 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

——

DL2307Mk03ps.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #26 - Radio Frequency - SparkFun CCS811 - Mk22
26-22
DL2307Mk03pr.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 Lithium Ion Battery - 850mAh
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>

// 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 = "";

// Software Version Information
String sver = "26-22";

void loop() {

  // SparkFun BME280 - Temperature, Humidity, Barometric Pressure, and Altitude
  isBME280();

  // SparkFun CCS811 - eCO2 & tVOC
  isCCS811();

  // Delay 1 sec
  delay(1000);

}

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]);
    
  }

}

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]);
    
  }

}

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();

  // 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

DL2307Mk03pr.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #26 - Radio Frequency - Bluetooth CCS811 - Mk22
26-22
DL2307Mk03pr.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 Lithium Ion Battery - 850mAh
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-22";

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 SparkFun Thing Plus – ESP32 WROOM – Mk20

——

#DonLucElectronics #DonLuc #RadioFrequency #Bluetooth #SparkFun #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

SparkFun Thing Plus - ESP32 WROOM

——

SparkFun Thing Plus - ESP32 WROOM

——

SparkFun Thing Plus - ESP32 WROOM

——

SparkFun Thing Plus – ESP32 WROOM

The SparkFun ESP32 Thing Plus is the next step to get started with Espressif IoT ideations while still enjoying all the amenities of the original ESP32 Thing. Espressif’s ESP32 WROOM is a powerful WiFi and Bluetooth MCU module that targets a wide variety of applications. At the core of this module is the ESP32-D0WDQ6 chip which is designed to be both scalable and adaptive. To make the Thing Plus even easier to use, we’ve moved a few pins around to make the board Feather compatible and it utilizes our handy Qwiic Connect System which means no soldering or shields are required to connect it to the rest of your system.

The ESP32 Thing plus integrates a rich set of peripherals, ranging from capacitive touch sensors, SD card interface, Ethernet, high-speed SPI, UART, I2S and I2C. Thanks to the onboard ESP32 WROOM module, the SparkFun Thing Plus features 16MB of flash memory, 520kB of internal SRAM, an integrated 802.11 BGN WiFi transceiver and dual-mode Bluetooth capabilities, and a JST connector to plug in a LiPo battery.

DL2307Mk01

1 x Arduino Uno
1 x SparkFun Thing Plus – ESP32 WROOM
1 x SparkFun Bluetooth Mate Silver
2 x SparkFun Cerberus USB Cable

Arduino Uno

RX – Digital 3
TX – Digital 2
VIN – +3.3V
GND – GND

——

DL2307Mk01pr.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #26 - Radio Frequency - Bluetooth SparkFun Thing Plus - ESP32 WROOM - Mk20
26-20
DL2307Mk01pr.ino
1 x Arduino Uno
1 x SparkFun Thing Plus - ESP32 WROOM
2 x SparkFun Bluetooth Mate Silver
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);

// Software Version Information
String sver = "26-20";

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();

}

——

SparkFun Thing Plus – ESP32 WROOM

RX2 – Bluetooth
TX2 – Bluetooth
VIN – +3.3V
GND – GND

——

DL2307Mk01ps.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #26 - Radio Frequency - Bluetooth SparkFun Thing Plus - ESP32 WROOM  - Mk20
26-20
DL2307Mk01pr.ino
1 x Arduino Uno
1 x SparkFun Thing Plus - ESP32 WROOM
2 x SparkFun Bluetooth Mate Silver
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

// Bluetooth Serial
BluetoothSerial SerialBT;

// Software Version Information
String sver = "26-20";

void loop() {

  // isBluetooth
  isBluetooth();

}

getBluetooth.ino

// Bluetooth
// Setup Bluetooth
void isSetupBluetooth(){

  // Serial Begin
  Serial.begin(9600);
  
  // Bluetooth device name
  SerialBT.begin("DL2307Mk01ps");
  
  // Serial
  Serial.println("The device started, now you can pair it with bluetooth!");
  
}
// isBluetooth
void isBluetooth() {

  // If stuff was typed in the serial monitor
  if (Serial.available()) {
    
    // Send any characters the Serial monitor prints to the bluetooth
    SerialBT.write(Serial.read());
    
  }
  // If the bluetooth sent any characters
  if (SerialBT.available()) {
    
    // Send any characters the bluetooth prints to the serial monitor
    Serial.write(SerialBT.read());
    
  }
  // Delay
  delay(20);

}

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 Commands – Mk19

——

#DonLucElectronics #DonLuc #RadioFrequency #Bluetooth #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

Bluetooth Commands

——

Bluetooth Commands

——

Bluetooth Commands

——

ACTION Commands

Begin by sending the inquiry scan command: I,, to search for other Bluetooth modules in range. The parameter defines the number of seconds the modem will take to look for other modules. It’ll default to 10 if not defined. If you just type “I” and click send, the device should respond with a “Inquiry, COD=0”, and then after ten seconds it’ll respond with any Bluetooth modules it found. It will print their information as “BT address, BT name, COD”.

If the modem finds any modules, you can try sending the connect command: C,

< to connect to one of them. The modem in the example above found one devices in range, by sending the C,0006664FAE18 command, we can attempt to connect to one of them. After sending the connect command, the device will respond with "TRYING", which will be followed by either "CONNECT failed" or the connection will be successful. After a successful connection we immediately enter data mode, and the modem becomes a pipeline. Any characters sent from one Bluetooth device will be sent to the other, and vice-versa. DL2306Mk06

1 x Arduino Uno
1 x SparkFun RedBoard Qwiic
2 x SparkFun Bluetooth Mate Silver
2 x SparkFun Cerberus USB Cable

Arduino Uno

RX – Digital 3
TX – Digital 2
VIN – +3.3V
GND – GND

——

DL2306Mk06pr.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #26 - Radio Frequency - Bluetooth Commands - Mk19
26-19
DL2306Mk03pr.ino
1 x Arduino Uno
1 x SparkFun RedBoard Qwiic
2 x SparkFun Bluetooth Mate Silver
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-19";

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();

}

——

SparkFun RedBoard Qwiic

RX – Digital 3
TX – Digital 2
VIN – +3.3V
GND – GND

——

DL2306Mk06ps.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #26 - Radio Frequency - Bluetooth Commands - Mk19
26-19
DL2306Mk03ps.ino
1 x Arduino Uno
1 x SparkFun RedBoard Qwiic
2 x SparkFun Bluetooth Mate Silver
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 = "0006664FAE18"; 

// Software Version Information
String sver = "26-19";

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 Moteino – Mk18

——

#DonLucElectronics #DonLuc #RadioFrequency #Bluetooth #Accelerometer #Magnetometer #Gyroscope #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

Bluetooth Moteino

——

Bluetooth Moteino

——

Bluetooth Moteino

——

Moteino

Moteino began as a low power wireless Arduino compatible development platform based on the popular ATmega328p chip used in the Arduino UNO. Moteinos are compatible and can communicate with any other Arduino or development platform that uses the popular HopeRF RFM69 or LoRa transceivers, or even the older RFM12B. Moteino also comes with an optional SPI flash memory chip for wireless programming, or data logging. Moteino was designed to be a compact, highly customizable and affordable development platform, suitable for IoT, home automation and long range wireless projects.

Moteino in RFM12B to rebuild suggests doing as new without completely replacing. I decided to stripped down at RFM12B and rebuild in Bluetooth.

DL2306Mk05

1 x Moteino
1 x SparkFun Bluetooth Mate Silver
1 x SparkFun 9 Degrees of Freedom Breakout – MPU-9150
1 x LED Red
1 x SparkFun FTDI Basic Breakout – 5V
1 x SparkFun Cerberus USB Cable

Moteino

LED – Digital 8
RX – Digital 3
TX – Digital 2
SDA – Analog A4
SCL – Analog A5
VIN – +3.3V
GND – GND

——

DL2306Mk05p.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #26 - Radio Frequency - Bluetooth Moteino - Mk18
26-18
DL2306Mk05p.ino
1 x Moteino
1 x SparkFun Bluetooth Mate Silver
1 x SparkFun 9 Degrees of Freedom Breakout - MPU-9150
1 x LED Red
1 x SparkFun FTDI Basic Breakout - 5V
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code
// Software Serial
#include <SoftwareSerial.h>
// Two Wire Interface (TWI/I2C)
#include <Wire.h>
// I2CDev I2C utilities
#include "I2Cdev.h"
// MPU9150Lib 9-axis fusion
#include "MPU9150Lib.h"
// CalLib magnetometer and accelerometer calibration
#include "CalLib.h"
// Motion Driver InvenSense Embedded SDK v5.1
#include <dmpKey.h>
#include <dmpmap.h>
#include <inv_mpu.h>
#include <inv_mpu_dmp_motion_driver.h>
// EEPROM Magnetometer and Accelerometer data is stored
#include <EEPROM.h>

// the MPU object
MPU9150Lib MPU;
//  MPU_UPDATE_RATE defines the rate (in Hz)
// at which the MPU updates the sensor data and DMP output
#define MPU_UPDATE_RATE  (20)
//  MAG_UPDATE_RATE defines the rate (in Hz) at which the
// MPU updates the magnetometer data
//  MAG_UPDATE_RATE should be less than or equal to the MPU_UPDATE_RATE
#define MAG_UPDATE_RATE  (10)
//  MPU_MAG_MIX defines the influence that the magnetometer has on the yaw output.
//  The magnetometer itself is quite noisy so some mixing with the gyro yaw can help
//  significantly. Some example values are defined below:
// Just use gyro yaw
#define  MPU_MAG_MIX_GYRO_ONLY          0
// Just use magnetometer and no gyro yaw
#define  MPU_MAG_MIX_MAG_ONLY           1
// A good mix value 
#define  MPU_MAG_MIX_GYRO_AND_MAG       10
// mainly gyros with a bit of mag correction
#define  MPU_MAG_MIX_GYRO_AND_SOME_MAG  50
//  MPU_LPF_RATE is the low pas filter rate and can be between 5 and 188Hz
#define MPU_LPF_RATE   5

// This is our earth frame gravity vector - quaternions and vectors
MPUQuaternion gravity;

// Quaternion Result
float Quaternion_X = 0.0;
float Quaternion_Y = 0.0;
float Quaternion_Z = 0.0;

//  SERIAL_PORT_SPEED defines the speed to use for the debug serial port
#define  SERIAL_PORT_SPEED  115200

// 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 = "0006664FAE18";

// LED Red
int iLedRed = 8;

// Variable to calculate frequency
unsigned long curr = 0;
unsigned long last = 0;
unsigned long freq;

// Software Version Information
String sver = "26-18";

void loop() {
  
  // MPU
  isMPU();

}

getMPU.ino

// MPU
// Setup MPU
void isSetupMPU() {

  // MPU
  MPU.init(MPU_UPDATE_RATE, MPU_MAG_MIX_GYRO_AND_MAG, MAG_UPDATE_RATE, MPU_LPF_RATE);     // start the MPU

  // Set up the initial gravity vector for quaternion rotation
  // Max value down the z axis
  gravity[QUAT_W] = 0;
  gravity[QUAT_X] = 0;
  gravity[QUAT_Y] = 0;
  gravity[QUAT_Z] = SENSOR_RANGE;
  
}
// MPU
void isMPU() {

  // Quaternion
  // This is our body frame gravity vector
  MPUQuaternion rotatedGravity;
  // This is the conjugate of the fused quaternion
  MPUQuaternion fusedConjugate;
  // Used in the rotation
  MPUQuaternion qTemp;
  // The accelerations
  MPUVector3 result;

  // Get the latest data
  if (MPU.read()) {
    
    // Need this for the rotation
    MPUQuaternionConjugate(MPU.m_fusedQuaternion, fusedConjugate);
    
    // Rotate the gravity vector into the body frame
    MPUQuaternionMultiply(gravity, MPU.m_fusedQuaternion, qTemp);
    MPUQuaternionMultiply(fusedConjugate, qTemp, rotatedGravity);
    
    // Now subtract rotated gravity from the body accels to get real accelerations.
    // Note that signs are reversed to get +ve acceleration results
    // in the conventional axes.
    // Quaternion Result
    Quaternion_X = -(MPU.m_calAccel[VEC3_X] - rotatedGravity[QUAT_X]);
    Quaternion_Y = -(MPU.m_calAccel[VEC3_Y] - rotatedGravity[QUAT_Y]);
    Quaternion_Z = -(MPU.m_calAccel[VEC3_Z] - rotatedGravity[QUAT_Z]);

    // Variable to calculate frequency
    curr = micros();
    freq = curr - last;
    last = curr;
    // Bluetooth
    Serial.print( "Blue|" + BTA + "|" );
    Serial.print( Quaternion_X );
    Serial.print( "|" );
    Serial.print( Quaternion_Y );
    Serial.print( "|" );
    Serial.print( Quaternion_Z );
    Serial.print( "|" );
    Serial.print( freq );
    Serial.println( "|*" );
    // Send any characters the Serial monitor prints to the bluetooth
    bluetooth.print((char)Serial.read());
   
  }

}

setup.ino

// Setup
void setup()
{
  
  // Serial
  Serial.begin(SERIAL_PORT_SPEED);

  // Bluetooth
  // The Bluetooth Mate defaults to 115200bps
  bluetooth.begin(115200);

  // LED Red
  pinMode(iLedRed, OUTPUT);
  digitalWrite(iLedRed, HIGH);
  
  // Give display time to power on
  delay(100);

  // Wire communicate with I2C / TWI devices
  Wire.begin();

  // Pause
  delay(50);

  // Setup MPU
  isSetupMPU();

}

——

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 MPU-9150 – Mk17

——

#DonLucElectronics #DonLuc #RadioFrequency #Bluetooth #Accelerometer #Magnetometer #Gyroscope #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

Bluetooth MPU-9150

——

Bluetooth MPU-9150

——

Bluetooth MPU-9150

——

MPU-9150

MotionInterface is becoming a “Must-Have” function being adopted by smartphone and tablet manufacturers due to the enormous value it adds to the end user experience. In smartphones, it finds use in applications such as gesture commands for applications and phone control, enhanced gaming, augmented reality, panoramic photo capture and viewing, and pedestrian and vehicle navigation. With its ability to precisely and accurately track user motions, MotionTracking technology can convert handsets and tablets into powerful 3D intelligent devices that can be used in applications ranging from health and fitness monitoring to location-based services. Key requirements for MotionInterface enabled devices are small package size, low power consumption, high accuracy and repeatability, high shock tolerance, and application specific performance programmability, all at a low consumer price point.

DL2306Mk04

1 x Arduino Uno
1 x SparkFun Bluetooth Mate Silver
1 x SparkFun 9 Degrees of Freedom Breakout – MPU-9150
1 x SparkFun Cerberus USB Cable

Arduino Uno

RX – Digital 3
TX – Digital 2
SDA – Analog A4
SCL – Analog A5
VIN – +3.3V
GND – GND

——

DL2306Mk04p.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #26 - Radio Frequency - Bluetooth MPU-9150 - Mk17
26-17
DL2306Mk07p.ino
1 x Arduino Uno
1 x SparkFun Bluetooth Mate Silver
1 x SparkFun 9 Degrees of Freedom Breakout - MPU-9150
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code
// Software Serial
#include <SoftwareSerial.h>
// Two Wire Interface (TWI/I2C)
#include <Wire.h>
// I2CDev I2C utilities
#include "I2Cdev.h"
// MPU9150Lib 9-axis fusion
#include "MPU9150Lib.h"
// CalLib magnetometer and accelerometer calibration
#include "CalLib.h"
// Motion Driver InvenSense Embedded SDK v5.1
#include <dmpKey.h>
#include <dmpmap.h>
#include <inv_mpu.h>
#include <inv_mpu_dmp_motion_driver.h>
// EEPROM Magnetometer and Accelerometer data is stored
#include <EEPROM.h>

// the MPU object
MPU9150Lib MPU;
//  MPU_UPDATE_RATE defines the rate (in Hz)
// at which the MPU updates the sensor data and DMP output
#define MPU_UPDATE_RATE  (20)
//  MAG_UPDATE_RATE defines the rate (in Hz) at which the
// MPU updates the magnetometer data
//  MAG_UPDATE_RATE should be less than or equal to the MPU_UPDATE_RATE
#define MAG_UPDATE_RATE  (10)
//  MPU_MAG_MIX defines the influence that the magnetometer has on the yaw output.
//  The magnetometer itself is quite noisy so some mixing with the gyro yaw can help
//  significantly. Some example values are defined below:
// Just use gyro yaw
#define  MPU_MAG_MIX_GYRO_ONLY          0
// Just use magnetometer and no gyro yaw
#define  MPU_MAG_MIX_MAG_ONLY           1
// A good mix value 
#define  MPU_MAG_MIX_GYRO_AND_MAG       10
// mainly gyros with a bit of mag correction
#define  MPU_MAG_MIX_GYRO_AND_SOME_MAG  50
//  MPU_LPF_RATE is the low pas filter rate and can be between 5 and 188Hz
#define MPU_LPF_RATE   5

// This is our earth frame gravity vector - quaternions and vectors
MPUQuaternion gravity;

// Quaternion Result
float Quaternion_X = 0.0;
float Quaternion_Y = 0.0;
float Quaternion_Z = 0.0;

//  SERIAL_PORT_SPEED defines the speed to use for the debug serial port
#define  SERIAL_PORT_SPEED  115200

// 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"; 

// Variable to calculate frequency
unsigned long curr = 0;
unsigned long last = 0;
unsigned long freq;

// Software Version Information
String sver = "26-17";

void loop() {
  
  // MPU
  isMPU();

}

getMPU.ino

// MPU
// Setup MPU
void isSetupMPU() {

  // MPU
  MPU.init(MPU_UPDATE_RATE, MPU_MAG_MIX_GYRO_AND_MAG, MAG_UPDATE_RATE, MPU_LPF_RATE);     // start the MPU

  // Set up the initial gravity vector for quaternion rotation
  // Max value down the z axis
  gravity[QUAT_W] = 0;
  gravity[QUAT_X] = 0;
  gravity[QUAT_Y] = 0;
  gravity[QUAT_Z] = SENSOR_RANGE;
  
}
// MPU
void isMPU() {

  // Quaternion
  // This is our body frame gravity vector
  MPUQuaternion rotatedGravity;
  // This is the conjugate of the fused quaternion
  MPUQuaternion fusedConjugate;
  // Used in the rotation
  MPUQuaternion qTemp;
  // The accelerations
  MPUVector3 result;

  // Get the latest data
  if (MPU.read()) {
    
    // Need this for the rotation
    MPUQuaternionConjugate(MPU.m_fusedQuaternion, fusedConjugate);
    
    // Rotate the gravity vector into the body frame
    MPUQuaternionMultiply(gravity, MPU.m_fusedQuaternion, qTemp);
    MPUQuaternionMultiply(fusedConjugate, qTemp, rotatedGravity);
    
    // Now subtract rotated gravity from the body accels to get real accelerations.
    // Note that signs are reversed to get +ve acceleration results
    // in the conventional axes.
    // Quaternion Result
    Quaternion_X = -(MPU.m_calAccel[VEC3_X] - rotatedGravity[QUAT_X]);
    Quaternion_Y = -(MPU.m_calAccel[VEC3_Y] - rotatedGravity[QUAT_Y]);
    Quaternion_Z = -(MPU.m_calAccel[VEC3_Z] - rotatedGravity[QUAT_Z]);

    // Variable to calculate frequency
    curr = micros();
    freq = curr - last;
    last = curr;
    // Bluetooth
    Serial.print( "Blue|" + BTA + "|" );
    Serial.print( Quaternion_X );
    Serial.print( "|" );
    Serial.print( Quaternion_Y );
    Serial.print( "|" );
    Serial.print( Quaternion_Z );
    Serial.print( "|" );
    Serial.print( freq );
    Serial.println( "|*" );
    // Send any characters the Serial monitor prints to the bluetooth
    bluetooth.print((char)Serial.read());
   
  }

}

setup.ino

// Setup
void setup()
{
  
  // Serial
  Serial.begin(SERIAL_PORT_SPEED);

  // Bluetooth
  // The Bluetooth Mate defaults to 115200bps
  bluetooth.begin(115200);
  
  // Give display time to power on
  delay(100);

  // Wire communicate with I2C / TWI devices
  Wire.begin();

  // Pause
  delay(50);

  // Setup MPU
  isSetupMPU();

}

——

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

Categories
Archives