Running weird after M106 command (to control a relay for router)

I have a relay that takes 12 volt input to turn on some switches which I have hooked up to my router. Before I run any code ( im using repetier ) I put the spindle where I want the zero to be and then run G92 X0 Y0 to set my home. Then I run the gcode. In the code I have it insert a M106 then G90 before the normal gcode starts (I am using Estlcam 11 to generate gcode). When I do this the machine runs really fast and plunges really deep on the first cut so I quickly have to kill the cut. I tried running G90 and then M106 and the same thing happens. If I leave off the M106 and I just have G90 then the machine runs normally. Has anyone seen this problem?

So you are using the M106 to turn on the router with a relay? What happens if you just try and run it without the relay? My 1st thought is it might be electrical interference with something.

2nd thought is how are you setting your Z position? If you set your spindle exactly where you want it to be, then you should be sending G92 X0 Y0 Z0

If you can share your code, that might help.

Maybe not so much the 2nd one, you did say it runs normal without the M106…

What port are you using most are only 5V, the fan port I assume you are using is 12v. Just to make sure.

Are you including “S255” to turn it all the way on?

I reloaded the firmware and it is working now. It looks like the firmware got messed up, perhaps when I was wiring the relay I touch some wires or jiggled something. I have had my firmware get corrupted before, I have a really cheap Chinese ramps, but when that happened before the screen wouldn’t show things right, but this time the screen looked fine.

My relay will take 5 or 12 volt so I am running it from the 12 volt. What finally tipped me off is that at the end of the print it was messing up also and not finishing with the old M03 command that estlcam so I could get the same problem running code that worked before (aka not running the relay or anything).