3D Print Bed Leveling Tool Using M5StickC

16,544

200

40

Introduction: 3D Print Bed Leveling Tool Using M5StickC

About: Avid Inventor, Programmer, and founder of GyroPalm LLC.

Do you ever find it a hassle to manually level your 3D print bed every time you make a print? Even seasoned 3D printing pros need to level the printbed after every couple prints. We’ve created a device that helps tremendously improve this procedure. This project, codenamed OmniLevel, helps you level your 3D printer bed with just a push of a button. We used the M5Stick-C to monitor the pressure between the nozzle of an extruder and the printer bed. Using a force-sensitive resistor (FSR), this allows the user to easily detect when the bed is level.

The current method of leveling a 3D print bed is to manually "eyeball" the surface of your 3D printer bed and adjust the screws on each corner accordingly. Alternately, some users slip a business card or piece of plastic between the printer bed and the nozzle to sense the "friction". This can be a tedious and frustrating task, and one that has led many people to question the usefulness of 3D printers. Sometimes improper leveling has led to poor first-layers and even failed prints.

While some new 3D printers may have special auto-leveling features, this Instructable is for the rest of us who may have an old 3D printer laying around that needs manual leveling. With the M5StickC and some basic components, I've created a device that makes the process of leveling a 3D printer bed incredibly easy! Just turn on the device, press one button, and the device will do all the hard work for you.

Step 1: Supplies and Materials

For this project, you will need the following materials:

  • M5StickC - $25 on Amazon
  • Male 8-pin header - $1 at Parts store or salvaged
  • Round Force-Sensitive Resistor (FSR sensor) - $7 on Adafruit
  • 10k Ohm Resistor - $0.50 at Parts store or salvaged

Overall, it should cost you less than $40 to build.

It is highly recommended that you have the following supplies:

  • Wire Strippers/Cutter
  • Soldering iron w/ solder
  • Tweezers
  • Hot glue or UV glue (to isolate connections)
  • A piece of large heat-shrink (to protect the circuit)

Step 2: Wiring and Schematic

The assembly will take anywhere from 15 mins to an hour, depending on your skill with soldering. Place the M5StickC on its back. Be careful when soldering and do not overheat the header pins or the FSR sensor or you might melt its terminals.

Instructions:

  1. Insert the header pins into the top of the M5StickC.
  2. Lay the 10k ohm resistor across Gnd and G36. Solder it.
  3. Cut the G0 and BAT terminals using your wire snippers. We don't need them. Put hot glue or UV glue on top.
  4. Solder one terminal of the FSR sensor to the 3V3 pin.
  5. Solder the other terminal of the FSR to the G36 pin.
  6. Put a large piece of heat-shrink on top of the circuit to protect your connections.

Step 3: Upload Firmware

Now that your hardware is prepared, you will need to upload the firmware to get the project working. Since this project involves the M5StickC, you will need to make sure you have the M5Stick library. Also, we will be using the OneButton library to handle button press events. Make sure you have both libraries installed. Also, make sure you have the M5StickC board profile by using the Arduino IDE "Board Manager".

Explanation of code for those technically inclined:

  • The M5Stick library included because we are using the M5.LCD commands to show objects on the display.
  • On the display, we plan to have a couple of text items, a custom progress bar to show the FSR, and a few icons that get drawn on the display to guide the user when leveling.
  • The OneButton library is included because we want to handle button events in an organized and scalable manner. In the future, DoubleClick events can be used for additional functions.
  • We are using EEPROM to store a calibrated setpoint integer between 0-127. This number is retrieved during the powering up of the device. A "tick mark" is shown on the progress bar to indicate the setpoint.
  • A "rainbow style" progress bar is drawn. A function is written to visually show the pressure applied to the FSR. The progress bar takes values from 0-127.
  • To recognize whether the print bed is leveled, a function to calculate percent error is written. In this function, we provide the setpoint as the exact value and the current pressure reading as the actual value. If the percent error falls below a threshold (typically set between 5-8%) then the device considers the print bed as leveled.
  • When the print bed is leveled, the LED is lit and a "thumbs up" icon is shown. When the print bed has a percent error beyond the threshold, the appropriate icon (clockwise or counterclockwise) is shown to assist the user in adjusting the print bed screws until it becomes leveled.
  • When the user presses Button A (large button), the device takes the current pressure reading, sets that as the setpoint, and stores the value in the EEPROM. This value gets restored when the device is power cycled on and off.
  • When the user presses Button B (right-side button), the M5Stick powers itself off.

