Comments (15)
Seems to be working with the latest Energia version (0101E0011). Can you try DMP code?
from i2cdevlib.
yea i have the last version .. first i tried the DMP code .. i get these errors from the example code
MPU6050_DMP6.ino: In function 'void setup()':
MPU6050_DMP6.ino:165:9: error: 'TWBR' was not declared in this scope
MPU6050_DMP6.ino:174:13: error: no match for 'operator!' in '!Serial'
MPU6050_DMP6.ino:174:13: note: candidate is:
MPU6050_DMP6.ino:174:13: note: operator!(bool)
MPU6050_DMP6.ino:174:13: note: no known conversion for argument 1 from 'HardwareSerial' to 'bool'
so i commented that lines and tried then it says
Initializing I2C devices...
Testing device connections...
MPU6050 connection successful
Send any character to begin DMP programming and demo:
Initializing DMP...
DMP Initialization failed (code 1)
however the raw values example works and print values but the unstable values
from i2cdevlib.
is it sthg with I2C clock ? as // TWBR = 24; // 400kHz I2C clock (200kHz if CPU is 8MHz)
#elif I2CDEV_IMPLEMENTATION == I2CDEV_BUILTIN_FASTWIRE
Fastwire::setup(400, true);
#endif
and tiva c is 80 MHZ
from i2cdevlib.
I can confirm that i am getting correct readings. Take a look at the snapshot attached.
Code uses Pins 23 and 24 on Jumper J3 for SCL and SDA.
Also, note that the baud rate must be 9600. This is a limit for the TM4C123G IC.
Code is as follows:
void setup() {
// join I2C bus (I2Cdev library doesn't do this automatically)
Wire.begin(3);
Wire.setModule(3);
Wire.begin();
// initialize serial communication
// (38400 chosen because it works as well at 8MHz as it does at 16MHz, but
// it's really up to you depending on your project)
Serial.begin(9600);
// initialize device
Serial.println("Initializing I2C devices...");
accelgyro.initialize();
from i2cdevlib.
Board used is a custom 9 Degrees of Freedom board.
http://www.explorelabs.com/imu-9-dof-fusion-mpu6150-hmc5883l-i2c-auto-voltage-shift.html
from i2cdevlib.
this what i get when i use the same connection with MPU-6050
from i2cdevlib.
it is stable and readings arenot close
from i2cdevlib.
I believe you should not be getting a reading of more than 32768/2 for gyro.
I am not sure.
What hardware are you using? Also, what modifications have you done to the original MPU6050_RAW sketch?
from i2cdevlib.
tiva c launch pad tm4c123 .. MPU6050 invense board ... i connected the vcc to 3.3 and gnd to gnd .. SCL to PA6 and SDA to PA7 .. and here is my code
// I2C device class (I2Cdev) demonstration Arduino sketch for MPU6050 class
// 10/7/2011 by Jeff Rowberg [email protected]
// Updates should (hopefully) always be available at https://github.com/jrowberg/i2cdevlib
//
// Changelog:
// 2013-05-08 - added multiple output formats
// - added seamless Fastwire support
// 2011-10-07 - initial release
/* ============================================
I2Cdev device library code is placed under the MIT license
Copyright (c) 2011 Jeff Rowberg
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
// I2Cdev and MPU6050 must be installed as libraries, or else the .cpp/.h files
// for both classes must be in the include path of your project
#include "I2Cdev.h"
#include "MPU6050.h"
// Arduino Wire library is required if I2Cdev I2CDEV_ARDUINO_WIRE implementation
// is used in I2Cdev.h
#if I2CDEV_IMPLEMENTATION == I2CDEV_ARDUINO_WIRE
#include "Wire.h"
#endif
// class default I2C address is 0x68
// specific I2C addresses may be passed as a parameter here
// AD0 low = 0x68 (default for InvenSense evaluation board)
// AD0 high = 0x69
MPU6050 accelgyro;
//MPU6050 accelgyro(0x69); // <-- use for AD0 high
int16_t ax, ay, az;
int16_t gx, gy, gz;
// uncomment "OUTPUT_READABLE_ACCELGYRO" if you want to see a tab-separated
// list of the accel X/Y/Z and then gyro X/Y/Z values in decimal. Easy to read,
// not so easy to parse, and slow(er) over UART.
#define OUTPUT_READABLE_ACCELGYRO
// uncomment "OUTPUT_BINARY_ACCELGYRO" to send all 6 axes of data as 16-bit
// binary, one right after the other. This is very fast (as fast as possible
// without compression or data loss), and easy to parse, but impossible to read
// for a human.
//#define OUTPUT_BINARY_ACCELGYRO
#define LED_PIN 13
bool blinkState = false;
void setup() {
// join I2C bus (I2Cdev library doesn't do this automatically)
Wire.begin();
Wire.setModule(1);
// initialize serial communication
// (38400 chosen because it works as well at 8MHz as it does at 16MHz, but
// it's really up to you depending on your project)
Serial.begin(9600);
// initialize device
Serial.println("Initializing I2C devices...");
accelgyro.initialize();
// verify connection
Serial.println("Testing device connections...");
Serial.println(accelgyro.testConnection() ? "MPU6050 connection successful" : "MPU6050 connection failed");
// use the code below to change accel/gyro offset values
/*
Serial.println("Updating internal sensor offsets...");
// -76 -2359 1688 0 0 0
Serial.print(accelgyro.getXAccelOffset()); Serial.print("\t"); // -76
Serial.print(accelgyro.getYAccelOffset()); Serial.print("\t"); // -2359
Serial.print(accelgyro.getZAccelOffset()); Serial.print("\t"); // 1688
Serial.print(accelgyro.getXGyroOffset()); Serial.print("\t"); // 0
Serial.print(accelgyro.getYGyroOffset()); Serial.print("\t"); // 0
Serial.print(accelgyro.getZGyroOffset()); Serial.print("\t"); // 0
Serial.print("\n");
accelgyro.setXGyroOffset(220);
accelgyro.setYGyroOffset(76);
accelgyro.setZGyroOffset(-85);
Serial.print(accelgyro.getXAccelOffset()); Serial.print("\t"); // -76
Serial.print(accelgyro.getYAccelOffset()); Serial.print("\t"); // -2359
Serial.print(accelgyro.getZAccelOffset()); Serial.print("\t"); // 1688
Serial.print(accelgyro.getXGyroOffset()); Serial.print("\t"); // 0
Serial.print(accelgyro.getYGyroOffset()); Serial.print("\t"); // 0
Serial.print(accelgyro.getZGyroOffset()); Serial.print("\t"); // 0
Serial.print("\n");
*/
// configure Arduino LED for
pinMode(LED_PIN, OUTPUT);
}
void loop() {
// read raw accel/gyro measurements from device
accelgyro.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
// these methods (and a few others) are also available
//accelgyro.getAcceleration(&ax, &ay, &az);
//accelgyro.getRotation(&gx, &gy, &gz);
#ifdef OUTPUT_READABLE_ACCELGYRO
// display tab-separated accel/gyro x/y/z values
Serial.print("a/g:\t");
Serial.print(ax); Serial.print("\t");
Serial.print(ay); Serial.print("\t");
Serial.print(az); Serial.print("\t");
Serial.print(gx); Serial.print("\t");
Serial.print(gy); Serial.print("\t");
Serial.println(gz);
#endif
#ifdef OUTPUT_BINARY_ACCELGYRO
Serial.write((uint8_t)(ax >> 8)); Serial.write((uint8_t)(ax & 0xFF));
Serial.write((uint8_t)(ay >> 8)); Serial.write((uint8_t)(ay & 0xFF));
Serial.write((uint8_t)(az >> 8)); Serial.write((uint8_t)(az & 0xFF));
Serial.write((uint8_t)(gx >> 8)); Serial.write((uint8_t)(gx & 0xFF));
Serial.write((uint8_t)(gy >> 8)); Serial.write((uint8_t)(gy & 0xFF));
Serial.write((uint8_t)(gz >> 8)); Serial.write((uint8_t)(gz & 0xFF));
#endif
// blink LED to indicate activity
blinkState = !blinkState;
digitalWrite(LED_PIN, blinkState);
}
thank you for ur response !
from i2cdevlib.
I see that you are using offset values. Just for testing purpose, can you try the original code.
Maybe, a glitch in setting the offset values.
from i2cdevlib.
no they are commented .. should i try pulling up SCL and SDA pins to 3.3 V ?
from i2cdevlib.
If you are using this board:
https://www.sparkfun.com/products/11028
Then, it has pull ups on the board. They are enabled by default.
I2C interface does not seem to be a problem. It should be related to Energia and Wire Library implementation in Energia.
from i2cdevlib.
yea that is the board i am using .. so i should check the wire library ?
from i2cdevlib.
Hi, mahmoudhamdy, did you get the output correctly?
from i2cdevlib.
Closing ancient issue for cleanup.
from i2cdevlib.
Related Issues (20)
- Serial Yaw Roll Pitch example of MPU6050_DMP6 lib HOT 2
- MPU DMP with 250 dps
- Upgrading DIY UAV from mega2560 to esp32 : unsuccessful after weeks of attempts HOT 1
- Yaw or Quaternion w value got unchanged eventhough my MPU6050 is rotating in place HOT 2
- IN YPR R is not changing for variable P HOT 1
- I get no output in Serial Monitor Wesmos D1 Mini HOT 7
- Calculate displacement
- How to get actual g-force values?
- publish platformio registry for MPU9250 package
- Count overflow in Arduino/I2Cdev::readBytes and I2Cdev::readWords HOT 1
- I'm trying to use your ADS1115 library for a current sensor project I'm working on right now. When i use that library it gives this error: HOT 1
- grove IMU 9dof
- Is it possible to use more than 2 adxl345 accel/gyros on an esp32?
- [FR] Project Examples for PlatformIO Registry
- Compilation error about no matching function for call to all writing and reading functions from I2Cdev.cpp
- STM32 HAL \ I2Cdev.h & I2Cdev.c compiler error : "multiple definition of `I2Cdev_readTimeout';"
- ESP32 error: i2c driver not installed
- is OUTPUT_READABLE_YAWPITCHROLL display Euler angles in degrees conversion correct? HOT 1
- Angular Velocity (Gyroscope_X deg/s, Gyroscope_Y deg/s, Gyroscope_Z deg/s,)
- Acceleration Range
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 i2cdevlib.