The Alpha Geek – Geeking Out

Project #25 – Movement – IMU – Mk05

——

#DonLucElectronics #DonLuc #SparkFunRedBoard #Movement #Magnetometer #Accelerometer #Gyroscope #9DOF #Barometer #Arduino #Project #Fritzing #Programming #Electronics #Microcontrollers #Consultant

——

——

IMU

——

IMU

——

Inertial Measurement Unit

An inertial measurement unit (IMU) is an electronic device that measures and reports a body’s specific force, angular rate, and sometimes the orientation of the body, using a combination of accelerometers, gyroscopes, and sometimes magnetometers. When the magnetometer is included, IMUs are referred to as IMMUs. IMUs are typically used to maneuver modern vehicles including motorcycles, missiles, aircraft, including unmanned aerial vehicles, among many others, and spacecraft, including satellites and landers. Recent developments allow for the production of IMU-enabled GPS devices. An IMU allows a GPS receiver to work when GPS-signals are unavailable, such as in tunnels, inside buildings, or when electronic interference is present.

AltIMU-10 v5 Gyro, Accelerometer, Compass, and Altimeter (LSM6DS33, LIS3MDL, and LPS25H Carrier)

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 board operates from 2.5 to 5.5 V and has a 0.1″ pin spacing.

DL2211Mk01

1 x SparkFun RedBoard Qwiic
1 x SparkFun Micro OLED (Qwiic)
1 x Qwiic Cable – 100mm
1 x Pololu AltIMU-10 v5
1 x SparkFun Cerberus USB Cable

SparkFun RedBoard Qwiic

SDA – Analog A4
SCL – Analog A5
VIN – +3.3V
GND – GND

——

DL2211Mk01p.ino

/* ***** Don Luc Electronics © *****
Software Version Information
Project #25 - Movement - IMU - Mk05
25-05
DL2211Mk01p.ino
1 x SparkFun RedBoard Qwiic
1 x SparkFun Micro OLED (Qwiic)
1 x Qwiic Cable - 100mm
1 x Pololu AltIMU-10 v5
1 x SparkFun Cerberus USB Cable
*/

// Include the Library Code
// Two Wire Interface (TWI/I2C)
#include <Wire.h>
// SparkFun Micro OLED
#include <SFE_MicroOLED.h>
// 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>

// 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;
// STMicroelectronics LPS25H digital barometer
LPS ps;
// Digital Barometer
float pressure;
float altitude;
float temperature;

// SparkFun Micro OLED
#define PIN_RESET 9
#define DC_JUMPER 1
// I2C declaration
MicroOLED oled(PIN_RESET, DC_JUMPER);

// Software Version Information
String sver = "25-05";

void loop() {

  // Accelerometer and Gyroscopes
  isIMU();

  // Magnetometer
  isMag();

  // Barometer
  isBarometer();
  
  // Micro OLED
  isMicroOLED();

}

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;

}

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

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

getMicroOLED.ino

// SparkFun Micro OLED
// Setup Micro OLED
void isSetupMicroOLED() {

  // Initialize the OLED
  oled.begin();
  // Clear the display's internal memory
  oled.clear(ALL);
  // Display what's in the buffer (splashscreen)
  oled.display();

  // Delay 1000 ms
  delay(1000);

  // Clear the buffer.
  oled.clear(PAGE);
  
}
// Micro OLED
void isMicroOLED() {

  // Text Display Accelerometer
  // Clear the display
  oled.clear(PAGE);
  // Set cursor to top-left
  oled.setCursor(0, 0);
  // Set font to type 0
  oled.setFontType(0);
  // Accelerometer
  oled.print("Acceler");
  oled.setCursor(0, 12);
  // X
  oled.print("X: ");
  oled.print(imuAX);
  oled.setCursor(0, 25);
  // Y
  oled.print("Y: ");
  oled.print(imuAY);
  oled.setCursor(0, 39);
  // Z
  oled.print("Z: ");
  oled.print(imuAZ);
  oled.display();

  // Delay
  delay(3000);

  // Text Display Gyroscopes
  // Clear the display
  oled.clear(PAGE);
  // Set cursor to top-left
  oled.setCursor(0, 0);
  // Set font to type 0
  oled.setFontType(0);
  // Gyroscopes
  oled.print("Gyro");
  oled.setCursor(0, 12);
  // X
  oled.print("X: ");
  oled.print(imuGX);
  oled.setCursor(0, 25);
  // Y
  oled.print("Y: ");
  oled.print(imuGY);
  oled.setCursor(0, 39);
  // Z
  oled.print("Z: ");
  oled.print(imuGZ);
  oled.display();

  // Delay
  delay(3000);

  // Text Display Magnetometer
  // Clear the display
  oled.clear(PAGE);
  // Set cursor to top-left
  oled.setCursor(0, 0);
  // Set font to type 0
  oled.setFontType(0);
  // Magnetometer
  oled.print("Mag");
  oled.setCursor(0, 12);
  // X
  oled.print("X: ");
  oled.print(magX);
  oled.setCursor(0, 25);
  // Y
  oled.print("Y: ");
  oled.print(magY);
  oled.setCursor(0, 39);
  // Z
  oled.print("Z: ");
  oled.print(magZ);
  oled.display();

  // Delay
  delay(3000);

  // Text Display Barometer
  // Clear the display
  oled.clear(PAGE);
  // Set cursor to top-left
  oled.setCursor(0, 0);
  // Set font to type 0
  oled.setFontType(0);
  // Barometer
  oled.print("Baro");
  oled.setCursor(0, 12);
  // Pressure
  oled.print("P: ");
  oled.print(pressure);
  oled.setCursor(0, 25);
  // Altitude Meters
  oled.print("A: ");
  oled.print(altitude);
  oled.setCursor(0, 39);
  // Temperature Celsius
  oled.print("T: ");
  oled.print(temperature);
  oled.display();

  // Delay
  delay(3000);

}

setup.ino

// Setup
void setup() {

  // Give display time to power on
  delay(100);
  
  // Set up I2C bus
  Wire.begin();

  // Setup Micro OLED
  isSetupMicroOLED();

  // Setup IMU
  setupIMU();

  // Setup Magnetometer
  setupMag();

  // Setup Barometer
  isSetupBarometer();

}

——

People can contact us: https://www.donluc.com/?page_id=1927

Technology Experience

  • Single-Board Microcontrollers (PIC, Arduino, Raspberry Pi,Espressif, etc…)
  • IoT
  • Wireless (Radio Frequency, Bluetooth, WiFi, Etc…)
  • Robotics
  • Camera and Video Capture Receiver Stationary, Wheel/Tank and Underwater Vehicle
  • Unmanned Vehicles Terrestrial and Marine
  • Machine Learning
  • RTOS
  • Research & Development (R & D)

Instructor and E-Mentor

  • IoT
  • PIC Microcontrollers
  • Arduino
  • Raspberry Pi
  • Espressif
  • Robotics

Follow Us

Luc Paquin – Curriculum Vitae – 2022
https://www.donluc.com/luc/

Web: https://www.donluc.com/
Facebook: https://www.facebook.com/neosteam.labs.9/
YouTube: https://www.youtube.com/channel/UC5eRjrGn1CqkkGfZy0jxEdA
Twitter: https://twitter.com/labs_steam
Pinterest: https://www.pinterest.com/NeoSteamLabs/
Instagram: https://www.instagram.com/neosteamlabs/

Don Luc

Leave a Reply

Your email address will not be published. Required fields are marked *

Categories
Archives