Optical Sensor Probe Project

Hey everyone. I’ve been mentioning this project for a little bit and I was thinking that it’s time to start posting my results. Hope you all like it!

Proximity Sensors are nice, but how accurate are they?

We have the Capacitive sensor that can be used on anything with a current, which is good, however it detects electrical current which means different readings for different print bed temperatures. This type of probe can also have different readings based on the ambient temperature in the room and may be affected by dust in the air…

We have the inductive sensor which is limited to metal print beds, is also affected by the amount of current running through its sensing area, can also be affected by ambient temperature and dust as well, and is at least 3x the cost

and we have the mechanical sensors that can be as simple as a microswitch or as complex as the BL Touch sensor (also 3x the cost of the capacitive sensor) . They can sense on any surface but are they really accurate?
With no experience, I can’t say anything about the BL Touch, but the common microswitch was highly inaccurate, and was also affected by the temperature of my print bed…

So, here’s my solution!
Optical Sensor.jpeg
An optical sensor!
This uses a LM393 Dual Differential Comparator IC and will output in Digital and/or Analog

This type of sensor with my probe design can detect distance on any surface with high speed and accuracy, and is not affected by current, print bed temperature, ambient temperature, dust, or humidity.
I’ve designed this to be used as a Z stop probe, however this can be used as an endstop with the simple implementation of a spring and a design tweek.

So now the fun stuff:

List of Parts:
Parts.jpg
1x Optical Sensor
1x Step down Buck converter
2x M3 x 12mm screw
1x M3 x 15mm screw
1x small washer
1x #14 gauge body piercing (one end chucked into a drill and sanded down to form a cylinder)
Jumper Cable Pin Header Connectors
Wires
you will need All printed parts from this post

Also you will need this equipment:
A Soldering Iron
Solder
Electrical Tape
Wire Cutters and maybe Wire Strippers
Heat Shrink Tubing
Digital Multimeter

And when you’re finished it should look something like this:
SensorAttached.jpg
I even have a video found here: (I am having serious problems uploading files to this forum)

Front:


CaseFront_Healed.stl (570 KB)
Back:

Holder2.stl (274 KB)
Holder

New Back.stl (45.2 KB)
Probe Screw

Screw W Hole.stl (570 KB)
New Activator Bar (this one works better)
Activator Bar.stl (11.6 KB)

Firmware adjustments needed:


Your Z_MIN_ENDSTOP_INVERTING within your firmware needs to be set to False

(Here are my offsets (using the mount adapted to the X-rails mod)
X_PROBE_OFFSET_FROM_EXTRUDER -14
Y_PROBE_OFFSET_FROM_EXTRUDER 127
Z_PROBE_OFFSET_FROM_EXTRUDER 0 (I use my gcode to set this offset)

Gcode


This is my current gcode, subject to change in the future.

G21 ; set units to millimeters
M107
G28 ; home all axes
G1 Z10 F5000 ; lift nozzle <----
M203 X192 Y208 Z4 ; set max rapid rates mm per sec
G91; set to incremental motion
G1 Z5 F11520; raise Z
G90; set to absolute motion
G28 X0 Y0; home X and Y axes
G1 X276 F11520; go to probe deployment position
G1 X289 F350; deploy probe
G1 X138 Y62 F11520; go to probing spot
G28 Z0; Home Z axes
G29; probe bed
G1 Z5 F11520; raise probe off bed
G1 X10 F11520; go to probe retract position
G1 X0 F350; retract probe
G1 X1 F350; move away from limit switch
G92 Z7.5; Set actual location <<-------(This is important when you’re setting your z-hight from the print bed)
G92 E0 ;zero the extruded length
G1 F200 E3 ;extrude 3mm of feed stock
G92 E0 ;zero the extruded length again
G1 F{travel_speed}
M117 Printing… ;Put printing message on LCD screen

This is awesome! Nice work! I’m curious though how the toolhead moves rapidly towards home and nicely slows down before hitting the endstop, I’ve never seen that behavior before.

Thanks. All of the movement outside of the G29 command is done with my start Gcode.
I’ve highlighted in red where my movement speed goes from 11520 mm/m down to 350 mm/m in the Gcode


G21 ; set units to millimeters
M107
G28 ; home all axes
G1 Z10 F5000 ; lift nozzle <----
M203 X192 Y208 Z4 ; set max rapid rates mm per sec
G91; set to incremental motion
G1 Z5 F11520; raise Z
G90; set to absolute motion
G28 X0 Y0; home X and Y axes
G1 X276 F11520; go to probe deployment position
G1 X289 F350; deploy probe
G1 X138 Y62 F11520; go to probing spot
G28 Z0; Home Z axes
G29; probe bed
G1 Z5 F11520; raise probe off bed
G1 X10 F11520; go to probe retract position
G1 X0 F350; retract probe
G1 X1 F350; move away from limit switch
G92 Z7.5; Set actual location <<-------(This is important when you’re setting your z-hight from the print bed)
G92 E0 ;zero the extruded length
G1 F200 E3 ;extrude 3mm of feed stock
G92 E0 ;zero the extruded length again
G1 F{travel_speed}
M117 Printing… ;Put printing message on LCD screen

New Servo Mount that sits under the X AXIS Liner Rail Plate

I will follow up in a few days with the files and more pictures. I’m going to bed :sleeping: