Build an Electronic Level with MPU-6050 and Arduino
ฝัง
- เผยแพร่เมื่อ 24 เม.ย. 2024
- Today we will be working with the MPU-6050 IMU, and we will use it to build an electronic level with an Arduino.
Article with libraries and code - dronebotworkshop.com/mpu-6050...
More articles and tutorials: dronebotworkshop.com
Join the conversation on the forum: forum.dronebotworkshop.com
Subscribe to the newsletter and stay in touch: dronebotworkshop.com/subscribe/
Today we will be working with the MPU-6050, a low-cost Inertial Measurement Unit, or IMU. This device has a lot of different applications in many fields including robotics, gaming, quadcopters, and IoT devices.
The MPU-6050 has an internal gyroscope and accelerometer. It's an inexpensive device, available in several packages and modules. The module I am using is very common and has a built-0in voltage regulator so it can work with 5-volt logic.
We will start by looking at the MPU-6050 internals, as well as at the pinout of the module I am using.
Next, we will load a couple of libraries into our Arduino IDE and ruins some sample code to display Pitch, Yaw, and Roll.
After that, we will build a small project, an electronic level. Our level will display on an LCD and will also use 5 LEDs to give a good visual indication of how level the surface is.
Here are the contents for today's video:
00:00 - Introduction
02:53 - MPU-6050 Intro
11:20 - MPU-6050 Arduino Experiments
20:29 - Electronic Level
You can get the sketch and the two libraries used in the experiments on the DroneBot Workshop website.
Hope you enjoy the video! - แนวปฏิบัติและการใช้ชีวิต
HOLLY SMOLLY!
Bill ---> Professor of the Year Award from me!
I'm not kidding! I've had professors in college who weren't anywhere near as good as you Bill.
History lessons:
In-depth mathematics lesson on Quarternions.
Does all the homework for us finding libraries etc.
College Level programming explained in-depth.
Unbelievable concise and even animated Schematic Graphics
Live in-lab demonstration of the final results.
LCD digital readout and an LED graphic display to boot!
And if all that isn't already above and beyond the call of duty,... A link to a full web page complete with the same lesson all typed out with graphics, links, and code!
Unbelievable! There's just no other word to describe this.
You are a Younique TH-camr Bill. To be sure!
yes! but subs don't say that 😢😢😢
youLamewhlteboi
Thanks for another great tutorial. Excellent pun at 7:56 -- " ... the MPU6050 that IMUsing ... "
I have been watching quite a bit of DroneBot's videos these past few weeks and this one is by far for me the most inspiring! I have to thank whomever it was that suggested the MPU-6050 sensor as a focus, as well as DroneBot of course. His videos are always great. I have a good feeling about where the wheels in my mind are rolling to now!
you Iamewhlteboi
What an excellent teacher you are sir. You really are superb at putting information across in a very clear and measured manner. Keep up the good work!
you Iamewhlteboi
An eye opener to the device.
Thanks
Greetings from Tanzania 🇹🇿
you black?????
@@atlnlgga4568 , if you’re asking whether I’m black, as of black matter; yes I’m black , native African from Tanzania 🇹🇿.
Otherwise, I didn't get your question dude, uliza tena tafadhali
This is another great video from the Dronebot Workshop! I'm looking forward to experimenting with the MPU-6050 after having enjoyed watching this clip.
you Iamewhlteboi
This was something I had been googling for, and I found a full explanation, thanks for your work, it seems selfless, we are grateful
An exquisite source; so well done. Thank Bill so much for your dedication to electronic experiments.
you Iamewhlteboi
Fantastic, I was looking for something I could use for an automatic leveling system on a camper van and I think this will be perfect, thanks.
youLamewhlteboi
This channel is inspiring so many ideas. Another device to be added to an upcoming project.
you Iamewhlteboi
I can not thank you enough for all these projects you make easy to understand keep on doing amazing work :)
you Iamewhlteboi
Your explanations are very welcome and clear. We only had to change the LCD adress to let the code provided for the level work.
you Iamewhlteboi
Thanks for the regular videos and the education they provide. Keep up the great work.
Absolute genius! Trying to adapt for a different use and the roll is changing way too slowly (unlike the pitch which is spot on). In the vid it responds instantly!
YouLAMEwhlteboi
Because of wonderful creators like you, I am able to learn and grow so much! Thank you!
You are so welcome!
Thank you very much for the wonderful video and for providing the libraries that work! You have been of great help to complete my Arduino projects. :)
you Iamewhlteboi
Thank you for the perfect demonstrations. I would be grateful for the ATtiny microprocessor projects.
you Iamewhlteboi
Thanks for this Bill, been waiting for this!
youIameazz whlteboi
thank you for another great video Bill. If I might say it would have been nice had you shown how to install the libraries in the ide.
you Iamewhlteboi
Thanks Sir for this video. I cannot emphasise how much this video helped me. Please keep coming with such videos.🥰
Really enjoyed this video. I've never this type sensor before. Thanks.
you Iamewhlteboi
Always great informative videos and excellent content and very thorough. I look forward to every one.
you Iamewhlteboi
Thank you very much for the best arduino tutorial ever!
Greetings from IRAN
youIameazz whlteboi
Really cool. I have had one of the 9DOF sensors in my drawer for several years, only tried playing with it a couple of times, didn't find it all that exciting since I am not into drones. Now, however I can see where it may be very handy in my RV for leveling her. The built in sensors are so slow that getting the old gal level enough for both walking and the operation of the frige are essential. I currently use an old spirit level and my wife telling me which way to go with the hydrolic levelers, but this would make life for both of us much easier and lest chaotic when we move to a new site. That is if we can ever get on the road again with this damn virus crap.
YouLAMEwhlteboi
Very good explained. Thanks for the helpful tutorial!
As usual , a fantastic video. I cannot thank you enough .
As always, great and comprehensive video.
YouLAMEwhlteboi
Thanks for helping get through Uni.
youIame whlteboi
18:34 The YPR angles drifted like crazy when the IMU sat still… you need to double check the code to see if there’s any compensation or filtering built in…
egads.. I came late to class... I have an mpu-6050 but have not yet had a chance to play with it.. Now I have some great ideas.. thanks Bill.. I don't worry about my ssd because I can't get anything to work on windows 3.1 any more... keep smile Billiam.. life is good... thanks for the share and please carry on.. till thursday!
youIame whlteboi
@@atlnlgga4568 Thanks!
Hey, thanks, you are great, your workshop is great, your videos are great .
I wish I could drink a cup of coffee with you in your workshop and poke around.
youIame azz whlteboi
Great video as always.Thanks for sharing.
YouLAMEwhlteboi
This is really great stuff! Thanks a bunch.
you Iamewhlteboi
@@atlnlgga4568 watch it, boy
Nicely explaind! Especially the graphics!!
you Iamewhlteboi
As usual highly professional and pragmatic delivery
YouLAMEwhlteboi
So professional ! Bravo !!!
you Iamewhlteboi
Thank you for making these awesome videos.
YouLAMEwhlteboi
Exactly what I was looking for. Thanks. I would like you to think about the thermometer for extreme conditions like sauna.
Take note what Bill said in this video; only accept request from News Letter subscribers.
you Iamewhlteboi
The way you explain this stuff is really awesome! Make More videos please.subscribed to channel and news letter
you Iamewhlteboi
Thank you very much sir for making the video that I requested for.
YouLAMEwhlteboi
I really enjoy your videos, I appreciated the effort that you put into them.
How do you use the XCL, XDA and INT pins ? I have address conflicts.
youLamewhlteboi
You're awesome. Thank you!
youIame whlteboi
actually the I2C12 zip file is not on your website instead it is the zip file with the aurduino code for the level
especially thank you for thr explanation of degrees of freedom ... I did not understand 6 (9) dof
I am glad I found this channel.
youIameazz whlteboi
Thank god I found this. Just discovered a new hobby!
youIameass whlteboi
Thank you.
- Subscribed.
youIameazz whlteboi
BEST Arduino professor.
youLAMEazz whlteboi
Thank you sir this was very helpful!
you Iamewhlteboi
Excellent video, as per (how soon we take perferection for granted). Am I correct in assuming that the initial calibration should be done on a levelled surface. As this will be the "zero" attitude for all future calculations?
you can do the initial calibration while not being on a leveled surface. You can use the accelerometer values for the calibration of the gyro to "tell" it in what position it is in.
you Iamewhlteboi
Incredibly helpful.
YouLAMEwhlteboi
Your channel is indispensable.
youIame whlteboi
Very interesting and helpful Video, Thanks a lot for such valuable information
youLAME whlteboi
great explanation. you are a hero!
YouLAMEASSwhlteboi
Beautiful ! Thanks much.
In other cases using my drone, cellphone, etc I have to move it in a figure 8 etc to calibrate its initial position. Does that 1000 reads at the beginning do that ? Thanks again.
That method will get you a rough approximation. Try MPU6050_tockn - Arduino library for easy communicating with the MPU6050: github.com/Tockn/MPU6050_tockn
YouLAMEwhlteboi
Superb! Video. Thank you so much!!!
awesome…you are 1000x better than my lecturers…full respect from me 💋
you Iamewhlteboi
Thank you so Much. A very very useful video .
It's the best lecture ever.
There is something I want to do.
I want to get more than 3 mpu6050s connected to one Arduino Uno.
I'm a novice at Arduino.
you Iamewhlteboi
This build is perfectly balanced. As all things should be.
youIame whlteboi
Love this project
Useful and very good video 👍
YouLAMEwhlteboi
Nice video and gave me an idea to build an joystick that does not rely on potentio meters but can use the gyro.
just to see if I get better and finer results compared to a analog joystick
youIame whlteboi
When the MPU is first initialized and calibrated on a level surface are the results stable or do they drift over time? If there is drift how often would the lever require a reset?
what did you use to mount the MPU6050 to the wood? I keep having difficulties with the MPU6050 connection failing or turning off due to the pins not making proper contact with the holes of the MPU6050, any ideas on how to help maintain this connection? I see that your MPU6050 never turns off even when you turn it many which ways. Thanks in advance!
Very Useful for me as I am trying to build an rc airplane flight controller/stabilizer.
Greetings from Greece. Grate video
Happy New Year!!!
I have been wanting to use one on an RC Submarine for automatic leveling.
I use it more for the Temperature Sensor feature
Hi Bill, i'm new to your channel... but loving so far! I've been playing around with the 6050 for a while.... I've just tried running through your tutorial (instructions are clean and easy to follow) but cannot seem to get much accuracy out of the level ----- i.e. the indicated angles are off compared to actual. I'm not sure if i'm doing anything wrong (ambient temperature is around 20c)? Do you think temperature is playing a part here? Is there any simple way we can incorporate temperature compensation? ----- THANKS AGAIN! LOVE YOUR STUFF!
I've been playing with this chip and in some other libraries there are calibration procedures. Apparently each chip is unique and has to be calibrated to get it to be precise.
you Iamewhlteboi
I Love your video The why u explain huge Fann Sir Love From Pakistan
Cool label - "well balanced workshop!"
youIame whlteboi
nice but as you only lit one LED at a time, you could save 4 resistors and only put one on the common ground wire of the LEDs ;-)
YouLAMEwhlteboi
The man is just sooo good
youIameazz whlteboi
Always great videos; I actually listen to them on my long drive to and from work.
I tried the accelerometer, btw, and it is giving me readings of x:10.63 (roughly), y: -0.43, and Z: -1.16 m/s^2 Any ideas why this is the reading when it is sitting still on my desk next to me?
you Iamewhlteboi
Well done !
Can RS485 be used to communicate? If so how can it be configured
Hey @DroneBot Workshop, can this device give live update of coordinates of accelerometer? Like every second?
Hi! How long could be the cable from the "UNO" to the sensor, in other words, how far away could be the sensor from the controller?
Thank you!
Would you explain it to me why you didn't use pull up resistors and the i2c pins on right top (18 and 19)?
Thanks for the explanatory video.
I think that the gy-521 module has inbuilt pull-up resistors.
Excellent video ! Thnxs for sharing ! A question... what video editing software do you use ?
you Iamewhlteboi
As much as I liked this video, I think I'll keep to the Level App of my iPhone :) Also, many new articles have come out about staying *AWAY* from SSD drives. It's scary!
youIame whlteboi
nice work shop
Well BALANCED episode
youLAMEazz whlteboi
i spent like four days trying to manually communicate via I2C and interpret the IMU + gyro myself (and failed)
thanks for pointing out these libraries
Thank you very much✌✌🌷🌷🌷🌷
Please do not forget the XOD. It would be interesting and useful. Nobody make a tutorial for XOD, but you. Thanks a lot.
YouLAMEwhlteboi
It occurred to me that this video may be quite useful for the amateur rocket-building community due to the gyro & accelerometer information.
you Iamewhlteboi
really very good explain i have one question i want to control a moving platform its having 4 wheels connected with
If that's a question, you need to be more specific. What is this "4 wheeled moving platform" supposed to do? Why do you need an IMU for it?
YouLAMEwhlteboi
Great job 👍👍👍
youIame azz whlteboi
Great video Bill. At 20:35 you suggest we could use a 16mHz Pro Mini. Could a 3.3v 8mHz Pro Mini be used? (kinda new at this)
YouLAMEwhlteboi
Great video. I have one of my MPU-6050's mounted on a breadboard and started the example in the library but the numbers are drifting quiet a lot with the non-moving module? Today i maybe try it with an other MPU-6050.
mine is drifting as well, did you ever find a fix for this?
Essentially, the small amount of error in the measurements adds up over time, creating this large drift from reality. Some math can be used to get more accurate results, but I'm pretty sure a magnetometer is needed to reduce the drift significantly. I'd suggest the IMU tutorial series on TH-cam by Paul McWhorter for a very detailed explanation.
@@MattyMacNJ Read my above comment^ Also I think a magnetometer can be connected to the MPU6050's digital motion processor if need be
@@mattn.8941 okay awesome thanks so much I'll look into it!
YouLAMEwhlteboi
Very good!
This is sooo cool! Could we extend this idea to make a three axis camera gimbal? Maybe add some servos?
youLAMEwhlteboi
THANKS
Hi Bill, can i calculate speed using this i cant seem to find photoelectric sensors where i am
how do you handle drift though? I've found these have a bad tendency to lose their position very quickly, even when not in motion.
Thank you