The Importance of Spirit Levels and Accelerometer ICs in DIY Projects
If you have ever put up a shelf or similar structure, you are likely familiar with the concept of a spirit level. This handy tool is used to ensure that surfaces are level and plumb, preventing objects from rolling off or becoming unstable. However, many people may not be aware of the technology behind these levels or the challenges they pose when trying to achieve high precision.
One common issue with traditional spirit levels is the poor precision of the air bubble eyeball technique. This method relies on the air bubble remaining perfectly centered in the level, which can be difficult to achieve due to various factors such as gravity and movement. In this project, we will explore an alternative solution using accelerometer ICs to create a battery-powered digital spirit level.
The Selection of Accelerometer ICs
--------------------------------
When it comes to selecting an accelerometer IC for our DIY project, there are many options available. One popular choice is the MPU-6050, which can be purchased for just one dollar. This IC uses I2C communication and requires minimal setup, as we can use example code from the Arduino playground to interact with it. By connecting its power pins to a 5V and GND pin on an Arduino Nano and hooking up its serial clock pin to A5 and serial data pin to A4, we are able to read out the acceleration values.
Understanding Acceleration Values
------------------------------
So, what do these acceleration values represent? To understand this, let's create an imaginary level Y axis with our accelerometer IC in the middle. Gravity pulls our IC downward in the Z axis with an acceleration of 1 G (9.81 meters per second squared). When the IC is level, there is no acceleration in the Y direction, and thus the numbers shown on the serial monitor will be almost zero.
However, if we have an un-level surface, a part of the gravitational acceleration affects the Y axis. This 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 represents 1 G at a full scale range of 2 G, achieved when the angle equals plus or minus 90 degrees.
Creating a Serial Monitor Breadboard Spirit Level
-------------------------------------------------
By doing some code editing, we can already create a serial monitor breadboard spirit level. This is because there is a proportional relation between the acceleration values and the angle of the IC. By combining an accelerometer IC with complementary components and a 3D printed enclosure, we can create a prototype digital spirit level.
Adding a Small OLED Screen
-------------------------
To take our DIY project to the next level, let's add a small OLED screen to display the readings. This will allow us to see the values in real-time and get an accurate reading of the surface's levelness. We will secure the slide switch to the enclosure with small wood screws and glue the OLED display to the top side of the enclosure.
Designing the 3D Printed Enclosure
---------------------------------
To create our DIY digital spirit level, we need a custom-designed 3D printed enclosure that can hold all the necessary components. Using Fusion 360 software, we measure the dimensions of a proper air bubble spirit level and the required electrical components, including a small slide switch. We then design the upper and lower parts of our DIY digital spirit level model and slice it for 3D printing.
Printing and Assembly
---------------------
With our design complete, we can start printing the enclosure. Using brown PLA filament, which took around 6 hours to print, we determine that the prints are not half bad. We place the M3 and M4 nuts into their designated indentations and remove the support material. Next, we secure the male headers from the accelerometer IC with wires and attach it to the bottom part of the 3D print.
The Final Assembly
------------------
We wire up the rest of the electronics system according to our schematic. Once the wiring is complete, we secure the slide switch to the enclosure with small wood screws. We glue the OLED display to the top side of the enclosure and stuff the rest of the electronics into the housing. Finally, we connect both halves together using long M4 bolts.
Conclusion
----------
Our DIY digital spirit level project has been completed, and it works quite well. However, as with any DIY project, there can be inaccuracy problems due to warping during 3D printing or incorrect mounting of the accelerometer IC. Additionally, our device only works properly if held still and not accelerated by external forces.
A potential solution to this problem is utilizing the gyroscope component of the IC. This would allow us to create a more stable and accurate digital spirit level that can handle movement and vibrations. However, for now, we will leave this subject for another video.
Don't forget to like, share, and subscribe to our channel for more DIY projects and tutorials! Stay creative, and I'll see you next time.