Introduction: Digital Level With Cross-Line Laser

Hi everyone, today I'm going to show you how to make a digital level with optional integrated cross-line laser. About a year ago I created a digital multi-tool. While that tool does feature a lot of different modes, for me, the most common and useful are the level and angle measuring modes. So, I thought it would be productive to make a new, more compact tool focused only on angle sensing. The assembly is straight forward, so hopefully it will be a fun weekend project for people.

I've also designed a sled to hold the level while using the cross-line laser. It can be adjusted by +/-4 degrees in y/x to help level the laser line. The sled can also be mounted on a camera tripod.

You can find all of the files needed for the level at my Github: here.

The level has five modes:

(You can see these in the video above. Seeing them will probably make more sense than reading the descriptions)

  1. X-Y Level: This is like a circular bubble level. With the level laying on it's back, the mode reports the tilt angles about the tool's upper/lower and left/right faces.
  2. Roll Level: This is like a regular spirit level. With the level standing upright on its upper/lower/left/right, it reports the angle of tilt of the level's top/bottom faces.
  3. Protractor: Like the roll level, but the level is lying flat on it's bottom face.
  4. Laser Pointer: Just a straight forward dot laser, projected from the right face of the tool.
  5. Cross-Line Laser: Projects a cross from right face of the level. This can also be activated when using the X-Y Level or Roll Level modes by double tapping the "Z" button. Should be oriented such that the bottom face is aligned with the laser line.

To make the level more compact, and assembly easier, I've incorporated all the parts onto a custom PCB. The smallest components are 0805 SMD size, which can be easily soldered by hand.

The level's case is 3D printed, and measures 74x60x23.8mm with the cross-line laser, 74x44x23.8mm without, making the tool comfortably pocket sized in either case.

The level is powered by a rechargeable LiPo battery. I should note that LiPo's can be dangerous if handled improperly. The main thing is not to short the LiPo, but you should do some safety research if you are completely unfamiliar with them.

Finally, the two lasers I use are very low powered, and while I do not recommend pointing them directly at your eyes, they should be safe otherwise.

If you have any questions at all, please leave a comment, and I'll get back to you.



You can find Gerber file for the PCB here: here (hit download in the bottom right)

If you'd like to inspect the PCB's schematic, you can find it here.

Unless you can make PCB's locally, you'll have to order some from a prototype PCB manufacturer. If you've never purchased a custom PCB before, it's very straight forward; most companies have an automated quoting system that accepts zipped Gerber files. I can recommend JLC PCB, Seeedstudio, AllPCB, or OSH Park, although I'm sure most others will work as well. All the default board specs from these manufactures will work fine, but make sure to set the board thickness to 1.6mm (should be the default). Board color is your preference.

Electronic Parts:

(note that you can probably find these parts for cheaper on sites like Aliexpress, Ebay, Banggood, etc)

  • One Arduino Pro-mini, 5V ver. Please note that there a few different board designs out there. The only difference between them is the placement of analog pins A4-7. I have made the level's PCB such that both boards should work. Found here.
  • One MPU6050 breakout board. Found here.
  • One 0.96" SSD1306 OLED. Display color doesn't matter (although the blue/yellow version works best). Can be found in two different pin configurations, where the ground/vcc pins are reversed. Either will work for the level. Found here.
  • One TP4056 1s LiPo charger board. Found here.
  • One 1s LiPo battery. Any kind is fine as long as it fits in a 40x50x10mm volume. Capacity and current output are not hugely important as the level's power consumption is fairly low. You can find the one I used here.
  • One 6.5x18mm 5mw laser diode. Found here.
  • One 12x40mm 5mw cross-line laser diode. Found here. (optional)
  • Two 2N2222 through-hole transistors. Found here.
  • One 19x6x13mm slide switch. Found here.
  • Four 1K 0805 resistors. Found here.
  • Two 100K 0805 resistors. Found here.
  • Two 1uf 0805 multi-layer ceramic capacitors. Found here.
  • Two 6x6x10mm through-hole tactile push-buttons. Found here.
  • 2.54mm male headers.
  • A FTDI programming cable. Found here, although other types are available on Amazon for less. You can also use an Arduino Uno as the programmer (if it has a removable ATMEGA328P chip), see a guide for that here.

