I am using GY-86 which is a breakout board for MPU6050, HMC5883L and MS5611. The MS5611 is a barometer.
I used GY-86 with Arduino Uno and successfully used all three sensors, but when I try to use the same code on Arduino Due, MS5611 won't respond. The other sensors read perfectly.
I'm not sure if this is a hardware problem or a problem in the code.
I've attached the library I am using in my code, and the example code (provided with the library) is:
#include <Wire.h>
#include <MS5611.h>
MS5611 ms5611;
double referencePressure;
void setup()
{
Serial.begin(9600);
// Initialize MS5611 sensor
Serial.println("Initialize MS5611 Sensor");
while(!ms5611.begin())
{
Serial.println("Could not find a valid MS5611 sensor, check wiring!");
delay(500);
}
// Get reference pressure for relative altitude
referencePressure = ms5611.readPressure();
// Check settings
checkSettings();
}
void checkSettings()
{
Serial.print("Oversampling: ");
Serial.println(ms5611.getOversampling());
}
void loop()
{
// Read raw values
uint32_t rawTemp = ms5611.readRawTemperature();
uint32_t rawPressure = ms5611.readRawPressure();
// Read true temperature & Pressure
double realTemperature = ms5611.readTemperature();
long realPressure = ms5611.readPressure();
// Calculate altitude
float absoluteAltitude = ms5611.getAltitude(realPressure);
float relativeAltitude = ms5611.getAltitude(realPressure, referencePressure);
Serial.println("--");
Serial.print(" rawTemp = ");
Serial.print(rawTemp);
Serial.print(", realTemp = ");
Serial.print(realTemperature);
Serial.println(" *C");
Serial.print(" rawPressure = ");
Serial.print(rawPressure);
Serial.print(", realPressure = ");
Serial.print(realPressure);
Serial.println(" Pa");
Serial.print(" absoluteAltitude = ");
Serial.print(absoluteAltitude);
Serial.print(" m, relativeAltitude = ");
Serial.print(relativeAltitude);
Serial.println(" m");
delay(1000);
}
The schematic for the GY-86 looks like this:
I wired 3.3v from the due to GY-86's 3.3v, and the 5v pin is not connected. The GY-86 has a level shifter from 3.3v to 5v from the sensors' SCL, SDA to breakout pins H_SCL and H_SDA, so I guessed wiring 5v to the GY-86 would damage the Due.
I read somewhere that there are internal pull up resistors in the due's SCL and SDA of 1.5k, so maybe the level shifter in the GY-86 is reducing the total resistance too much, and that's causing the problem?
MS5611.cpp (5.42 KB)
MS5611.h (1.95 KB)