Download my code on Github: https://github.com/dominicklee/3D-Print-Bed-Leveler

Step 4: Calibration and Test

Now that you've uploaded the code to the microcontroller, let's test it. Unfortunately, you will have to manually level your 3D printer by hand one more time. Hopefully, it's the last time!

Then follow these instructions to calibrate your device:

  1. Home the XYZ axes of your 3D Printer. Power off the stepper motors.
  2. Move the extruder to any area of your 3D print bed. Insert the FSR sensor between the nozzle and print bed.
  3. Hold the M5Stick by hand and press Button A (the large button).

Quick tip: Do not place your M5Stick on the print bed when doing the calibration. When you push the button, you would be also pushing on the print bed, and that will affect the FSR reading.

At this point, the red LED should be lit. You've calibrated your device and it's ready to use!

Step 5: Usage

This is how you would level your 3D printer:

  1. To turn on the M5Stick, push the power button on the left side (might be obvious by now).
  2. Home the XYZ axes of your 3D printer.
  3. Insert the FSR sensor between the nozzle and the print bed.
  4. Look at the icon shown. If you see "thumbs up" with an LED, it is leveled. Otherwise, turn your bed screw in the clockwise/counterclockwise direction indicated by the icon.
  5. Repeat steps 3 and 4 until all the corners of your print bed light up.

Remember to turn off your device afterward by pressing the right-side button.

Let me know if you have any comments, questions, or suggestions. In the future, I may offer an assembled version of this project on Tindie. PM me if you are interested to get one. I would be happy to hear from you!

Anything Goes Contest

Participated in the
Anything Goes Contest

2 People Made This Project!

Recommendations

  • Big and Small Contest

    Big and Small Contest
  • For the Home Contest

    For the Home Contest
  • Make It Bridge

    Make It Bridge

40 Comments

0
daniel_234_199
daniel_234_199

Question 5 months ago

hi everyone have question regarding M5stickc plus ?? i have download arduiuno 1,8,1,8 vers and 2.0 but i want to upload the program (3D Print Bed Leveling Tool Using M5StickC) it says error all the time non can help me more some described or with pictures showing steps per step please

0
Penguin-fach
Penguin-fach

Question 5 months ago on Step 5

I am attempting to build this with an M5StickC Plus, but when I try to compile the firmware, the EEPROM library is not recognised, and it is not listed as an option in the Arduino library manager. After playing around it appears that access to the EEPROM library is board-specific, so this must be missing from the M5StickC and M5StickC Plus board definitions. Not sure how to get around this without getting whoever maintains those definitions to update them.

0
Jack_Spot
Jack_Spot

2 years ago

Interesting, Is it possible to use a M5StickC plus instead of the M5StickC while using the maximum screen resolution of the M5StickC plus?

0
Jack_Spot
Jack_Spot

Reply 2 years ago

I just read the message from Goldjunge491 and your answer.
So let us know when you have do this.

0
methtaylor31
methtaylor31

Question 1 year ago on Step 3

For the life of me I can’t figure out how to program this thing. Is there anyway that anyone can post a detailed video from start to finish on how to program the M5Stick with this code.

0
Srobinson9305
Srobinson9305

1 year ago

I love the thought of using this but I can't get it to be less than the max value. Essentially, when I place it between my print head and the bed when it's at the distance that it should be, the chart is over the limit of the scale when calibrated therefore when I use it on my other test points if it's anything off the chart then it says it's good. Is there a way to readjust the maximum pressure?

0
imalan54
imalan54

1 year ago

Hi, I'm trying to upload your code to my M5StickC with arduino 1.8.13 and I get an error on this line " M5.Axp.PowerOff(); " while compiling. The error says " 'class AXP192' has no member named 'PowerOff' " How do I fix this? Also I have all the libraries installed.

0
del-robinson
del-robinson

1 year ago

Hi, great bit of kit. any chance of adding a little battery level % or icon to the screen please. In addition i also agree with mcdc_repairs about a numeric value

Cheers

0
mcdc_repairs
mcdc_repairs

2 years ago

1st of all, thank you for an amazing project!

Just a quick question, Is there any chance of adding to the screen some kind of numeric value?
It would be much more precise and easier to remember.

Thanks in advance.

