Adding router control with SKR Pro and Iot relay

Hey all,

I just recently finished building my mpcnc and have done several successful jobs. Now that I have the basics working, I would like to add a relay to my router so I don’t have to keep checking to see when the job is done, so I can turn off my router.

I have a SKR Pro v1.2 board and a TFT35 screen and am running a dual end stops setup with the V1 dual end stop firmware running on it.

I’ve purchase an “Iot” relay from Amazon ( which can be actuated by either 3-48vdc or 12-120vac.

Could someone help me with what pins/terminals on the SKR Pro I should be connecting the control side of the relay to and what needs to be changed in the firmware for those pins to work? I have a bit of experience with editing the marlin firmware on my ender 3 and re-flashing, but I don’t know what I would change for this setup.

Thanks in advance.


1 Like

I use this relay on my Rambo board. I connected the relay to one of the fan pin pairs. I then modified my CNC tools (Fusion 360 and Lightburn), so that a M106 is inserted at the start of every script, and a M107 is inserted at the end. No Marlin editing/changes are required.

You do have more choices for turning it on and off. This IOT relay’s specifications indicated it will switch on with as little as 3V, so you can use any available pin on your board. An M42 g-code command can be used to set the state of any pin, and that command can also be automatically inserted into any script.

The connection between to the relay is polarity sensitive.

so I don’t have to keep checking to see when the job is done

Obligatory safety statement here. CNC routers have been known to start fires, so remaining near the machine is prudent.

1 Like

:rotating_light: :monkey: :rotating_light:
Safety monkey time: Never, ever, ever leave your CNC alone. Not even to refill your coffee/tea/water/fizzy-lifting-drink. That’s what you have a shop fridge/hot plate for. Seriously, assuming you built a “stock” MPCNC, you’re running a DW trim router, which is a fixed 30K RPM. Something goes wrong, and the bit gets buried in your stock, and things go from neato-keen (albeit loud and keening) to screaming and yelling in seconds. Ask @jeffeb3 about his close call… Luckily, he smelled the burning wood from atop the ladder he was on before the smoke alarm he’d hooked up right next to the machine went off. He saved his machine, his shop, and possibly his life. Had he been out of the shop, things could have gone very differently. And don’t get me started on what might happen if your dust collection isn’t functioning and the smoke starts (kindling, tinder, etc., etc.). If you want the full paranoia, what happens if it is working, but you start a fire anyway, and suck up some embers (not sparks, but full-on embers)?

Of course, all that being said, it is, at the end of the day, your machine, your shop, your show, your liability. But we are obligated (well, some of us feel a duty to our fellow hominids) to stress safety at every turn and try to avoid as many preventable injuries and damages as possible.

Monkey out! :monkey_face:


Wow, yeah, didn’t actually think about that. I do have a webcam that I use to watch it, but you make a very good point. I do still want to set up my router to turn off and on automatically though.

1 Like

No worries. 3-D Printers have made us complacent. If a job goes pear-shaped overnight, we end up with a bid’s nest of filament and a mess to clean up. Maybe a first-gen might have a massive thermal runaway and light up, but those are pretty well under control these days. But those are still just soldering irons on wheels. The MPCNC is a robot with lethal intentions. You’ve given it a brain (controller), muscles (steppers), and weapons (spindles & bits and/or lasers), and then let it loose (let’s be real, it’s all open-loop control)…

And yeah, I make light of it to a certain degree, but that’s mainly so I don’t come off as too much of a wet blanket. Hmmm… Maybe an enclosure with one of those fire-suppression blankets in the top like they put on car hoods… Could help with the sound proofing, too… I’m sure it’s been discussed here sometime before…

I’m thinking a smoke detector, a fire extinguisher, and do go to far away.

Worked like a charm, thank you.


Yeah. I was on the ladder hooking up the smoke detector when I smelled the smoke. The bit was completely buried and the collet was rubbing making some smoke. The smoke detector didn’t go off.


At least a smokie and extinguisher yeah, and remember Jeff’s tale so we don’t trust the smoke alarm too much, and be sure to test that your mounting location will work well. I agree you should add a relay to the spindle, but I think leaving a cnc unattended should be a disconnected discussion. I mean, if you’re leaving it unattended enough where you come back and are like, “man, that’s been running for an hour without cutting… what a waste of bearings and energy”, then IMHO you are not playing it safe enough to avoid a major incident in the long run. Definitely not taking away from our safety monkey advice… but if I like need to use the head during a cut (and for whatever reason, pausing the machine or holding my bodily function is not possible), I am well aware if it’s cutting OK or not as I walk to and from the bathroom… my ears never loose sight if you will (like wait… that was way too long a pause in noise to be a normal rapid… better run and check on it, or dude, that squealing is getting higher pitched, no time to wipe… lol!). Yeah, the garage door get’s chocked open so I can it hear while I pee.

@Jeffeb3, not sure what detector you have or how old it is, bit it may be worth experimenting with different locations for the smokie. Like if the detector is down low by the machine, smoke may rise to the rafters right next to it without the stream ever touching the sensor. Then remounting the smokie like near the ridge beam might give you the earliest detection.

It isn’t always 100% best to put the smokie at the highest point in a room, but that does work out to be best 95% of the time. My printer smokie is a 5% example… print enclosure sits against a wall, with a 30" deep upper cabinet overhanging it. The smokie for my printer is mounted under the cabinets, because any smoke from printer parts funnels through that area before making it to the rafters (so earlier detection than rafters).

Thank you everybody for your concern. I’m actually not leaving it un-monitored at all any more. I’m there or have my Wyze cam with a mic on it while I’m in my house at my computer. And, there is an extinguisher in the garage and a hose right outside the garage if I decide to electrocute myself.

Everyone’s responses have been great. It’s nice to have so many people reach out to help.
You guys are awesome!


Duly noted. Thank you.

How did you get it to insert the code at the beginning and end in Fusion 360? I’ve been able to cut out things and do some 2.5D carvings using fisher’s post-processor and got a iot Relay similar to Nick Wilson’s, I just can’t figure out how to get it going. I’m a complete noob to CNC so this has come as somewhat of a challenge.

Gcode is just a txt file. You can edit it and insert your own code. Im not using 360 but most programs have a spot that will let you put in custom codes to be inserted into every file.

I dont use the spindle output, both my router and vacuum are controlled by the “mist” output. So a G7 at the beginning and a G9 at the end turns on/off the relay for me.