This little project is from a while back, but I thought I would share it anyways.
I can’t go into too many technical details, as some of them are classified.
During one of my previous projects I had developed an IMU (Inertial Measurement Unit). I though about what else could be done with this finished PCB and came up with the idea to use it as a level. Now, levels are usually these really low-tech things and I thought it would be fun to completely over-engineer it. Plus I actually needed a level as I was moving at the time and had some things that I needed to hang. 🙂
How it works:
Like I said I basically had a finished IMU lying around and so I decided to just use the accelerometer in it to measure if the PCB of the IMU is perpendicular to the earth’s gravitational field. If it is, then all of the G-force is measured in the Z-axis of the accelerometer. So the more acceleration is measured in the X and Y-axis the less level everything is. As an output I decided to just use some LEDs and through PWM adjust the brightness according to the acceleration measured in X and Y. I included a little threshold, in which the LEDs are completely off as a “close-enough” indicator. The PWM is generated manually with one of the Timers, since the MCU used had no available PWM outputs.
Everything is powered by a coin cell (3V). This is really stretching the minimal operational voltage (2,7V) of the MCU as the battery voltage drops when the capacity gets lower. Especially during power-up the voltage across the battery dropped significantly. I solved this by simply putting capacitor in parallel to the battery supporting it during power-up.
The hard part:
Since I already had the PCB and most of the code the hardest part probably was soldering the tiny wires to the existing PCB. I basically had to use the pads, that were meant for the MCU and attach tiny wires to that. I then put some drops of hot glue to keep everything in place.
This made for a nice little device that can be used as a level. It even tells you if things are level in both X and Y-axis at the same time. It’s also quite fun to play arround with. Shaking it back and forth and tilting it around kind of gives you the feeling of bouncing around a little red ball.
Below is a video showing everything in action. I compared it to a “normal” level and it actually performs pretty well. But what else would you expect when you are measuring gravitation. Of course its going to be completely vertical. The biggest error probably comes from the two PCBs not being completely parallel to one another.