Introduction: DIY Digital Spirit Level
In this project we will have a closer look at accelerometer ICs and find out how we can use them with an Arduino. Afterwards we will combine such an IC with a couple of complementary components and a 3D printed enclosure in order to create a digital spirit level. Let's get started!
Step 1: Watch the Video!
The video gives you all the information you need to create your own digital spirit level. During the next steps though I will present you some additional information.
Step 2: Order Your Components!
Here you can find a parts list with example seller (affiliate links):
Aliexpress
1x Arduino Nano: https://s.click.aliexpress.com/e/_dULoNXh
1x MPU9250: https://s.click.aliexpress.com/e/_d8hQS0C
1x Slide Switch: https://s.click.aliexpress.com/e/_dVn7Jlz
1x 128x32 SSD1306 OLED Display: https://s.click.aliexpress.com/e/_dSxLQku
1x LiPo Battery: https://s.click.aliexpress.com/e/_dV4FScY
Ebay:
1x Arduino Nano: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...
1x MPU9250: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...
1x Slide Switch: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...
1x 128x32 SSD1306 OLED Display: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...
1x LiPo Battery: http://rover.ebay.com/rover/1/711-53200-19255-0/1?...
Amazon.de:
1x Arduino Nano: http://amzn.to/2pmIEQr
1x MPU9250: http://amzn.to/2GG00ju
1x Slide Switch: http://amzn.to/2poJBI3
1x 128x32 SSD1306 OLED Display: http://amzn.to/2FKkXNh
1x LiPo Battery: http://amzn.to/2pqt6vp
Step 3: Build the Circuit and Upload the Code!
Here you can find the schematic and code for the circuit. Use them to create your own circuit. Also do not forget to include the SSD1306 Library from Adafruit.
Attachments
Step 4: 3D Print the Enclosure!
Here you can find the .stl files of my designed enclosure. Feel free to use them to 3D print your own housing.
Step 5: Success!
You did it! You just created your own Digital Spirit Level!
Feel free to check out my YouTube channel for more awesome projects: http://www.youtube.com/user/greatscottlab
You can also follow me on Facebook, Twitter and Google+ for news about upcoming projects and behind the scenes information:
23 Comments
Question 1 year ago on Step 5
hi Scott good project could however I would like to use this for visually impaired could you advise additions to sketch for and audible indication
Thanks Mick
Tip 2 years ago on Step 4
Probably a year or more late to some replies down there but in case there are any future people looking for answers. If you want to add the x and z axis, comment out the line:
//I2CwriteByte(MPU9250_ADDRESS, 108, 0x2F);
and add these in the loop()
int16_t ax = -(Buf[0] << 8 | Buf[1]); //y axis
int16_t az = -(Buf[4] << 8 | Buf[5]); //z axis
xangle = ax/ 182.04;
zangle = az/ 182.04;
xangle = ax/ 182.04;
zangle = az/ 182.04;
Below each of the ones for 'y'. You may want to average the data over two points (not more as it will introduce higher inaccuracies actually).
Reply 2 years ago
Insted of quoting out the "I2CwriteByte(MPU9250_ADDRESS, 108, 0x2F);" Change it to "I2CwriteByte(MPU9250_ADDRESS, 108, 0x0F);" that should disable all but X & Y axis.
Reply 2 years ago
hi tombankz
thanks for the info however it dosent seem to be working
i am using a 6050 could that be why
Question 4 years ago
Hi. Nice interesting project. I have most of the parts and will be trying it. However, I have read that MPU9250 uses a 3.3V supply with a max of 4v. You are apparently using 5V. Isn't there a problem of it being blown by overvoltage? Can anyone please confirm whether this is correct?
Answer 2 years ago
The LiPo battery is rated at 3.7V
Question 3 years ago
Question 3 years ago
SUPER NICE WORK!
I AM TEACHER OF PHYSICS AND WE NEED as physics tool A INO SKETCH THAT PROVIDE ALSO PITCH AND ROLL ANGLE..CAN YOU HELP US ? IF SO SUPER,MY GMAIL IS
nektarios.25ma@gmail.com thanks
4 years ago
Could I please re-ask the question posted by offtherails2010. I also would like to know the lipo battery charge module shown in this instructable but totally ignored in the build description.
Question 4 years ago
Good day to you GreatScott and everyone !!
Please please could ANYONE help identify this charging module, its not shown or mentioned in this instructable but its in the main photo which is really BUGGING the HECK outta ME lol !!
ive tried to find it online in the usual places, ebay and aliexpress, dx, banggood etc but no luck finding this exact module
just curious on its specs and yes, i know theres the TP4056 alternative out there, but it would be nice to solve this puzzling module that not mentioned lol
Pretty please help ?!? lol
BE POSITIVE in replies please, no negativity, thanks in advance.
4 years ago
Hi
Thank you for this awesome instructable
can I use ADXL345 instead of MPU9250?
Merry Christmas ❤️
4 years ago
Hallo,
First at all, thank you for your great videos/posts. I used this idea to pimp up my inaccurate spirit level meter and I developed a bit more stuff for the OLED. So please feel free and use that in case you like it: https://github.com/aattila/arduino/blob/master/ADXL345TiltMeter/ADXL345TiltMeter.ino
4 years ago
How can I use Z Axis and XAxis
5 years ago
This is really cool! A project I doubt I'll ever make, but love that its possible!
5 years ago
Not to put too fine a point on it, but a "spirit" level is so-called because it consists of a partially filled vial of a tinted spirit or alcohol. This is a digital level. No spirits involved, unless of course you consume some while making or using it.
Question 5 years ago
Can you recommend a good alternative/equivalent to the IRLZ44N?
Answer 5 years ago
The IRLZ44N is an huge N-Channel transistor in a TO220 package. almost any
N-Channel TO220 package transistor will do.
Answer 5 years ago
Research, why ask this here?
Tip 5 years ago
Maybe rather use the Low-Pass filter from Arduino https://playground.arduino.cc/Code/Filters - it's just three lines of code!
5 years ago on Step 5
when I saw this I thought Good, viable alternative to the commercial versions. But after, only, watching the video I gave it a pass, sigh. No bells and whistles - no calibration method or angle transfer or hold or accuracy dampening ability.
It's a good start, just needs some work. Oh and how do you make the chip and rail parallel, shims?