Git Product home page Git Product logo

basicmpu6050's Introduction

basicMPU6050

The purpose of this library is to make a basic and lightweight interface for the MPU6050. It can do the following:

  • Configure the inbuilt low pass filter
  • Configure the sensitivity of the accelerometer and gyro
  • Retrieve the raw output of the sensor
  • Output scaled accelerometer and gyro values

Calibration

The library includes two functions to calibrate the gyro and remove bias. The first is intended to be called when the sensor is turned on and is not moving. It takes a long term average of the output of each axis and subtracts these values from the raw signals.

The second function is designed to update the averages. It updates the values with a moving average and the gain is controlled by something akin to a kalman filter. By polling this function one can correct for drift in the gyro bias. By combining these two functions one can obtain stable and consistent gyro outputs. However, The accelerometer needs to calibrated manually by correcting the bias and scale.

References

See this link for the information on the registers of the MPU6050: MPU 6050 register map

basicmpu6050's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

basicmpu6050's Issues

Missing call to Wire.begin()

First of all, thanks for making this library! Smallest flash footprint of any MPU6050 library I've come across, especially when you're not making use of all the fancy floating point features. Just like as a size comparison, Adafruit's MPU6050 library, with nothing else, immediately blows clear through the ATTiny85's 8K and then some. This one is barely more than 1K, perfect for a constrained environment like that, so thanks!

Anyway, one issue I did run into when moving code from my Uno testing ground to its final home on the ATTiny85 was that a missing call to Wire.begin() anywhere in the library meant that all reads from the MPU failed and returned -1. Works just fine on the Uno but I guess the Wire library provided by the ATTinyCore I'm using is a little more picky. Also works fine if you manually slap a call to Wire.begin() in your own code before you start making calls into this library.

need help regarding ubuntu

Hi please I have an issue, I wanted to scrap Google results exactly to find the number of search results in excel, I found this source here https://github.com/RomainFallet/keyworder it is what I want, but it didn't work because of the commands (sudo npm install
, sudo npm install [email protected] --unsafe-perm=true --allow-root --no-save, npm run build).
Please let me know how to solve this problem.

consult

Hello, a great library

If I change the int pin D2 to D19, what do I need to do

change address

is it possible to add a simple function to set the address from 0x68 to 0x69, so as not to modify the file.h?

same values diffrent mpus

Hello, I get the same values for both although both MPU's are connected to different addresses and are read out individually.What is wrong with my code?

#include <Wire.h>
#include <basicMPU6050.h>

#define MPU_ADDRESS_LOW 0x68
#define MPU_ADDRESS_HIGH 0x69

basicMPU6050<MPU_ADDRESS_LOW> imu1;
basicMPU6050<MPU_ADDRESS_HIGH> imu2;

void setup() {

Wire.begin();
Serial.begin(38400);

Wire.beginTransmission(MPU_ADDRESS_LOW);
Wire.write(0x6B); // PWR_MGMT_1 register
Wire.write(0x00); // set to zero (wake up MPU6050)
Wire.endTransmission();

Wire.beginTransmission(MPU_ADDRESS_HIGH);
Wire.write(0x6B); // PWR_MGMT_1 register
Wire.write(0x00); // set to zero (wake up MPU6050)
Wire.endTransmission();

Wire.beginTransmission(MPU_ADDRESS_LOW);
if (Wire.endTransmission() == 0) {
Serial.println("MPU6050 IMU 1 connected.");
} else {
Serial.println("MPU6050 IMU 1 NOT connected!");
}

Wire.beginTransmission(MPU_ADDRESS_HIGH);
if (Wire.endTransmission() == 0) {
Serial.println("MPU6050 IMU 2 connected.");
} else {
Serial.println("MPU6050 IMU 2 NOT connected!");
}

imu1.setBias();
imu2.setBias();
}

void loop() {

imu1.updateBias();

Serial.print( imu1.ax() );
Serial.print( " " );
Serial.print( imu1.ay() );
Serial.print( " " );
Serial.print( imu1.az() );
Serial.print( " " );

imu2.updateBias();

Serial.print( imu2.ax() );
Serial.print( " " );
Serial.print( imu2.ay() );
Serial.print( " " );
Serial.print( imu2.az() );
Serial.println();

delay(100);
}

basicMPU6050 with ESP32

Hello,

I'm trying to run basicMPU6050 with ESP32, but I got some errors, hope you can help me with that.
Firstly, for Velocity example, esp32 keep resetting. I tried to debug it and I think this error because of vector data type library.
Secondly, For output example. The readings are not stable at all and keep changes although I didn't move the module at all.

Sorry for your time, I will be very grateful if you can help me. Thanks in advance.

Sincerely,
Zidan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.