-
Notifications
You must be signed in to change notification settings - Fork 471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
One Question #4
Comments
It would help to know what breakout board you are using, some of the purple boards from China are nit designed correctly and will not work. |
I am assuming you tried something like the MPU9250 initiation sequence in my MPU9250/STM32F4DiscoveryBoard repo? |
Yes. I tried to proceed similar to your code. Is there any way to find that the board is correctly designed or not? |
One the two purple boards I bought pin 1 is not tied to VCC as it should be. This results in the magnetometer giving wild responses and the accel and gyro only sometimes work. In general I would say if your MPU9250 boards are purple, throw them away and get one from embeddedmasters available on the invensense web site store. |
my board is not purple and is similar to the one is selling in following link. the problem is instability of the gyro ; the values are skipping frequently in the range of -1 to +10. for example = [0.3 0 0.9 1 4 0.3 0.2 6 0.1 11 9 0.6 ... ]. also the temperature sensor return 40 degrees in a room with 25 degrees. |
The board looks OK, pin #1 seems to be attached to VCC. I don’t have experience with this particular board but the GY-521 boards with the MPU6050 I have used are just fine. The temperature could be that much higher since it is not intended as an ambient temperature sensor but an internal gyro temperature. How you set up the gyro has a lot to do with the data returned. What is the sample rate? I would suggest 200 Hz. What is the bandwidth? I would suggest 40 Hz. Did you calibrate the gyro? This shouldn’t affect the apparent jitter. If you run the gyro at a high rate and no filtering you could get a lot of jitter. From: pou2014 my board is not purple and is similar to the one is selling in following link. the problem is instability of the gyro ; the values are skipping frequently in the range of -1 to +10. for example = [0.3 0 0.9 1 4 0.3 0.2 6 0.1 11 9 0.6 ... ]. also the temperature sensor return 40 degrees in a room with 25 degrees. — |
I simultaneously reading a MPU6050 accelerometer and i do not have such a problem. Gyros work normally and the temperature sensor shows the room temperature. although there is no difference in outputs when setting the DLPF or not, but everything seems to be OK. |
There is a default clock selection, I believe, but it is always a good idea to set the gyro z-axis as the clock source. The MPU9250 uses the MPU6500 gyro/accelerometer which has a different register map than the MPU9150 and the MPU6050, which are the same except for the mag. Make sure you are using the correct register map to set your clock and everything else since an incorrect bit set can also cause problems. I haven’t seen such strange out put from the MPU9250 using my program. I wonder if there is something peculiar about the STM32F4 that is interfering with the operation of the gyro? From: pou2014 I simultaneously reading a MPU6050 accelerometer and i do not have such a problem. Gyros work normally and the temperature sensor shows the room temperature. although there is no difference in outputs when setting the DLPF or not, but everything seems to be OK. — |
I have another Question. Have been you tested any integration process on the Gyro/Acc outputs? |
I have used integration and the best way to do this is to use the FIFO to provide a common time stamp for the gyro/accel data. From: pou2014 I have another Question. Have been you tested any integration process on the Gyro/Acc outputs? — |
How to do it? Could you please explain the entire process? |
You may burst read the gyro and accel data written to the FIFO at a specified duty cycle and use the duty cycle to mark the data time. Then you have time-marked data and can perform the usual integration to get velocities and position, if you want. There are better ways to get orientation though through sensor fusion to get quaternions, etc. Relative position tracking is going to be inaccurate except for very short time due to gyro drift. Unless you have a magnetometer or GPS to help compensate for the drift you won't be able to get good position tracking for more than a few seconds. |
You mean FIFO unit of Micro? |
Yes, you can use the dt from the FIFO collection duty cycle (rate). |
thanks. |
I don't know specifically how for this processor, but most ARM processors have some sort of time elapsed utility like millis or some such, depending on the library. Internal to the processor, there are lots of ways to keep track of time. |
Hi pou2014 and Kris. if you go with the internal source, read this about the calibration not specific for the 407 but should be still suitable: http://www.st.com/st-web-ui/static/active/en/resource/technical/document/application_note/CD00221839.pdf if you want to add a crystal pay attention to the quality : higher ppm crystal will give you high drift rates. probably not important if you just want to measure the dt, more important if you will need a more precise time clock for other usages. About dt and integration: I started doing odometry experiments with imu/dead reckoning one month ago and learned 2 things:
I also have a LSM9DS0 and a BMP180 and will soon try with them. Will possibly see less noise from accel and more precision from altimeter. When you will move on to calculating the integrals you will see VERY different results depending on the dt value. You will also have to choose an integral calculation algorithm suitable for variable dt or the result will not be correct. I did read on the web many info sources about rectangular, trapezoidal and simpson integral calc methods before choosing simpson. Even if my results are currently encouraging I'm still having issues. I'm currently considering other small size micros and could probably arrive to test the F407 if i will not find another with higher sys clock. I'm trying to track my body movement using a strapdown approach like Madgwick did, but would like to avoid the shoe mounting since i would like to use this also on a bike and for some friends currently doing theatre shows in open spaces. I'm currently using 9 dof sensor fusion algorithm by Madgwick but did not find a way to merge the altimeter data in a good way. Did you find some code about this? I would be glad to share thoughts / experiences with you guys. Just drop me a line and i will do my best to reply when not busy at work. |
"I'm currently using 9 dof sensor fusion algorithm by Madgwick but did not find a way to merge the altimeter data in a good way. Did you find some code about this?" You have to use a Kalman filter to include the altimeter data in the sensor fusion. One of my team members has done this but I cannot share the code at the moment. If you or someone you know is familiar with constructing Kalman filters this addition should be straightforward. BTW, did you know that you can overclock the Teeny 3.1 to at least 168 MHz? It doesn't have a floating point engine but it is a pretty capable processor for $17 delivered! |
Hi Kris. |
If you search the Teensy forum you will see posts on overclocking Teensy 3.1. I don't think it hurts them! Position tracking is much harder than calculating absolute orientation. Errors build quickly when double integrating. I am trying to add GPS to periodically correct drift of the fused sensor data and use the fused sensor data to fill in gaps or delays in the GPS data. That is the idea. So far I am having hardware issues in the first GPS board I designed and assembled. So there is still lots to do. |
Hello mariocannistra |
i don't have a 9250 so tomorrow morning i will check the datasheet. |
I use a stm32f4 discovery board. It has 8 MHZ crystal on-board but not the RTC crestal (The Pad is exist to solder a new one) |
ok, so i suggest you leverage the blog at this url http://stm32f4-discovery.com/2014/05/all-stm32f429-libraries-at-one-place/ |
I have now tightly connected with the site. its RTC library really working but the accuracy of internal clock source is not high as the owner of site also mentioned. I use a way to test that the DT is true or not and that is testing numerical integration of one of gyro axis. I expect 90 degrees as result of integration while the IMU goes under 90 degrees of rotation about the selected axis. but neither the RTC nor the timers get true DT. |
Hello kriswiner I have also faced with another issue while trying to change acceleration FS from 2g to 4,8&16g on mpu6050 on GY-88. It doesn't change when writing 0x01 to 0x03 on accel.Config register. Is there any other changes to be done? |
Writing to the accel config register should be enough. Make sure the value is not being overwritten by some other function by checking (reading) the value before the data is read. If the integration time is changing with the full scale then this could be a scaling error since time ~ 1/gyro rate. Check that the scaling is being done properly when you change the full scale. Both of these problems should not occur with the sketches in my repository. If you find they have an error please let me know so I can fix it. Which code are you using? |
Actually I am not using your code and the problem refers to a cod of mine. However the process is similar. I don't understand your mean by FS error?! I have changed it, then I used the related sensitivity value to convert it to deg/sec and everything are working well except DT. |
Hello Kris Winer |
I have read this paper many times. I essentially copied the Madgwick algorithm from this paper and made a few integer type changes. The MARG algorithm takes gyro, accelerometer, and magnetometer input and produces an iterative estimation of the orientation as a quaternion for output. It is possible to derive the gravity vector from the accelerometer data plus the quaternion. But the gravity vector is not really an input. In any case, Madgwick's algorithm is a minimal sensor fusion solution. It will not be perfect. It gets better if there is sufficient iterations to reach an asymptotic solution. This usually means a sample data rate of 100 - 200 Hz and a sensor fusion algorithm rate of ~100 Hz, so that there is time for 4 or 5 gradient iterations for each new data sample. What the simple algorithm lacks is any hysteresis, such as would be provided by an integral correction or running average of quaternions. It does not contain a low pass or high pass filter, although some low pass filtering of the input data is usual. In other words,Madgwick's algorithm is a good place to start, but it is not a complete sensor fusion solution. |
Thank you for good explanation. When I just test the algorithm for the first time I observed nice result in x & y channels so that no integration windup occurred. But in the z channel I had windup. Is this the real performance of the algorithm or I just made a mistake somewhere? |
These algorithms are a pretty good basic sensor fusion solution for AHRS (heading) determination applicable for general use. If you are seeing windup there might be an error; I usually do not see this in my fairly gentle motion applications. There are standard ways to estimate gravity from quaternions. I don't know how off the top of my head but i would bet a goole search would quickly turn up some good references. All the hardware sensor fusion algorithms do this. |
Finally I have got to work with mpu9250 successfully. The problem was at acc & Gyro registers in my header file where determining the config register options. How ever i just had copied them from other codes. The DT also is now equal to EX. time! |
Glad you got it to work! Kris -----Original Message----- off course a lot of things may be found on the google. I jut wanted to know Reply to this email directly or view it on GitHub |
Hello kriswiner, thank you for your great work. |
I have code for the MPU9250 using the STM32F401 Nucleo board on mbed. I -----Original Message----- Hello kriswiner, thank you for your great work. Reply to this email directly or view it on GitHub |
Thanks Kris, I will take a look. |
honuoc |
I have no problem with AK... -----Original Message----- honuoc Reply to this email directly or view it on GitHub |
My problem with magnetometer is that its output value is quite small event in 16bit mode (maximum is about 300) and irregularly. If I translated the sensor without rotation the magnetometer output changed. Is it normal? |
Is that 300 mGauss? If it is 300 counts, that is rather low but this depends -----Original Message----- My problem with magnetometer is that its output value is quite small event Reply to this email directly or view it on GitHub |
The earth magnetic field is between 20 - 80 Microtesla. |
The point is that when I translated the sensor the output values of all three axes changed so much (from -50 to 50 for example). And, when I rotated the sensor around z axis, the z output also changed a lots. |
What MPU9250 breakout are you using? Have you calibrated the sensors to -----Original Message----- The point is that when I translated the sensor the output values of all Reply to this email directly or view it on GitHub |
I am using this board: I used your MPU9250.h and main.cpp code from mbed, just ported to CooCox (gcc). Btw, Accel and Gyro data are all fine. |
These boards usually work well, but not the purple ones. Have you calibrated the mag with a figure eight motion to remove the bias I really don't know why your mag is misbehaving. They are of course -----Original Message----- I am using this board: I used your MPU9250.h and main.cpp code from mbed, just ported to CooCox Reply to this email directly or view it on GitHub |
What do you mean by calibration? is it calling the function "initAK8963(magCalibration)" ? if it were, I did. |
No, it is using the function described here: -----Original Message----- What do you mean by calibration? is it calling the function Reply to this email directly or view it on GitHub |
Hello
I am working on a project; using mpu9250 on stm32f4 discovery board. I have two issues with the device and will be pleased if some one helps.
First;
I am trying to configure PWR_1 register and clock source but it does not work.
I do the following :
disabling sleep mode ; writing 0x00 to PWR_1
wait(100 ms)
choosing clock source to one of pll sources ; writing 0x02 ... 0x05 to PWR_1
after such a configuration i have still unstable gyro values and a wrong temperature value.
Second;
When using AK.. magnetometer; I have just enabled the bypass bit and them configured the magnetometer . I think that the outputs are wrong. in 14 bit mode i receive [50 30 45] for example when having 90 degrees drift from north. the outputs do not agree whit environmental facts?
if there is any idea please share with me.
thanks
The text was updated successfully, but these errors were encountered: