The problem
A bubble spirit level tells a carpenter whether a surface is horizontal, but it only answers yes or no: the bubble sits between two lines or it does not, and the size of the error stays invisible. A shelf off by two degrees looks level, yet a door on it swings shut alone. Bubble reading also depends on viewing angle and lighting, so two people can disagree about the same surface. This project replaces the air bubble with a digital spirit level built around the MPU6050 motion sensor and an Arduino Nano: the sensor measures tilt on two axes, firmware converts those readings into pitch and roll angles in degrees, and a 0.96-inch OLED display shows the numbers with a moving bubble graphic and a level indicator. A buzzer sounds inside the level band, and a calibration button zeroes the reading on any reference surface, so the tool works on a bench that is off.
3-axis accelerometer that measures the gravity vector on X, Y and Z and reports it over I2C.
Follow the working sequence
How it works
When the unit is still, the MPU6050 accelerometer feels only Earth's gravity, a constant pull of 1g straight down, so the direction of that pull inside the sensor's own axes reveals exactly how far the board has tilted. The Arduino Nano reads the three accelerometer axes over I2C, converts the gravity vector into pitch and roll angles with the atan2 function, subtracts the stored calibration offsets, and writes the result to the OLED as numbers and a moving bubble graphic. If both angles sit inside the level band the buzzer sounds and the display shows LEVEL; moving the unit off level silences the buzzer and moves the bubble. The whole loop repeats continuously, so the display tracks the surface as it is adjusted. Calibration is stored as two offset numbers, so re-zeroing on a new surface takes one button press and no code change.
- The MPU6050 is powered up and initialised over I2C at address 0x68, with the accelerometer range set to ±2g (datasheet default).
- The Arduino Nano reads the 16-bit accelerometer values on the X, Y and Z axes through the I2C bus.
- The firmware averages 10 consecutive samples on each axis, then computes pitch and roll in degrees from the gravity vector using atan2.
- The stored calibration offsets, captured when the push button was last pressed, are subtracted so the reading is relative to the chosen reference surface.
- The OLED display is updated with the pitch and roll values, the bubble-dot position, and the LEVEL indicator when both angles are inside the band.
- The buzzer sounds while both angles stay inside the ±0.5° level band (design target) and stops as soon as either axis moves outside it.
- The loop repeats at approximately 10 readings per second (design target), so the display follows the surface continuously while it is adjusted.
Tech stack:
- Arduino Nano (ATmega328P)
- MPU6050 6-axis IMU
- SSD1306 OLED display 128×64
- Arduino IDE · C/C++
- I2C communication
- Active buzzer · push button
- 9 V battery · USB 5 V power
- Breadboard · jumper wires
| Parameter | Value |
|---|---|
| Controller | Arduino Nano (ATmega328P, 16 MHz clock) |
| Sensor | MPU6050 6-axis IMU (3-axis accelerometer + 3-axis gyroscope) |
| Accelerometer range | ±2g (datasheet, configurable to ±16g) |
| Accelerometer sensitivity | 16,384 LSB/g at ±2g (datasheet) |
| Gyroscope range | ±250°/s (datasheet, configurable to ±2000°/s) |
| Display | 0.96-inch SSD1306 OLED, 128 × 64 pixels, I2C address 0x3C |
| Angle display | Pitch and roll in degrees, 0.1° display resolution (design target) |
| Level tolerance | ±0.5° buzzer band (design target, adjustable in firmware) |
| Power supply | 5 V USB or 9 V battery (expected) |
| Update rate | Approximately 10 readings per second (design target) |
Project features
The spirit level project is built around four capabilities that work together: a dual-axis angle readout in degrees on the OLED, a digital bubble graphic with a LEVEL indicator that mirrors the behaviour of a traditional level, a buzzer that sounds when both axes fall inside the level band, and a one-touch calibration button that zeroes the reading on any reference surface. The Arduino Nano reads the MPU6050 over I2C, averages the samples so the display stays steady, and refreshes the screen continuously while the unit is moved. The whole unit is wired on one breadboard and runs from USB or a 9 V battery, so it can be carried to a shelf, a machine base or a workbench for a live demonstration. The gyroscope inside the MPU6050 is fitted but not needed for the angle, which keeps the firmware simple enough to explain line by line in a viva.
- [Dual-axis angle readout] The OLED shows pitch and roll in degrees with one decimal place, so the size of the tilt is visible instead of only a yes-or-no bubble position.
- [Digital bubble graphic] A bubble dot moves inside a circle on the display and centres when the surface is level, with the word LEVEL shown on screen, keeping the familiar reading style of a traditional level.
- [Buzzer on level] An active buzzer sounds when both pitch and roll fall inside the ±0.5° level band (design target), so level can be confirmed without watching the display.
- [One-touch calibration] Pressing the push button stores the current tilt as the new zero, so the level can be zeroed on a bench or surface that is itself slightly off.
- [Steady averaged readings] The firmware averages 10 consecutive accelerometer samples before computing each angle, which keeps the displayed value from flickering while the unit is held still.
- [Adjustable level tolerance] The width of the level band is a single constant in the firmware and can be tightened or loosened for the demonstration.
- [Portable battery or USB power] The unit runs from a 9 V battery or a 5 V USB supply, so it can be carried to a shelf, machine base or workbench for a live demonstration.
What is included
- Working digital spirit level prototype (Arduino Nano, MPU6050, OLED, buzzer, calibration button)
- Complete firmware source code with comments (Arduino IDE)
- Circuit and wiring documentation with pin connections
- Component list with part details
- Project report PDF (background, sensor theory, methodology, results)
- Project abstract PDF for submission
- PPT presentation for final review
- Viva Q&A preparation document (accelerometer tilt maths, I2C, calibration, sensor limits)
- Demonstration guidance and calibration procedure
Limitations & prerequisites
- Accuracy is a design target (±0.5° buzzer band), not a measured claim — final accuracy depends on calibration and must be verified against a reference level by the buyer.
- The tilt comes from the accelerometer alone, so readings are valid only while the unit is still; vibration or movement during a reading disturbs the result.
- The MPU6050's gyroscope is fitted but the base firmware derives tilt from the accelerometer only; gyro fusion is future scope.
- This is a level, not a compass: there is no magnetometer, so it cannot measure heading or direction.
- The 0.96-inch OLED is small and can be hard to read in bright sunlight.
- Battery runtime is limited and depends on the battery — approximately 8–10 hours on a fresh 9 V alkaline battery (expected, not measured).
- The prototype is an academic measuring aid, not a certified instrument, and is not a substitute for a calibrated surveyor's level.
Frequently Asked Questions
How does the MPU6050 measure tilt?
When the unit is still, the accelerometer feels only Earth's gravity, a constant 1g pull straight down, so the direction of that pull across the sensor's three axes reveals the tilt. The firmware converts the three axis readings into pitch and roll angles with the atan2 function and shows them in degrees on the OLED. The gyroscope inside the same chip is fitted but not used for the angle in the base build.
Is this project suitable for a final-year project?
Yes, for Electronics & Telecommunication, Instrumentation and Electrical programs, because it demonstrates sensor interfacing, I2C communication, embedded C programming, signal averaging and calibration in one compact build. The tilt maths, wiring and test procedure are all documented for the viva, and the working prototype gives the team a live demonstration.
How accurate is the digital spirit level?
The buzzer band is a ±0.5° design target and the display resolves 0.1°, but no accuracy figure is claimed as measured. Final accuracy depends on careful calibration and on the surface used as the reference, and the buyer verifies it against a known level during testing. The report states this honestly and explains the calibration procedure.
Does it need a computer or internet to work?
No. Once programmed, the unit runs standalone from a 9 V battery or a 5 V USB supply, showing the angles on its own OLED display and sounding the buzzer when the surface is level, with no phone, computer or network involved at any point. A computer is needed only to upload the firmware from the Arduino IDE and to change settings such as the level tolerance.
Can the level tolerance or the display be changed?
Yes. The level band is a single constant in the firmware, so it can be tightened for a stricter demonstration or loosened for a rough one, and the display layout, bubble graphic and units shown can all be changed in code. A larger OLED or an added second display is possible on request.
Can it be mounted on a longer level bar?
Yes. The sensor board and display can be fixed to a straight aluminium or wooden bar so the unit spans a longer surface, which is how a traditional level is used on shelves and machine bases, and the bar makes small tilts easier to see. The calibration button is then used to zero the reading with the bar resting on the reference surface.
Components & software requirements
- Arduino Nano (ATmega328P)
- MPU6050 6-axis IMU
- SSD1306 OLED display 128×64
- Arduino IDE · C/C++
- I2C communication
- Active buzzer · push button
- 9 V battery · USB 5 V power
- Breadboard · jumper wires
Delivery information
Built-to-order project. Delivery timeline is shared after order confirmation based on current queue.
Support terms
Complete documentation, setup guide, and viva preparation included. Support for setup and explanation provided.
Download free synopsis (PDF)
Enter your name and WhatsApp number — the synopsis PDF downloads immediately. We may send occasional project updates on WhatsApp; no spam.