Pocket Tilt-O-Meter 3000: Tiny ESP32C3 Tilt and Range Gadget
by jfunky1111 in Circuits > Tools
10 Views, 0 Favorites, 0 Comments
Pocket Tilt-O-Meter 3000: Tiny ESP32C3 Tilt and Range Gadget
This project is a compact tool that combines a digital level and a ruler in one device.
At its heart is a Seeed Studio XIAO ESP32-C3 microcontroller. It reads distance from an HC-SR04T ultrasonic sensor and tilt from an MPU6050 accelerometer/gyroscope. The measurements are shown in real time on a 64×32 SSD1306 I2C OLED display and on a WiFi page.
You can use it to:
- Check if shelves, frames, or furniture are level
- Measure distances like a digital ruler without a tape
- Align projects in the workshop with both angle and distance feedback
Because the XIAO ESP32-C3 is small and low power, the whole device can be made very compact and portable. In this Instructable, I will show how to wire the parts, program the microcontroller, and use the screen to display distance and tilt clearly so you can use it as a handy level-and-ruler tool in your shop or on the go.
Supplies
- Seeed Studio XIAO ESP32-C3 microcontroller
- HC-SR04T ultrasonic distance sensor
- MPU6050 accelerometer and gyroscope module
- 64×32 SSD1306 I2C OLED display
- Soldering iron
- Hot glue gun
- USB-C cable for programming the XIAO ESP32-C3
- Small 3.7v LiPo battery
- Arduino IDE
Assembly
-----WIRING-----
Power
- VCC of all boards to ESP32 3v3 pin
- GND of all boards to the ESP32 GND pin
- LiPo + to BAT+ on ESP32 back
- LiPo - to BAT- on ESP32 back
Signal
- All SDA to D4
- All SCL to D5
-----3D PRINTING-----
Download Tilt-O-Meter 3000.stl
(This was created with Autodesk TinkerCad, my favorite 3D modeling software, even though it is simple.)
Print it (I used Ender 3 V2)
----HOT GLUE!!!----
In the shorter end of the 3D printed parts, insert the HC-SR04T with the white plastic connector sticking out the hole on the end and glue it in.
Insert the power switch in the other hole on the other part.
On the short side of the parts on the outside, glue the screen.
On the longer part, glue the ESP32 in the small divot in the edge so the port sticks out.
Glue the MPU6050 to the inside of the opposite side on which you placed the LCD screen.
Plug the HC-SR04 cable into the white connector.
Downloads
Coding
Get Arduino IDE and open a new sketch.
Paste this:
For both of these libraries, click on Library Manager, search for it, and install. Supporting images are in the step.
- MPU6050 by Electronic Cats
- Adafruit SSD1306 by Adafruit
Go to Preferences -> Additional Board URL's and paste this: https://espressif.github.io/arduino-esp32/package_esp32_index.json
Go to Board Manager, search ESP32, and click install.
Plug in your ESP32.
Select XIAO ESP32-C3
Select Upload!
Your screen should show the distance and how you need to tilt it.
WiFi Interface
Connect the antenna to the connector between the boot and reset buttons.
Look for a network called Tilt-O-Meter 3000. It should be an open network.
Connect to it, and go to 192.168.4.1 in a web browser.
The web interface should appear with the distance and a moving representation of the tilt!
Customization and Usage
Using It as a Level
- Place the device on a shelf, frame, or piece of wood.
- Watch the OLED:
- When both pitch and roll say LEVEL, the surface is flat enough for most projects.
- If it shows TILT FWD/BACK/LEFT/RIGHT, adjust the object until the text changes to LEVEL.
- You can also use just the web interface and watch the “bubble” move into the center circle.
Using It as a Digital Ruler
- Point the ultrasonic sensor at the target you want to measure (wall, cabinet, etc.).
- Hold the enclosure so the sensor is roughly perpendicular to the target.
- Read the distance in inches on either:
- The OLED display, or
- The WiFi page (the big distance readout).
- This is handy for:
- Quick room measurements
- Checking clearances on the workbench
- Measuring how far a drawer extends
Ideas for Further Customization
- Add a small buzzer that beeps when the device is perfectly level.
- Change the WiFi SSID in the code so you can tell multiple tools apart.
- Update the CSS colors in getHTML() to match your favorite theme (dark, neon, workshop colors, etc.).
- 3D print a different case that fits on a tripod, camera shoe, or the side of a tool.
Get out there and get measuring!!!
-James F