MPU-6050 gyroscope and accelerometer~
This feature is not included in precompiled binaries
When compiling your build add the following to user_config_override.h
:
#ifndef USE_MPU6050
#define USE_MPU6050 // [I2cDriver25] Enable MPU6050 sensor (I2C address 0x68 AD0 low or 0x69 AD0 high) (+3K3 of code and 188 Bytes of RAM)
#define USE_MPU6050_DMP // Enable in MPU6050 to use the DMP on the chip, should create better results (+8k6 of code)
#endif
The MPU-6050 combines a 3-axis gyroscope and a 3-axis accelerometer on the same silicon die, together with an onboard Digital Motion Processor™ (DMP™), which processes complex 6-axis MotionFusion algorithms.
Configuration~
Wiring~
MPU-6050 | ESP |
---|---|
GND | GND |
VCC | 3.3V |
SDA | GPIOx |
SCL | GPIOy |
XDA | |
XCL | |
AD0 | |
INT |
Tasmota Settings~
In the Configuration -> Configure Module page assign:
- GPIOx to
I2C SDA
- GPIOy to
I2C SCL
After a reboot the driver will detect MCU-69050 automatically and display measurements.
Sensor sends a tele/%topic%/SENSOR
JSON response:
tele/tasmota/SENSOR = {"Time":"2019-12-10T19:37:50","MPU6050":{"Temperature":27.7,"AccelXAxis":-7568.00,"AccelYAxis":-776.00,"AccelZAxis":12812.00,"GyroXAxis":270.00,"GyroYAxis":-741.00,"GyroZAxis":700.00},"TempUnit":"C"}
Digital Motion Processor Enabled~
If you define flag
#define USE_MPU6050_DMP // Enable in MPU6050 to use the DMP on the chip, should create better results (+8k6 of code)
Sensor sends an expanded tele/%topic%/SENSOR
JSON response:
tele/tasmota/SENSOR = {"Time":"2019-12-10T19:24:55","MPU6050":{"Temperature":25.0,"AccelXAxis":756.00,"AccelYAxis":-1409.00,"AccelZAxis":2152.00,"GyroXAxis":0.00,"GyroYAxis":-1.00,"GyroZAxis":10.00,"Yaw":0.86,"Pitch":-1.45,"Roll":-10.76},"TempUnit":"C"}
Breakout Boards~
Rule Triggers~
The following trigger events are supported for use in Rules:
ON MPU6050#Temperature DO <command> ENDON
ON MPU6050#AccelXAxis DO <command> ENDON
ON MPU6050#AccelYAxis DO <command> ENDON
ON MPU6050#AccelZAxis DO <command> ENDON
ON MPU6050#GyroXAxis DO <command> ENDON
ON MPU6050#GyroYAxis DO <command> ENDON
ON MPU6050#GyroZAxis DO <command> ENDON
ON MPU6050#Yaw DO <command> ENDON
ON MPU6050#Roll DO <command> ENDON
ON MPU6050#Pitch DO <command> ENDON
ON MPU6050#Yaw DO publish espMotion/sensor/data/Yaw %value% ENDON