In this guide you’ll learn how to use the MPU-6050 accelerometer and gyroscope module with the ESP8266 NodeMCU. The MPU-6050 IMU (Inertial Measurement Unit) is a 3-axis accelerometer and 3-axis gyroscope sensor. The accelerometer measures the gravitational acceleration and the gyroscope measures the rotational velocity. Additionally, this module also measures temperature. This sensor is ideal to determine the orientation of a moving object.
We have a similar guide for the ESP32: ESP32 with MPU-6050 Accelerometer, Gyroscope and Temperature Sensor (Arduino)
In this guide we’ll cover two examples:
- Get gyroscope, acceleration and temperature readings (Serial Monitor)
- Display gyroscope and acceleration readings on OLED display
Introducing the MPU-6050 Gyroscope Accelerometer Sensor
The MPU-6050 is a module with a 3-axis accelerometer and a 3-axis gyroscope.
The gyroscope measures rotational velocity (rad/s), this is the change of the angular position over time along the X, Y and Z axis (roll, pitch and yaw). This allows us to determine the orientation of an object.
The accelerometer measures acceleration (rate of change of the object’s velocity). It senses static forces like gravity (9.8m/s2) or dynamic forces like vibrations or movement. The MPU-6050 measures acceleration over the X, Y an Z axis. Ideally, in a static object the acceleration over the Z axis is equal to the gravitational force, and it should be zero on the X and Y axis.
Using the values from the accelerometer, it is possible to calculate the roll and pitch angles using trigonometry. However, it is not possible to calculate the yaw.
We can combine the information from both sensors to get more accurate information about the sensor orientation.
MPU-6050 Pinout
Here’s the pinout for the MPU-6050 sensor module.
VCC | Power the sensor (3.3V or 5V) |
GND | Common GND |
SCL | SCL pin for I2C communication (GPIO 5) |
SDA | SDA pin for I2C communication (GPIO 4) |
XDA | Used to interface other I2C sensors with the MPU-6050 |
XCL | Used to interface other I2C sensors with the MPU-6050 |
AD0 | Use this pin to change the I2C address |
INT | Interrupt pin – can be used to indicate that new measurement data is available |
Preparing Arduino IDE
We’ll program the ESP8266 NodeMCU board using Arduino IDE. So, make sure you have the ESP8266 add-on installed. Follow the next tutorial:
If you prefer using VS Code + PlatformIO IDE, follow the next guide:
Installing Libraries
There are different ways to get readings from the sensor. In this tutorial, we’ll use the Adafruit MPU6050 library. To use this library you also need to install the Adafruit Unified Sensor library and the Adafruit Bus IO Library.
Open your Arduino IDE and go to Sketch > Include Library > Manage Libraries. The Library Manager should open.
Type “adafruit mpu6050” on the search box and install the library.
Then, search for “Adafruit Unified Sensor”. Scroll all the way down to find the library and install it.
Finally, search for “Adafruit Bus IO” and install it.
After installing the libraries, restart your Arduino IDE.
If you’re using VS Code with PaltformIO, copy the following lines to the platformio.ini file.
lib_deps = adafruit/Adafruit MPU6050 @ ^2.0.3
adafruit/Adafruit Unified Sensor @ ^1.1.4
Getting MPU-6050 Sensor Readings: Accelerometer, Gyroscope and Temperature
In this section you’ll learn how to get sensor readings from the MPU-6050 sensor: acceleration (x, y, z), angular velocity (x, y, z) and temperature.
Parts Required
For this example you need the following parts:
- MPU-6050 Accelerometer Gyroscope
- ESP8266 (read Best ESP8266 development boards)
- Breadboard
- Jumper wires
You can use the preceding links or go directly to MakerAdvisor.com/tools to find all the parts for your projects at the best price!
Schematic Diagram – ESP8266 NodeMCU with MPU-6050
Wire the ESP8266 to the MPU-6050 sensor as shown in the following schematic diagram: connect the SCL pin to GPIO 5 and the SDA pin to GPIO 4.
Code – Getting MPU-6050 Sensor Readings: Accelerometer, Gyroscope and Temperature
The Adafruit library provides several examples for this sensor. In this section, we’ll take a look at the basic example that prints the sensor readings in the Serial Monitor.
Go to File > Examples > Adafruit MPU6050 > basic_readings. The following code should load.
It gets the angular velocity (gyroscope) on the x, y and z axis, the acceleration on the x, y and z axis and the temperature.
// Basic demo for accelerometer readings from Adafruit MPU6050
// ESP32 Guide: https://RandomNerdTutorials.com/esp32-mpu-6050-accelerometer-gyroscope-arduino/
// ESP8266 Guide: https://RandomNerdTutorials.com/esp8266-nodemcu-mpu-6050-accelerometer-gyroscope-arduino/
// Arduino Guide: https://RandomNerdTutorials.com/arduino-mpu-6050-accelerometer-gyroscope/
#include <Adafruit_MPU6050.h>
#include <Adafruit_Sensor.h>
#include <Wire.h>
Adafruit_MPU6050 mpu;
void setup(void) {
Serial.begin(115200);
while (!Serial)
delay(10); // will pause Zero, Leonardo, etc until serial console opens
Serial.println("Adafruit MPU6050 test!");
// Try to initialize!
if (!mpu.begin()) {
Serial.println("Failed to find MPU6050 chip");
while (1) {
delay(10);
}
}
Serial.println("MPU6050 Found!");
mpu.setAccelerometerRange(MPU6050_RANGE_8_G);
Serial.print("Accelerometer range set to: ");
switch (mpu.getAccelerometerRange()) {
case MPU6050_RANGE_2_G:
Serial.println("+-2G");
break;
case MPU6050_RANGE_4_G:
Serial.println("+-4G");
break;
case MPU6050_RANGE_8_G:
Serial.println("+-8G");
break;
case MPU6050_RANGE_16_G:
Serial.println("+-16G");
break;
}
mpu.setGyroRange(MPU6050_RANGE_500_DEG);
Serial.print("Gyro range set to: ");
switch (mpu.getGyroRange()) {
case MPU6050_RANGE_250_DEG:
Serial.println("+- 250 deg/s");
break;
case MPU6050_RANGE_500_DEG:
Serial.println("+- 500 deg/s");
break;
case MPU6050_RANGE_1000_DEG:
Serial.println("+- 1000 deg/s");
break;
case MPU6050_RANGE_2000_DEG:
Serial.println("+- 2000 deg/s");
break;
}
mpu.setFilterBandwidth(MPU6050_BAND_5_HZ);
Serial.print("Filter bandwidth set to: ");
switch (mpu.getFilterBandwidth()) {
case MPU6050_BAND_260_HZ:
Serial.println("260 Hz");
break;
case MPU6050_BAND_184_HZ:
Serial.println("184 Hz");
break;
case MPU6050_BAND_94_HZ:
Serial.println("94 Hz");
break;
case MPU6050_BAND_44_HZ:
Serial.println("44 Hz");
break;
case MPU6050_BAND_21_HZ:
Serial.println("21 Hz");
break;
case MPU6050_BAND_10_HZ:
Serial.println("10 Hz");
break;
case MPU6050_BAND_5_HZ:
Serial.println("5 Hz");
break;
}
Serial.println("");
delay(100);
}
void loop() {
/* Get new sensor events with the readings */
sensors_event_t a, g, temp;
mpu.getEvent(&a, &g, &temp);
/* Print out the values */
Serial.print("Acceleration X: ");
Serial.print(a.acceleration.x);
Serial.print(", Y: ");
Serial.print(a.acceleration.y);
Serial.print(", Z: ");
Serial.print(a.acceleration.z);
Serial.println(" m/s^2");
Serial.print("Rotation X: ");
Serial.print(g.gyro.x);
Serial.print(", Y: ");
Serial.print(g.gyro.y);
Serial.print(", Z: ");
Serial.print(g.gyro.z);
Serial.println(" rad/s");
Serial.print("Temperature: ");
Serial.print(temp.temperature);
Serial.println(" degC");
Serial.println("");
delay(500);
}
How the Code Works
Start by including the required libraries for the MPU-6050 sensor: Adafruit_MPU6050 and Adafruit_Sensor.
#include <Adafruit_MPU6050.h>
#include <Adafruit_Sensor.h>
Create an Adafruit_MPU6050 object called mpu to handle the sensor.
Adafruit_MPU6050 mpu;
setup()
In the setup(), initialize the serial monitor at a baud rate of 115200.
Serial.begin(115200);
Initialize the MPU-6050 sensor.
if (!mpu.begin()) {
Serial.println("Sensor init failed");
while (1)
yield();
}
Set the accelerometer measurement range:
mpu.setAccelerometerRange(MPU6050_RANGE_8_G);
Set the gyroscope measurement range:
mpu.setGyroRange(MPU6050_RANGE_500_DEG);
Set the filter bandwidth:
mpu.setFilterBandwidth(MPU6050_BAND_5_HZ);
loop()
In the loop() we’ll get sensor readings and display them in the Serial Monitor.
First, you need to get new sensor events with the current readings.
sensors_event_t a, g, temp;
mpu.getEvent(&a, &g, &temp);
Finally, print the readings. For the acceleration:
- a.acceleration.x: gets acceleration on the x axis;
- a.acceleration.y: gets acceleration on the y axis;
- a.acceleration.z: gets acceleration on the z axis.
The acceleration is measured in meters per second square (m/s2)
Serial.print("Acceleration X: ");
Serial.print(a.acceleration.x);
Serial.print(", Y: ");
Serial.print(a.acceleration.y);
Serial.print(", Z: ");
Serial.print(a.acceleration.z);
Serial.println(" m/s^2");
To get gyroscope readings:
- g.gyro.x: gets angular velocity on the x axis;
- g.gyro.y: gets angular velocity on the y axis;
- g.gyro.z: gets angular velocity on the z axis.
The angular velocity is measured in radians per seconds (rad/s).
Serial.print("Rotation X: ");
Serial.print(g.gyro.x);
Serial.print(", Y: ");
Serial.print(g.gyro.y);
Serial.print(", Z: ");
Serial.print(g.gyro.z);
Serial.println(" rad/s");
Finally, print the temperature – it is measured in Celsius degrees. To access the temperature reading use temp.temperature.
Serial.print("Temperature: ");
Serial.print(temp.temperature);
Serial.println(" degC");
New sensor readings are displayed every 500 milliseconds.
delay(500);
Demonstration
Upload the code to your ESP8266 board. Go to Tools > Board and select the ESP8266 board you’re using. Go to Tools > Port and select the port your board is connected to. Then, click the Upload button.
Open the Serial Monitor at a baud rate of 115200, press the on-board RST button. The sensor measurements will be displayed.
Move the sensor orientation and see the values changing accordingly.
Sensor Calibration
Ideally, when the sensor is static, the gyroscope values should be zero on all axis, which doesn’t happen in our case. When the sensor is static, these are the gyroscope values we get:
- x: 0.06 rad/s
- y: -0.02 rad/s
- z: 0.00 rad/s
On practical applications, you need to take the error into account and correct the values in the code to get more accurate readings.
The same happens for the acceleration values. The acceleration on the z axis should be closer to the gravitational force (9,8 m/s2) and it should be closer to zero on the x and y axis. In our case, these are the approximate values we get when the sensor is static:
- x: 0.71 m/s2
- y: 0.28 m/s2
- z: 9.43 m/s2
Display MPU-6050 Readings on OLED Display
The Adafruit MPU6050 library provides an example that dipslays the MPU-6050 gyroscope and accelerometer readings on an OLED display.
Parts Required
Here’s the parts required to complete this example:
- MPU-6050 Accelerometer Gyroscope
- ESP8266 (read Best ESP8266 development boards)
- 0.96 inch I2C OLED Display SSD1306
- Breadboard
- Jumper wires
You can use the preceding links or go directly to MakerAdvisor.com/tools to find all the parts for your projects at the best price!
Schematic Diagram – ESP8266 NodeMCU with MPU-6050 and OLED Display
Wire all the parts as shown in the following schematic diagram. Because the OLED display and the MPU-6050 sensors use different I2C addresses, we can connect them to the same I2C bus (same pins on the ESP8266).
Learn more about using the OLED display with the ESP8266: ESP8266 NodeMCU OLED Display with Arduino IDE.
Code – Display MPU-6050 Sensor Readings on OLED Display
To use this example, make sure you have the Adafruit SSD1306 library installed. This library can be installed through the Arduino Library Manager.
Go to Sketch > Library > Manage Libraries and search for “SSD1306” and install the SSD1306 library from Adafruit.
For this example, copy the following code or go to File > Examples > Adafruit MPU6050 > MPU6050_oled.
// Basic OLED demo for accelerometer readings from Adafruit MPU6050
// ESP32 Guide: https://RandomNerdTutorials.com/esp32-mpu-6050-accelerometer-gyroscope-arduino/
// ESP8266 Guide: https://RandomNerdTutorials.com/esp8266-nodemcu-mpu-6050-accelerometer-gyroscope-arduino/
// Arduino Guide: https://RandomNerdTutorials.com/arduino-mpu-6050-accelerometer-gyroscope/
#include <Adafruit_MPU6050.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_Sensor.h>
Adafruit_MPU6050 mpu;
Adafruit_SSD1306 display = Adafruit_SSD1306(128, 64, &Wire);
void setup() {
Serial.begin(115200);
// while (!Serial);
Serial.println("MPU6050 OLED demo");
if (!mpu.begin()) {
Serial.println("Sensor init failed");
while (1)
yield();
}
Serial.println("Found a MPU-6050 sensor");
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3C for 128x64
Serial.println(F("SSD1306 allocation failed"));
for (;;)
; // Don't proceed, loop forever
}
display.display();
delay(500); // Pause for 2 seconds
display.setTextSize(1);
display.setTextColor(WHITE);
display.setRotation(0);
}
void loop() {
sensors_event_t a, g, temp;
mpu.getEvent(&a, &g, &temp);
display.clearDisplay();
display.setCursor(0, 0);
Serial.print("Accelerometer ");
Serial.print("X: ");
Serial.print(a.acceleration.x, 1);
Serial.print(" m/s^2, ");
Serial.print("Y: ");
Serial.print(a.acceleration.y, 1);
Serial.print(" m/s^2, ");
Serial.print("Z: ");
Serial.print(a.acceleration.z, 1);
Serial.println(" m/s^2");
display.println("Accelerometer - m/s^2");
display.print(a.acceleration.x, 1);
display.print(", ");
display.print(a.acceleration.y, 1);
display.print(", ");
display.print(a.acceleration.z, 1);
display.println("");
Serial.print("Gyroscope ");
Serial.print("X: ");
Serial.print(g.gyro.x, 1);
Serial.print(" rps, ");
Serial.print("Y: ");
Serial.print(g.gyro.y, 1);
Serial.print(" rps, ");
Serial.print("Z: ");
Serial.print(g.gyro.z, 1);
Serial.println(" rps");
display.println("Gyroscope - rps");
display.print(g.gyro.x, 1);
display.print(", ");
display.print(g.gyro.y, 1);
display.print(", ");
display.print(g.gyro.z, 1);
display.println("");
display.display();
delay(100);
}
How the Code Works
Start by including the required libraries for the MPU-6050 sensor and for the OLED display.
#include <Adafruit_MPU6050.h>
#include <Adafruit_SSD1306.h>
#include <Adafruit_Sensor.h>
Create an Adafruit_MPU6050 object called mpu to handle the sensor.
Adafruit_MPU6050 mpu;
Create an Adafruit_SSD1306 object called display to handle the OLED display. This is for a display with 128×64 pixels.
Adafruit_SSD1306 display = Adafruit_SSD1306(128, 64, &Wire);
setup()
In the setup(), initialize the serial monitor at a baud rate of 115200.
Serial.begin(115200);
Initialize the MPU-6050 sensor.
if (!mpu.begin()) {
Serial.println("Sensor init failed");
while (1)
yield();
}
Initialize the OLED display.
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { // Address 0x3C for 128x64
Serial.println(F("SSD1306 allocation failed"));
for (;;)
; // Don't proceed, loop forever
}
display.display();
Set the font size and color for the display.
display.setTextSize(1);
display.setTextColor(WHITE);
display.setRotation(0);
loop()
In the loop() is where we’ll get the sensor readings and display them on the OLED.
Start by creating events for each measurement, accelerometer, gyroscope and temperature.
sensors_event_t a, g, temp;
Get new sensor readings.
mpu.getEvent(&a, &g, &temp);
Clear the display in each loop() to write new readings.
display.clearDisplay();
Set the display cursor to (0,0) – the upper left corner. It will start writing text from that location.
display.setCursor(0, 0);
The following lines print the accelerometer readings in the Serial Monitor.
Serial.print("Accelerometer ");
Serial.print("X: ");
Serial.print(a.acceleration.x, 1);
Serial.print(" m/s^2, ");
Serial.print("Y: ");
Serial.print(a.acceleration.y, 1);
Serial.print(" m/s^2, ");
Serial.print("Z: ");
Serial.print(a.acceleration.z, 1);
Serial.println(" m/s^2");
The following lines display the acceleration x, y an z values on the OLED display.
display.println("Accelerometer - m/s^2");
display.print(a.acceleration.x, 1);
display.print(", ");
display.print(a.acceleration.y, 1);
display.print(", ");
display.print(a.acceleration.z, 1);
display.println("");
Display the gyroscope readings on the Serial Monitor.
Serial.print("Gyroscope ");
Serial.print("X: ");
Serial.print(g.gyro.x, 1);
Serial.print(" rps, ");
Serial.print("Y: ");
Serial.print(g.gyro.y, 1);
Serial.print(" rps, ");
Serial.print("Z: ");
Serial.print(g.gyro.z, 1);
Serial.println(" rps");
Finally, print the gyroscope readings on the display.
display.println("Gyroscope - rps");
display.print(g.gyro.x, 1);
display.print(", ");
display.print(g.gyro.y, 1);
display.print(", ");
display.print(g.gyro.z, 1);
display.println("");
Lastly, call display.display() to actually show the readings on the OLED.
display.display();
New readings are displayed every 100 milliseconds.
delay(100);
Demonstration
Upload the code to your ESP8266 board. Go to Tools > Board and select the ESP8266 board you’re using. Go to Tools > Port and select the port your board is connected to. Then, click the upload button.
Open the Serial Monitor at a baud rate of 115200, press the on-board RST button. The sensor measurements will be displayed both on the Serial Monitor and on the OLED display.
Move the sensor and see the values changing.
You can watch the video demonstration:
Wrapping Up
The MPU-6050 is an accelerometer and gyroscope. It measures acceleration on the x, y and z axis as well as angular velocity. This module also measures temperature.
This sensor modules communicates via I2C communication protocol. So, the wiring is very simple. Just connect the sensor to the ESP8266 default I2C pins.
In this tutorial you’ve learned how to wire the sensor and get sensor readings. We hope you’ve found this getting started guide useful. We have guides for other popular sensors:
- ESP8266 with DHT11/DHT22 Temperature and Humidity Sensor using Arduino IDE
- ESP8266 with BME280 using Arduino IDE (Pressure, Temperature, Humidity)
- ESP8266 DS18B20 Temperature Sensor with Arduino IDE (Single, Multiple, Web Server)
- ESP8266 with BME680 Environmental Sensor (Gas, Pressure, Humidity, Temperature)
Learn more about the ESP8266 with our resources:
Thanks for reading.
Nice tutorial, and a Happy New Year to all !
I just received a pair of mpu6050 to play with it.
A question, how can the rotation be changed to degrees (°) in place of rps ?
Degrees are more easy to comprehend.
Hi.
It is in radians per second.
You can check the formula here: rapidtables.com/convert/number/radians-to-degrees.html
Regards,
Sara
Change line:
display.println(“Gyroscope – rps”);
TO something like that:
display.setTextSize(2);
display.setCursor(0,0);
display.println(“Gyroscope – degrees”);
display.cp437(true);
display.write(167);
Ah ok, thanks, i thought it was via a calculation pi/180 something.
That means that these calculations are already in the Adafruit library.
Great, now testing …
All perfect as usual.
But I have a problem instead of MPU6050 I have a module GY-271, I think that uses the same chip, that if I use with the library QMC5883LCompass.h I can read some values, in another sketch.
In setup I commented from line 17 to line 21 to read values in the display, under I obtain a fixed value and under some continously changing value.
May I change.
May I change something to obtain the right values?
Thanks
Renzo
Hi,
Very good post.
How do you make the calibration? That is just an offcet ?
Thank you
Hi.
Yes, it’s just an offset. It’s the simplest way.
If anyone knows a better way, please share 🙂
Regards,
Sara
Hi sara, can you please help us to indicate some suggestions how to apply this example to own home?
Hi.
What do you mean?
Regards,
Sara
I meant some useful applications.
Make your own drone of quadcopter.
Make a electronic level.
Switch something when x or y angle is reached.
Hi Luc, thanks.
I meant something into my home….check for earthquakes?
No earthquakes i think, but I’m really not sure about this.
Hello dear Sara,
Can you please tell me which software do you guys use to draw connection diagrams?
Thank you
Hi.
We use fritzing.
Regards,
Sara
Muy buen trabajo ! perfectamente explicado !! me sirvio mucho , muchisimas gracias !!!
Hi Sara, thanks for this tutor, nice one. I am using VS. Could you tell me what should I put in the plarform.ini file to support SSD1306 OLED ? You skipped telling this for VS users. Thanks in advance
OK, I found it on Github, I share it with the ones who are interested:
add the following line to the platform.ini file:
lib_deps =Â Â Â Â adafruit/Adafruit SSD1306 @ ^2.4.5
kind regards,
Hi.
You can follow this section to learn how to search for libraries and how to include them in your projects using VS Code + PIO: https://randomnerdtutorials.com/vs-code-platformio-ide-esp32-esp8266-arduino/#7
Regards,
Sara
Thanks a lot, Sara, you are fast and helpful as usual, keep on going 🙂
Hi.
I want to receive Yaw, Pitch, Roll from Digital Motion Processor(DMP) on the MPU6050 (GY521) like this link:
github.com/jrowberg/i2cdevlib/blob/master/Arduino/MPU6050/examples/MPU6050_DMP6/MPU6050_DMP6.ino
but when I’m using this code by nodemcu1.0, I will receive this error:
“Error compiling for board NodeMCU1.0 (ESP-12E Module).”
Does anyone know how I can get Yaw, Pitch, Roll from DMP by MPU6050 and NodeMCU1.0 ???
Hi.
Can you provide more details about the error?
Otherwise, it is very difficult to find out what might be wrong.
Regards,
Sara
Thanks. The problem was solved. The problem was of the library I had added.
Hi, can you tell me which library are you using? I’m working on a project with ESP8266 and need to use the Roll, Pitch and Yaw values. I’ve tried doing some calculations, but the Yaw still gives me problems.
Good morning and thank you very much for your tutorial.
I have relaized the assembly with a wemos D1 R2 when initializing it gives an error
Sensor init failed.
I have tried without the library with another program and it works fine but the calculations are all by hand.
the address is MPU 0x68
SCL — D1 Wemos
SCA — D2 wemos
File > Examples > Adafruit MPU6050 > MPU6050_oled .
Thank you very much for your help.
hello,i want ask about how to use a 1.44” inch tft screen to approach display of the info from mpu6050
Hi.
Unfortunately, we don’t have any tutorial about that.
Regards,
Sara
I know I am late to this one, but thankyou its always great when these online designs works, This one worked first time afte a couple of other ones using the same MPU6050.
Thanks again.
Hi! Having issues with this- it doesn’t seem to be recognising my sensor, despite it showing up on an I2C scan, it working with an Uno, and it working sometimes with another library (50% of time time it outputs correct data, the other 50% of the time it just outputs 0’s)
Do you have any solutions?
Thanks 🙂
Hello! Did you manage to solve it? I’m also having issues. My Wemos D1 isn’t detecting the MPU sensor when performing the I2C scan. Sometimes I get faulty data outputs with meaningless characters.
No luck yet :/ I’ve found a library that works like 50% of the time, I think its MPU6050_light. What sensor are you using (as in exactly what sensor) wondering if we’ve got it from the same manufactuerer. I’ll update if I get it fixed!
Thank you very much for your great work, I am a follower of your emails.
I have built the system with the Adafruit libraries, and it does not work with other libraries.
The error is that it does not recognize the chip, it was purchased in China, when searching for its address it answers correctly with 0x68
It seems that the Adafruit libraries do another calculation for a magic number 0x71 in my case
I attach the URL that solved my problem.
https://forum.pjrc.com/threads/67594-not-initialize-mpu6050-Failed-to-find-MPU6050-chip
With NoceMCU on 3V output it works but does not work with D1 Mini Pro, it does not work on 3V output 5V is necessary
Hello, I would like to know how I could provide electricity through a battery similar to the one found in smartwatches or perhaps with the ones that cell phones have. Could you tell me your opinion?
Thank you very much for your great work, I am a follower of your emails.
I have built the system with the Adafruit libraries, and it does not work with other libraries.
The error is that it does not recognize the chip, it was purchased in China, when searching for its address it answers correctly with 0x68
It seems that the Adafruit libraries do another calculation for a magic number 0x71 in my case
I attach the URL that solved my problem.
https://forum.pjrc.com/threads/67594-not-initialize-mpu6050-Failed-to-find-MPU6050-chip
With NoceMCU on 3V output it works but does not work with D1 Mini Pro, it does not work on 3V output 5V is necessary
Sorry maybe I am splitting hairs but the snippets of code shown in the above explanation for the basic readings do not tally with the RAW CODE eg Yield() is just not in it. I know it works as I have tried it but this is meant for people just beginning with the 6050 and maybe also Arduino and ESP8266, these little things could confuse beginners easily.