All Projects → tockn → Mpu6050_tockn

tockn / Mpu6050_tockn

Arduino library for easy communication with MPU6050

Projects that are alternatives of or similar to Mpu6050 tockn

Dmxusb
DMXUSB emulates an ENTTEC-compatible DMXKing USB to DMX serial device with one, two, or n universes.
Stars: ✭ 66 (-44.54%)
Mutual labels:  arduino, arduino-library
Ramp
Arduino Interpolation Library
Stars: ✭ 72 (-39.5%)
Mutual labels:  arduino, arduino-library
Micronmea
A compact Arduino library to parse NMEA sentences.
Stars: ✭ 66 (-44.54%)
Mutual labels:  arduino, arduino-library
Tm16xx
Arduino TM16xx library for LED & KEY and LED Matrix modules based on TM1638, TM1637, TM1640 and similar chips. Simply use print() on 7-segment and use Adafruit GFX on matrix.
Stars: ✭ 61 (-48.74%)
Mutual labels:  arduino, arduino-library
Fpm
Arduino library for the R30x/ZFMxx/FPMxx optical fingerprint sensors
Stars: ✭ 79 (-33.61%)
Mutual labels:  arduino, arduino-library
Ws2812fx
WS2812 FX Library for Arduino and ESP8266
Stars: ✭ 1,113 (+835.29%)
Mutual labels:  arduino, arduino-library
Liquidcrystal pcf8574
A library for driving LiquidCrystal displays (LCD) by using the I2C bus and an PCF8574 I2C adapter.
Stars: ✭ 67 (-43.7%)
Mutual labels:  arduino, arduino-library
Cayennelpp
Library for Arduino compatible with Cayenne Low Power Payload
Stars: ✭ 51 (-57.14%)
Mutual labels:  arduino, arduino-library
Tft espi
Arduino and PlatformIO IDE compatible TFT library optimised for the STM32, ESP8266 and ESP32 that supports different driver chips
Stars: ✭ 1,215 (+921.01%)
Mutual labels:  arduino, arduino-library
Ultrasonic
Minimalist library for Ultrasonic Module HC-SR04, PING))) and Seeed SEN136B5B to Arduino
Stars: ✭ 77 (-35.29%)
Mutual labels:  arduino, arduino-library
Button2
Arduino Library to simplify working with buttons. It allows you to use callback functions to track single, double, triple and long clicks. It also takes care of debouncing.
Stars: ✭ 109 (-8.4%)
Mutual labels:  arduino, arduino-library
Simpledht
Simple, Stable and Fast Arduino Temp & Humidity Sensors for DHT11 and DHT22. http://learn.adafruit.com/dht
Stars: ✭ 111 (-6.72%)
Mutual labels:  arduino, arduino-library
Segacontroller
Arduino library to read Sega Genesis (Mega Drive) and Master System (Mark III) controllers.
Stars: ✭ 55 (-53.78%)
Mutual labels:  arduino, arduino-library
Dmxserial2
An Arduino library for sending and receiving DMX RDM packets.
Stars: ✭ 65 (-45.38%)
Mutual labels:  arduino, arduino-library
Gem
Good Enough Menu for Arduino
Stars: ✭ 54 (-54.62%)
Mutual labels:  arduino, arduino-library
Nintendoextensionctrl
Arduino library for communicating with Nintendo extension controllers
Stars: ✭ 67 (-43.7%)
Mutual labels:  arduino, arduino-library
Fram mb85rc i2c
Arduino library for I2C FRAM - Fujitsu MB85RC & Cypress FM24, CY15B
Stars: ✭ 41 (-65.55%)
Mutual labels:  arduino, arduino-library
Sslclient
🔒Add SSL/TLS functionality to any Arduino library
Stars: ✭ 45 (-62.18%)
Mutual labels:  arduino, arduino-library
Aunit
Unit testing framework for Arduino platforms inspired by ArduinoUnit and Google Test. Used with AUniter or EpoxyDuino for continuous builds.
Stars: ✭ 73 (-38.66%)
Mutual labels:  arduino, arduino-library
Beelan Lorawan
A LoRaWAN library for compatible arduino board
Stars: ✭ 87 (-26.89%)
Mutual labels:  arduino, arduino-library

MPU6050_tockn

Arduino library for easy communicating with the MPU6050

Usage

You can see example sketch.

If you want to get data of MPU6050, you must execute update() method before get method.
update() will get all data of MPU6050, and calculating angle by accelerometer, gyroscope and complementary filter.

Complementary filter

update() method calculate angle by accelerometer and gyroscope using complementary filter.
Those two coefficients determined by constructor.
Default coefficient of accelerometer is 0.02, gyroscope is 0.98.
filtered_angle = (0.02 * accel) + (0.98 * gyro)

example

If you want to set 0.1 to accelerometer coefficient and 0.9 to gyroscope coefficient, your code is
MPU6050 mpu6050(Wire, 0.1, 0.9);

Auto calibration

If you use calcGyroOffsets() in setup(), it will calculate calibration of the gyroscope, and the value of the gyroscope will calibrated.
⚠DO NOT MOVE MPU6050 during calculating.⚠

#include <MPU6050_tockn>
#include <Wire.h>

MPU6050 mpu6050(Wire);

void setup(){
  Wire.begin();
  mpu6050.begin();
  mpu6050.calcGyroOffsets();
}

If you use calcGyroOffsets(true) in setup(), you can see state of calculating calibration in serial monitor.

#include <MPU6050_tockn>
#include <Wire.h>

MPU6050 mpu6050(Wire);

void setup(){
  Serial.begin(9600);
  Wire.begin();
  mpu6050.begin();
  mpu6050.calcGyroOffsets(true);
}

Serial monitor:

Calculate gyro offsets
DO NOT MOVE MPU6050.....
Done!
X : 1.45
Y : 1.23
Z : -1.32
Program will start after 3 seconds

If you know offsets of gyroscope, you can set them by setGyroOffsets(), and you don't have to execute calcGyroOffsets(), so you can launch program quickly.

example

#include <MPU6050_tockn>
#include <Wire.h>

MPU6050 mpu6050(Wire);

void setup(){
  Serial.begin(9600);
  Wire.begin();
  mpu6050.begin();
  mpu6050.setGyroOffsets(1.45, 1.23, -1.32);
}

Licence

MIT

Author

tockn

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].