0
kjellgnilsson.kn
kjellgnilsson.kn

Question 2 years ago on Step 4

I've just managed after 3 days to upload the code. Had to buy a USB 3.1 to USB-C cable. The included USB 2.0 cable didn't work. So far so good. Must be something I have missed!
When I level my bed the old way I use a A4 sheet about 0.1 mm thickness. What I don't understand how I will be able to slide the FSR sensor, which have a thickness of 0.5 mm between the nozzle and the heat bed for calibration and leveling. Is my FSR sensor too thick or have I got it all wrong how the calibration works?
Hope you have a good answer to help me.
Best regards, Kjell

0
dnicky2288
dnicky2288

Answer 2 years ago

Nice question. A couple of things to note. To my knowledge, the M5StickC usually comes in a box with its own little USB-C cable. The M5Stick Plus does not come with a cable in some cases (hope they would provide one).
Regarding the theory of leveling the print bed, the way that a 3D print bed is leveled is by measuring the distance between the print bed and the extruder tip. Whenever the print bed touches the extruder tip, force is exerted. So as you said, even if your FSR has a thickness of 0.5mm, it should technically be fine if the nozzle squeezes against the print bed. Understand that the FSR is designed to measure force, not distance. So this application would be ideal, even if the friction by using the FSR feels more than your A4 sheet with 0.1mm thickness. The sensor values are generally more accurate and forgivable than your "feeling friction" on a piece of paper.

Also, you do not have to "slide" the FSR like you did on the piece of paper. You can just gently push down on the print bed to insert the FSR sensor. Then press the calibrate button. Your print bed is likely supported on metal springs that generally have a slight margin of error. This error is hard to visualize by hand, but easy to see via the bed leveling tool. Alternately, you can keep "Calibrating" the sensor until you have a proper first-layer on your print.

Hope this helps!

0
kjellgnilsson.kn
kjellgnilsson.kn

Reply 2 years ago

Thanks for your prompt answer,
This explanation made me to understand how it works, maybe you should have mentioned it in your description that you have to push the bed to slice the sensor in between the extruder tip and heat bed as it thicker then the distance between the extruder tip (0,5 mm). It would make it more clear to understand. It did work but I had problem to find the hot spot for the sensor as it is obstructed by the print head. Also the problem with heated nozzle vs the heated bed. I'm sorry to say, it still not such a hassle to level the bed manually with an A4 sheet. Anyway, it was a great project and I learned a lot of it. I hope I don't offend you.
Thanks and best regards Kjell Nilsson

1
bwmitchem
bwmitchem

2 years ago

Built it and worked great. Was thrown off at first because the calibrate word didn't disappear after calibration, but after moving and seeing that it gave the thumbs up and the scale was at about (as far as my eyes can tell) the same place I was ok.

0
dnicky2288
dnicky2288

Reply 2 years ago

Great! I'm glad it worked out for you! Yeah the "Calibrate" and "Off" text are labels. They don't change...its just to indicate the button's function

0
AverageCanadian
AverageCanadian

2 years ago

Looking for a little guidance. Not all that familiar with flashing with Aurdio but I'm getting an error when I try to Verify.

OmniLevel_3Dprint_leveler:28:14: error: 'G10' was not declared in this scope
int ledPin = G10;

I made sure to include eeprom.h through the menu system sketch --> include library --> eeprom.

Is that not the way to do it?

0
dnicky2288
dnicky2288

Reply 2 years ago

The Arduino IDE doesn't know what G10 by default. You need to first install the ESP32 core for Arduino. To do that, click File -> Preferences. Then in Additional URLs, put in this line: https://raw.githubusercontent.com/ espressif/arduino-esp32/gh-pages/ package_esp32_dev_index.json

Then click Tools -> Boards. Then click Board Manager and type in esp32. Install the v1.0.4 core and then make sure M5StickC is selected as your board. Check your COM port as well.

If it still doesn't know what G10 is, just replace it to 10. That is in case you did everything above.

0
AverageCanadian
AverageCanadian

Reply 2 years ago

Thanks! I actually did have v1.0.4 installed but from a different link. Perhaps it was corrupt, anywho, got it up and running now. Can't wait to get a chance to test this out, hopefully have time on the weekend

0
Goldjunge491
Goldjunge491

Question 2 years ago on Step 5

Hi nice work,
Can I use the M5StickC PLUS?