LED 3D Printer Bed Leveling Tool

30,868

263

33

About: Crazy about technology and the possibilities it can bring. I love the challenge of building unique things. My goal is to make technology fun, relevant to everyday life and help people succeed in building coo...

Being new to 3D printing I found leveling the print bed a challenge, particularly on printers without auto bed leveling. This 3D Printer Bed Leveling Tool uses a Pulse Induction Metal Detection Sensor and a LED Bar Graph to show the relative distance from the Print Head to the hotbed. This is an independent add-on that does not require any code changes to printer firmware or wiring. It is easy to quickly attach to check and tune bed levels then remove.

The sensitivity and stability of the device are illustrated in the video by applying downward or upward finger pressure on the hotbed to see the effect on the LED bar graph. The calibration button on the top of the unit is used to reset the baseline height and recenter the LED indicator to the center of the bar graph.

Step 1: How It Works

The LED 3D Printer Bed Leveling Tool uses a Pulse Induction Sensor Coil powered by an Arduino Nano. The Sensor Coil is made up of a separate TX and RX coil where a pulse is induced into the TX coil which creates an electromagnetic field around the RX coil. The changing field induces a voltage into the RX coil which is detected and amplified before the pulse width of the signal is read by the Arduino.

A smoothing algorithm in the Arduino code is used to remove noise from valid pulses making it very stable. A calibration algorithm in the code takes an average of readings over a short period of startup and sets a threshold to compare the signal against. When a metal object comes within range of the electromagnetic field the field is disrupted and some of the energy is diverted from the RX coil into "Eddy currents" that form in the target object. This parasitic effect of the target object results in the pulse width detected in the RX coil reducing. Essentially we are measuring the loss of power into the target object.

An algorithm is used to translate the pulse width variation into an LED Bar Graph to show the relative distance between the coil and the printer bed.

A calibration button is provided to reset the Bar Graph to the current height so it can be used as a reference for the rest of the unit.

This circuit for this has evolved over the past 18 months into a very stable and reliably performing detector. The coil configuration and orientation have been deliberately designed to maximize stability.

Step 2: Gather the Materials

Parts List

  1. Arduino Nano with USB Cable and header pins
  2. Lm339 Integrated Circuit
  3. BC548 Transistor
  4. 2N7000 FET
  5. WS2812 LEDs X 10
  6. 10nF polyester capacitor
  7. 18nF polyester capacitor
  8. 150pF ceramic capacitor
  9. 0.3mm Diameter Enamel Copper Wire (approx 3M length)
  10. Resistors 2.2k, 47R, 1M, 1K
  11. Vero Board 21x7 holes
  12. 6mm SPST Micro Tactile Push Switch
  13. Hookup Wire
  14. External USB power bank

Step 3: 3D Print the Case

The 3D printed case can be done using a single print and the dimensions and 3D files can be found here on Thingiverse.

Note: This unit has been specifically designed for Creality Ender 3 printers however the shape could be modified for other units. The only prerequisite would be that the printer bed is made of metal.

Step 4: Build the Sensor Coil

Take the inner and outer coil formers and wind 20 turns of copper wire around each former ensuring there is a good 15 cm of additional wire at the end for connecting to the PCB. Use the two holes provided in each former to provide an entry and exit point for the copper wire as per the photograph.

Use hot glue to tack the coils into place so they do not unwind.

Gently push the inner coil into the outer coil and ensure the four 15cm ends are oriented as per the diagram.

Thread the four wire ends through the main body of the unit through the four wire guide holes provided in the print as per the diagram.

