. If not then here’s a quick rundown.. If your shelf is not level, then due then due to Earth’s gravitational force, the air bubble will not stay in the middle. That makes such a spirit level a handy tool the have, if you do not want your spherical objects to roll off your shelf. All the time., But what always bothered me is the kind of poor precision of such an air bubble, eyeball technique., So in this small project. In order to counteract this problem, we will have a closer look at accelerometer ICs in order to combine one of them with a couple of complimentary components and a 3D printed enclosure. In order to create our own battery powered digital spirit. Level. Lets get started.. This video is sponsored by JLCPCB, One fact about them. Jlcpcb has currently over 300000 customers, worldwide. and 10000 online orders. Every day. Upload your Gerber files to order high quality PCBs for low prices.. When it comes to accelerometer ICs, then the selection is quite big.. What I initially wanted to use was this MPU 6050 3 axis accelerometer, which you can get for just one dollar. To interact with it. All I had to do was to was to connect its power pins to the 5v and GND pin of an arduino nano and hooking up its serial clock, pin to A5 and its serial data pin to A4. This implies that the IC utilizes I2C for communication., Which traditionally means a whole lot of IC register studying in order to control the IC.
. But since we live in the age of arduino, I rather utilized an example code from the Arduino playground., Which, after uploading to the board and opening the serial monitor, presented me a whole lot of different numbers.. What we only care about, though, are those numbers which represent the acceleration in the Y direction.. But what does this acceleration actually mean? Well, it is quite easy to understand if we create an imaginary level Y axis with our accelerometer IC in the middle., In this constellation gravity pulls our IC downward in the Z axis, with an acceleration of 1 G aka 9.81 meters per square second.. That means when the IC is level, there is no acceleration in the Y direction., And thus the numbers shown in the serial monitor are almost 0., But if we have an un level surface, a part of the part of the gravitational acceleration affects the Y axis., Which Means that by tilting the breadboard left and right, the serial monitor values oscillate around the zero point. in the positive and negative range.. The maximum number of plus or minus 16384, which represents 1 G at a full scale. Range of 2 G is then achieved when the angle equals plus or minus 90 degrees.. This way we have a proportional relation between the acceleration values and the angle of the IC., Which means that by doing a bit of code editing, we can already create a serial, monitor, breadboard spirit, level. And needless to say, such an accelerometer does also work in the X and Z direction.
Your smartphone, for example, utilizes such an accelerometer to automatically rotate the screen., And if you want to dig even deeper and understand what MEMS are and how an accelerometer is made up of them, then definitely check out Afrotechmods’ video about the subject. But I’M, getting off topic here. Right now. We only got prototype of a digital spirit level., So to turn it more into a proper tool. I added a small 128×32 OLED screen to the breadboard., Which i also hooked up to the I2C lines Of the Arduino.. After adding a couple lines of code more to the codes by mostly relying on the Adafruit SSD1306 library, I was then able to output the calculated angle to the display., Which revealed a small problem., As you can see, even without moving the breadboard. The angle value jumps around 0.5 Degrees., Which is probably a noise problem. To decrease it. I tried another similar IC., The MPU 9250., Which is slightly more expensive but reduces the noise down to around 0.2 degrees. Much better. To communicate with it. I partly used code from lulu’s blog and additionally added the line of codes in order to deactivate the other accelerometer axis and gyroscope axis. In order to save a bit of power.. This resulted in a total current demand of roughly 25mA at 5V., Which, with a LiPo battery capacity of 1200 mAh, should give me run time of around 28 hours. To the battery. I also added my homemade LiPo charge, protect boost circuit.
To create a stable 5v for the circuit and being able to charge the battery. Feel free to watch the video about it. If you are interested in creating your own., But of course adding all those components to a breadboard does not equal a spirit level., Since a breadboard is not very level to begin with.. So what I did next was measuring the dimensions of a proper air bubble, spirit level and the dimensions of all the required electrical components., Including a small slide switch which will be connected to the battery circuit.. With those measurements in mind, I then created the upper and lower parts of my DIY digital spirit level, with Fusion 360.. Afterwards, I sliced the models and 3D printed with brown PLA filament, which took around 6 hours in total.. Once that was done, I removed the support material determined that the prints were not half bad and thus placed the M3 and M4 nuts into their designated indentations.. Then i removed the male headers from the accelerometer IC and instead added wires to the board and secured it to the bottom part of the 3D print with M3 bolts.. Last but not least, I wired up the rest of the electronics system with some simple hookup wire. According to this schematic. And, of course, if you’re interested in creating a similar project, then you can, as always, find the code schematic and more information in the video description.. Once the wiring was complete, I secured the slide switch to the enclosure with small wood screws glued.
The OLED display to the topside of the enclosure and stuffed the rest of the electronics into the housing.. All there was left to do was to connect both halfs through long M4 bolts. And the project was complete.. I have to say it does work decently, but of course there can be inaccuracy problems. Due to warping during 3D printing or incorrect mounting of the accelerometer IC., And lets not forget that this digital spirit level only works properly. If you hold it still. and thus not accelerate it with your own forces., A solution to that problem would be to utilize the gyroscope component of the IC., But that is a subject for another video.. Until then, don’t forget to like share and subscribe.
arduino 9250 Video
arduino 9250 news
Posted on Thursday August 22, 2019How to Make Arduino Portable and Future Proof Elektor … Continue Reading »
Posted on Tuesday March 12, 2019Do You Know Where Your Drone Is Headed? HJWYDK Article Explores Limits Of MEMS Sensors Hackaday … Continue Reading »
Posted on Thursday April 26, 2018Catch A Rising Star With Arduino Hackaday … Continue Reading »
arduino 9250 Social
🔬 Now that you’ve gotten your feet wet, dive into the kit and enjoy all nine experiments. Order yours today: http://bit.ly/2MnQ7fr
*insert Rick and Morty reference*
Literally went to the comments to make this joke, dammit.
You beat me to it!
Guess my IQ wasn’t high enough to get the reference
GreatScott! Hey ich hab mal ne frage
Kannst du mal ein video machen wo du ein ac to dc converter machst der so ca 24v dc ausgibt
Great Scott! Hey, I have a question
Can you make a video where you make an ac to dc converter so the outputs about 24v dc
GreatScott! Do you think it’d be possible to make something like this to sense rotation in the Z-axis? For example to accurately measure the bevel/miter angle on a mitersaw?
I read mems as memes
Torpedo level, torpedo level, torpedo level
you should check the level of things diagonally from leg to leg.
Z and Y mixed up? or am I english?
Yeah, $2 for 10 pcbs, and $20 for shipping
Wth is the point
I could really use this to give my 3D printer an auto-leveling function.
that thing is called ‘vaser vaga’ and you probably know the correct german word for it…
Am I the only one that doesn’t see the zero??? 2:54
Google mems, did you mean “memes”?
do a running average and the noise will be eliminated 🙂
As most your videos, it is quite interesting information and nice built. Is it possible to create an angle finder protractor gauge with these same principles? Is it possible to reset cero degrees to measure an specific inclination? Thanks in advance
Difference beyween accelerometer and gyroscope
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.
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 !
Sir can u help me by making a tutorial on 2 wheel self balancing robot that move on DC motors and it should be atleast of three level that is three layers plz sir help me
is there already a more indept video on the MPU-9250?