Hey Scott, another way of reducing noise is to use all three axes simultaneously in your calculations. If you use the angles between the values you reduce your nose significantly, and get a now accurate reading overall. If you combine that with the 9250 chip you would get virtually zero noise in the calculation. Loved the project!
A couple quick modifications that would've made this better: -Adding Kalman filter, to use the gyro as well, in order to cancel out the shaking noise. -An offset zeroing button that zero'ed the level, allowing for relative leveling. Great video tho!
Excellent. A zero button. So you can lay it down next to a reference level. Once a perfect level is known, press the button. Need a way to store the setting. SD card? Hmmm.. was that 28 hours with or without the display? How long can the level stay powered without the display on? Maybe put it to sleep. A way to get that jumping around on the data stream to even out would be to write code to continuously average out a sample section, take 1000 measurements (size?) into an array, average and update display. You could then write two of these functions with two arrays and overlap at the half way point so there are never discernible starts and stops. And write a bargraph routine to display an actual line the moves back and forth instead of numbers. Add a button to toggle between the options. Sound - a little beep when it centers would be helpful when the level is overhead and the display can't be seen. Great build - and thanks for the work you put in on it to share whit everyone!
You are the most person I have ever seen in my life who can control his information with practical application .... You are wonderful I am studying the mechatronic geometry
Bubble levels are pretty cool when you think of it. You can even get high precision bubble levels that show you an error of 0.01mm/m! That's just ridiculously accurate
A quick way to improve accuracy is to use all three axis in the tilt calculation. Some MEMS accelerometer manufactures have white papers on such topics. You will find errors once the tilt exceeds 45° or more if only one axis is used. ST application note - AN4509 will provide more info.
Thanks a lot for your videos. I like how your speak English because very easy to understand. Your videos are very clear and bring me lot of knowledge. It's a treasure!
You did a small angle approximation. To really get an angle from the accelerations you need an atan2 function. Division works only for angles close to zero.
Gotbread Actually, he did not the small angle approximation, but the interpolation of the full range of accelerometer unto -90 to 90 degrees range. For small angles it will get greater values than should be.
This was a really cool project! It would also be interesting to see a two-axis digital spirit level, much like the spirit level app built in to many smartphones
Very inspirational! A cheap small laser can be added easy as a power source is in the enclosure . The system can also switch itself off after not moving for some time.
Moin, Super Video! Vielen Dank für die ausführlichen Erklärungen mit einen Blick in das Datenblatt. Ich finde deinen Anspruch, etwas nicht nur zu verwenden sondern auch verstanden zu haben, super! Hatte auch Probleme mit manchen ICs, da nicht alle eine Gyro-Funktion haben. Viele sind reine Beschleunigungssensoren, welche zwar auch den Winkel messen können aber eigentlich dafür nicht gedacht sind - so wie bei diesem Projekt. Wäre wirklich sehr interessant! Vielen Dank und weiter so! :D
You could smooth out the output out. Also you could dynamically change smoothing strength. Fast changes, mostly in one direction -> minimal smoothing to decrease lag Small, oscillating changes -> stronger smoothing for easier reading
Yeah, there's a lot of potential error to be had in the mounting, but you could always do a slow manual calibration with some tissue paper shims. It could also probably do well with all the readings over 100-500 milliseconds constantly averaged. Easy code, easy tune, and the output is so much more aesthetically pleasing than taking the real time data to the eyes.
GreatScott! I would recomend a possible darker pitch than the microkorg, but the size of it is super. Thanks for the arduino motivatin and awesome vids
I said it once and I'll say it again. Next = ((Previous * MixFactor) + Sample * (1.0 - MixFactor)) / 2.0; Previous = Next; With MixFactor between 0 and 1 you can slew or really average as many previous values as you want, each new value's influence decreases with each iteration.
Add a calibration feature where you place it on a surface to measure it one way then turn it around to measure it the other way. Then utilize averaging to give yourself a more stable reading. I like it.
Awesome project! You should be putting these projects on a PCB that your fans can buy from your sponsor. Getting rid of all the lead wires and some ground shielding might even get rid of some of the noise.
You need to calibrate it as the accelerometer may be at an angle to the bottom of the level. I would glue on carbide feet too that way you can lap them flat.
Wait a minute, am I missing someting?.. Isn't gyro much more suitable for what you are trying to achieve (measure the angle relative to the "down" - the pull of gravity, in this case) instead of accelerometer?
If you added a pushbutton and code to make a tare function, that would sort out any issues with warping or uneven mounting of the Accel board. Toss in a couple lasers and you would have a really kickass laser level.
I tried your JLCPCB recommendation ... Really cheap ... *except* shipping ! 10 x 1"x2" PCBs = $2 + Shipping to the UK = $24 !! :-) The maths doesn't work. Great videos though ! :-)
Hallo, kannst du vielleicht mal ein Oszilloskop Tutorial machen? Deine Messungen sehen immer so clean aus. Und eventuell die ganzen Funktionen erklären wie zB Dc Kopplung usw. Wie man richtig triggert. Und wie man z.B die Ladung eines Kondensators aufzeichnet. Würde mich freuen!
How about a tutorial about encoders and decoders .. or make a homemade voltage display? Really appreciate your videos specially for aspiring Electrical engineer like me...
great tutorial! :) I have completed a similar project, a car accelerometer but the problem in my case is if there is vehicle roll it picks it up and displays different lateral g force than real, a bit lower. I’ve used the mpu6050 and with a moving average it filters vibrations very well, basically even with engine vibrations or if you tap it, it would keep to zero obviously the “trade off” is slow reaction time but this is in fact very convenient as you can’t read a display that changes the values too quickly. so the fix for the tilt would be a gyro but it seems a lot more complex 🤔
How useful! I was thinking about adding a gyroscope to my clock project to set the time by tilting it. You could also add a VL53L0X laser rangefinder to this project to measure small distances very accurately.
as this project only uses i2c, you could swap the arduino with an attiny to make it even cheaper and more compact. or add an esp8266 to make a wifi enabled spirit level
With a bit more accurate and stable reading, it could be easily converted to a digital protractor (Few switches for unit selection, zero, 3d angular reading, angle registration and slight code additions of course). Waiting for the gyroscope part ;)
You could have utilized the integrated sleepmode the accelerometer comes with. Then you could have put the arduino to sleep and use the accelerometer as an interrupt to wake it up. i think that would caused it to consume considerable less than 1mA when its in standby, might be able to remove the switch at that point. you could just put it in the shelf at that point and use it like you'd use a normal level without turning it on and you probably only have to charge it once in a month or two. Just a suggestion.
I actually have been using the 6050 to do some motion capture, using a library that taps into getting raw quaternion data from the chips that it generates itself with its own corrections. Using that, I've found the accelerator data to be very accurate and only start to drift after 20 hours of operation with no movement (yes, when I leave them on by mistake). That being said, I may have to order a handful of the 9250s and see how much better they work.
Well here's another one: The chips can only have 2 IDs, which I don't remember right off the top of my head. However, it can be adjusted by setting a pin high or low. A way around the need of an IC Multiplexer is to just have all set to low and set the one you want to grab data from to high. When in the internal calculation mode, it will cry about an overflow issue, but if you set it to flush the data and wait on the next incoming message, it will be nice and clean. Set it to low and go to the next with high. Rinse and repeat. Granted, I'm using an ATMega 2560 to do it (extra I/O pins), but if you used a bit-shift register, I'm sure it'd work just the same.
Great build! I've tried many digital levels and none of them are as accurate as a bubble level. Off topic but the size of the bubble in that Stabila level was truly disappointing. It needs a larger bubble to be able to read between the lines without guessing if it's in the middle or off to one side.
I am currently working with the MPU9250 for Jugend Forscht. I actually wrote a library for it because the internet library are pieces of shit that a) don't allow me to use the FIFO, making it impossible to capture data at 200Hz while writing to an SD card, b) don't allow me to include external sensor with the I2C_SLV.. while c) taking up space and memory to support features I don't need like Wake On Motion. The library seems adequate for your use cases, though.
What would it take to develop a 3-axis accelerometer that can save data, and including power supply can fit within an area 28x24x131mm? I'd like to mount one inside a model railway container wagon load, to record and then provide data on gradients and curve banking.
A solution for ur inaccuracies problems is maybe to calibrate ur digital spirit level once with a air bubble one, and so on remove the inaccuracie with calcuting on the Arduino ?
if you reset the board or... switch on the board at an angle, the MPU-6050 takes that as the reference angle(that is Pitch = yaw = roll =0). For example, if I switch on at an angle of 45, it would display "0", and it will show the difference from that angle. How did you avoid this? Please help me with this.
Awesome use of a accelerometer! How about making two wheeled self balancing robot with such accelerometer and gyroscope?? I think everyone would love to see you make it? Love your vids!! :)
*insert Rick and Morty reference*
Finally someone got it. Congrats!
I was thinking of that clip this whole time! XD
Reality is poison
Lambs to the cosmic slaughter!
was thinking the same after 5 sec
Not going to lie GreatScott. At first glance of the title I thought you were going to be turning into one of those nutty ghost hunters.
NEVER!
Lol
GreatScott! Try IOT projects next time it's trending now
GreatScott! I don't know why this man doesn't have 1M subscribers 🤨😔
He's only 255K away from it!
Got to love those $1.50 ebay Nano clones.
Why are they so bad? They work just fine 99% of the time.
Hey Scott, another way of reducing noise is to use all three axes simultaneously in your calculations. If you use the angles between the values you reduce your nose significantly, and get a now accurate reading overall. If you combine that with the 9250 chip you would get virtually zero noise in the calculation. Loved the project!
A couple quick modifications that would've made this better:
-Adding Kalman filter, to use the gyro as well, in order to cancel out the shaking noise.
-An offset zeroing button that zero'ed the level, allowing for relative leveling.
Great video tho!
Good ideas
Do you have some good resources for learning how a kalman filter works?
Dr Webius Internata Shall help you
Excellent.
A zero button. So you can lay it down next to a reference level. Once a perfect level is known, press the button. Need a way to store the setting. SD card? Hmmm.. was that 28 hours with or without the display? How long can the level stay powered without the display on? Maybe put it to sleep.
A way to get that jumping around on the data stream to even out would be to write code to continuously average out a sample section, take 1000 measurements (size?) into an array, average and update display. You could then write two of these functions with two arrays and overlap at the half way point so there are never discernible starts and stops.
And write a bargraph routine to display an actual line the moves back and forth instead of numbers. Add a button to toggle between the options.
Sound - a little beep when it centers would be helpful when the level is overhead and the display can't be seen.
Great build - and thanks for the work you put in on it to share whit everyone!
Oops - someone said the zero button thing.. But with a different reasoning for it. I like motherjoon's idea better. But same concept.
You are the most person I have ever seen in my life who can control his information with practical application .... You are wonderful
I am studying the mechatronic geometry
Bubble levels are pretty cool when you think of it. You can even get high precision bubble levels that show you an error of 0.01mm/m! That's just ridiculously accurate
A quick way to improve accuracy is to use all three axis in the tilt calculation. Some MEMS accelerometer manufactures have white papers on such topics. You will find errors once the tilt exceeds 45° or more if only one axis is used.
ST application note - AN4509 will provide more info.
Thanks a lot for your videos. I like how your speak English because very easy to understand. Your videos are very clear and bring me lot of knowledge. It's a treasure!
I like how he says "air bubble" xD
Hey says like 'aia pubble' 😀
German accent is really fine and "clean"
die ai babl
Ron Albert Ramos I hear 'hyperbole'
You did a small angle approximation. To really get an angle from the accelerations you need an atan2 function. Division works only for angles close to zero.
Gotbread Actually, he did not the small angle approximation, but the interpolation of the full range of accelerometer unto -90 to 90 degrees range. For small angles it will get greater values than should be.
Keine schlechte Idee. Ich wusste nicht mal, dass eine Wasserwaage im englischen spirit level heißt. Vielen Dank für das schöne Video!
Hi Greatscott ! Love your video !
I've never been able to read the right Z angle using your code, but x and y are perfect !
This was a really cool project! It would also be interesting to see a two-axis digital spirit level, much like the spirit level app built in to many smartphones
Finally projects we can make and understand. Thanks! Great video.
ves mogoc kje kodo dobit
Na Patreonu ma mnda.
I like the bubble ones. They just work, even without power. They are just perfect. :D
Amazing. Very good intro for those of us who are way behind in our skills.
northshorepx patreon?
"5 hour ago" I think yes
yeah. why?
northshorepx you wrote a comment before the video was out (for non patreons)
Thank you for supporting him ;P
I cannot do it :(
*AFROTECHMODS AND YOU MAKE THE BEST ELECTRONICS VIDEOS IN THE WORLD. ECLECTROBOOM COMES NEXT WITH HIS FUNNY EXPLODING VIDEOS.*
So glad you upload a new video.. they always cheer me up...
Great job as always. The quality of your videos are at a solid A++! Keep it up!
Could you do a video on industrial PCB manufacturing?
Maybe a direct collab video with JLCPCP?
Very interesting video by the way
Definitely possible
Very inspirational!
A cheap small laser can be added easy as a power source is in the enclosure .
The system can also switch itself off after not moving for some time.
Stabila! The finest German made levels out there
Moin,
Super Video! Vielen Dank für die ausführlichen Erklärungen mit einen Blick in das Datenblatt. Ich finde deinen Anspruch, etwas nicht nur zu verwenden sondern auch verstanden zu haben, super!
Hatte auch Probleme mit manchen ICs, da nicht alle eine Gyro-Funktion haben. Viele sind reine Beschleunigungssensoren, welche zwar auch den Winkel messen können aber eigentlich dafür nicht gedacht sind - so wie bei diesem Projekt. Wäre wirklich sehr interessant! Vielen Dank und weiter so! :D
You could smooth out the output out. Also you could dynamically change smoothing strength.
Fast changes, mostly in one direction -> minimal smoothing to decrease lag
Small, oscillating changes -> stronger smoothing for easier reading
This is kind of what I wanted and it is 3D printed, which is the reason I am here for klipper
I'm familiar with the "Buble" Morty, I also dabble in precision!
Watching you rub the highlighter across the paper gives me a unpleasant shivers like nails down a chalkboard.
Yeah, there's a lot of potential error to be had in the mounting, but you could always do a slow manual calibration with some tissue paper shims. It could also probably do well with all the readings over 100-500 milliseconds constantly averaged. Easy code, easy tune, and the output is so much more aesthetically pleasing than taking the real time data to the eyes.
You could calibrate the digital level on a known level surface and coding in an offset to the Y axis
I like the concept f the "abable"
Beautiful and extremely practical design.
Hey greatscott, a good project that you could build is a simple synthesizer. Some good ones are the ones on mfos
A simple synthesizer is on my to do list.
That would be really cool
The Alien screamer from MFOS would be a good one to build
GreatScott! I would recomend a possible darker pitch than the microkorg, but the size of it is super.
Thanks for the arduino motivatin and awesome vids
Awesome. Think I'll be making a version of this as soon as my accelerometer arrives.
Oh, just built this like 4 days ago... You could also get bigger display and display half-second average and raw data
I just use my iPhone's Compass app in the level mode (swipe left). Easy peasy lemon squeezy! Interesting tutorial anyways.
Pretty cool. I would like to see you expanding on this and show us improved versions. :)
You could put a row of leds either side of the display and the further from level it is the more leds light up on that sight.
I said it once and I'll say it again. Next = ((Previous * MixFactor) + Sample * (1.0 - MixFactor)) / 2.0; Previous = Next; With MixFactor between 0 and 1 you can slew or really average as many previous values as you want, each new value's influence decreases with each iteration.
Add a calibration feature where you place it on a surface to measure it one way then turn it around to measure it the other way. Then utilize averaging to give yourself a more stable reading. I like it.
Awesome project! You should be putting these projects on a PCB that your fans can buy from your sponsor. Getting rid of all the lead wires and some ground shielding might even get rid of some of the noise.
Might be a good idea for the future.
You need to calibrate it as the accelerometer may be at an angle to the bottom of the level. I would glue on carbide feet too that way you can lap them flat.
Wait a minute, am I missing someting?.. Isn't gyro much more suitable for what you are trying to achieve (measure the angle relative to the "down" - the pull of gravity, in this case) instead of accelerometer?
You should redo this using Murata inclinometers. The precision is very high.
If you added a pushbutton and code to make a tare function, that would sort out any issues with warping or uneven mounting of the Accel board. Toss in a couple lasers and you would have a really kickass laser level.
You should connect to the board while in the case and zero the angle again. Similar to using Tare on a scale when baking.
I tried your JLCPCB recommendation ... Really cheap ... *except* shipping ! 10 x 1"x2" PCBs = $2 + Shipping to the UK = $24 !! :-) The maths doesn't work. Great videos though ! :-)
The MCU 6050 has a Digital Motion Computer, you need another library to access it, it solves the noise problems, I'm using it for a quadcopter.
Hallo, kannst du vielleicht mal ein Oszilloskop Tutorial machen? Deine Messungen sehen immer so clean aus. Und eventuell die ganzen Funktionen erklären wie zB Dc Kopplung usw. Wie man richtig triggert. Und wie man z.B die Ladung eines Kondensators aufzeichnet. Würde mich freuen!
I hope you took in consideration that the y component of the force is actually proportional to the sin of the angle.
please make a video on inductive tachometer for motorcycles or similar applications....
You should create "Digital Creativity Level indicator". Right now it would show big numbers
How about a tutorial about encoders and decoders .. or make a homemade voltage display? Really appreciate your videos specially for aspiring Electrical engineer like me...
i have seen your all videos
every video is superb
will you please make a video on CNC machine
Nice little project. The only other thing it needs is to make the noise. :)
great tutorial! :)
I have completed a similar project, a car accelerometer but the problem in my case is if there is vehicle roll it picks it up and displays different lateral g force than real, a bit lower. I’ve used the mpu6050 and with a moving average it filters vibrations very well, basically even with engine vibrations or if you tap it, it would keep to zero obviously the “trade off” is slow reaction time but this is in fact very convenient as you can’t read a display that changes the values too quickly.
so the fix for the tilt would be a gyro but it seems a lot more complex 🤔
Fantastic work man 😘
Accelerometers didn't work like I thought. Thanks!
How useful! I was thinking about adding a gyroscope to my clock project to set the time by tilting it.
You could also add a VL53L0X laser rangefinder to this project to measure small distances very accurately.
i personally would use an extruded aluminium profile as a case they are very precise and do not warp
but this was a great video and a cool project
to get this project work you need to use both accelerometer and gyroscope and add some kind of filter (complementary filter are the simplest one )
I never miss your videos even in exams.
That's the spirit!
yangle is in deggree, right? and what meaning of 182.40? and where you find 182.04 thanks
To make it more useful, since nothing is really level. Add a zero button to make it easier to level one surface to another.
Great video. I'd love to see the follow up about the gyroscope component being used to eliminate external acceleration.
Fantastic job, man. Extremely simple and useful! 😀
as this project only uses i2c, you could swap the arduino with an attiny to make it even cheaper and more compact. or add an esp8266 to make a wifi enabled spirit level
how would you make it bluetooth enabled?
@@jazzyj2899 esp32 or other microcontroller with bluetooth from ti/st/nordic/others. Whatever you can get your hands on at the moment.
Please explain about flip flop and it's types and when to use them video
I think you need to calibrate this accelerometer to get more better reading... right??
When u said square second my mind went off in a tangent trying too imaging one. Will haunt me all day
With a bit more accurate and stable reading, it could be easily converted to a digital protractor (Few switches for unit selection, zero, 3d angular reading, angle registration and slight code additions of course). Waiting for the gyroscope part ;)
Could you make a diy computer mouse?
Very entertaining and educational. Great video, as always :)
You could have utilized the integrated sleepmode the accelerometer comes with. Then you could have put the arduino to sleep and use the accelerometer as an interrupt to wake it up. i think that would caused it to consume considerable less than 1mA when its in standby, might be able to remove the switch at that point. you could just put it in the shelf at that point and use it like you'd use a normal level without turning it on and you probably only have to charge it once in a month or two. Just a suggestion.
one way to calibrate it would be to take a big tub and fill it with water and place it on something that floats on the water
I actually have been using the 6050 to do some motion capture, using a library that taps into getting raw quaternion data from the chips that it generates itself with its own corrections. Using that, I've found the accelerator data to be very accurate and only start to drift after 20 hours of operation with no movement (yes, when I leave them on by mistake). That being said, I may have to order a handful of the 9250s and see how much better they work.
Thanks for letting us know about your experience. I think it's great these sensors are so inexpensive.
Well here's another one: The chips can only have 2 IDs, which I don't remember right off the top of my head. However, it can be adjusted by setting a pin high or low. A way around the need of an IC Multiplexer is to just have all set to low and set the one you want to grab data from to high. When in the internal calculation mode, it will cry about an overflow issue, but if you set it to flush the data and wait on the next incoming message, it will be nice and clean. Set it to low and go to the next with high. Rinse and repeat. Granted, I'm using an ATMega 2560 to do it (extra I/O pins), but if you used a bit-shift register, I'm sure it'd work just the same.
Love this video because I love measuring devices. Can you show us how to build digital micrometer?
Great build! I've tried many digital levels and none of them are as accurate as a bubble level.
Off topic but the size of the bubble in that Stabila level was truly disappointing. It needs a larger bubble to be able to read between the lines without guessing if it's in the middle or off to one side.
I really like your videos
I think if you use Arduino pro mini you can save more power and have more room for other stuff that way
I am currently working with the MPU9250 for Jugend Forscht. I actually wrote a library for it because the internet library are pieces of shit that a) don't allow me to use the FIFO, making it impossible to capture data at 200Hz while writing to an SD card, b) don't allow me to include external sensor with the I2C_SLV.. while c) taking up space and memory to support features I don't need like Wake On Motion.
The library seems adequate for your use cases, though.
Nice one mr great scott! :) greetings from Philippines and hope more power to your youtube channel and patreon. :)
Thanks mate ;-)
Could you give me some heart into my comment? Haha wish next time you make some tutorials about basic arduino robotic movement. :)
Have you plan to make basic arduino robot?
What would it take to develop a 3-axis accelerometer that can save data, and including power supply can fit within an area 28x24x131mm? I'd like to mount one inside a model railway container wagon load, to record and then provide data on gradients and curve banking.
Das war mal unsere Abschlussprüfung 😂
That idea is pretty cool!!
Hi, how to program the Arduino for transmitting ASCII and HEX characters over GPRS on the sim800с module, over the TCP protocol. Thank you!
28hours standby power for 1.2amp 3.7v battery. But what is the value 0.8 that you have multiple to get the standby hours. Sry if I am asked wrongly.
2 years later and I'm scrolling through the comments wondering the exact same thing :P I think it's some kind of safety factor
A solution for ur inaccuracies problems is maybe to calibrate ur digital spirit level once with a air bubble one, and so on remove the inaccuracie with calcuting on the Arduino ?
Spirit level, 1 shows how much whiskey is left, 2 indicates the presence of ghosts, 3 indicates levels of morale. 😁
Just like it, you are the best
That, my friend, is impressive.
Thanks
if you reset the board or... switch on the board at an angle, the MPU-6050 takes that as the reference angle(that is Pitch = yaw = roll =0). For example, if I switch on at an angle of 45, it would display "0", and it will show the difference from that angle.
How did you avoid this? Please help me with this.
Wow! very good... your inspirational.
Just use Digital motion Processor inside MPU6050 and your measurements will be stable.
Once again the great one as done a good job
Is there another video where you use the gyroscopic component of the ic
Awesome use of a accelerometer!
How about making two wheeled self balancing robot with such accelerometer and gyroscope??
I think everyone would love to see you make it?
Love your vids!! :)
One or two gyroscope projects will follow in the future :-)
Can't wait!!! :-)
A good spirit level is easily accurate to 1/20th of a degree. Specialty ones can be had accurate to 5 arc-seconds.
Thank you so much for the video! Very inspirational!
Awesome video!