Skip to main content
Share Your Experience: Take the 2024 Developer Survey
8 votes

How to generate hardware interrupt in mpu6050 to wakeup arduino from SLEEP_MODE_PWR_DOWN mode?

Well, this code worked. In this code, MPU's INT PIN is Active Low so generates Ground on motion which is than connected to INT0 or arduino UNO pin 2 which generates interrupt and wakes UP the MCU #...
bandejiya's user avatar
  • 307
5 votes
Accepted

How important is the INT pin of the MPU6050 (GY-521)?

The INT is the interrupt signal, usually open-drain output and you can connect many of them to the single MCU interrupt line (but you have to check all devices which ones are ready). The LOW level ...
KIIV's user avatar
  • 4,752
4 votes
Accepted

Understanding why should avoid “String” and alternative solutions

First, let me point out a problem in your code, completely unrelated to your question: AcX = Wire.read()<<8|Wire.read(); The C++ standard does not specify in which order the two reads will be ...
Edgar Bonet's user avatar
  • 43.2k
4 votes

Understanding why should avoid “String” and alternative solutions

Edgar answers your first question about String and printing very nicely. Majenko also has a nice description here of the pitfalls. Regarding your second question about GPS/efficiency/speed: use ...
slash-dev's user avatar
  • 2,029
4 votes
Accepted

Changing I2C address of MPU-6050

The MPU-6050 has an address pin, marked as A0, which can be used to set the LSB (least significant bit) of the address. So if you connect A0 to ground, the address will be 0b1101000, if you connect it ...
chrisl's user avatar
  • 16.3k
4 votes

MPU6050 Arduino Jeff Rowberg library interrupt Issue

The functions mpu.dmpGetCurrentFIFOPacket(fifoBuffer), etc, are using I2C for getting the data. The I2C interface on the Uno and Mega (which you tagged your question with) is implemented in hardware ...
chrisl's user avatar
  • 16.3k
4 votes
Accepted

Adafruit MPU-6050 and adafruit I2C Multiplexer

