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:
- Insert the header pins into the top of the M5StickC.
- Lay the 10k ohm resistor across Gnd and G36. Solder it.
- Cut the G0 and BAT terminals using your wire snippers. We don't need them. Put hot glue or UV glue on top.
- Solder one terminal of the FSR sensor to the 3V3 pin.
- Solder the other terminal of the FSR to the G36 pin.
- 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:
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.
- 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.
- 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:
- Home the XYZ axes of your 3D Printer. Power off the stepper motors.
- Move the extruder to any area of your 3D print bed. Insert the FSR sensor between the nozzle and print bed.
- 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
1 / 3
2 / 3
3 / 3
This is how you would level your 3D printer:
- To turn on the M5Stick, push the power button on the left side (might be obvious by now).
- Home the XYZ axes of your 3D printer.
- Insert the FSR sensor between the nozzle and the print bed.
- 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.
- 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.
Schematics
Code
Github