Gently push the coils into the head of the unit as per the photograph provided. Ensure you can identify which wire corresponds to which coil so you can connect to the PCB in a later step. (Don't glue these in place until the last step as the LEDs need to be added and tested first)

Step 5: Build the Circuit

I recommend using a BreadBoard to test the circuit with your coils to ensure you have the coils wound correctly and the circuit components assembled correctly before transferring to Vero Board.

I have provided a picture of the Oscilloscope traces you should see on D2, D3 and the Transistor RXR Output for troubleshooting purposes.

The Arduino Nano requires header pins to be installed to connect to the Vero Board.

Check the position of the Vero board and Arduino Nano as indicated in the photographs. These are oriented by the guides in the 3D print however were tacked into place using hot glue to ensure minimal movement.

The LED bar graph is made from 10 WS2812 LEDs connected via 3 wires then ho glued into the main chassis and aligned to the holes.

Once this is in place and the circuit tested you can glue in the coil formers.

Step 6: Assembling and Testing the Unit

Final Assembly and Testing

Connect the search coils to the PCB and connect to your Desktop device with the Arduino IDE to load the code. Included in this step is the Arduino INO code file that will be needed to test and operate the unit. Before loading the Arduino code you will need to add the Library "FastLED.h" as a library to drive the WS2182 LEDs.

You can easily test by turning on the IDE Plotter function that will provide a pulse width graph of approximately 480uS for this circuit.

Note:

1.The polarity of the search coils does make a difference to performance. My advice is once you are connected, if there are issues try reversing the polarity of the TX or RX coil as this changes the phase of the signal. See optimal output on oscilloscope traces provided.

2. Breadboard testing yields lower pulse width outputs (Approx 250uS) than the final assembled unit (Approx 480uS). This is likely due to the 3D Housing introducing some stray capacitance into the overall circuit, nothing to be concerned about as the difference is improvement to sensitivity.

Once tested you are ready to put into position on the printer.

Final Testing on your 3D Printer

The sensitivity and stability of the device are illustrated in the video by applying downward or upward finger pressure on the hotbed to see the effect on the LED bar graph.

The calibration button on the top of the unit is used to reset the baseline height and recenter the LED indicator to the center of the bar graph.

Operation instructions for the Ender 3
1. Attach the Bed Leveling unit to the print head by pushing onto the stock housing. Connect the USB power to the unit. You should see a power-up sequence on the LEDs.

2. Adjust Z axis manually down by turning the Z-Axis drive thread until you just hear the microswitch activate with a click.

3. Push the calibrate button (gently so as not to move the carriage down or up). Once calibrated a LED should be somewhere in the center of the bar graph.

4. Shift the head across the X and Y axis as in the video to determine the relative height of each part of the bed.

5. Print the Test Print with the test print file provided and use the Bed Leveler and test print to quickly validate heights. If the LED on the Bar Graph goes down below the reference then the Bed is lower so needs moving upwards. As you adjust the bed level you will see the LED move up to the correct height.

You are now ready to go and use for ongoing leveling of your 3D printer bed!!

Make it Glow Contest 2018

Participated in the
Make it Glow Contest 2018

Share

    Recommendations

    • Paint Challenge

      Paint Challenge
    • Barbeque Challenge

      Barbeque Challenge
    • Growing Beyond Earth Maker Contest

      Growing Beyond Earth Maker Contest

    33 Discussions

    0
    None
    WillemII

    Question 4 months ago

    Hello,
    disregard my Question, to old to see the tree in the middle of the wood.(A german saying) I just found the code.
    Regards WillemII

    0
    None
    WillemII

    Question 4 months ago

    Hello,
    I like your idea where much, have all the parts printed, the electronic parts are all here, ready to be installed, but I miss out the code for the Arduino.I read all the instruction on thingsversie, here on instructatables, even got premium member here to download the PDF, but still there is no code. Can you please provied me the link to your sketch for that projekt. Thanks a lot in advance

    0
    None
    rover109

    Question 6 months ago

    Unless I've missed seeing it you don't give much detail of the layout of the LM339 board. You do give a hint with a picture of the copper side of the 7x21 hole strip board with tracks cut and you must correctly assume that anyone skilled enough to tackle this project will be able to figure it out.
    What did you do about the three unused comparators on the LM339? It's a question that often arises regarding unused op-amps and comparators because of the possibility of stray coupling between output and inputs inducing oscillation with attendant high current drain and HF noise that can be induced into the active unit(s) on the chip. The answers to the possible problem range all the way from biasing all unused inputs to a known state through to grounding all unused inputs and sometimes grounding the unused outputs as well. From my limited understanding the scheme adopted depends on the design parameters of the particular type of chip.
    You report that your design is satisfactorily stable and I'm just wondering what you did about the unused pins or whether its not really a worry in this design.
    The National Semiconductor LM339 datasheet suggests "ALL pins of any unused comparators should be tied to the negative supply."
    OnSemi suggests "It is good design practice to ground all unused INPUT pins." (capitalization is mine)
    I believe it is okay to tie the LM339 outputs to ground because it is an open collector design.
    I will probably tie all unused pins to ground. No trouble to run a shorting jumper from pin to pin.
    I'm still waiting for my LED array to arrive in the mail so I will probably breadboard the LM339 circuit as you suggest while I'm waiting and look for any spurious oscillations with a 'scope and then verify that a grounding scheme does no harm. Then I'll build it onto my bit of stripboard.
    You could either disregard the issue if you are satisfied that floating pins do no harm or you could add a note about it to the Instructable text.

    2 answers
    0
    None
    TechKiwiGadgetsrover109

    Answer 6 months ago

    Hey very good point raised. I havent grounded the other three comparator inputs so its probably worth doing. I have preserved a test jig for the unit as Im developing the next iteration so I will test with and without and see if there is any material difference in stability.

    0
    None
    rover109TechKiwiGadgets

    Reply 6 months ago

    I thought a bit before bringng it up because I didn't want to sound like one of those instant web experts who tell cleverer people where they went wrong. YouTube comments are full of them. But I'm glad to learn that the point simply escaped your attention at the time. Good that you still have the test jig set up and that you have by no means finished developing this concept.

    0
    None

    Great idea. I bought the Cobblebot from Kickstarter and it's a pain to level. With a metal bed, this could do the trick - at least faster than using a dial, provided it's calibrated and each LED means something relevant.

    3 replies
    0
    None
    ChiefInstructorfrarugi87

    Reply 6 months ago

    No. Cobblebot is one of the worst products I purchased. The company ended up being super hostile to users, the instructional manual was made by a 3rd grader, and the company is now in default, so you are on your own. The v-bearing concept should be discarded for screws. In the positive, it was a good price and 80/20 is very sturdy. you get what you pay for. bed leveling is non-existent, so this idea may be of value. If it's faster and more/at least as accurate as other methods, then it's worth it.

    0
    None
    ErwinB19

    6 months ago on Step 6

    sorry to be picky, but you said "Tool" rather than "Sensor" so I assumed !=) it was attached to some screw/small motor config to actually _l e v e l_ the heat platform (small things what I see in eBay...should mount on a base platform... I mean, nowhere have I seen hard degrees vs. hmmm.... size... material...I mean what are the parameters when "imbalanced" becomes meaningful??
    ((On second thought, I guess I'm asking - ungratefully - what can I 3D produce before I need something like this?? Thanks.))

    1 reply
    0
    None
    TechKiwiGadgetsErwinB19

    Reply 6 months ago

    Hey, no problems. This instructable is relevant to individuals who have a 3D printer with manual leveling controls that are adjusted by hand. e.g like the Creality Ender 3
    My experience is if the bed is not level by more than half a layer then there will be bed adhesion and print quality issues.
    It is not mandatory to have a bed leveling tool/device as there is normally a stock procedure you follow to do so.
    The objective of this instructable is to make this process less onerous.

    0
    None
    rryks

    6 months ago

    This is interesting for more than just leveling my 3d printer bed and will be very useful.

    Question though, for the 3d printer, how is this superior to using a good quality dial indicator? Even an average quality dial indicator has .01mm resolution with the better test indicator giving you .0005 inch.

    2 replies
    0
    None
    TechKiwiGadgetsrryks

    Reply 6 months ago

    Hi Im just in the process of trying to accurately measure the incremental change detected for each LED. I’ll post here once I have. What I would say is that I am using with an Ender 3 and it shifts after about 75% turn of a bed nut turn in the cornersof the bed. When you combine this with a test print provided it significantly speeds up the process of leveling om scratch.

    0
    None
    TechKiwiGadgetsTechKiwiGadgets

    Reply 6 months ago

    Also forgot to add one advantage is there is no physical contact required with the bed so this bed can be moving at any speed.

    0
    None
    keesj

    Question 6 months ago

    I presume, that this cannot be used when printing on glass attached on the aluminium base plate of the bed.

    1 answer
    0
    None
    TechKiwiGadgetskeesj

    Answer 6 months ago

    Yes it can be used as that is what my Ender 3 prints on

    0
    None
    rover109

    6 months ago on Step 6

    Had not heard of the ws2812 LED array before but I have now! Your project looks intriguing and for the price of the LED array it looks well worth trying. Everything else is in my junk box and my own Ender 3 is looking for a print job to perform. Will post again to say how my build went.

    1 reply
    0
    None
    pcarew

    Question 6 months ago

    Nice idea for detecting distance.
    I have a few questions for you on this.
    1) Did you 3D print the coil formers?
    I didn't see these in the Thingiverse parts.
    2) Is the inner coil the Tx or the outer?
    3) How did you determine the number of turns to make up the coils?
    Was it trial and error, or did you calculate the req. inductance etc?

    1 answer
    0
    None
    TechKiwiGadgetspcarew

    Answer 6 months ago

    Hi thanks for the questions
    1. Yes the formers were printed and are in the master STL. I have had this feedback so I think its because the formers are on the other side of the print obscured from vision by the main body. Ive put a separate STL file up for the formers for this reason.
    2. Yes the inner coil is TX this is noted on the circuit diagram.
    3. Initially number of coils was trial and error combined with capacitance value. The performance changed when assembked due to stray capacitance. So at this stage I settled on the current number of turns and cap values for consistency. The biggest challenge was getting the PulseIn function to work reliably detcting the pulse as timi is critical. Another reason for publishing the values.