The Mini Differential IR height sensing board for 3D printers provides the following features:
A differential modulated IR height sensor. The sensor detects the target height by looking for the reflected light from two separate LEDs to be equal. The two LEDs are positioned such that they reflect light into the sensor at slightly different heights. This allows the sensor to be used most any bed surfaces.
- A high degree of immunity from sunlight, incandescent artificial light, and other background sources of IR.
- Unlike capacitive and inductive sensors, the sensor measures the height to the top surface of a glass bed, not the distance to a backing plate.
- A red LED indicates when the head is at or below target height.
Small size, ideal for use where space is restricted, such as under the effector of a delta printer. The current (version 1.1) board is just 24mm wide and 18mm high, small enough to fit below the heatsink of a genuine E3Dv6 hot end.
- Automatic selection of a 4-level analog output for printer electronics that support it (e.g Duet), or a digital output for other printer electronics.
How to get it: For individual sensors and small quantities, please order from duet3d.com (UK) or from a Duet3d genuine reseller. If you wish to purchase 20 or more sensors then you can enquire about direct shipment from me via my Escher3D site.
- Power: 5V or 3.3V
- Maximum current draw: 20mA @ 5V, or 12mA @ 3.3V
- Size: 18mm high x 24mm wide x 10mm deep
- Weight: 2g (board and 3-way header, excluding socket)
- Trigger height to 3mm glass target on top of black paper: between 2.5mm and 3.5mm
- Reproducibility of repeated probing at same spot: approx. 0.01mm
Mounting the board
The board needs to be mounted with the two fixing holes at the top, and the bottom edge of the board (where the infrared components are mounted) facing the bed and at right angles to it. The sensing area is approximately in the middle of the bottom edge of the board, below the cylindrical capacitor. In order to minimise the effect of any tilt of the hot end as it moves in the XY plane, this area should be as close to the nozzle as reasonably possible, without being so close that the board or the components on it get hot. Mounting it with the back facing the nozzle is recommended, because it reduces the chance of the optical components getting contaminated by extruded filament, and shields the optical components from the heat of the nozzle.
The bottom edge of the board should be no more than 2mm higher than the tip of the nozzle, to ensure that it will trigger before the nozzle touches the bed. To avoid the risk of the board fouling on the print, we suggest that the bottom edge is at least 1mm higher than the tip of the nozzle. So aim for 1.5mm.
To connect the board to your printer electronics, if you have the version 1.1 board then you need to solder either the supplied 3-pin straight header or the 3-pin right angle header to the board – or you can solder wires directly to the board if you wish. The version 1.2 board comes with a 3-pin straight header already fitted. Then use the black 3-pin shell and three of the crimp pins to connect your wires to the header. The remaining three crimp pins I supply are spares.
I provide two M2.5 x 8mm screws for fixing the board. Here are some designs for printable parts to mount version 1.1 and 1.2 sensors. Some of these are designed to secure the hot end or to support fans as well.
- For E3Dv6 hot end: here, here and here
- For E3D Chimera hot end: here
- For J-head hot end: here
- For Printrbot Plus: here
- For the RepRapPro Ormerod: see this thread
- For the JGAurora A5: here
Very important! Check that there is no possibility of the board shorting against anything (e.g. the printer frame or the nozzle heating block), even if the head moves outside the normal printing range. Note that the heater block on E3Dv6 and similar hot ends is liable to rotate about the heat break! If the back of the sensor is close to the heater block, you should trim any protruding wire stubs and header pins on the back of the board, and put at least two layers of Kapton tape or alternative high-temperature electrical insulation on the back of the board. It is also a good idea to fit a silicone sock over the heater block, because this will provide additional electrical and thermal insulation. E3D now includes silicone socks with their hot ends, and they can supply socks to retrofit to earlier hot ends that were supplied without them.
Note for delta printer owners: It is important that the effector does not change its tilt relative to the horizontal as it moves in the XY plane. Otherwise, the height difference between the tip of the nozzle and the bottom of the sensor board will vary with XY position, giving rise to calibration errors when you use the sensor to auto-calibrate your printer. If you are using Duet electronics then you can compensate for effector tilt in the bed.g file, but it is better to avoid it in the first place.
For best results, the sensor needs to sense the reflection from the top surface of the bed. There is a potential problem when the sensor is used with a transparent bed material that reflects infrared light weakly and there is a surface below the transparent material that reflects IR much more strongly. Here is a guide to using the sensor with different print surfaces:
- Glass (with or without coatings such as hairspray, PVA or Kapton tape): works as-is if placed directly on a PCB bed heater or other surface that does not reflect strongly. If there is an aluminium heat spreader or bed plate underneath the glass, then either paint the aluminium surface matt black (see below), or put a sheet of matt black paper between the glass and the aluminium. Coatings on the glass affect the trigger height slightly.
- PEI: this is highly transparent to IR. Paint the underside matt black (see below) before using adhesive sheet to attach it to the bed plate. Changes to the surface finish affect the trigger height slightly. We have a report that as an alternative to painting the underside black you can sand the top surface with very fine grit sandpaper until it has a dull matt appearance, but we have not confirmed this.
- BuildTak: the dark grey variant works well with the sensor. I have not tested the white variant, but it should work too.
- PrintBite: early samples were found to be opaque to IR, but more recent samples are transparent to IR. This means that it needs to be painted black on the underside in order to work well with the IR sensor. However, this is not practical if the PrintBite sheet has the adhesive already attached.
- Anodised aluminium, with or without a thin PEI coating: suitable if the finish is matt or semi-matt
- Bright aluminium: not suitable
- Mirror: not suitable
If you need to paint the top of an aluminium heat spreader or the underside of a PEI sheet matt black, then I recommend using spray-on barbecue & stove paint. It needs to be cured at an elevated temperature to harden. I have found 2 hours at 170C in a domestic electric fan oven works well. Caution: the temperature in a domestic oven without a fan will vary greatly in different parts of the oven.
Connecting the board
Looking at the board from the component side, with the mounting holes at the top and the cylindrical capacitor at the bottom, the pads for the 3-pin connector are near the top. These pads are labelled from left to right on the front of the board as follows:
- OUT: this is the output from the board to the printer electronics.
- GND: this must be connected to signal ground on your printer electronics.
- VCC: this must be connected to the +3.3V rail of your 3.3V printer electronics, or the +5V rail if you have 5V printer electronics.
There are also pads for a 6-pin connector, on the right of the board looking at it from the component side. Ignore those pads – they are used for programming only.
Connecting to Duet electronics
Duet 0.6 electronics: wire the sensor to the Duet as shown for PROXIMITY SENSOR in this diagram (click on it for a larger version), where the blue wire is connected to OUT, the black wire is connected to GND, and the red wire is connected to VCC.
Duet 0.8.5 and Duet WiFi electronics: wire the sensor to the 4-pin PROBE connector. Connect sensor GND and VCC pins to Duet GND and 3V3 pins respectively. The OUT pin of the sensor should be connected to the AD12 or IN pin on the probe connector. Leave the AD14 or PC10 or MOD pin on the probe connector unconnected.
Duet Shield: connect the board to the 4-pin proximity sensor connector on the shield. Connect OUT, GND and VCC on the board to pins S, G and + respectively on the 4-pin connector. Leave the T pin on the 4-pin connector unconnected.
Connecting to RADDS electronics
If you are using ArduinoDue/RADDS electronics running RepRapFirmware, then you can connect the sensor in analog mode as for the Duet. Connect the sensor to the AUX ADC connector on the RADDS (Gnd to GND, Vcc to 3.3V, and Out to ADC). Then test and commission the board as for Duet electronics.
If you are not running RepRapFirmware, then use the instructions below for other electronics.
Connecting to Smoothieboard electronics
The Smoothieboard uses low value (1K) pullup resistors in its endstop inputs. This is too low for the sensor output to drive, because the sensor output series resistors are chosen to protect the sensor in the event of incorrect connection.
Here are some workarounds:
- Connect the sensor output to a GPIO pin on the Smoothieboard instead of to an endstop input.Use the option “zprobe.probe_pin” in the configuration file to tell Smoothieware which pin it is connected to.
- Add a pulldown resistor from the sensor output to ground (it has been reported that 470 ohms works, but 1K does not).
- Replace the 3K resistor R4 on the sensor board by a lower value (e.g. 220 ohms), or bypass resistor R4 completely. Be extra careful to connect the sensor to your electronics correctly, because R4 protects the sensor from damage if you reverse the connector.
- Increase the value of the pullup resistor on the Smoothieboard to 6.8K or 10K (for the Z_MIN endstop input on a genuine Smoothieboard V1, it’s R100 that you need to change).
Connecting to other electronics
If you are not using Duet electronics, then it probably expects an active-high digital input, for example to the Z low endstop input on a RAMPS board. In this case, connect the three wires from the sensor board to the corresponding wires on the electronics board, as if it were an optical endstop. The Vcc, Gnd and Out pins of the sensor must be connected to the +, – and S pins respectively of the RAMPS endstop connector as shown here. Make sure that the pullup resistor for this input is enabled. When the sensor board detects the pullup resistor four seconds after power up, it sets the output to digital mode.
Warning: the sensor is fairly tolerant to mis-wiring, including having the 3-pin connector reversed. However, if you apply power with the Vcc and Gnd connections swapped over, you will destroy the microcontroller.
Note for Arduino Due users: Boards shipped prior to 5 August 2015 may not recognise the high-value pullup resistor in the Arduino Due, in which case the LED will flash four times at startup instead of twice. A fix is to add an external pullup resistor between the sensor output and +3.3V. Any value between 10K and 47K should suffice.
Testing and commissioning the board
Testing with Duet electronics
In your config.g file, use probe type P1 in your M558 command and trigger threshold P500 in your G31 command.
Start with the hot end and sensor some distance above the bed. Power up the Duet using USB power only. About 4 seconds after power is applied, the LED on the sensor should flash four times, indicating that the board has started in analog output mode. If it does not flash, check the power connections to the board.
Connect to the Duet from a PC using the web interface. On the Control page you can see a continuous readout of the Z probe reading.
Send M558 P1 to the Duet, then send G31 P500 Z1.0.
Move a suitable target (e.g. white paper or glass) up underneath the sensor. Check that you get the following readings:
- With the sensor a long way above any surface, the reading should be close to zero.
- With the sensor close to a surface but slightly further away than the trigger height, the reading should be about 465.
- With the sensor slightly closer to a surface, the reading should be about 535 and the red LED on the sensor board should illuminate.
- If you place a surface right up against the sensor board, then the reading may drop to near zero again. This is normal.
- If you see a reading of around 1000, or if the LED flashes rapidly, this means that there is too much ambient IR for the sensor to function correctly. This normally happens only when direct bright sunlight is reflected from the bed into the sensor, or when you place a highly reflective surface below the sensor such as aluminium foil.
If you get the expected readings, then you can apply 12V power and continue with commissioning. If not, check your wiring.
With 12V power applied, send M558 P1 followed by G31 P500 Z1.0 to the Duet again. Note: if your printer does not use the Z probe to home any axes, you also need to add parameters X0 Z0 to the M558 P1 command.
To calibrate the sensor for Z homing and bed probing, home X and Y, then position the head over the centre of the bed. With the nozzle at operating temperature, lower the head so that it is just touching the bed or just gripping a sheet of paper, then send G92 Z0 to define that position as Z=0. Raise the head 5mm and remove the paper. Then send command G30 S-1 to probe the bed at that point without adjusting the Z height setting. Read off the Z height in the “Head Position” box in Duet Web Control, or from the Z coordinate shown on the Control page of PanelDue, or send M114 to retrieve the head position if using a USB host program on a PC. It should be in the range 0.5 to 2.5mm. Use that value for the Z parameter in your G31 command in config.g. Please note:
- The S-1 parameter may not be supported in the official RepRapFirmware release. It is supported in my fork and dcnewman’s fork.
- Always use a P value of 500. When the probe is triggered, the Z probe reading will be about 535. When it is slightly higher than the trigger height, the reading will be about 465. With a P value of 500, when the Duet sees the reading of about 465, it knows it is getting close to target height and it will slow down the Z motor.
- If you are using my (dc42) fork of RepRapFirmware, then the G31 command in config.g must come after the M558 P1 command. This is because the firmware supports different G31 values for different sensor types.
- After turning your printer on, do not perform any operation that uses the sensor (e.g. X homing on some printers) for 5 seconds, until after the LED has done its 4 flashes.
Testing with other electronics
I recommend you test the board initially with 5V power only applied (e.g. via the USB connector) if your electronics supports that.
About four seconds after power is applied, the LED on the sensor board should flash twice. This indicates that the sensor has started up in digital output mode. If it flashes four times, check that the output is connected to a suitable input on your printer electronics, and that your firmware is configured to activate the pullup resistor on that pin. If is does not flash at all, check the power connections to the sensor board.
Move a suitable target (e.g. white paper or glass) up underneath the sensor. Check the following:
- With the sensor a long way above any surface, the LED on the sensor should be off, and your printer firmware should indicate that the sensor is not triggered.
- With the sensor closer to a surface than the trigger height (which is approximately 2.75mm measured from the bottom of the sensor board to the bed), the LED should illuminate and your printer firmware should indicate that the sensor is triggered.
- If you place a surface right up against the sensor board, then the LED may turn off again and the status will change to not triggered. This is normal.
- If the LED flashes rapidly, this means that the phototransistor is saturated and the sensor is unable to determine a trigger height. Make sure you do not have strong sunlight reflecting off the target into the sensor, and do not use mirror or bright aluminium as the target. Note: sensors shipped before approx. February 2016 do not flash rapidly when the phototransistor is saturated, instead they produce an output and illuminate the LED as if triggered.
Now use the M119 command to check that the printer recognises that the sensor is triggered when the LED is lit, and not otherwise.
To calibrate the sensor for bed probing, apply 12V power to your printer, home X and Y, then position the head over the centre of the bed. With the nozzle at operating temperature, lower the head so that it is just touching the bed or just gripping a sheet of paper. Send G92 Z0 to define that position as Z=0. Remove the paper and raise the head in small steps until the LED illuminates, and continue raising the head until it goes out again. Now lower the head in 0.05mm or smaller steps until the LED illuminates again. Read off the Z height (e.g. by sending command M114 to your printer) and use that value as the Z probe trigger height in your firmware configuration.
Note: after turning your printer on, do not perform any operation that uses the sensor for 5 seconds, until the LED has done its 2 flashes.
LED illuminates (more dimly than normal) as soon as the board is connected. This usually means that you have plugged the 3-pin connector the wrong way round on the board, thereby transposing the Vcc and Out connections. Turn the power off and check your wiring.
LED turns on/off to indicate triggering, but the printer firmware does not recognise whether or not it is triggered. Check that you are getting the correct number of flashes from the LED after power up (4 if you are using Duet electronics or RADDS electronics running RepRapFirmware, 2 for other electronics). If you are getting 4 flashes but expecting 2, then either the sensor output pin is not connected to your electronics correctly, or the pullup resistor is not enabled in your printer firmware, or the pullup resistor has too high a value. If you are getting 2 flashes but the firmware always indicates that the sensor is triggered even when it is not, then the value of the pullup resistor may be too low – see the note for Smoothieboard users above.
Trigger height relative to nozzle varies with XY position. This may mean that there is a large variation in the surface of your print bed, or (if it is a glass bed) in the reflectivity of the surface underneath the glass. Check that the bed surface is the same everywhere you are probing. Another common cause is that the print head is tilting slightly by an amount that depends on XY position (this is common on delta printers). Mounting the sensor close to the nozzle will reduce the effect of any such tilt.
If you cannot eliminate the variation of trigger height with XY position, then if you are using Duet electronics running my fork of RepRapFirmware version 1.09e or later, you can compensate for differences in trigger height using the H parameter on the G30 commands in the bed.g file.
Trigger height too low. This usually means that you have mounted the board too high. The bottom edge of the board should be between 1mm and 2mm higher than the tip of the nozzle. This should give you a trigger height between 0.5mm and 1.5mm. Another possibility is that you are using a glass or PEI bed and the surface underneath the glass is reflective – you should use a black surface underneath the glass or PEI.
Modification of the sensor is at your own risk. You can find the schematic here and the firmware source code here. Warning: This product has been designed so that the levels of infrared radiation it emits are safe in normal use . If you modify the hardware and/or firmware, you could cause the infrared LEDs to produce intense invisible light that may be hazardous to the eye when viewed at close range or with a magnification device.
The trigger height is checked before shipment to be between 2.5 and 3.5mm, measured between the bottom edge of the board and a target of 3mm glass on top of a dark surface. On version 1.0 and 1.1 boards (but not version 1.2 boards, which use SMD optical components) it can be increased a little by mechanically adjusting the angle of the outer LED. Grip the LED by the sides (never by the front, where the lens is) with long nose pliers, then move the pliers so as to rotate the LED slightly anticlockwise as seen from above from its 45 degree position. Only a tiny change in angle is required. Do this at your own risk! Damage to the LEDs is not covered by the warranty. Adjusting the LED position in this way will increase the sensitivity to differences in the bed surface. It will also decrease the overall sensitivity, so it may no longer work with dark surfaces such as BuildTak.
Finally, here is a video showing the board used to perform auto-calibration of a delta printer using Duet electronics. See here for more information on how I configured this. Happy 3D printing!
Appendix: Board dimensions and mounting holes for version 1.1 and 1.2 boards
If the bottom left corner of the board is position (0, 0) then other points on the board are at the following (X, Y) coordinates, in mm:
Top right corner (24.0, 17.62)
Mounting hole centres (2.70, 14.92) and (21.11, 14.92)
Mounting hole diameter 2.8
Last updated 2018-01-10.