Max30102,MPU6050 and Esp8266
-
I am having some trouble connecting both the MAX30102 and MPU6050 sensors to my ESP8266 board. Both sensors use the I2C communication protocol to interface with the microcontroller.
I have tried writing some baremetal code to read data from both sensors, but I am not getting any output values from either of them. I have also checked my wiring connections and confirmed that the sensors are receiving power.
I would really appreciate any suggestions or advice on how to troubleshoot and resolve this issue. Specifically, I would like to know if there are any common issues that arise when using I2C communication with multiple sensors on an ESP8266 board. Additionally, if anyone has successfully interfaced these sensors with an ESP8266 board and can share their code or any tips, it would be greatly appreciated.
-
Hey @Adithya-SM
Could you drop your code here? -
@Adithya-SM Can you confirm the I2C address is correct? You can use this I2C Scanner to program to find the correct address
// -------------------------------------- // i2c_scanner // // Modified from https://playground.arduino.cc/Main/I2cScanner/ // -------------------------------------- #include <Wire.h> // Set I2C bus to use: Wire, Wire1, etc. #define WIRE Wire void setup() { WIRE.begin(); Serial.begin(9600); while (!Serial) delay(10); Serial.println("\nI2C Scanner"); } void loop() { byte error, address; int nDevices; Serial.println("Scanning..."); nDevices = 0; for(address = 1; address < 127; address++ ) { // The i2c_scanner uses the return value of // the Write.endTransmisstion to see if // a device did acknowledge to the address. WIRE.beginTransmission(address); error = WIRE.endTransmission(); if (error == 0) { Serial.print("I2C device found at address 0x"); if (address<16) Serial.print("0"); Serial.print(address,HEX); Serial.println(" !"); nDevices++; } else if (error==4) { Serial.print("Unknown error at address 0x"); if (address<16) Serial.print("0"); Serial.println(address,HEX); } } if (nDevices == 0) Serial.println("No I2C devices found\n"); else Serial.println("done\n"); delay(5000); // wait 5 seconds for next scan }