[adrotate banner=”7″]

 
. 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.

 
 

[adrotate banner=”1″]

arduino 9250 Video

[mam_video id=USa3HFLnrlk]

 

 

[adrotate banner=”2″]

 

[mam_tag id=4225]

 

 

[adrotate banner=”3″]

 

arduino 9250 news

 

 

 

 

 

[adrotate banner=”4″]

 

 

arduino 9250 Social

 

 

[adrotate banner=”5″]

 

 

official.arduino
2019-10-02T19:32:52+0000

👋 Want to bring Tony Stark-like gesture control to your projects? Learn how with the BLE-enabled MKR WiFi 1010 and Nano 33 BLE Sense boards using the ArduinoBLE library.
official.arduino
2019-10-02T19:08:01+0000

Arduin-yo ho ho! A fairground favorite, the pirate ship is a fun way to explore the oscillation of a pendulum. How much fun, you ask? Access our Science Kit Physics Lab preview and see for yourself: http://bit.ly/2oC6L0Q

🔬 Now that you’ve gotten your feet wet, dive into the kit and enjoy all nine experiments. Order yours today: http://bit.ly/2MnQ7fr

 

[adrotate banner=”6″]