Calibrating X/Y offsets on IDEX printers

As I almost finished my Anycubic i3 Mega IDEX mod (GitHub - Life0fBrian/Anycubic-i3-Mega-IDEX-mod: This mod converts the Anycubic i3 Mega into an IDEX 3D printer.) it was time to research on how to properly calibrate/determine the offsets of the two printheads/nozzles.
Most users seem to print some special patterns and change the offsets until everything is fine but the internet and especially @EddyMI3D (special thanks to you again!) suggested using a webcam/camera.

But how to get it done with a camera properly? There is at least one commercial solution consisting of a camera-box and software but I did not want to pay extra money but use the stuff I have here.
As further research on suitable tools for this task was not successful I used my good copy and paste skills and the rest of my grey matter to write a small HTML-page that can run almost everywhere and does not require admin rights under Windows.
This is currently still WIP but already works great:

You initially set up everything in the printer.cfg so the kinematic is running properly and have your belts tightened and then you just home all axes and move either the print heads upwards (cartesian printer) or the bed downwards (CoreXY) so that a webcam or other camera fits underneath the nozzle with some space to it:

The cameras image plane should be parallel to the bed and the camera somehow fastened to the bed if you need to adjust Y as well.
Z offsets of the nozzles should be corrected before this procedure.

Then move T0 to for example X=100 and arrange the camera underneath its nozzle so that it is properly focused/sharp in the camera stream and so that the nozzle tip is congruent with the red circle in the center of the stream.
Maybe you need to adjust focus or Z to achieve this.
Then you switch to T1 and move its nozzle tip into the red circle as well via manual adjustments of X and/or Y.
After that procedure you can read the X and maybe Y coordinates and get your offsets compared to the values for T0.
The new calculated X value is represented by the position_endstop and position_max values on my cartesian setup in the Dual_Carriage section and the Y offset is set via SET_GCODE_OFFSET Y=xx in the T1 macro.

If there are useful additions to the tool I’ll try to implement it as well.
Currently the webcam needs to be chosen under the manage options of the browser/tab. There is a way to enumerate the available webcams but this needs more time for me to get it done. :grimacing:

Here is the project on github:


One thing that has been bothered me about the offset calibration solutions is that X can still be thrown off the next time the toolheads are homed, depending on how consistent the homing switches are.

Ideally a print would start immediately after the correct offsets are applied, but this is usually not the case.

Are you doing anything special to maximize the consistency of homing X?
I’d like the option to treat the X endstops more like a probe, but it’s a bit over my head.
I am using a slow second_homing_speed for now, but more approaches and maybe taking an average would be better.

Yeah good call!
I have mechanical endstops without the lever to be more precise and like you are doing home a second time with slower speed.

A sophisticated printer could perform this before every print using AI but my tests today were quite good.
As this is my prototype there might be some changes in the future.

Maybe you could check your PMs. :wink:

Great idea. It works ok with a webcam I have but resolution of my webcam sucks.

Would it be possible to use an IP webcam instead of an USB webcam? This is what I’m thinking, I can my phone’s camera in my PC using “IP Webcam” app anc quality is great. If we could have this overlay on that feed, it would be great.