Optical Sensor Probe Project

Want to use the Open Source Hardware documentation to make your LulzBot 3D Printer do even more? Start here!
Post Reply
Rp1030
Posts: 95
Joined: Tue Apr 28, 2015 9:20 am

Optical Sensor Probe Project

Post by Rp1030 » Thu Jul 04, 2019 9:12 am

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
Sensor Board
Optical Sensor.jpeg (19.43 KiB) Viewed 660 times
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
Parts
Parts.jpg (21.73 KiB) Viewed 660 times
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
Attached
I even have a video found here: (I am having serious problems uploading files to this forum)
https://streamable.com/ibyup

Rp1030
Posts: 95
Joined: Tue Apr 28, 2015 9:20 am

STL Files for this Project

Post by Rp1030 » Thu Jul 04, 2019 9:17 am

Front:
Case Front 2.png
CaseFront_Healed.stl
(569.91 KiB) Downloaded 54 times
Back:
Case Back.png
New Back.stl
(45.2 KiB) Downloaded 51 times
Holder
Case Holder.png
Holder2.stl
(274.11 KiB) Downloaded 53 times
Probe Screw
Probe Screw.png
Screw W Hole.stl
(570.39 KiB) Downloaded 51 times
New Activator Bar (this one works better)
Activator Bar.stl
(11.61 KiB) Downloaded 53 times

Rp1030
Posts: 95
Joined: Tue Apr 28, 2015 9:20 am

Gcode and Firmwaree

Post by Rp1030 » Thu Jul 04, 2019 9:18 am

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

jimbalny
Posts: 15
Joined: Tue Apr 14, 2015 5:27 am

Re: Optical Sensor Probe Project

Post by jimbalny » Mon Oct 14, 2019 2:07 pm

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.

Rp1030
Posts: 95
Joined: Tue Apr 28, 2015 9:20 am

Re: Optical Sensor Probe Project

Post by Rp1030 » Mon Oct 14, 2019 7:46 pm

jimbalny wrote:
Mon Oct 14, 2019 2:07 pm
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

Post Reply