Reprap Load Cell Z-Probe

Introduction: Reprap Load Cell Z-Probe

I have been looking at adding Z-probing to my Prusa i3 for awhile. Having to flip down a contact Z-probe seemed unnecessarily painful and the probe, at best, would approximate the height of the nozzle tip. Force sensing resistors are another option which appear to work well, though getting the mountings exactly right can be a pain.

A load cell, as used in cooking scales, seemed to be a good idea. The load cell could become the main mounting beam between the carriage and the hot end.

There are several issues that had to be overcome in the design to make sure that

  1. the setup was sufficiently sensitive without false triggers – particularly from dynamic loads as the head moves around;
  2. various things that might cause false (or missed) triggers; and
  3. that the whole setup didn't drift over time.

Its operation is simple.

The HX-711 board continuously samples the weight of the extruder head (80 per second) which hangs on the end of the load cell. It transmits samples to the Arduino Nano.

The Nano raises a DigitalPin when the weight reduction from the nozzle touching the bed passes a pre-determined value.

This is picked up by the printer firmware using an unallocated digital input.

To counter drift, another digital output on the controller is used to trigger a re-zero (M42), just before a Z-probing is started.

The reference setup for this Instructable is:

  • RepRap Prusa i3
  • RAMPS 1.4 electronics
  • Geeetech Mk8 extruder
  • Heated bed with 3 point mounting
  • Repetier Firmware (0.92.8) and
  • Repetier Host 1.6.0

If your setup varies from this, you'll need to make adjustments!

