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
Posts: 87
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 145 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 (21.73 KiB) Viewed 145 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
you will need All printed parts from this post

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

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

Posts: 87
Joined: Tue Apr 28, 2015 9:20 am

STL Files for this Project

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

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

Posts: 87
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)
Z_PROBE_OFFSET_FROM_EXTRUDER 0 (I use my gcode to set this offset)

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

G21 ; set units to millimeters
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