Welcome! Log In Create A New Profile

Advanced

Capacitive Proximity Sensor problems.

Posted by dragonizer 
Capacitive Proximity Sensor problems.
June 17, 2016 08:41AM
Hi everyone.

I am having trouble with a Capacitive Proximity Sensor for Auto Bed Levelling.

The sensor detects the bed, and it is registered by the Arduino, so it is not a hardware problem. (I used M119 to check already.)

The limit gets ignored and the nozzle crashes into the bed when it probes. The offset should be correct. 10mm is the distance between the nozzle and the bed when the sensor triggers.

I am using Marlin firmware on a modified Kossel, and a CJM18M-8N1 NPN Capacitive Proximity Sensor. It is rated for 6V to 36V but 5V seems to work fine (in terms of hardware.)

This is the section for Bed Leveling in my Configuration.h
#define AUTO_BED_LEVELING_FEATURE // Delete the comment to enable (remove // at the start of the line)
//#define DEBUG_LEVELING_FEATURE
//#define Z_MIN_PROBE_REPEATABILITY_TEST  // If not commented out, Z Probe Repeatability test will be included if Auto Bed Leveling is Enabled.

#if ENABLED(AUTO_BED_LEVELING_FEATURE)

  // There are 2 different ways to specify probing locations:
  //
  // - "grid" mode
  //   Probe several points in a rectangular grid.
  //   You specify the rectangle and the density of sample points.
  //   This mode is preferred because there are more measurements.
  //
  // - "3-point" mode
  //   Probe 3 arbitrary points on the bed (that aren't collinear)
  //   You specify the XY coordinates of all 3 points.

  // Enable this to sample the bed in a grid (least squares solution).
  // Note: this feature generates 10KB extra code size.
  #define AUTO_BED_LEVELING_GRID  // Deltas only support grid mode.

  #if ENABLED(AUTO_BED_LEVELING_GRID)

    // Set the rectangle in which to probe
    #define DELTA_PROBEABLE_RADIUS (DELTA_PRINTABLE_RADIUS - 10)
    #define LEFT_PROBE_BED_POSITION -(DELTA_PROBEABLE_RADIUS)
    #define RIGHT_PROBE_BED_POSITION DELTA_PROBEABLE_RADIUS
    #define FRONT_PROBE_BED_POSITION - (DELTA_PROBEABLE_RADIUS - 40)
    #define BACK_PROBE_BED_POSITION DELTA_PROBEABLE_RADIUS - 40

    #define MIN_PROBE_EDGE 10 // The Z probe minimum square sides can be no smaller than this.

    // Non-linear bed leveling will be used.
    // Compensate by interpolating between the nearest four Z probe values for each point.
    // Useful for deltas where the print surface may appear like a bowl or dome shape.
    // Works best with AUTO_BED_LEVELING_GRID_POINTS 5 or higher.
    #define AUTO_BED_LEVELING_GRID_POINTS 5

  #else  // !AUTO_BED_LEVELING_GRID

    // Arbitrary points to probe.
    // A simple cross-product is used to estimate the plane of the bed.
    #define ABL_PROBE_PT_1_X 15
    #define ABL_PROBE_PT_1_Y 180
    #define ABL_PROBE_PT_2_X 15
    #define ABL_PROBE_PT_2_Y 20
    #define ABL_PROBE_PT_3_X 170
    #define ABL_PROBE_PT_3_Y 20

  #endif // AUTO_BED_LEVELING_GRID

  // Z Probe to nozzle (X,Y) offset, relative to (0, 0).
  // X and Y offsets must be integers.
  //
  // In the following example the X and Y offsets are both positive:
  // #define X_PROBE_OFFSET_FROM_EXTRUDER 10
  // #define Y_PROBE_OFFSET_FROM_EXTRUDER 10
  //
  //    +-- BACK ---+
  //    |           |
  //  L |    (+) P  | R <-- probe (20,20)
  //  E |           | I
  //  F | (-) N (+) | G <-- nozzle (10,10)
  //  T |           | H
  //    |    (-)    | T
  //    |           |
  //    O-- FRONT --+
  //  (0,0)
  #define X_PROBE_OFFSET_FROM_EXTRUDER 0.0     // Z probe to nozzle X offset: -left  +right
  #define Y_PROBE_OFFSET_FROM_EXTRUDER 40.0    // Z probe to nozzle Y offset: -front +behind
  #define Z_PROBE_OFFSET_FROM_EXTRUDER -10.0     // Z probe to nozzle Z offset: -below (always!)

  #define XY_TRAVEL_SPEED 8000         // X and Y axis travel speed between probes, in mm/min.

  #define Z_RAISE_BEFORE_PROBING 10   // How much the Z axis will be raised before traveling to the first probing point.
  #define Z_RAISE_BETWEEN_PROBINGS 10 // How much the Z axis will be raised when traveling from between next probing points.
  #define Z_RAISE_AFTER_PROBING 20    // How much the Z axis will be raised after the last probing point.

  #define Z_PROBE_END_SCRIPT "G28" // These commands will be executed in the end of G29 routine.
                                                                             // Useful to retract a deployable Z probe.

  // Probes are sensors/switches that need to be activated before they can be used
  // and deactivated after their use.
  // Allen Key Probes, Servo Probes, Z-Sled Probes, FIX_MOUNTED_PROBE, ... . You have to activate one of these for the AUTO_BED_LEVELING_FEATURE

  // A fix mounted probe, like the normal inductive probe, must be deactivated to go below Z_PROBE_OFFSET_FROM_EXTRUDER
  // when the hardware endstops are active.
  #define FIX_MOUNTED_PROBE

  // A Servo Probe can be defined in the servo section below.

  // An Allen Key Probe is currently predefined only in the delta example configurations.

  // Enable if you have a Z probe mounted on a sled like those designed by Charles Bell.
  //#define Z_PROBE_SLED
  //#define SLED_DOCKING_OFFSET 5 // The extra distance the X axis must travel to pickup the sled. 0 should be fine but you can push it further if you'd like.

  // A Mechanical Probe is any probe that either doesn't deploy or needs manual deployment
  // For example any setup that uses the nozzle itself as a probe.
  //#define MECHANICAL_PROBE

  // Allen key retractable z-probe as seen on many Kossel delta printers - [reprap.org]
  // Deploys by touching z-axis belt. Retracts by pushing the probe down. Uses Z_MIN_PIN.
  //#define Z_PROBE_ALLEN_KEY