Step 1: Get the Parts

  1. 1 kg (2lb) load cell (YZC-131 or similar). Size: 75-80mm x 12.7mm x 12.7mm (there are other smaller load cells that might work quite well, but don't fit my plastic parts).
  2. HX-711 sensor board.Arduino Nano V3.0 (5V, Atmega328) not the Arduino Pro Mini.
  3. A 2 x 3 female IDC cable at least 800mm long (or 2 x 3 header socket)
  4. Two part plastic mount for the extruder (Load_Cell_Extruder_Mounts).

The total cost of the parts is around $20 on eBay.

Step 2: Print the Plastic Parts

Print the front and back parts (files here) of the mount.

The design is for a Prusa I3 carriage and an extruder/hot end with a NEMA 17 motor.

The additional file is for a cooler duct that fits a 50 x 50 x 15 blower fan. Break off the six tags after printing - they are just to help bed adhesion.

    Step 3: Connect Electronics

    Don't install the header pins onto the Nano.

    The Nano will be installed with the USB port at the top and to the outside.

    Wire the HX-711 and Arduino Nano together. 75mm of cable should be enough.

    • 5V Power: HX-711 VCC - Nano VCC [J2 Pin 4] (not VIN)
    • GND: XH-711 GND - Nano GND [J1 Pin 4]
    • Data: HX-711 DT - Nano D5 [J1 Pin 8]
    • Clock: HX-711 SCK - Nano D6 [J1 Pin 9]

    Wire the Nano to RAMPS cable. I made my cable 800mm long.

    • 5V Power: Nano VCC [J2 Pin 4] (not VIN) - Cable Pin 3
    • GND: Nano GND [J1 Pin 4] - Cable Pin 1
    • Ztrigger: Nano D4 [J1 Pin 7] - Cable Pin 5
    • Tare Pulse: Nano D3 [J1 Pin 6] - Cable Pin 6

    Attach HX-711 and Nano to hot end rear mount, mount load cell onto the back mount and connect up the wires. Tuck the spare load cell wiring under the HX-711 board, with a piece of electrical tape to hold it temporarily in place.

    Finally, Wire the load cell to the HX-711:

    • Sense Power (Vavdd): LoadCell Red Wire - HX-711 E+
    • Sense Ground: LoadCell Black Wire - HX-711 E-
    • Cell -: LoadCell Green Wire - HX-711 A-
    • Cell +: LoadCell White/Purple Wire - HX-711 A+

    Step 4: Assemble the Mount

    Assemble the rest of the mount.

    The order is important as many of the screws get hidden at later stages.

    1. Load cell to rear mount.
    2. Rear mount to carriage
    3. Front mount to Load cell
    4. Extruder to front mount
    5. Fan duct to front mount (optional)
    6. Cable tie all cables to both front and back mounts so that cables are securely restrained and are parallel to the load cell. Do not leave any cables out of the bundle as this will produce erratic readings as the carriage moves around!

    Step 5: Firmware and Calibration

    Connect the Nano to your computer via the USB and download the firmware using the Arduino IDE.

    With the Nano still plugged in via the USB (and with your printer off), when the hot end is lightly pushed UP with your finger to simulate a z-probe (grams of pressure here, rather than kilograms!) the LED on the Nano should light.

    If not, enable SERIAL_ON in the code and use a terminal program (e.g. Putty) to debug the readings from the load cell (see Step 7 - Debugging ).

    If you're getting negative numbers with upward pressure to the hot end, either reverse the A- & A+ wires from the load cell or make the calibration_factor a negative number.

    If you're not getting readings of the order of 100 – 1000 when light upward pressure is applied, adjust the calibration_factor, which should be around +500 with some (50g) pressure applied. I use a stack of three Australian 50c coins balanced on top of the outer mounting screws on the load cell to provide a ~50g weight.

    If the reading is drifting (normal), just press the reset button on the Nano, which will reset the reading to zero. resetting the scale to zero (Tare) is triggered by the M42 command at the start of the Z-probe sequence.

    Step 6: Speeding Up the Readings

    Now comes the delicate part: changing the reading rate on the HX-711 from 10 samples per second to 80. This significantly improves the accuracy of the Z-probing.

    On the cheaper boards there isn't a link that can be cut to enable this change, so the pin needs to be disconnected from GND and tied to VCC. Cut pin 15 just above the solder line, and bend it up.

    Scrape a little of the protective coating off the track just above pin 16 and connect pin 15 to that track. I've used a 10k resistor, but that's not strictly necessary, a direct connection with wire is OK.

    If you have bought a "red" board, then there is a link on the back. Cut it to make the rate 80 samples per second.

    Step 7: Final Testing and RepRap Setup

    Add a Jumper to the Power header on the RAMPS to connect the Servo header 5V pins to Arduino-supplied VCC.

    Plug the header Cable into the RAMPS controller (SERVO pins).

    In your Reprap firmware

    1. Enable Z-probing, with Digital Pin 5 as the sensing pin. No pull-up. Z-probe true when HIGH.
    2. I use
      • 2 probe repetitions at each point
      • 0.5mm probe switching distance
      • 1mm/sec probing speed
      • The defaults for most of the other Z-Probe settings work OK

    3. Set up the tri-point bed leveling points. I have found that 15mm inside the three bed height adjusting screws works well.

    My "auto level" script is simple and stored as a “push-button” script in my Repetier Host desktop controller. Digital Pin 4 is pulsed by the firmware (M42) to signal a re-zero at the start of each probing cycle.

    M42 P4 S1 ; zero the load cell by pulsing Digital Pin 4

    M42 P4 S0

    G32 S0 ; bed level and store

    Setup is now complete and everything should work.

    Step 8: Debugging

    Can't load Firmware

    • Check the bottom of your Nano – if the chip is marked CH340G or similar, you need to install the correct drivers. This Instructable should help: Arduino Nano CH340.

    No triggers

    Check the following:

    • Output is increasing when pressure is applied to push up the extruder (i.e. as the extruder pushes against the bed). If the readings are decreasing, then either reverse the A+ A- wires from the load cell, or make the calibration_factor negative in the Nano firmware.
    • All the stuff below.

    False or inconsistent triggers

    Check the following:

    • Nano is not zeroing the readings before each probe sequence (M42 S1/S0 sequence) and the unloaded reading has drifted. The terminal interface (Putty) is the best way to check this behaviour. The set-up can also be zeroed by resetting the Nano (small push button).
    • M42 command not supported by your firmware. Manually reset nano before probing.
    • All cables from the extruder are securely cable tied at both ends of the load cell and run parallel to the load cell beam..
    • Insufficient slack in filament between reel and extruder (extra pull up tension on extruder).
    • Blobs of filament on the end of the nozzle.
    • Calibration factor is incorrect – doesn't produce readings of around -500 (anywhere between -300 and -700 should be OK) when 50g weight is applied. Adjust calibration_factor factor in Nano firmware.

    Be the First to Share

      Recommendations

      • Teach With Tinkercad Contest

        Teach With Tinkercad Contest
      • Microcontroller Contest

        Microcontroller Contest
      • Fiber Arts Challenge

        Fiber Arts Challenge

      16 Comments

      0
      cpretorius
      cpretorius

      Question 1 year ago on Step 5

      Ive got it all working. But for the life of me I can not get the light to stop flickering when no load is applied. Ive taken the hysterisis up to 1023

      0
      palmerr23
      palmerr23

      Reply 1 year ago

      Two possibilities:

      Most likely you need to adjust PROBE_HVAL - as every setup will be generating different values.

      Turn SERIAL_ON and watch the "reading" values coming out of the USB Serial. Set the #define value to something that is a "light hit" - say pushing your finger solidly against the bottom of the extruder. Then you should be able to take hysteresis back down to 50 or so. "Probe_hit" should reliably turn on and off when you repeat the pressure and release.

      Sometimes it just needs a power reset - as the Load Cell does a Tare during setup().

      Hope this helps.

      0
      cpretorius
      cpretorius

      Reply 1 year ago

      I get 0,1 when probe is hit and a value of about 59000 every few milliseconds

      0
      palmerr23
      palmerr23

      Reply 1 year ago

      OK, that seems high. Is it varying (I expect that it is, given the 0,1 when probe is hit)?

      It's safe to put a delay() into the main loop while testing so that you're not flooded with readings.

      Are you getting an indication that the scale is completing the Tare function first time through (hard to tell with thousands of readings a second!)?
      After tare is completed, you should be getting readings close to zero (as the 'no load' value is automatically subtracted by the HX711 library).

      Tare is currently triggered by an interrupt on the rising edge of pin 3. Maybe try a delay of say 3 seconds in setup() and then setting tare_now = true, and disable the interrupt.

      setup()
      ...
      // pinMode(TARE_PIN, INPUT_PULLUP); // signal from RAMPS to triger zero set
      // attachInterrupt(digitalPinToInterrupt(TARE_PIN), tare_int, RISING);
      // interrupts();
      delay(3000); // allow HX711 to start
      tare_now = true;


      0
      cpretorius
      cpretorius

      Reply 1 year ago

      Thanks for the reply. I am using the Red Board. And this one has VCC and VDD. I connected VDD also and....well...bobs your uncle. It works now.

      0
      palmerr23
      palmerr23

      Reply 1 year ago

      Good to hear. Have fun with it!

      0
      cpretorius
      cpretorius

      Reply 11 months ago

      YO...me again. what numbers can I change to make the bowden tube stop triggering the loadcell...I cant place the bowden to make it stop

      0
      palmerr23
      palmerr23

      Reply 11 months ago

      Ah, I haven't tried this with a Bowden tube extruder!
      I'm assuming that it's false triggering while you're attempting to probe.
      What reading fluctuations are you getting with the extruder cable connected?
      Try slowing down the loop (say delay(500);) and inserting a diagnostic print on "reading".
      The values to change are:
      #define PROBE_HVAL 1500 // something representing a firm contact #define HYSTERESIS 50 // stop chatter - increase if light flickers
      I'd start with HYSTERESIS if the variation, while probing is underway, exceeds the current value.
      Then set PROBE_HVAL so that only a frim touch triggers the probe.

      Hope that helps.

      0
      cpretorius
      cpretorius

      Reply 11 months ago

      Im assuming HVAL must be higher for a more firm touch?

      0
      palmerr23
      palmerr23

      Reply 11 months ago

      Yes, that's my recollection. My probe has been working reliably for 6 years without needing any work, so the detailed memories are starting to fade!

      I'm about to pull apart my 3D printer controller to do some other work (RAMPS 1.4 upgrade to RAMPS 1.6 as the hot bed FET finally burnt out), so I'll play with the parameters while I have things accessible.

      0
      mlynigor
      mlynigor

      Question 11 months ago

      Hello,
      I am curious why did you write that it has to be Arduino nano and not Arduino Pro Mini.
      Is this due to lack of usb port? Or there is other reason?

      I am asking because I would like to use something smaller like Beetle or Seeeduino XIAO.

      0
      cpretorius
      cpretorius

      Question 1 year ago on Step 6

      Any idea what the code would be to use this setup on a duet wifi board with duex5 expansion?

      0
      palmerr23
      palmerr23

      Answer 1 year ago

      The code to run the loadcell is in the Arduino Nano (code download is at Step 5). The Nano needs to be retained with the duet/duex5. It makes the load cell look like any other touch probe. As long as your firmware offers touch probe auto-levelling, then all you should need to do is tell it which pin on the duet/duex5 the probe is connected to. My auto-levelling code (Repetier firmware) looks like this:

      ; probe and autolevel
      G28 X ; just home x y
      G28 Y
      M42 P4 S255 ; pulse TARE line
      M42 P4 S0
      G4 P1000 ; wait a second for HX711 reset
      g32 s0 ; bed level
      M320 ; activate level


      ;sometimes I get a better print just using the Z setting feature without autolevel
      m321; turn off auto level

      My firmware settings are in the images.

      Hope this helps!

      repet auto 2.pngrepet auto 1.png
      0
      cpretorius
      cpretorius

      Reply 1 year ago

      I use reprap firmware. Just not sure how to connect the nano to the duet and let it talk to the duet as a z probe.

      0
      palmerr23
      palmerr23

      Reply 1 year ago

      OK, that's straighforward.

      Check which pins on the duex5 are available for input expansions on the GPIO/I2C header. Simply assign one of these to the task in your firmware generator (don't use repRazp firmware, so no sure how this is done) and connect the output of the Nano to this pin (and a wire to ground of course!)

      This page https://duet3d.dozuki.com/Wiki/Connecting_a_Z_probe seems to have the answers.