MPU6050
Moderator: Benj
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
MPU6050
Hi!
I have made a project with the Gyro sensor MPU6050. The X,Y,Z axis is only given some random number I try to get an average readout by sampling 10 times and divide by 10, but the number is stil some random. Please help, am I doing something wrong, please.
Work nice in simulation.
Br Jorgen
I have made a project with the Gyro sensor MPU6050. The X,Y,Z axis is only given some random number I try to get an average readout by sampling 10 times and divide by 10, but the number is stil some random. Please help, am I doing something wrong, please.
Work nice in simulation.
Br Jorgen
- Attachments
-
- Mpu6050Test Uno.fcfx
- (16.33 KiB) Downloaded 289 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: MPU6050
Hi Jorgen,
You have the gyro set to the most sensitive setting maybe turning this down in the component properties would provide better results.
When you say random numbers are you moving the sensor or is the sensor stationary and what sort of range are the numbers varying by?
There will likely be noise on the sensor so the numbers will jump around a bit even when stationary and gyros tend to drift over time so this may not be helping either.
You have the gyro set to the most sensitive setting maybe turning this down in the component properties would provide better results.
When you say random numbers are you moving the sensor or is the sensor stationary and what sort of range are the numbers varying by?
There will likely be noise on the sensor so the numbers will jump around a bit even when stationary and gyros tend to drift over time so this may not be helping either.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
Re: MPU6050
Hi Ben!
Thank´s for fast reply. I already try to adjust the sensitive Doesn´t work. I try to search on the web and I see that it need to be calibrated before use.
I made a test where I try to calibrate ( only X) but still very unstable, maybe I not do it correct.
I also test some projejct with Arduino IDE and then it is very stable
Look in serial monitor. I add a copy of the schetch in comment, not able att. the ino.
Do you have MPU6050 in your workshop? otherwise I will send you one for test, and you keep it (and maybe a little example in FC
)
Br Jorgen
Thank´s for fast reply. I already try to adjust the sensitive Doesn´t work. I try to search on the web and I see that it need to be calibrated before use.
I made a test where I try to calibrate ( only X) but still very unstable, maybe I not do it correct.
I also test some projejct with Arduino IDE and then it is very stable

