IR Probe improvements (e.g. selectable sensitivity ) ?

  • I use a duet 0.8.5 with Davids IR probe and it works pretty fine after sensitivity reduction.
    Some points I noticed with the handling on this.

    1. Sensitivity selectable
      Is there a way to select the sensitivity (for light reflecting and dark printbeds) for the IR probe ?
      For an Aluminium printbed the sensitive was to high and required some changes on the probe, but from time to time I put some different surface
      on the pritnbed for better adhesion on different filaments. This works if the add on surface (FR4 plate) is light, a dark one is not working.

    As wish, can the sensitivity be made selectable ?
    May be a small dip switch or a software command ?

    1. connector type with lock
      I use the normal pinheader and expierenced some times that due to the movement of the printsledge the cable may get loose. When adding a loose connection
      with not enough attention on the webinterface the nozzle crashes into the printbed.

    Can the IR Probe connector have some kind of lock to prevent unwanted disconntecting ?

    1. Firmware Z-probe check before homing z-axis
      This might be Firmware and/or webinterface related. Is it possible to check (if a z-probe is configured) if this is correctly connected before performing a z-axis homing
      and if this fails, ignore the z-axis homing command ?
      And possible get the z-probe field in the webinterface into a red (blinking ? ) colour to get more attention to this failure ?


  • administrators

    For #1 I may be able to extend the sensitivity range a little in firmware. More than a little would mean going to a larger microcontroller to get more I/O pins.

    For #2 I used to supply a 3-way locking Molex connector with the version 1.0 probe. Unfortunately it takes up too much space, which is why I switched to a 3-way header. I suggest you zip tie the cable in place to prevent it being pulled off.

    For #3 it would be possible to conduct a basic check that something is connected, but it wouldn't catch the case of just the Vcc wire getting disconnected.

    #4 is really chrishamm's area because he wrote and maintains Duet Web Control.

  • Thanks for the feedback.

    #3 if the config says your IR Probe is used and you can check if someting is connected, I think this would be great.
    As this means, if nothing is found as being connected, something must be wrong.

    Or do you mean, if just Vcc is missing and the other 2 wires are connected, you will still see somthing is connected ?

  • administrators


    Thanks for the feedback.
    Or do you mean, if just Vcc is missing and the other 2 wires are connected, you will still see something is connected ?

    Yes, Assuming that the probe is connected but not triggered, it should output 0V through about 1.6K. The Duet could detect this by enabling the internal pullup resistor, However, if the OUT and GND pins are connected but not the Vcc pin, it would probably look much the same to the Duet.

  • Hello about the Z probe I have some issue with detecting a glass top surface so maybe a sensitivity adjustement would be usefull

    I have tried:
    1- 5mm glass on aluminium.
    good detection but never managed to get under 70 um stdev probably because of the reflections from the alu
    2- 5mm glass on white paper on aluminium.
    excellent detection reached better than 20 um stdev on 10 points unfortunately the sensor is 0.2 mm from the glass
    3- and finally white paper on glass on aluminium.
    Well obviously can't use that in practice but I wanted to know what to expecte and yes in that case the sensor triggers roughly 2-3 mm above the paper.

    but I do need the sensor to trig at 2-3 mm of my glass otherwise I'll crash the nozzle which should come about 1mm under the probe.

    This is my first build and a large one. It seems that this probe trigger height adjustment in relation with my nozzle is the last splinter in my sole before I can start printing.
    I couldn't find a proper guide on how to tune the probe height in relation to the nozzle, so how is it done with enough precision 100um or better?
    I mean of course without crashing the nozzle or damaging the printer ore bed with all the different surface reflection inconsistence.

    Isn't the IR probe meant to work on glass? and if that's the case it seems quite complicated to have the nozzle in the 0.2mm gap between glass and probe?

    I tried to follow the guide here:
    I am very happy with the algos and the overall reapeatability and bed adjustement it's just the headroom doesn't seem enough to be able to use the probe on glass but maybe I am missing sth…
    This is the result from my G30 S-1 on glass on paper on alu
    Bed probe heights: 0.000 -0.012 -0.017 -0.010 0.011 -0.021 -0.020 0.009 -0.003 -0.016, mean -0.008, deviation from mean 0.011.

    This is my probe setting
    G31 X0 Y35 Z0 P500
    But unfortunately I do have to put Z0 because even with Z0.5 my sensor hits the glass after calibration when I try to move to Z=0 ( I had the nozzle removed for now obviously)

    and I'd like Z bigger than 1.5mm possibly...

    Thanks for any help.

  • administrators

    When using a glass bed, we recommend having a matt black surface below the glass, such as black paper or black painted aluminium. Have you tried that yet? Glass painted black on the underside would be even better, but I haven't yet tested whether the spray-on stove/barbecue paint that I use will adhere well enough to glass.

  • Hi just tried dark black paper (from a photo album) under the 5mm glass.

    Bottom of IR pcb to glass distance is less than 1mm when the led lights up and I am going down from 10mm in 0.1mm steps.
    Paper color doesn't seem to do any difference. It seems it is detecting the otherside of the glass…
    I just did 2 pics with a 1.5mm allen key at the detection height.

    Interestingly the camera does also seem to pick the second reflection (back of glass)much more strongly than the first where the allen is sitting.

    I smudged the glass with finger grease but it doesn't seem to help either… Shoud I sand the glass? seems a bad idea...
    My impression is that the top surface is not reflective enough to trigger the sensor, but through the refraction index and the 5mm glass thickness the second is...

    Thank you so much !!!

  • So next try was some polyimide film which I had lying arounda and which I believe to be 50um thick.
    It increased the distance of detection to about 1.7mm instead of my usual 0.2-0.3.
    But it also made the measurement much less precise than with glass…
    I get this kind of inconsitent results post multiple successive calibrations....
    1:41:02 AMBed probe heights: 0.383 -0.061 0.017 -0.372 0.852 -0.571 -0.044 0.050 -0.401 0.492, mean 0.034, deviation from mean 0.417
    1:37:40 AMCalibrated 6 factors using 10 points, deviation before 0.382 after 0.107
    firmware bed probe heights:
    Bed probe heights: 0.383 -0.061 0.017 -0.372 0.852 -0.571 -0.044 0.050 -0.401 0.492 0.000 0.000 0.000 0.000 0.000 0.00

    I then turned the glass over and immediately got this on the matt black paper:
    1:56:54 AM Calibrated 6 factors using 10 points, deviation before 0.041 after 0.039
    1:55:00 AM G32 Calibrated 6 factors using 10 points, deviation before 10.495 after 0.046

    but of course the distance was again ~0.2mm only

    I checked leds and sensor alignement and can also confirm that any solid surface desk or white paper would give a trigger at a distance of 2.5-3mm.
    Are you positive that when used on the 3mm glass you mention for calibration it's not in fact picking the bottom internal reflection or a combination of both, that would explain a lot.
    I tried it on my scanner glass (don't know its thickness but lower than 5mm) and I get about 2mm distance so it makes perfect sense.. and the sensor does seem to work as intended...almost...
    I haven't yet tried to sketch the reflections with the leds positions and angles but that could explain why on my bed 5mm glass I get a trig about 2mm lower than expected.
    Some old memories of total internal reflection and frustrated internal reflections....

    Maybe I shall play with the led's power and see if I could get another higher trig from the top surface instead of the backsurface or be able to output the ADC signal somehow to know what response the sensor gets during the approach.
    I suppose that would mean lowering the resistors value somehow what value would you recommend?

    Thank you for all your work again and sorry for writting so much everytime...

    tldr: I believe with some elements of proof that the mini IR sensor does actually pick the bottom side of the glass instead of the topside which explains why it works on 3 mm glass and not 5mm with an acceptable working distance.

  • administrators

    Hi sga,

    All the IR sensors I ship directly are tested using a target of 3mm float glass backed with black paper, and are verified to have a trigger height of not less than. 2.6mm. The trigger height with opaque targets is a fraction of a mm higher because the reflection from the back of the glass does have some effect. I have also used these sensors with 4mm glass on top of black aluminum - but 4mm glass on top of bright aluminium gave a very low trigger height. I am surprised that you are having trouble when using 5mm glass on a black backing, but perhaps there is something going on that I haven't thought of. I don't have any 5mm glass to test with at present.

  • I think I will increase the current in the leds by halving the resistors and see if I can get the top surface detected without saturating the sensor and report back.

  • administrators

    I really don't think increasing the current will make any difference, because the firmware is designed to be insensitive to the signal level, within limits. Be careful, with higher LED current you may exceed the safe exposure limit if someone looks directly into the LEDs.

    Do you have any 3mm glass that you can test the sensor against? I'll get a piece of 5mm glass to test with when I can, but it is unlikely to be very soon.

    btw if you are planning to use a PEI surface in future, then the thickness of the glass won't matter if you spray the back of the PEI sheet matt black as I recommend in the fitting instructions.

  • Yes, as written earlier (in the too long posts) the sensor works fine as is on 2 different scanner glass flatbeds, without any modification and properly triggers at a distance of about 2.5mm

    • either it needs the combined reflection of the both interfaces air-glass + glass-air to work fine
    • or it is mainly picking the second interface. which explains why the 5mm glass triggers at about 0.2mm
    • and that one single layer reflection is not sufficient for my sensor to trigger (this would require a 2-3cm thick piece of glass to prove
      The angles are so close to the brewster at 45° (first interface) and ~28°(second interface) respectively and the reflection is so weak at these angles a few percents at most. That it's not really surprising that it behaves so sensitively to the glass material and thickness.
      Figures somewhere in the middle of :
      I'll order some PEI I guess but first I have an experiment to do…

    Thanks for the recomendations and I'll be carefull.

  • administrators

    What I suspect is happening is that with 5mm thick glass, the spots form the IR LEDs become too defocussed by the time the reflection from the back of the glass reaches the phototransistor. A weak reflection from the top surface is all that's needed - the sensor works with dark grey BuildTak as the target too. The trouble is interference from the reflection off the back of the glass. I suspect that black glass would work well. The angle of incidence isn't that close to the Brewster angle (about 56 degrees for air/glass), and in any case there is a reflection even at the Brewster angle because the light emitted by the IR diodes is not polarised.

  • So I soldered 511 and 422 resistors in place. I saw no difference on white paper or dark plastics they still work good and it's still impossible to saturate them.
    Still working on scanner flatbed too. ~2mm glass
    Saturating but still "working" on aluminium though…
    no improvement on my 5mm glass alone...
    BUT does trigger perfectly when I put the 5mm glass on the aluminium with 1.9mm trigger distance. 😉
    Just checked the stddev and it's around 50um I think my alu back plate is not as flat and homogenous in reflection as the glass thickness is; so the part of the back side contribution is introducing some error but I would think it is useable at least. (what do you think of the values below?)

    My modest understanding and it's going back to the original subject of this post is that reflections at 45° (unpolarised) is about 10% R= 1/2 (Rs+Rp) of the led power 20 % if you add the backside contribution Rtot=2R/(1+R) whereas on alu you are more likely around 90-95%. And that is not even approaching the surface roughness/specularity differences or alignment problem.

    Without a gain or sensitivity adjustment, it is indeed not too easy to have a single trigger level work for these extreme setups.
    Trigging correctly on one and not saturating on the other.
    Looking at the schematic I guess the nres pin (PB5) is the only place where a switch could be added for a 2-3 gains selection as it is currently floating.
    the pin is also ADC0 so it would probably be possible to add a 10k smd pot to define a trigger level 0-1024.
    Placing the sensor at 2.5 mm of the plate and then adjuting the trigger level would probably work fine IMHO.

    Last question after a calibration the values are reverted to the M666 and M665 in the config, which is probably safe and sound.
    If I switch beds adding or removing 1-2 mm would you recommend setting up several "bed selection" macros with different M666 and M665 values which should be use before the bed calibration or is there a better way?

    sorry again for the long post!!!

    1:26:36 AMCalibrated 6 factors using 10 points, deviation before 0.062 after 0.051
    1:23:19 AMBed probe heights: -0.010 -0.029 -0.087 0.050 0.043 -0.049 0.090 -0.072 -0.131 0.012, mean -0.018, deviation from mean 0.065
    1:21:05 AMCalibrated 6 factors using 10 points, deviation before 12.497 after 0.053
    1:20:14 AMConnection established!
    1:20:04 AMEmergency Stop!
    1:19:33 AMM665
    Diagonal 509.50, delta radius 246.43, homed height 787.38, bed radius 120.0, X 0.59°, Y 1.18°, Z 0.00°
    1:19:27 AMM666
    Endstop adjustments X-1.56 Y1.99 Z-0.43
    12:50:45 AMBed probe heights: -0.053 -0.050 -0.001 0.021 0.049 -0.032 0.109 -0.004 -0.141 -0.011, mean -0.011, deviation from mean 0.063
    12:45:54 AMCalibrated 6 factors using 10 points, deviation before 0.064 after 0.061

  • administrators

    The sensor has a dynamic range of about 30:1 so a sensitivity adjustment isn't really needed. I have a new version coming out with the range increased to 100:1.

    To handle different thickness beds, you could just increase the dive height in the M558 command so that probing always starts from a sufficient height.

  • Thanks again for your reply,
    I appreciate the fact that having a large dynamic range is quite important.
    but if the default threshold value is too high for the surface to be detect (as I do suspect it was for my glass, before I increased the leds current) it won't help, or am I missing sth?

    Looking forward for the new version !!!

  • administrators

    What you are missing is that the sensor isn't just looking for the IR to exceed a particular threshold. It is looking for the reflected light reaching the phototransistor from the two IR diodes to have equal intensities,

  • Thanks that's what I missed indeed… Now I have to think about it .....

  • Dear David,

    I got my oscilloscope to monitor sig after returning to the original values of the resistors.
    with white paper under the glass both signals increase at the about same rate until I am about 1mm away and it takes another 0.7 mm for near to catch on, only to equate when I am close to contact ~0.3mm. Finally near overtakes far only at contact
    It is about the same with black paper although with lower intensity.

    I checked the leds alignement and the photodiode and they are as coplanar, parallel and as close to 45° as a binocular and my eyes could see.
    Also all the other materials I have checked (wood, black smooth, black matt, 2mm glass) give close to 2.5mm trigger distance and would be usable as beds… but this damn piece of 5mm glass doesn't want to collaborate. I just ordered some buildtak so it won't be a problem anymore soon.

    I understand now that the 2 spots are supposed to be of equal intensities (because the difference in resistor values compensate for spot size due to the increased distance of the far led) and that the trigger zone is when the overlapped area of these 2 spots align with the photodiode detection cone.
    I think I have been unlucky with my choice of glass thickness as the back reflection must cause the total reflected far led intensity to be larger than intended in the overlapped area. Not sure what happens with the paper but I suspect it is not affecting the 2nd reflection too much as black paint would.

    I guess that's all the feedback I can give you and hope it could be as much help to design/debug next gen as the number of characters in my posts... 😉

  • administrators

    I agree with your diagnosis. As the target gets closer, the received intensity of the near beam should rise faster than the received intensity of the far beam. I suspect that as the surface reflection of the near beam reaches maximum intensity at the phototransistor, so does the back reflection of the far beam, with that particular thickness of glass. I'll do the sums when I get some spare time.

  • Tried to draw this to scale in geometrical optics and yes the far back reflection alignes almost 1to 1 with the near led.

  • Hope you don't mind me jumping in here but just wanted to say that I've started commissioning my printer, complete with David's probe. I have 6mm glass on top of black painted aluminium but the glass is sandblasted. This is the first time I've used the probe so I just followed David's instructions and it's worked "straight out of the box". I'm getting a trigger height of 1.47mm which seems to be repeatable (but it's early days yet). Maybe the sandblasting is doing the trick?

  • Yes this would surely help; you mean the backside only is sandblasted. Not the front side.
    I received my Buildtak yesterday applied it to the glass and it works like a charm it's black and works at about 2.2 mm. Perfect adhesion right from the start. The Duetwifi and sensor are so easy to learn. I am having a lot of pleasure using it!!!

    Since it is my first printer. I am going through the learning process right now. I am getting 5 perfect PLA layers but I think I need blowers because after that the whole top surface gets so soft (heat from the underlayers). I tried with a handheld blower but then I had hadened curled corners on overhangs and my head crased into them….. Not sure what to do next.. (sry it's out of topic)

  • Hi sga,

    Nope, it's the top side that's sand blasted (and also "Brite Guard" coated). It's experimental and I haven't yet tried it but if it works, I may be able to print directly on to the (heated) glass without any tape, glue, paste, or other sticky stuff. The surface finish is almost smooth - a bit like the very finest abrasive paper that one can buy - the sort of stuff used between coats of varnish is that means anything to you. The glass just looks opaque like it's been etched but not rough.

    If it doesn't work, I can always resort to some other method and/or turn the glass over. I've got 3 pieces of glass so I could potentially have 6 different pre-prepared print surfaces.

    It is normal to use print cooling fans with pla but I've found it only necessary with small objects. Larger objects seem to have enough time to set before the next layer gets printed. You could try printing more slowly. I have my Slicer set so that the minimum layer time is 20 seconds. What then happens is that if a layer would normally take say 10 seconds, then the printer will slow down by about 50% so that it always takes 20 seconds to print. If you have no fan, you could experiment with that setting,

    Sorry we've gone off topic.


  • Interesting, I guess that you won t have adhesion problems. Or maybe too much of it… let us know, it would be very intersting to know how well it works.
    Yes small part-no fans is certainly the problem I think. The layer to layer is too quick to properly set. Plus they get a lot of convection/radiation from the hotend...

Log in to reply