Comments (11)
I changed some part and finally it work with esp8266 and Arduino IDE
#include <MPU6050_tockn.h>
#include <Wire.h>
MPU6050 mpu6050(Wire);
int X, Y, Z;
void setup() {
Serial.begin(9600);
Wire.begin(4,5,0x68);
Wire. setClock ( 400000);
mpu6050.begin();
mpu6050.calcGyroOffsets(true);
}
void loop() {
X = mpu6050.getAngleX();
Y = mpu6050.getAngleY();
Z = mpu6050.getAngleZ();
mpu6050.update();
Serial.print("angleX : ");
Serial.print(X);
Serial.print("\tangleY : ");
Serial.print(Y * (-1));
Serial.print("\tangleZ : ");
Serial.println(Z);
}
from mpu6050_tockn.
Hi,
It's working fine for me. Just make your setup according to your board :
"
#include <MPU6050_tockn.h>
#include <Wire.h>
MPU6050 mpu6050(Wire);
void setup() {
Serial.begin(115200); // I use this bauderate for the esp32
Wire.begin(21,22); //SDA SDL for esp32
mpu6050.begin();
mpu6050.calcGyroOffsets(true);
} "
from mpu6050_tockn.
This dont work for me, because i have esp32 oled
I dont have avaible this pins
from mpu6050_tockn.
Is this the same of your ESP32 OLED?
https://banggood.com/Wemos-ESP32-OLED-Module-For-Arduino-ESP32-OLED-WiFi-Bluetooth-Dual-ESP-32-ESP-32S-ESP8266-p-1148119.html?cur_warehouse=CN
If so, you can use 25
and 26
pin.
You will connect 25
to SDA
and 26
to SCL
and following example may work.
#include <MPU6050_tockn.h>
#include <Wire.h>
MPU6050 mpu6050(Wire);
void setup() {
Serial.begin(115200); // I use this bauderate for the esp32
Wire.begin(26,25); //SDA SDL for esp32
mpu6050.begin();
mpu6050.calcGyroOffsets(true);
}
...
from mpu6050_tockn.
i was try, because the result is ever:
angleX : -135.00 angleY : 135.00 angleZ : -0.00
angleX : -135.00 angleY : 135.00 angleZ : -0.00
angleX : -135.00 angleY : 135.00 angleZ : -0.00
angleX : -135.00 angleY : 135.00 angleZ : -0.00
angleX : -135.00 angleY : 135.00 angleZ : -0.00
angleX : -135.00 angleY : 135.00 angleZ : -0.00
angleX : -135.00 angleY : 135.00 angleZ : -0.00
angleX : -135.00 angleY : 135.00 angleZ : -0.00
angleX : -135.00 angleY : 135.00 angleZ : -0.00
angleX : -135.00 angleY : 135.00 angleZ : -0.00
angleX : -135.00 angleY : 135.00 angleZ : -0.00
angleX : -135.00 angleY : 135.00 angleZ : -0.00
angleX : -135.00 angleY : 135.00 angleZ : -0.00
from mpu6050_tockn.
If you're using the Wemos ESP32 Lolin, I2C uses pins 5 and 4 for SDA and SCL respectively. So in your setup function, you need to have Wire.begin(5,4);
from mpu6050_tockn.
That's great! It's working fine for me.Thx!
from mpu6050_tockn.
Have similar problem. Wire.begin(5,4) didn't improve things.
repreated resests and loading always gave rhe same results, whatever movement is made:
temp. 36.50
accX: --0.00 accY - 0.00 accZ: -0.00
gyroX: -0.00 gyroY: - 0.00 gyroZ: -0.00
accAngleX: -35.26 accAngleY: -0.00
gyroAngleX: -0.00 gyroAngleY: -0.00 gyroAngleZ: -0.00
anglex: 35.26 angleY: 35.26 angleZ: -0.00
GEEKCREIT ESP-F DEVKIT V4 and a WEMOS mini gave exact the same results!
Other basic sketches did give changing values.
from mpu6050_tockn.
Of course, the text should be smaller!
from mpu6050_tockn.
This library for the MPU6050 is the third tried, with some or no succes at all.
After delving (today) into problems elsewhere mentioned with the combo ESP and MPU6050, a suggested addition to the code made it working the right way.
After Wire.begin(); added the line: __Wire. setClock ( 400000);
It seems that the MPU6050 starts default with 100.000 Hertz, which is the right way for a Arduino, but not for the (in much aspects faster) ESP.
from mpu6050_tockn.
If you're using the Wemos ESP32 Lolin, I2C uses pins 5 and 4 for SDA and SCL respectively. So in your setup function, you need to have
Wire.begin(5,4);
I have same problem with this code it works before on Arduino pro micro but on esp8266 the output is
angleX : -135.00 angleY : 135.00 angleZ : -0.00 angleX : -135.00 angleY : 135.00 angleZ : -0.00 angleX : -135.00 angleY : 135.00 angleZ : -0.00 angleX : -135.00 angleY : 135.00 angleZ : -0.00 angleX : -135.00 angleY : 135.00 angleZ : -0.00 angleX : -135.00 angleY : 135.00 angleZ : -0.00 angleX : -135.00 angleY : 135.00 angleZ : -0.00 angleX : -135.00 angleY : 135.00 angleZ : -0.00 angleX : -135.00 angleY : 135.00 angleZ : -0.00 angleX : -135.00 angleY : 135.00 angleZ : -0.00
I changed to Wire.begin(5,4) but isn't work.
from mpu6050_tockn.
Related Issues (20)
- accZ is always -2.00 on ESP32 HOT 4
- angleX Vs angleAccX
- Temperature error - please check
- Change power management
- Roll value of GY-521 HOT 1
- Missing Yaw transfer HOT 8
- Unreliable endianness of retrieved data HOT 1
- Measurement units of raw data of acceleration and angular velocity HOT 3
- How the library compiles for seeeduino xiao
- Reading the Offsets
- I want to drive dc motor HOT 1
- Accelerometer and gyroscope sensitivity HOT 1
- compatibe with Arduino Nano Every?
- Mpu and RTC didn't work at same time
- Value by getangleZ() keeps on increasing with time. Even the sensor is still. HOT 5
- Accelerometer getting stuckk at value 0.
- how to deal with multiple mpu with TCA9548A
- The Angle value has a large jump mpu6050.getAngleX(); mpu6050.getAngleY();
- Perform hardware interfacing on a microcontroller platform effectively
- The mpu6050 fast jitter Angle becomes smaller
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mpu6050_tockn.