It seems like you would need to call .begin() on your Adafruit_MPU6050 instances, like the examples do. So, following the pattern, in setup() you would need to: tcaselect(0); if (!mpu1.begin()) { ...
timemage's user avatar
  • 5,299
4 votes
Accepted

Stabilize data from four gyros/accelerometer

Looking at your code, I see the only place where gyro_1_angle_x is updated is here: gyro_1_angle_x = gyro_1_angle_x + (gyro_1.gyro.x - mpu_1_gyro_err_x) * elapsedTime; This is adding to ...
Edgar Bonet's user avatar
  • 43.2k
3 votes
Accepted

Help with MPU-6050

I finally got this working after one sleepless night #include<Wire.h> const int MPU = 0x68; int t = 0,dt = 1; int AcX,AcY,AcZ,GyX,GyY,GyZ,tmp; int AcXo,AcYo,AcZo,GyXo,GyYo,GyZo; float roll = 0,...
Teja Allani's user avatar
3 votes

Understanding why should avoid “String” and alternative solutions

I would use sprintf, with a statically allocated buffer. E.g. substitute // Data preparation for file saving: String dataString = ""; // string for assembling the data to log: // Add time tag: ...
Patrick Trentin's user avatar
3 votes

MPU6050 doesn't work

The MPU-6050 is a 3.3V chip. When you are using a 5V Arduino board, you should take care that you don't put current into the SDA and SCL pins of the MPU-6050. Start with a i2c scanner. This one: ...
Jot's user avatar
  • 3,246
3 votes
Accepted

Not able to find right library for MPU9250

In the Arduino IDE, click on SKETCH > INCLUDE LIBRARY > MANAGE LIBRARIES. Then, search for 9250, select the SparkFun one, and click INSTALL. Finally, from the examples, choose the ...
Marcos Saito's user avatar
3 votes

How can I fix this error "invalid operands of types 'const char [17]' and 'float' to binary 'operator+'"?

These lines give you errors, because you cannot simply add character arrays (aka c-strings) and floats together with the + operator. C/C++ is very strict, when it comes to variable types. The compiler ...
chrisl's user avatar
  • 16.3k
3 votes
Accepted

Wire.endTransmission(false) hanging the program after running once when using MPU6050

In the comments below, @chrisl makes something explicit that I hadn't in previous edits. Reading it first may make the below easier to interpret: Useful fact about I2C on Arduino: Wire....
timemage's user avatar
  • 5,299
3 votes

Serial and I2C not working together

The SSD1306 uses a lot of RAM. Pretty much all your RAM. Serial also uses quite a bit of RAM. The two struggle to work together. There is a special "text only" SSD1306 library that uses ...
Majenko's user avatar
  • 105k
3 votes
Accepted

Multiple I2C devices connected to one Arduino Uno?

I2C is a multi-drop bus. That means that one set of I2C pins are designed to have multiple devices on it as long as each device has a unique address. On an Uno the discrete I2C pins and the A4/A5 I2C ...
Majenko's user avatar
  • 105k
3 votes
Accepted

MPU6050 does not give output

From the MPU-6000/MPU-6050 Register Map and Descriptions: Section 4.28, Register 107 – Power Management 1 PWR_MGMT_1, pages 40 to 41: Note: When using SPI interface, user should use DEVICE_RESET (...
tim's user avatar
  • 699
3 votes

MPU6050 does not give output

A while ago while figuring out I2C difficulties of my own I did some research and listed out all the failure modes and test techniques I could think of regarding I2C. See I2C protocol doesn't work ...
RowanP's user avatar
  • 869
2 votes

QuadCopter PID using MPU6050

Quadcopters usually use 2-PID loops per axis, a rate loop and an angle loop. Your quadcopter needs to be very aggressive about its rate of rotation but relatively relaxed about how quickly it returns ...
BrettFolkins's user avatar
  • 4,431
2 votes

How to do run time calibration for MPU9250?

I used this script to calibrate the MPU6050, which is the same as the MPU9250 minus the digital compass. This guide explains how to calibrate the MPU9250's magnetometer.
Cerin's user avatar
  • 1,628
2 votes

Understanding values from an MPU6050

I think the best choice for you is to read raw data from the sensor using Wire library. First of all, you have to include the "Wire.h" library: #include "Wire.h" Next step is to start the I2C ...
Bancila Sorin's user avatar
2 votes

FIFO overflow - reading IMU MPU6090 and GPS uBlox NEO-6M at once

When I try to read data separately it works, but together it stuck every second (probably reading of gps data) and MPU6050 serial monitor sending FIFO overflow error . Yes, you have to be careful ...
slash-dev's user avatar
  • 2,029
2 votes
Accepted

MPU6050 code explanation

I've added in a bunch of comments for you: // MPU-6050 Short Example Sketch // By Arduino User JohnChi // August 17, 2014 // Public Domain #include<Wire.h> const int MPU_addr=0x68; // I2C ...
Malachi's user avatar
  • 311
2 votes

Best way to detect tilt using MPU 6050

Well suppose you have a starting position, let's say 0 degrees, then once you detect and angle change, let's say 10 degrees, you know that there is a tilt of 10 degrees on one of the 3 axies. The ...
Dat Ha's user avatar
  • 2,913
2 votes
Accepted

MPU-6050 + Arduino Micro + nRF24L01 FIFO overflow!

I found the problem, I had to comment out_put_readable_realaccel. So it had to be //#define OUTPUT_READABLE_REALACCEL because it was running the yaw pitch and roll and the real acceleration at the ...
Dat Ha's user avatar
  • 2,913
2 votes
Accepted

What pin is the external interrupt #0 for an arduino micro?

The ATmega32U4 pin mapping says 3.
Ignacio Vazquez-Abrams's user avatar
2 votes

how to communicate MPU-6050 ( on arduino micro) wirelessly using nrf24l01 to arduino uno?

You have a few options here for the wireless communication (~ denotes wireless): MPU -> Arduino -> Bluetooth ~ ~ ~> PC MPU -> Arduino -> NRF ~ ~ ~> NRF -> Arduino -> PC MPU -> Arduino -> WiFi (ESP?) ~...
Orotavia's user avatar
  • 171
2 votes
Accepted

Arduino randomly does incorrect addition

int only goes from -32768 to 32768, and rolls-over, as you've seen. Use a long data type instead and you can go MUCH further from zero. Use double instead of float likewise, when you need more room. ...
dandavis's user avatar
  • 1,037
2 votes

Understanding why should avoid “String” and alternative solutions

A chat system I used to use "back in the day" used a fixed "stack" based string buffer. Basically a single char * buffer of a fixed size was created at the beginning of the program and initialised to ...
Majenko's user avatar
  • 105k

Only top scored, non community-wiki answers of a minimum length are eligible