Hot answers tagged

4

Might be a little late, but you can string more than two of these on one I2C bus, with a little ingenuity. You connect the AD0 pin of each MPU to a different I/O pin of the processor, then take low the address of the one MPU you want to talk to. Then that MPU has one address, all the others have the other address, and being slaves will not respond. ...


3

I just made my GY-521(MPU6050) work with Simulink using s-function. I wish this would be helpful for you. I am using an Arduino MEGA 2650 board. The sensor data is read in in real time. Note that currently only Arduino MEGA 2650, Arduino MEGA 2650 ADK, and Arduino DUE support the real time windows target. If you are using other types of board, this answer ...


3

A technique commonly used in digital signal processing is using fixed-point arithmetic instead of floating point. In fixed-point arithmetic, one calculates using numbers multiplied by some power of two or ten, and in effect mentally positions a binary or decimal point several bits or digits up while calculating. Numerical analysis may be needed to determine ...


3

Is not really connecting GPS to IMU, is more like you read GPS values, read IMU values and after apply what is called a sensor fusion algorithm. One of the most common used sensor fusion algorithms is called Kalman filter (the Extended Kalman Filter more likelly). However, if you do not have some basis on control theory you may have more trouble in ...


3

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 performed. This may work well with the particular version of the particular compiler you are using, but it can break the day you (or an update to the Arduino ...


3

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 NeoGPS, use AltSoftSerial, use the MPU FIFO, use the up-to-date SdFat, watch out for SD write delays, and close the log file at some point. 1. NeoGPS is the ...


3

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 #include <avr/sleep.h> #include <Wire.h> //Analog port 4 (A4) = SDA (serial data) //Analog port 5 (A5) = SCL (serial clock) #define SIGNAL_PATH_RESET ...


3

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 to Vcc it will be 0b1101001. You can find this information in the table under capter 6.4 in the MPU-6050 datasheet (page 15). Normally this pin is getting ...


2

Possible problem: pin interference But as soon as I connect INT to anything (pins 0 through 3), the sketches do not find the MPU6050 any more. (They report ""MPU6050 connection failed"). Is my wiring off, or is my chip defective, and even more important, how could I figure that out on my own in the future? =) If I'm reading the Arduino ...


2

Page 23 of the manual you linked: The MPU-9250 always acts as a slave when communicating to the system processor. The LSB of the of the I2C slave address is set by pin 9 (AD0). It seems you can only choose between two addresses as listed in the table on page 12.


2

I searched quite some time for everything regarding the MPU6050, but there is just rumors and jokes about the dmp funcionality. One project encorporates the hard reverse-engeneering some wise people did, which is: http://www.i2cdevlib.com/docs/html/class_m_p_u6050.html This also uses the interrupt, which I suppose you can't really avoid. Why exaclty this ...


2

Please respect others by presenting code that is readable. By doing that you may also find obvious errors in your code. Let me clean up the loop() and you will see what I mean. void loop() { int a = ax + 10900; if (1) { int val; val = map(ax, -1300, 1300, 0, 1023); Input = val; myPID.Compute(); Serial.println(Output); ...


2

For reading non-consecutive bytes, the “normal” way would be to do a one-byte request and a one-byte read for each byte you want. However, if the bytes you want are close enough (e.g. you want every other byte), it would be faster to do a contiguous read and just ignore the bytes you do not want. E.g.: byte data1 = Wire.read(); // read first byte Wire.read(...


2

The DMP data from the MPU6050 is already filtered, and while I have not expirimented with the DMP data much myself I believe it is pretty clean. If there is a calibration process you can do to improve it, that is probably worth expirimenting with, but you should not filter the values a second time. You should figure out what your application's noise ...


2

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 about the loop structure and "blocking" to "wait" for a new GPS speed report. SoftwareSerial also blocks everything else during each received character time. ...


2

How fast is your system compared to the loop() sampling time? Does (100-map((ax+10900),-1300,1300,0,1024)) change appreciably during the sub-millisecond loop()? With kI=5, an error of only 10 will saturate your 0-255 speed output in 26 iterations of loop(), potentially producing the behavior you see. If you don't have control of your sampling time, the ...


2

Let's deconstruct this down to a simple example which we can test without the MPU6050: #include <PID_v1.h> double Setpoint, Input, Output; //Specify the links and initial tuning parameters double Kp = 2, Ki = 5, Kd = 1; PID myPID(&Input, &Output, &Setpoint, Kp, Ki, Kd, DIRECT); void setup() { Setpoint = 100; //turn the PID on myPID....


2

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 its angle to the center so it doesn't overshoot. With a single PID it will either be too slow to correct or overshoot and oscillate with no "usable" range of ...


2

The ATmega32U4 pin mapping says 3.


2

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 same time so it was overloading. Posted on behalf of the OP.


2

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 MPU6050 is a 6DOF, meaning 6 Degrees Of Freedom. This means that it can detect acceleration on axis: x, y, and z and it can detect gyro angles on axis: yaw, pitch, ...


2

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. Be aware however that larger types use more RAM, and in the case of double, execute a bit slower as well.


2

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 0. Then strings were appended to that buffer using whatever functions were appropriate at that time. A pointer was kept pointing to the start of the "free" ...


2

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: dataString += String(Time0); dataString += ","; // Append the MPU6050 data to the string: dataString += String(AcX); dataString += ","; dataString += String(AcY);...


2

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: Arduino Playground I2C scanner Or this one: Nick Gammon I2C scanner If the I2C scanner halts, then there is a hardware problem with the I2C bus. It might be a ...


2

Reflow soldering is an assembly process for printed circuit boards (PCBs) in which surface-mount parts are placed on a PCB prepared with solder paste. The solder is melted by heating in a temperature-controlled oven, which then electrically connects component leads to pads on the PCB. ICs can be damaged by high temperatures/rapid changes in temperatures, ...


2

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 from MPU device signalize that data are ready (conversion was finished). So you don't have to periodically read status register to find it out (no polling is ...


2

Given that both libraries are the same. The two sketches seem to set up the motorcontroller quite differently. Changing an "input pin" and "enable pin" around, would lead to errratic motor behaviour. ``` LMotorController motorController(ENA, IN1 LMotorController motorController(inA, inB ``` To me, an input pin would be an PWM signal to drive the speed of ...


2

It's not entirely true that it does not require any calibration at all. The MPU60X0 family's triple-axis MEMS gyroscope has certain features that reduce the need for calibration. These features are, as mentioned by Juraj, and on the datasheet: Enhanced bias Sensitivity temperature stability This does not mean the sensor is 100% properly calibrated right ...


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