Hola, soy José Vicente Galadí.
He intentado conectar un Arduino Uno y un GY-91 según el esquema que se muestra aquí...
Aquí tenéis los pines del GY-91
Y éste es el código del programa.
/*
by MohammedDamirchi
Home
*/
#include <MPU9250_asukiaaa.h>
#include <Adafruit_BMP280.h>
#ifdef _ESP32_HAL_I2C_H_
#define SDA_PIN 21
#define SCL_PIN 22
#endif
Adafruit_BMP280 bme; // I2C
MPU9250_asukiaaa mySensor;
float aX, aY, aZ, aSqrt, gX, gY, gZ, mDirection, mX, mY, mZ;
void setup() {
Serial.begin(115200);
while (!Serial);
#ifdef _ESP32_HAL_I2C_H_ // For ESP32
Wire.begin(SDA_PIN, SCL_PIN);
mySensor.setWire(&Wire);
#else
Wire.begin();
mySensor.setWire(&Wire);
#endif
bme.begin();
mySensor.beginAccel();
mySensor.beginGyro();
mySensor.beginMag();
// You can set your own offset for mag values
// mySensor.magXOffset = -50;
// mySensor.magYOffset = -55;
// mySensor.magZOffset = -10;
}
void loop() {
if (mySensor.accelUpdate() == 0) {
aX = mySensor.accelX();
aY = mySensor.accelY();
aZ = mySensor.accelZ();
aSqrt = mySensor.accelSqrt();
Serial.print("accelX: " + String(aX));
Serial.print("\taccelY: " + String(aY));
Serial.print("\taccelZ: " + String(aZ));
Serial.print("\taccelSqrt: " + String(aSqrt));
}
if (mySensor.gyroUpdate() == 0) {
gX = mySensor.gyroX();
gY = mySensor.gyroY();
gZ = mySensor.gyroZ();
Serial.print("\tgyroX: " + String(gX));
Serial.print("\tgyroY: " + String(gY));
Serial.print("\tgyroZ: " + String(gZ));
}
if (mySensor.magUpdate() == 0) {
mX = mySensor.magX();
mY = mySensor.magY();
mZ = mySensor.magZ();
mDirection = mySensor.magHorizDirection();
Serial.print("\tmagX: " + String(mX));
Serial.print("\tmaxY: " + String(mY));
Serial.print("\tmagZ: " + String(mZ));
Serial.print("\thorizontalDirection: " + String(mDirection));
}
Serial.print("\tTemperature(*C): ");
Serial.print(bme.readTemperature());
Serial.print("\tPressure(Inches(Hg)): ");
Serial.print(bme.readPressure()/3377);
Serial.print("\tApproxAltitude(m): ");
Serial.print(bme.readAltitude(1013.25)); // this should be adjusted to your local forcase
Serial.println(""); // Add an empty line
}
El GY-91 es un circuito impreso que integra el BMP280 (sensor de temperatura, presión y altura) y un MPU9250 que es un giroscopio, acelerómetro, brújula, etc.
Solo puedo ver la información que proporciona el MPU9250.
Casualmente he comprobado que poniendo el pin SAO/SDO a 3,3 voltios, aparece la información del BMP260, pero no la del MPU9250.
He probado, con la ayuda de un divisor de tensión de 1KOhmio y 2,2 KOhmio conectado al pin digital 4 y con la salida de tensión llevada a SAO/SDO, de poner alternativamente ese pin en alta y en baja y acceder a toda la información. Pero no funciona.
Tras pasarle el I2CScaner me aparecen tres dispositivos: 0x5A, 0x68 and 0x76. Ocurre que tengo también conectado un CCS811 que es un sensor de CO2 y partítulas volátiles en el aire y que me parece que corresponde con la primera dirección.
Les agradeceré cualquier consejo.
José Vicente Galadí.



