Quantcast

Arduino with GY-86

The Rocketry Forum

Help Support The Rocketry Forum:

nmrs.thrust

Member
Joined
Nov 17, 2020
Messages
6
Reaction score
1
Has anyone made a rocket altimeter with the GY-86 IMU and an Arduino? If so, please help me out! I have tried coding the sensor for several hours, and I can't seem to get a result. Here is the wiring: VCC-5V, GND-Ground, SCL-A5, SDA-A4. (Arduino Uno). Here is the code I'm using to get data from the MS5611 sensor that is onboard the module. When I open the Serial monitor, it only reads "Initializing MS5611 sensor" and nothing happens. I have tried different example code from different sources using the same library, but they all have the same problem.
#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);
}
 

Monoxide

Member
Joined
Mar 6, 2019
Messages
9
Reaction score
2
Location
Cedar Rapids, Iowa
I'm using the GY-63 and GY-521 (MPU6050 and MS5611), same as you but on two separate boards. My project is here.
If you put a println after the ms5611.begin() while loop, can you see if it's coming out of the loop successfully?
That would tell us if it's in the begin function or the readPressure function.
What MS5611 library are you using? And are you using SPI or I2C?
 

nmrs.thrust

Member
Joined
Nov 17, 2020
Messages
6
Reaction score
1
Here is the MS5611 library I'm using:
It is through i2C.
I'll take a look at everything you sent me tonight and let you know. Thanks sooo much!
 

Monoxide

Member
Joined
Mar 6, 2019
Messages
9
Reaction score
2
Location
Cedar Rapids, Iowa
Ok. The library I have/use is for SPI. Put those print statements in and let me know if that works. I got my sensors from Banggood, and the lifetime on these leaves something to be desired. If you have a second sensor I'd recommend trying it before you get real deep into the code. I know from experience...
 

nmrs.thrust

Member
Joined
Nov 17, 2020
Messages
6
Reaction score
1
So I tried the code once again, but the serial data is obviously wrong.
I think it came out of the loop, but now I don't think it it reading any data. I'll give your SPI code a shot
1606424268915.png
 

Monoxide

Member
Joined
Mar 6, 2019
Messages
9
Reaction score
2
Location
Cedar Rapids, Iowa
Ya sorry just saw that in your original post. Beat me to editing my reply. One of the problems I had in some of the libraries was the sending the ADC read command, then reading too quickly. Looks like that lib takes care of that... You won't have much luck with my code, this module can't be used with SPI.
You could try sending the reset to the sensor a second time, maybe it's not getting initialized completely? You'd have to do this in the library or move "void reset(void);" to public in the header file.
You could also try using the address 0x76 for the MS5611, that's the alternate I2C. Although most schematics I found say it's wired as 0x77.
The more I look into it the more stumped I become.... There's a few other libraries out there for the MS5611, maybe try one of them.
Also looking at the lib someone pointed out the usage with arduinos wire lib is incorrect. Maybe try making these changes.
 
Last edited:

jjhdnd

Member
Joined
Aug 6, 2012
Messages
15
Reaction score
2
I think the instantiation statement needs to specify the IIC address:


MS5611 MS5611(0x77);
 

bdureau

Well-Known Member
Joined
Dec 20, 2011
Messages
414
Reaction score
39
Hello
When using the I2C you might want to try a different clock speed
//try after your begin
Wire.begin();
// change your clock
Wire.setClock(400000 );
 

bdureau

Well-Known Member
Joined
Dec 20, 2011
Messages
414
Reaction score
39
For my Gimbal project I am now using a bno055 and a bmp180 rather than mpu6050 and MS5611. bno055 is easier to use and a lot more stable than the mpu6050 . I do not know about the MS5611 but what I know is the bmp180 is good enought for what I am doing

 
Top