# ESP8266 not working with MPU 6050 over wire library and I2C

I'm trying to use this version of ESP8266 to access MPU 6050. However, it's not working.

https://www.amazon.com/gp/product/B07HF44GBT/ref=ppx_yo_dt_b_asin_title_o07_s00?ie=UTF8&psc=1 i.e. NodeMCU CP2102 ESP-12E

The code worked with nano very fine. However, when I tried to scan the I2C device, it's said I2C device not found.

I have tried

  Wire.begin(D2, D1);


and

  Wire.begin(4, 5);


i.e. to change the pin to GIOP 4 5 in case if the default was not working. I have also tried to put a large capacitor between the power lines, still not working.

Why ESP8266 does not work with MPU 6050?(Serial and wire together)

Updates 2: I watched the video and did what G6EJD suggested, i.e. restarted the IDE and everything. Now it's reading data. However, the data reading was somehow incorrect by a large factor. For example, at flat the device is reading

42.63/-38.37/7.82


for angle x,angle y,and angular speed z with complementary filter applied and steady at flat surface. It worked for nano but not for ESP 8266.

Also, I tried to adjust the circuit like the spectrum dandavis suggested. I tried resistor range from 4.7 k to 10, even directly connect to the power source. The attempts also included 100 $\mu$F capacitor and power board to stabilize the noise. Both pull up and pull down has been attempted as well as changing boards. However, none of those were working and the issue persisted. The pull up resistor did not seem to be response to what the device was reading.

Update 3: The power consumption has been ruled out and a pair of 100k resistor was also attempted. Not working.

• how long are the leads? do you use pullup resistors? – dandavis Feb 19 at 21:07
• @dandavis the wire is about 10cm each, what's a pull up resistors? – ShoutOutAndCalculate Feb 19 at 21:26
• @dandavis It didn't work even if I put in the resistor. – ShoutOutAndCalculate Feb 19 at 22:53
• @dandavis I tried to adjust the circuit like the spectrum you suggested. I tried resistor range from 4.7 k to 10, even directly connect to the power source. The attempts also included 100 $\mu$F capacitor and power board to stabilize the noise. Both pull up and pull down has been attempted as well as changing boards. However, none of those were working and the issue persisted. – ShoutOutAndCalculate Feb 20 at 6:18