Please help me check if I have done anything wrongly. Let me know if you need any other information or any pictures.

An advanced thanks,
dragonizer
Re: Capacitive Proximity Sensor problems.
June 17, 2016 11:45AM
Change the voltage to 12 volts and use a 7805 regulator for the signal, your signal at 5 volts is too weak.
Re: Capacitive Proximity Sensor problems.
June 18, 2016 07:56AM
Thanks for your reply,

I tried your advice, but it still did not work. When I attached a regulator to the signal line, the LED on the sensor lights up constantly, even when the bed is far away from the sensor.

Tried using some decoupling capacitors and they didn't work either. Next solution will be to use opto-couplers. Will update again.

dragonizer.
Re: Capacitive Proximity Sensor problems.
June 18, 2016 01:56PM
Check in your firmware for the pull up resistor and be sure is enabled, and also the logic of the endstop might be inverted.
Re: Capacitive Proximity Sensor problems.
June 18, 2016 02:37PM
Hi ggherbaz,

The bed detecting have no problem. Pullups are enabled, logic is inverted as it is a Normally Open model.

The problem is that the detection is ignored and the print head continues to lower pass the software limit of the minimum Z (which is 0), causing the nozzle to crash into the bed.

It might have been the inadequate voltage supply to the sensor, lengthening the time it takes to sense the bed. Or it might be a bug in the codes (I doubt so though). I will try again once the opto-coupler arrives.

Thanks for your suggestions!
Re: Capacitive Proximity Sensor problems.
June 18, 2016 04:56PM
Ok, so your problem is on the offsets, can you test reducing your Z offset about 2 or 3mm?

Your actual detection might be shorter than actual sensor to nozzle distance.
Sorry, only registered users may post in this forum.

Click here to login