And the error text is?
/*
GY87_Readerv0.ino
This sketch is based on various sketches and libraries by Jeff Rowberg
<jeff@rowberg.net> and discussion thread by pistolero992000 on the Arduino forum
https://forum.arduino.cc/index.php?topic=223345.0. The BMP180 pressure
Senor library is from Love Electronics Ltd (loveelectronics.com)
http://embedded-lab.com/blog/bmp180/bmp180_11/
It gets all sensors on a GY87 IMU board reporting (something) to the
Serial. The challenge is the Digital Compass which is nromally blocked by
the Accelerometer. This is remedied by using an I2C bypass command. Thanks to
pistolero992000 for this solution.
Sensors on board the GY87 are:
MPU6050 Accelerometer. Address is 0x68
HMC5883L Digital Compass. Address is 0x1E
BMP180 Barometer and Temperature Sensor. Address is 0x77
Connections are through the i2c bus.
SCL to Arduino Pin A5
SDA to Arduino Pin A4
GND, 5V and 3.3V connections also present.
All sensors report sensible values. The tab seperated data covers a lot of screen space
so you will need to stretch your Serial monitor window to accommodate it.
*/
#include "I2Cdev.h"
#include "MPU6050.h"
#include "Wire.h"
#include <BMP180.h> //Library for the BMP180 barometer.
//MPU6050 Accelerometer
MPU6050 accelgyro;
int16_t ax, ay, az;
int16_t gx, gy, gz;
//HMC5883L Digital Compass
const int hmc5883Address = 0x1E; //0011110b, I2C 7bit address for compass
const byte hmc5883ModeRegister = 0x02;
const byte hmcContinuousMode = 0x00;
const byte hmcDataOutputXMSBAddress = 0x03;
//The BMP180 Digital Barometer
BMP180 barometer;
// Store the current sea level pressure at your location in Pascals.
float seaLevelPressure = 101325;
int LEDPin = 13;
bool blinkState = false;
int x,y,z; //triple axis data from HMC5883L.
void setup() {
Wire.begin();
Serial.begin(9600);
// initialize device
Serial.println("Initializing I2C devices...");
accelgyro.initialize();
// verify connection
Serial.println("Testing device connections...");
Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");
accelgyro.setI2CBypassEnabled(true); //This sets the bypass so the HMC5883L gets a look in.
//Initialise the Digital Compass
Wire.beginTransmission(hmc5883Address); //Begin communication with compass
Wire.write(hmc5883ModeRegister); //select the mode register
Wire.write(hmcContinuousMode); //continuous measurement mode
Wire.endTransmission();
//Initialise the BMP180 Barometer (and Temperature Sensor)
barometer = BMP180();
// We check to see if we can connect to the BMP180 sensor.
if(barometer.EnsureConnected())
{
Serial.println("Connected to BMP180.");
// When we have connected, we reset the device to ensure a clean start.
barometer.SoftReset();
// Now we initialize the sensor and pull the calibration data.
barometer.Initialize();
}
else
{
Serial.println("No BMP180 sensor found.");
}
// configure Arduino LED for
pinMode(LEDPin, OUTPUT);
delay(10000);
}
void loop() {
// read raw accel/gyro measurements from device
accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
// these methods (and a few others) are also available
//accelgyro.getAcceleration(&ax, &ay, &az);
//accelgyro.getRotation(&gx, &gy, &gz);
// display tab-separated accel/gyro x/y/z values
Serial.print("a/g:\t");
Serial.print(ax); Serial.print("\t");
Serial.print(ay); Serial.print("\t");
Serial.print(az); Serial.print("\t");
Serial.print(gx); Serial.print("\t");
Serial.print(gy); Serial.print("\t");
Serial.print(gz); Serial.print("\t");
// blink LED to indicate activity
blinkState = !blinkState;
digitalWrite(LEDPin, blinkState);
//Accessing the HMC5883L Digital Compass
//Tell the HMC5883L where to begin reading the data
Wire.beginTransmission(hmc5883Address);
Wire.write(hmcDataOutputXMSBAddress); //Select register 3, X MSB register
Wire.endTransmission();
//Read data from each axis of the Digital Compass
Wire.requestFrom(hmc5883Address,6);
if(6<=Wire.available())
{
x = Wire.read()<<8; //X msb
x |= Wire.read(); //X lsb
z = Wire.read()<<8; //Z msb
z |= Wire.read(); //Z lsb
y = Wire.read()<<8; //Y msb
y |= Wire.read(); //Y lsb
}
int angle = atan2(-y,x)/M_PI*180;
if (angle < 0)
{
angle = angle + 360;
}
//Reporting the Compass data to the Serial port
//Serial.print("Compass XYZ:\t");
//Serial.print(x,y,z);Serial.print("\t");
Serial.print("Dir(deg):\t");
Serial.print(angle); Serial.print("\t");
if(barometer.IsConnected)
{
long currentPressure = barometer.GetPressure();
// Print out the Pressure.
Serial.print("BMP180 P:\t");
Serial.print(currentPressure);Serial.print("Pa");Serial.print("\t");
// Retrieve the current altitude (in meters). Current Sea Level Pressure is required for this.
float altitude = barometer.GetAltitude(seaLevelPressure);
// Print out the Altitude.
Serial.print("Alt:\t");
Serial.print(altitude);Serial.print(" m");Serial.print("\t");
// Retrieve the current temperature in degrees celcius.
float currentTemperature = barometer.GetTemperature();
// Print out the Temperature
Serial.print("Temp:\t");
Serial.print(currentTemperature);Serial.println("C");
}
}
Please Help to get the GY87 10 DOF get the Reading on the Arduino SerialArduino: 1.8.13 (Windows 10), Board: "Arduino Nano, ATmega328P (Old Bootloader)"
libraries\MPU6050\I2Cdev.cpp.o (symbol from plugin): In function `I2Cdev::I2Cdev()':
(.text+0x0): multiple definition of `I2Cdev::I2Cdev()'
libraries\I2Cdev\I2Cdev.cpp.o (symbol from plugin).text+0x0): first defined here
libraries\MPU6050\I2Cdev.cpp.o (symbol from plugin): In function `I2Cdev::I2Cdev()':
(.text+0x0): multiple definition of `I2Cdev::I2Cdev()'
libraries\I2Cdev\I2Cdev.cpp.o (symbol from plugin).text+0x0): first defined here
libraries\MPU6050\I2Cdev.cpp.o (symbol from plugin): In function `I2Cdev::I2Cdev()':
(.text+0x0): multiple definition of `I2Cdev::writeBytes(unsigned char, unsigned char, unsigned char, unsigned char*)'
libraries\I2Cdev\I2Cdev.cpp.o (symbol from plugin).text+0x0): first defined here
libraries\MPU6050\I2Cdev.cpp.o (symbol from plugin): In function `I2Cdev::I2Cdev()':
(.text+0x0): multiple definition of `I2Cdev::writeByte(unsigned char, unsigned char, unsigned char)'
libraries\I2Cdev\I2Cdev.cpp.o (symbol from plugin).text+0x0): first defined here
libraries\MPU6050\I2Cdev.cpp.o (symbol from plugin): In function `I2Cdev::I2Cdev()':
(.text+0x0): multiple definition of `I2Cdev::writeWords(unsigned char, unsigned char, unsigned char, unsigned int*)'
libraries\I2Cdev\I2Cdev.cpp.o (symbol from plugin).text+0x0): first defined here
libraries\MPU6050\I2Cdev.cpp.o (symbol from plugin): In function `I2Cdev::I2Cdev()':
(.text+0x0): multiple definition of `I2Cdev::writeWord(unsigned char, unsigned char, unsigned int)'
libraries\I2Cdev\I2Cdev.cpp.o (symbol from plugin).text+0x0): first defined here
libraries\MPU6050\I2Cdev.cpp.o (symbol from plugin): In function `I2Cdev::I2Cdev()':
(.text+0x0): multiple definition of `I2Cdev::readBytes(unsigned char, unsigned char, unsigned char, unsigned char*, unsigned int)'
libraries\I2Cdev\I2Cdev.cpp.o (symbol from plugin).text+0x0): first defined here
libraries\MPU6050\I2Cdev.cpp.o (symbol from plugin): In function `I2Cdev::I2Cdev()':
(.text+0x0): multiple definition of `I2Cdev::readByte(unsigned char, unsigned char, unsigned char*, unsigned int)'
libraries\I2Cdev\I2Cdev.cpp.o (symbol from plugin).text+0x0): first defined here
libraries\MPU6050\I2Cdev.cpp.o (symbol from plugin): In function `I2Cdev::I2Cdev()':
(.text+0x0): multiple definition of `I2Cdev::readBit(unsigned char, unsigned char, unsigned char, unsigned char*, unsigned int)'
libraries\I2Cdev\I2Cdev.cpp.o (symbol from plugin).text+0x0): first defined here
libraries\MPU6050\I2Cdev.cpp.o (symbol from plugin): In function `I2Cdev::I2Cdev()':
(.text+0x0): multiple definition of `I2Cdev::readBits(unsigned char, unsigned char, unsigned char, unsigned char, unsigned char*, unsigned int)'
libraries\I2Cdev\I2Cdev.cpp.o (symbol from plugin).text+0x0): first defined here
libraries\MPU6050\I2Cdev.cpp.o (symbol from plugin): In function `I2Cdev::I2Cdev()':
(.text+0x0): multiple definition of `I2Cdev::writeBit(unsigned char, unsigned char, unsigned char, unsigned char)'
libraries\I2Cdev\I2Cdev.cpp.o (symbol from plugin).text+0x0): first defined here
libraries\MPU6050\I2Cdev.cpp.o (symbol from plugin): In function `I2Cdev::I2Cdev()':
(.text+0x0): multiple definition of `I2Cdev::readTimeout'
libraries\I2Cdev\I2Cdev.cpp.o (symbol from plugin).text+0x0): first defined here
libraries\MPU6050\I2Cdev.cpp.o (symbol from plugin): In function `I2Cdev::I2Cdev()':
(.text+0x0): multiple definition of `I2Cdev::writeBits(unsigned char, unsigned char, unsigned char, unsigned char, unsigned char)'
libraries\I2Cdev\I2Cdev.cpp.o (symbol from plugin).text+0x0): first defined here
libraries\MPU6050\I2Cdev.cpp.o (symbol from plugin): In function `I2Cdev::I2Cdev()':
(.text+0x0): multiple definition of `I2Cdev::readWords(unsigned char, unsigned char, unsigned char, unsigned int*, unsigned int)'
libraries\I2Cdev\I2Cdev.cpp.o (symbol from plugin).text+0x0): first defined here
libraries\MPU6050\I2Cdev.cpp.o (symbol from plugin): In function `I2Cdev::I2Cdev()':
(.text+0x0): multiple definition of `I2Cdev::readWord(unsigned char, unsigned char, unsigned int*, unsigned int)'
libraries\I2Cdev\I2Cdev.cpp.o (symbol from plugin).text+0x0): first defined here
libraries\MPU6050\I2Cdev.cpp.o (symbol from plugin): In function `I2Cdev::I2Cdev()':
(.text+0x0): multiple definition of `I2Cdev::readBitW(unsigned char, unsigned char, unsigned char, unsigned int*, unsigned int)'
libraries\I2Cdev\I2Cdev.cpp.o (symbol from plugin).text+0x0): first defined here
libraries\MPU6050\I2Cdev.cpp.o (symbol from plugin): In function `I2Cdev::I2Cdev()':
(.text+0x0): multiple definition of `I2Cdev::readBitsW(unsigned char, unsigned char, unsigned char, unsigned char, unsigned int*, unsigned int)'
libraries\I2Cdev\I2Cdev.cpp.o (symbol from plugin).text+0x0): first defined here
libraries\MPU6050\I2Cdev.cpp.o (symbol from plugin): In function `I2Cdev::I2Cdev()':
(.text+0x0): multiple definition of `I2Cdev::writeBitW(unsigned char, unsigned char, unsigned char, unsigned int)'
libraries\I2Cdev\I2Cdev.cpp.o (symbol from plugin).text+0x0): first defined here
libraries\MPU6050\I2Cdev.cpp.o (symbol from plugin): In function `I2Cdev::I2Cdev()':
(.text+0x0): multiple definition of `I2Cdev::writeBitsW(unsigned char, unsigned char, unsigned char, unsigned char, unsigned int)'
libraries\I2Cdev\I2Cdev.cpp.o (symbol from plugin).text+0x0): first defined here
collect2.exe: error: ld returned 1 exit status
Multiple libraries were found for "I2Cdev.h"
Used: C:\Users\mkbut\Documents\Arduino\libraries\I2Cdev
Not used: C:\Users\mkbut\Documents\Arduino\libraries\MPU6050
exit status 1
Error compiling for board Arduino Nano.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
/*
GY-87 Test
Tests basic functionality of the GY-87 sensor board.
Connections:
|== GY-87 ==|== Arduino ==|
| VCC_IN | VCC |
| GND | GND |
| SDA | SDA |
| SCL | SCL |
|=========================|
Requires the I2CDevLib library, which can be found here: https://github.com/jrowberg/i2cdevlib
by Tom Kuehn
26/06/2016
*/
#include "I2Cdev.h"
#include "MPU6050.h"
#include "HMC5883L.h"
#include "BMP085.h"
#include "Wire.h"
static const char LED = 6;
static const float ACCEL_SENS = 16384.0; // Accel Sensitivity with default +/- 2g scale
static const float GYRO_SENS = 131.0; // Gyro Sensitivity with default +/- 250 deg/s scale
// Magnetometer class default I2C address is 0x1E
// specific I2C addresses may be passed as a parameter here
// this device only supports one I2C address (0x1E)
HMC5883L mag;
int16_t mx, my, mz;
// Accel/Gyro class default I2C address is 0x68 (can be 0x69 if AD0 is high)
// specific I2C addresses may be passed as a parameter here
MPU6050 accelgyro;
int16_t ax, ay, az;
int16_t gx, gy, gz;
// Barometer class default I2C address is 0x77
// specific I2C addresses may be passed as a parameter here
// (though the BMP085 supports only one address)
BMP085 barometer;
float temperature;
float pressure;
int32_t lastMicros;
void setup()
{
boolean state = HIGH;
unsigned int count = 0;
pinMode(LED, OUTPUT);
Serial.begin(9600);
while (!Serial && (count < 30) )
{
delay(200); // Wait for serial port to connect with timeout. Needed for native USB
digitalWrite(LED, state);
state = !state;
count++;
}
digitalWrite(LED, HIGH);
// join I2C bus (I2Cdev library doesn't do this automatically)
Wire.begin();
// ==================== MPU6050 ============================
accelgyro.initialize();
Serial.print("Testing Accel/Gyro... ");
Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");
// Starts up with accel +/- 2 g and gyro +/- 250 deg/s scale
accelgyro.setI2CBypassEnabled(true); // set bypass mode
// Now we can talk to the HMC5883l
// ==================== HMC5883L ============================
mag.initialize();
Serial.print("Testing Mag... ");
Serial.println(mag.testConnection() ? "HMC5883L connection successful" : "HMC5883L connection failed");
// ==================== BMP085 ============================
barometer.initialize();
Serial.print("Testing Pressure... ");
Serial.println(barometer.testConnection() ? "BMP085 connection successful" : "BMP085 connection failed");
Serial.println("Setup Complete");
}
void loop()
{
static unsigned long ms = 0;
static boolean state = HIGH;
// Serial Output Format
// === Accel === | === Gyro === | ======= Mag ======= | === Barometer === |
// X Y Z | X Y Z | X Y Z Heading | Temp Pressure |
if (millis() - ms > 100)
{
// read raw accel/gyro measurements
accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
// display tab-separated accel/gyro x/y/z values
Serial.print(ax/ACCEL_SENS); Serial.print("\t");
Serial.print(ay/ACCEL_SENS); Serial.print("\t");
Serial.print(az/ACCEL_SENS); Serial.print("\t");
Serial.print(gx/GYRO_SENS); Serial.print("\t");
Serial.print(gy/GYRO_SENS); Serial.print("\t");
Serial.print(gz/GYRO_SENS); Serial.print("\t");
// read raw heading measurements
mag.getHeading(&mx, &my, &mz);
// display tab-separated mag x/y/z values
Serial.print(mx); Serial.print("\t");
Serial.print(my); Serial.print("\t");
Serial.print(mz); Serial.print("\t");
// To calculate heading in degrees. 0 degree indicates North
float heading = atan2(my, mx);
if(heading < 0) heading += 2 * M_PI;
Serial.print(heading * 180/M_PI); Serial.print("\t");
// request temperature
barometer.setControl(BMP085_MODE_TEMPERATURE);
// wait appropriate time for conversion (4.5ms delay)
lastMicros = micros();
while (micros() - lastMicros < barometer.getMeasureDelayMicroseconds());
// read calibrated temperature value in degrees Celsius
temperature = barometer.getTemperatureC();
// request pressure (3x oversampling mode, high detail, 23.5ms delay)
barometer.setControl(BMP085_MODE_PRESSURE_3);
while (micros() - lastMicros < barometer.getMeasureDelayMicroseconds());
// read calibrated pressure value in Pascals (Pa)
pressure = barometer.getPressure();
// display measured values if appropriate
Serial.print(temperature); Serial.print("\t");
Serial.print(pressure/100); Serial.println("\t");
ms = millis();
digitalWrite(LED, state);
state = !state;
}
}
Arduino: 1.8.13 (Windows 10), Board: "Arduino Nano, ATmega328P (Old Bootloader)"
GY87:23:10: fatal error: BMP085.h: No such file or directory
#include "BMP085.h"
^~~~~~~~~~
compilation terminated.
Multiple libraries were found for "HMC5883L.h"
Used: C:\Users\mkbut\Documents\Arduino\libraries\HMC5883L
Not used: C:\Users\mkbut\Documents\Arduino\libraries\Grove_3-Axis_Digital_Compass_HMC5883L
Multiple libraries were found for "I2Cdev.h"
Used: C:\Users\mkbut\Documents\Arduino\libraries\I2Cdev
Not used: C:\Users\mkbut\Documents\Arduino\libraries\MPU6050
exit status 1
BMP085.h: No such file or directory
Invalid library found in C:\Users\mkbut\Documents\Arduino\libraries\Arduino-Test-master: no headers files (.h) found in C:\Users\mkbut\Documents\Arduino\libraries\Arduino-Test-master
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
Invalid library found in C:\Users\mkbut\Documents\Arduino\libraries\Arduino-Test-master: no headers files (.h) found in C:\Users\mkbut\Documents\Arduino\libraries\Arduino-Test-master