Do you have MPU6050 in your workshop? otherwise I will send you one for test, and you keep it (and maybe a little example in FC

Br Jorgen
- Attachments
-
- Mpu6050Test UnoCalibrate.fcfx
- (18.56 KiB) Downloaded 310 times
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: MPU6050
Hi Jorgen,
Thanks but I think I have one here. I'll see if I can dig it out.
Thanks but I think I have one here. I'll see if I can dig it out.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
Re: MPU6050
Hi Ben!
I have done a little more research. In FC for me it look like, for me the Gyro akt like a mix of accelerometer and Gyro and as mentioned very flickering
I found this link here and testet the program with same hardware setup, and it work very nice and stable. How they have programmed and done in program, I am not able to see. maybe it could help.
https://dronebotworkshop.com/mpu-6050-l ... _Libraries
It work fine, but not created in FC as I prefer
Br Jorgen
I have done a little more research. In FC for me it look like, for me the Gyro akt like a mix of accelerometer and Gyro and as mentioned very flickering

I found this link here and testet the program with same hardware setup, and it work very nice and stable. How they have programmed and done in program, I am not able to see. maybe it could help.
https://dronebotworkshop.com/mpu-6050-l ... _Libraries
It work fine, but not created in FC as I prefer

Br Jorgen
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: MPU6050
Hi Jorgen,
I've had a dig in the office and also at home and not been able to put my hands on one yet, I'll check out the component code against some known working code and make sure there's not a problem lurking.
What value do you get returned from the initialise function. If all is well it should return 0 and we write value 0x41 to register 107 to "Switch to use X Gyro with PLL".
If the init function returns 255 then something is off and the register write is not called.
I've had a dig in the office and also at home and not been able to put my hands on one yet, I'll check out the component code against some known working code and make sure there's not a problem lurking.
What value do you get returned from the initialise function. If all is well it should return 0 and we write value 0x41 to register 107 to "Switch to use X Gyro with PLL".
If the init function returns 255 then something is off and the register write is not called.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
Re: MPU6050
Hi Ben.
have a look this evening. But anyway, a MPU6050 is on a way to you to morrow, if ok, and if you don` want to keep it after testing, throw it away
Br jorgen
have a look this evening. But anyway, a MPU6050 is on a way to you to morrow, if ok, and if you don` want to keep it after testing, throw it away


Br jorgen
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: MPU6050
Ok thanks Jorgen,
I'll add it to my collection of random hardware 
I could never do thatif ok, and if you don` want to keep it after testing, throw it away![]()


Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
Re: MPU6050
Hi Ben!
I have sent MPU6050 to you today. I have sent it as a package so we are able to track and trace.
Don't laugh at the size of this one. large envelope for the small PCB
Please let me hear when you receive it.
Br jorgen
I have sent MPU6050 to you today. I have sent it as a package so we are able to track and trace.
Don't laugh at the size of this one. large envelope for the small PCB

Please let me hear when you receive it.
Br jorgen
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
Re: MPU6050
Hi Ben!
I just inquired in the shipping department. They had overlooked my package so it's first shipped today
Hopefully you have it in few days.
Br Jorgen
I just inquired in the shipping department. They had overlooked my package so it's first shipped today

Hopefully you have it in few days.
Br Jorgen
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
Re: MPU6050
Hi again Ben!
Are you on holyday
or have you still not received the MPU6050 from me, please
Br Jorgen
Are you on holyday


Br Jorgen
- LeighM
- Matrix Staff
- Posts: 2178
- Joined: Tue Jan 17, 2012 10:07 am
- Has thanked: 481 times
- Been thanked: 699 times
Re: MPU6050
Hi Jorgen,
I can confirm it just arrived in the office, and is currently on Ben's desk.
But as we are currently each only occasionally in the office it could be a while before Ben collects and can look at it.
Thanks!
Leigh
I can confirm it just arrived in the office, and is currently on Ben's desk.
But as we are currently each only occasionally in the office it could be a while before Ben collects and can look at it.
Thanks!
Leigh
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
Re: MPU6050
Hi Leigh!
Thank you for reply. Well ok. Of course if he is busy I May have patience, I wait
Send a regard.
Br Jorgen
Thank you for reply. Well ok. Of course if he is busy I May have patience, I wait

Send a regard.
Br Jorgen
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: MPU6050
Hi Jorgen,
Sorry I have had a weeks holiday for my little man's birthday and it arrived during that time. I'm back in the office today or tomorrow so will pick it up and see what I can make of it.
Sorry I have had a weeks holiday for my little man's birthday and it arrived during that time. I'm back in the office today or tomorrow so will pick it up and see what I can make of it.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
Re: MPU6050
Hi Ben!
Congratulations to the little guy.
No sorry at all
Ben no hurry at all. I have time to wait. only when you can. I only want to be sure you get the parcel, and you have
Br Jorgen
Congratulations to the little guy.
No sorry at all

Ben no hurry at all. I have time to wait. only when you can. I only want to be sure you get the parcel, and you have



Br Jorgen
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: MPU6050
Hi Jorgen,
Right I've plugged in the MPU6050 and it seems to be working ok for me.
I couldn't get my Arduino board working, I think I may have killed it previously so I'll try and pick one up next time I'm in the office again.
However using a dsPIC I was able to get it working and the readings seem fairly stable using your program with a few tweaks to show min and max readings.
The Ranges I am getting with the module running for a few minutes are approx.
X = -71 to -58
Y = 15 to 30
Z = -40 to -26
I've being very careful not to move the module, I even turned off my music while taking the readings just in case this introduced vibration.
Have a go and see what ranges you are getting so I know what sort of readings we are dealing with.
Right I've plugged in the MPU6050 and it seems to be working ok for me.
I couldn't get my Arduino board working, I think I may have killed it previously so I'll try and pick one up next time I'm in the office again.
However using a dsPIC I was able to get it working and the readings seem fairly stable using your program with a few tweaks to show min and max readings.
The Ranges I am getting with the module running for a few minutes are approx.
X = -71 to -58
Y = 15 to 30
Z = -40 to -26
I've being very careful not to move the module, I even turned off my music while taking the readings just in case this introduced vibration.
Have a go and see what ranges you are getting so I know what sort of readings we are dealing with.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
Re: MPU6050
Wow Ben. First see your reply now. Unfortunaly I am not able to test now, first in the weekend.
First I test with an EICO, then I Will try to change your program to Mega and see what happend.
For your always kindness, I am willing to send you a Mega2560

Thank`s, you hear from me.
By the way, how do we give thump up in the new system?
Br jorgen
First I test with an EICO, then I Will try to change your program to Mega and see what happend.
For your always kindness, I am willing to send you a Mega2560


Thank`s, you hear from me.
By the way, how do we give thump up in the new system?
Br jorgen
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
Re: MPU6050
Hi Ben!
Ready for testing your program. But suddently I am not able to program the Eico?
First I try directly from Fc8, you know compiling and press te reset.
After that I try direct from Mloader. Mloader can see the device, but when I press send it can´t see the USB? And I can´t se the USB in devicemanager.
I try to install the USB driver again for Eico, but still no luck
Br Jorgen
Ready for testing your program. But suddently I am not able to program the Eico?
First I try directly from Fc8, you know compiling and press te reset.
After that I try direct from Mloader. Mloader can see the device, but when I press send it can´t see the USB? And I can´t se the USB in devicemanager.
I try to install the USB driver again for Eico, but still no luck

Br Jorgen
- Attachments
-
- EicoUsb.PNG (238.07 KiB) Viewed 12317 times
-
- Eico40.PNG (127.09 KiB) Viewed 12317 times
-
- Posts: 52
- Joined: Fri Apr 07, 2017 1:55 am
- Location: Greece
- Has thanked: 16 times
- Been thanked: 14 times
Re: MPU6050
Hi Jorgen,
Go into windows settings, then devices, find your device and uninstall it.
Unplug your device and replug it.
Let windows reinstall the drivers.
Now check if you can use your device within FC8.
I had problems programming my EB091 last night and as I was about to post into the bugs section, I did the above and my board worked again.

George
Go into windows settings, then devices, find your device and uninstall it.
Unplug your device and replug it.
Let windows reinstall the drivers.
Now check if you can use your device within FC8.
I had problems programming my EB091 last night and as I was about to post into the bugs section, I did the above and my board worked again.

George
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
Re: MPU6050
Hi George!
Thank you. Do you mean in devicemanager or where please?. I cant see it anywhere
Br jorgen
Thank you. Do you mean in devicemanager or where please?. I cant see it anywhere
Br jorgen
-
- Posts: 52
- Joined: Fri Apr 07, 2017 1:55 am
- Location: Greece
- Has thanked: 16 times
- Been thanked: 14 times
Re: MPU6050
yes in your windows device manager.
when you connect your module to your pc, can you hear the usb connected windows sound?
have FC8 and mloader closed before you do that.
If your module connects to your pc you should be able to find it in the windows device manager and when you do, right click and uninstall device.
then unplug from pc and reconnect, let windows install the driver again.
but if your module does not connect to windows as a usb device then Ben could help (corrupted bootloader maybe?)
George
when you connect your module to your pc, can you hear the usb connected windows sound?
have FC8 and mloader closed before you do that.
If your module connects to your pc you should be able to find it in the windows device manager and when you do, right click and uninstall device.
then unplug from pc and reconnect, let windows install the driver again.
but if your module does not connect to windows as a usb device then Ben could help (corrupted bootloader maybe?)
George
-
- Posts: 1333
- Joined: Tue Oct 06, 2009 9:39 am
- Has thanked: 1135 times
- Been thanked: 299 times
Re: MPU6050
Thank´s George. But from the start I wrote I cannot see the USB in the devicemanager, so it´s not easy to uninstall it
Br Jorgen

Br Jorgen