Other Parts:

  • Twenty 6x1mm round neodymium magnets. Found here.
  • One 25x1.5mm clear acrylic square. Found here.
  • A small length of adhesive backed Velcro.
  • Four 4mm M2 Screws.


  • 3D printer
  • Soldering iron w/ fine tip
  • Plastic glue (for gluing acrylic square, superglue fogs it up)
  • Superglue
  • Hot glue gun and hot glue
  • Paint+brush (for filling button labels)
  • Wire stripper/cutter
  • Tweezers (for handling SMD parts)
  • Hobby knife

Sled Parts (optional, if you're adding the cross-line laser)

  • Three M3 nuts
  • Three M3x16mm screws (or longer, will give you a larger angle adjustment range)
  • One 1/4"-20 nut (for camera tripod mounting)
  • Two 6x1mm round magnets (see link above)

Step 1: Design Notes (optional)

Before I launch into the level's construction steps, I am going to record a few notes about its design, construction, programming, etc. These are optional, but if you want to tweak the level in any way, they may be useful.

  • The assembly pictures I have are of an older version of the PCB. There were a few small issues that I've since fixed with a new PCB version. I have tested the new PCB, but in my haste to test it, I completely forgot to take assembly pictures. Fortunately, the differences are very small, and the assembly is mostly unchanged, so the older pictures should work fine.
  • For notes on the MPU6050, SSD1306 OLED, and TP4056, see Step 1 of my Digital Multi-tool instructable.
  • I wanted to make the level as compact as possible, while also keeping it easy to assemble by someone with average soldering skills. Therefore, I opted to use mostly through-hole components, and common off-the-shelf breakout boards. I used 0805 SMD resistors/capacitors because they're fairly easy to solder, you can overheat them without worrying too much, and they're very cheap to replace should you break/lose one.
  • Using pre-made breakout boards for the sensor/OLED/microcontroller also keeps the overall part count low, so it's easier to buy all the parts for the board.
  • On my Digital Multi-tool I used a Wemos D1 Mini as the main micro-controller. This was mostly due to programming memory constraints. For the level, because the MPU6050 is the only sensor, I opted to use an Arduino Pro-mini. Although it has less memory, it's a bit smaller than a Wemos D1 Mini, and since it's a native Arduino product, programming support is included natively in the Arduino IDE. In the end, I actually came very close to maxing out the programming memory. This is mainly due to the size of the libraries for the MPU6050 and the OLED.
  • I opted to use the 5v version of the Arduino Pro-Mini over the 3.3v version. This is mainly because the 5v version has a double the clock speed of the 3.3v version, which helps make the level more responsive. A fully charged 1s LiPo outputs 4.2v, so you can use it to power the pro-mini directly from its vcc pin. Doing this bypasses the onboard 5v voltage regulator, and generally shouldn't be done unless you are certain that your power source will never go above 5v.
  • In addition to the previous point, both the MPU6050 and the OLED accept voltages between 5-3v, so a 1s LiPo will have no issues powering them.
  • I could have used a 5v step-up regulator maintain a steady 5v across the whole board. While this would be good to ensure a constant clock speed (it decreases with decreasing voltage), and prevent the lasers from dimming (which isn't really noticeable), I didn't think it was worth the additional parts. Likewise, a 1s LiPo is 95% discharged at 3.6v, so even at it's lowest voltage, the 5v pro-mini should still run faster than the 3.3v version.
  • Both the buttons have a debounce circuit. This prevents a single button press being counted multiple times. You can debounce in software, but I prefer to do it in hardware, because it only takes two resistors and one capacitor, and then you don't have to worry about it ever. If you'd prefer to do it in software, you can omit the capacitor and solder a jumper wire between the 100K resistor's pads. You should still include the 1K resistor.
  • The level reports the current LiPo charge percentage at the top right corner of the display. This is calculated by comparing the Arduino's internal 1.1V reference voltage to the voltage measured at the vcc pin. Originally I thought you needed to use an analog pin to do this, which is reflected on the PCB, but can be safely ignored.

Step 2: PCB Assembly Step 1:

To begin, we will assembly the level's PCB. To make the assembly easier, we'll add components to the board in stages, ordered by increasing height. This gives you more room to position your soldering iron, because you only have to deal with components of similar heights at any one time.

First you should solder all the SMD resistors and capacitors on the top side of the board. The values are listed on the PCB, but you can use the attached picture for reference. Do not worry about the 10K resistor, as it is not featured on your board. I was originally going to use it to measure the battery voltage, but I found an alternate way to do it.

Step 3: PCB Assembly Step 2:

Next, cut and strip the lead wires of the small laser diode. You'll probably need to strip them all the way to the base of the laser. Be sure to keep track of which side is positive.

Place the laser in the cut-out area on the right side of the PCB. You may want to use a bit of glue to hold it in place. Solder the lasers leads to the the +/- holes labeled "Laser 2" as pictured.

Next, solder two 2N2222's into position on the top right corner of the board. Be sure that they match printed orientation on the board. When you solder them, only push them about half way into the board as pictured. After they are soldered, trim away any excess leads, and then bend the 2N2222's so that the flat face is against the top of the board as pictured.

Step 4: PCB Assembly Step 3:

Flip the board over, and solder single male headers to the holes near the laser diode. Next, solder the TP4056 module to the headers, as pictured. Make sure it is mounted to the underside of the board, with the USB port aligned with the boards edge. Trim away any excess lengths of headers.

Step 5: PCB Assembly Step 4:

Flip the board back over to its top side. Using a row male headers, solder the MPU6505 board as pictured. Try to keep the MPU6050 as parallel to the level's PCB as possible. This will help keep its initial angle readings close to zero. Trim away any excess header lengths.

Step 6: PCB Assembly Step 5:

Solder male headers for the Arduino Pro-Mini in place on the top side of the board. Their orientation doesn't matter, except for the top most row of headers. This is the programming header for the board, so it is critical that they are oriented so that the long side of the headers be pointing out of the top side of the level's PCB. You can kinda see this in the picture. Also, make sure you use the A4-7 pin orientation matching your Pro-Mini (mine has the as a row along the bottom of the board, but some have them placed as pairs along one edge).

Next, although it is not pictured, you can solder the Arduino Pro-Mini in place.

Then, solder the SSD1306 OLED display in place on the top of the board. Like with the MPU6050, try to keep the display as a parallel to the level's PCB as possible. Please note that SSD1306 boards seem to come in two possible configurations, one with the GND and VCC pins reversed. Both will work with my board, but you must configure the pins using the jumper pads on the back side of the level's PCB. Simply bridge the central pads to either the VCC or GND pads to set the pins. Unfortunately, I don't have a picture for this, as I did not find out about the reversed pins until after I had bought and assembled the initial PCB (my display's pins were wrong, so I had to order a whole new display). If you have any questions, please post a comment.

Finally, trim away any excess pin lengths.

Step 7: PCB Assembly Step 6:

If you did not do so in the previous step, solder the Arduino Pro-Mini into place on the top of the PCB.

Next, solder the two tactile push-buttons and the slide switch into place as pictured.You will need to trim away the slide switch's mounting tabs with a pair of pliers.

Step 8: PCB Assembly Step 7:

Attach a small strip of Velcro to the back of the level PCB and the LiPo battery, as pictured. Please ignore the extra red wire between the Arduino and the display in the first image. I made a small wiring mistake when designing the PCB. This has been corrected on your version.

Next, attach the battery to the back of the level's PCB using the Velcro. Then, cut and strip the battery's positive and negative wires. Solder them to the B+ and B- pads on the TP4056 as pictured. The battery's positive wire should be connected to B+, and the negative to B-. Before soldering, you should confirm each wire's polarity using a multi-meter. To avoid shorting out the battery, I recommend striping and soldering one wire at a time.

At this point, the level's PCB is complete. You may want to test it before installing it in the case. To do so, skip ti the Code Uploading step.

Step 9: Case Assembly Step 1:

If you are adding the cross-line laser, print out "Main Base.stl" and "Main Top.stl". They should match the parts pictured.

If you are not adding the cross-line laser, print out "Main Base No Cross.stl" and "Main Top No Cross.stl". These are the same as the pictured parts, but with the compartment for the cross-line laser removed.

You can find all these parts at my Github: here

For both cases, glue 1x6mm round magnets into each of the holes in the case's exterior. You'll need 20 magnets in total.

Next, take the "Main Top" and glue a 25mm acrylic square into the cutout as pictured. Do not use super glue for this because it will fog up the acrylic. If you plan on reprogramming the level once it is assembled, you can cut out the rectangle in the upper left corner of the "Main Top" using a hobby knife. After the level is fully assembled, this will give you access to the programming header. Note that this is already cut out in my pictures.

Lastly you can optionally use some paint to ink in the "M" and "Z" button labels.

Step 10: Case Assembly Step 2:

For both cases, insert the assembled level PCB into the case. It should be able to sit flat on the case's internal risers. Once you are satisfied with its position, hot glue it into place.

Step 11: Code Uploading

You can find the code at my Github: here

You will need to install the following libraries either manually or by using the Arduino IDE's library manager:

I give credit for the work done by Adafruit, Roberto Lo Giacco, and Paul Stoffregen in producing these libraries, without which, I would almost certainly have not been able to complete this project.

To upload the code, you'll need to connect an FTDI programming cable to the six pin header above the Arduino pro-mini. The FTDI cable should either have a black wire, or some kind of marker for orientation. When you insert the cable onto the header, the black wire should fit over the pin labeled "blk" on the level's PCB. If you get it the right way round the power LED on the Arduino should light up, otherwise you'll have to reverse the cable.

You can alternatively upload the code using an Arduino Uno as described here.

When using either method, you should be able to upload the code as you would to any other Arduino. Be sure to select Arduino Pro-Mini 5V as the board under the tools menu when uploading. Before uploading my code, you should calibrate your MPU6050 by running "IMU_Zero" example (found under the examples menu for the MPU6050). Using the results, you should change the offsets near the top of my code. Once the offsets are set, you can upload my code, and the level should begin working. If you are not using the cross-line laser, you should set "crossLaserEnable" to false in the code.

The level's mode is changed using the "M" button. Hitting the "Z" button will zero out the angle or turn on one of the lasers depending on the mode. When in an either roll or x-y level mode double pressing the "Z" button will turn on the cross-laser if it's enabled. The battery's charge percentage is shown in the top right of the display.

If you cannot upload the code, you may have to set the board as an Arduino Uno using the tools menu.

If the display doesn't turn on, check its I2C address with whomever you bought it from. By default in the code it is 0x3C. You can change by changing DISPLAY_ADDR at the top of the code. If this doesn't work, you'll have to remove the level's PCB from the case and confirm that the display's pins match those on the level's PCB. If they do, you probably have a broken display (they're fairly fragile and can come broken in shipping) and you'll have to remove it.

Step 12: Cross-Line Laser Assembly:

If you are not using a cross-line laser, you can skip this step. If you are, take the laser module and insert it into the case as pictured, it should snap into the rounded cut-outs for the laser.

Next, take the laser's wires, and snake them under the display to the Laser 1 port on the level's PCB. Strip and solder the wires to the +/- positions as pictured. The red wire should be positive.

Now, to make the cross-line laser useful it needs to be aligned with the level's case. To do this, I used an index card bent into a right angle. Place the both the level and the index card on the same surface. Power on the cross laser and point it at the index card. Using a pair of tweezers or pliers, rotate the laser's knurled front lens cap until the laser's cross is aligned with the horizontal lines of the index card. Once you are satisfied, secure both the lens cap and the cross-line laser module using hot glue.

Step 13: Final Assembly

Take the "Main Top" of the case and press it onto the top of the "Main Base" of the case. You may have to angle it slightly to get it round the display.

Update 2/1/2021, changed the top to attach with four 4mm M2 screws. Should be straight-forward.

At this point your level is complete! I will next go over how to build the precision sled, which you can optionally make.

If you are stopping here, I hope you find the level useful, and I thank you for reading! If you have any questions, please leave a comment and I'll try to help.

Step 14: Precision Sled Assembly Step 1:

I'll now go over the assembly steps for the precision sled. The sled is intended to be used in conjunction with the X-Y level mode. Its three adjustment knobs give you fine control over the level's angle, which is helpful when dealing with uneven surfaces. The sled also includes space for a 1/4"-20 nut, which allows you to mount the level on a camera tripod.

Being by printing out one "Precision Sled.stl" and Three of both "Adjustment Knob.stl" and "Adjustment Foot.stl" (the picture above is missing one adjustment knob)

On the bottom of the sled, insert three M3 nuts as pictured, and glue them in place.

Step 15: Precision Sled Assembly Step 2:

Take three 16mm M3 bolts (not two as pictured) and insert them into the adjustment knobs. They head of the bolt should be flush with the top of the knob. This should be a friction fit, but you may need to add a bit of superglue to bind the knobs and bolts together.

Next, thread the M3 bolts through the M3 nuts you inserted into the sled in step 1. Make sure that the side with the adjustment knob is on the top of the sled as pictured.

Glue an adjustment foot onto the end of each of the M3 bolts using super glue.

After doing this for all three feet, the precision sled is complete! :)

You can optionally insert a 1/4"-20 nut and two 1x6mm round magnets into the holes at the center of the sled (make sure the magnet polarities are opposite those on the bottom of the level). This will let you mount the sled and level on a camera tripod.

If you've made it this far, thank you for reading! I hope you found this informative/useful. If you have any questions, please leave a comment.

Build a Tool Contest

Runner Up in the
Build a Tool Contest