# IOT Relay Activation

**URL:** <https://forum.sienci.com/t/iot-relay-activation/1805>\
**Category:** 🧰 CNC Setup\
**Created:** [October 28, 2020, 2:10am UTC](https://forum.sienci.com/t/iot-relay-activation/1805 "2020-10-28T02:10:55Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![clark77494](https://forum.sienci.com/letter_avatar_proxy/v4/letter/c/b9e5f3/32.png) [@clark77494](https://forum.sienci.com/u/clark77494)\
**Post date:** [October 28, 2020, 2:10am UTC](https://forum.sienci.com/t/iot-relay-activation/1805/1 "2020-10-28T02:10:55Z")

</div>

I Just added an IOT Relay to the Long Mill to turn on the router when I activate a job. Is there a code or command I need to put into the UGS Software to get the relay to activate when I start a print job? I have the IOT relay plugged into the Coolant and ground on the controller.

---

<div class="post-metadata">

**Author:** ![Heyward43](https://forum.sienci.com/user_avatar/forum.sienci.com/heyward43/32/369_2.png) [@Heyward43](https://forum.sienci.com/u/Heyward43)\
**Post date:** [October 28, 2020, 3:12am UTC](https://forum.sienci.com/t/iot-relay-activation/1805/2 "2020-10-28T03:12:15Z")

</div>

I believe M7/M8 at the start to turn on the coolant and M9 at the end to turn it off. You can always test it using the UGS command line. Just key in M7 and hit enter to see if it turns on the router. If it works don’t forget to test turn off with m9 (or the power switch).

---

<div class="post-metadata">

**Author:** ![gwilki](https://forum.sienci.com/user_avatar/forum.sienci.com/gwilki/32/366_2.png) [@gwilki](https://forum.sienci.com/u/gwilki)\
**Post date:** [October 28, 2020, 11:38am UTC](https://forum.sienci.com/t/iot-relay-activation/1805/3 "2020-10-28T11:38:00Z")

</div>

@clark77494 I believe that Heyward is right, Kent. I looked into doing this, but never got around to it. Would you please post a link to the relay that you are using? Please post your results, too.

I believe that there is a function in UGS that will have it add the M7 and M8 commands to every toolpath you send it, but I can’t seem to find it this morning.

---

<div class="post-metadata">

**Author:** ![Spectre180](https://forum.sienci.com/user_avatar/forum.sienci.com/spectre180/32/1176_2.png) [@Spectre180](https://forum.sienci.com/u/Spectre180)\
**Post date:** [January 13, 2021, 3:21am UTC](https://forum.sienci.com/t/iot-relay-activation/1805/4 "2021-01-13T03:21:09Z")

</div>

Hooked up my IoT Power Bar and edited my header and footer in the GRBL mm post processor in VCarve desktop and it actually works. Using the two normally off outlets, I now have my shop vac and Makita router connected to them. Initially tried M7 but that didn’t work so used M8 to turn on and M9 to turn off.  
Connected the Power bar to the coolant port on the Longboard controller, and used this IoT power bar [https://www.amazon.ca/Iot-Relay-Enclosed-High-power-Raspberry/dp/B00WV7GMA2/ref=sr\_1\_1?crid=1OKUW9V9VMN3V&dchild=1&keywords=iot+relay+power+bar&qid=1610507837&sprefix=iot+%2Caps%2C261&sr=8-1](https://www.amazon.ca/Iot-Relay-Enclosed-High-power-Raspberry/dp/B00WV7GMA2/ref=sr_1_1?crid=1OKUW9V9VMN3V&dchild=1&keywords=iot+relay+power+bar&qid=1610507837&sprefix=iot+%2Caps%2C261&sr=8-1)

---

<div class="post-metadata">

**Author:** ![risenbar](https://forum.sienci.com/letter_avatar_proxy/v4/letter/r/7bcc69/32.png) [@risenbar](https://forum.sienci.com/u/risenbar)\
**Post date:** [January 13, 2021, 12:27pm UTC](https://forum.sienci.com/t/iot-relay-activation/1805/5 "2021-01-13T12:27:04Z")

</div>

Good to hear. I just ordered the same. I was a little concerned it wouldn’t be able to handle both the router and Vac.

Thanks

---

<div class="post-metadata">

**Author:** ![Megistus](https://forum.sienci.com/user_avatar/forum.sienci.com/megistus/32/1592_2.png) [@Megistus](https://forum.sienci.com/u/Megistus)\
**Post date:** [June 3, 2021, 10:01pm UTC](https://forum.sienci.com/t/iot-relay-activation/1805/7 "2021-06-03T22:01:23Z")

</div>

Single Phase Solid State Relay.

 ![image](https://forum.sienci.com/uploads/default/original/2X/b/b3ce896da4c484e094c2cf9ee2c9303c645cb48b.jpeg)  
This is the unit I just installed for powering the router. 25 amp relay and DC 3-32V control. Connected to the coolant contact and activated/deactivated with the M8/M9 commands. Works great.

---

<div class="post-metadata">

**Author:** ![chrismakesstuff](https://forum.sienci.com/user_avatar/forum.sienci.com/chrismakesstuff/32/10759_2.png) [@chrismakesstuff](https://forum.sienci.com/u/chrismakesstuff)\
**Post date:** [June 24, 2021, 3:04pm UTC](https://forum.sienci.com/t/iot-relay-activation/1805/8 "2021-06-24T15:04:15Z")

</div>

To add, there is now a page discussion IOT relay setup in our CNC resources:

> **[IOT Relay Control - LongMill CNC CNC](https://resources.sienci.com/view/lm-iot-relay/)**
>
> Use an IOT relay on your LongMill CNC to automatically control power to your router, vacuum, lighting, or other AC power systems.

---

<div class="post-metadata">

**Author:** ![Megistus](https://forum.sienci.com/user_avatar/forum.sienci.com/megistus/32/1592_2.png) [@Megistus](https://forum.sienci.com/u/Megistus)\
**Post date:** [June 25, 2021, 10:34am UTC](https://forum.sienci.com/t/iot-relay-activation/1805/9 "2021-06-25T10:34:26Z")

</div>

In the Sienci Resources it details the following -

Another option if you’re using CNCjs is to set up custom ‘Events’:

1. Go to Settings (gears on the left) → Events, and add a new event for the both commands
2. Use events “G-code: Start” for the M8 command and “G-code: Stop” for M9

This will now ‘inject’ the M8 command at the start of any gcode file and an M9 at the end. It applies to every file you run unless you disable them.

 ![](https://forum.sienci.com/uploads/default/original/2X/e/e709f07fc7681a1d2fa08d8ec11291c49bc58e51.png)

My question, is this feature currently available in gSender and I haven’t found it, or, Will this ability be made available for gSender to have Headers and Footers in new revisions.

---

<div class="post-metadata">

**Author:** ![chrismakesstuff](https://forum.sienci.com/user_avatar/forum.sienci.com/chrismakesstuff/32/10759_2.png) [@chrismakesstuff](https://forum.sienci.com/u/chrismakesstuff)\
**Post date:** [June 26, 2021, 5:26pm UTC](https://forum.sienci.com/t/iot-relay-activation/1805/10 "2021-06-26T17:26:08Z")

</div>

Great catch Wayne! Yes this is a new feature that we’re actually working to have ready for the upcoming release of gSender, so you should be able to try it out then 😀

---

<div class="post-metadata">

**Author:** ![Chrisjsmitty](https://forum.sienci.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@Chrisjsmitty](https://forum.sienci.com/u/Chrisjsmitty)\
**Post date:** [June 27, 2021, 11:27am UTC](https://forum.sienci.com/t/iot-relay-activation/1805/11 "2021-06-27T11:27:27Z")

</div>

Has anyone run into issues using gsender with this? I manually add M8 as first line and m9 as last line. When I go to run the job in gsender my router and dust collection power on but the program doesn’t run. If I remove the m8 and m9 codes the program runs as expected. Any thoughts?

---

<div class="post-metadata">

**Author:** ![gwilki](https://forum.sienci.com/user_avatar/forum.sienci.com/gwilki/32/366_2.png) [@gwilki](https://forum.sienci.com/u/gwilki)\
**Post date:** [June 27, 2021, 12:51pm UTC](https://forum.sienci.com/t/iot-relay-activation/1805/12 "2021-06-27T12:51:50Z")

</div>

@Chrisjsmitty Welcome to the group, Chris. I’m sure that you will find it an excellent place to get answers to your questions.

My answer may not help, but here goes. I don’t have the relay set up, so I just added an M8 command to the beginning of two gcode files. Both ran fine. I can’t see that actually having the relay would matter, but maybe someone here with the relay can chime in.

Have you tried this on more than one file? Can you post the file that is not working? I’ll run it and see if I get the same results.

---

<div class="post-metadata">

**Author:** ![Chrisjsmitty](https://forum.sienci.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@Chrisjsmitty](https://forum.sienci.com/u/Chrisjsmitty)\
**Post date:** [June 27, 2021, 2:43pm UTC](https://forum.sienci.com/t/iot-relay-activation/1805/13 "2021-06-27T14:43:37Z")

</div>

Thanks @gwilki ! So The relay is turning everything on.

I try multiple files. What is happening in gsender. Vac and router power on, in gsender the job is running in the visualizer. . The machine is not moving however. I delete the commands and runs perfectI have uploaded the file, thanks for the assist!

[M8TEST.nc](https://forum.sienci.com/uploads/short-url/1fHElbYZVb2eY099K2NCGMzuUWt.nc) (68.8 KB)

---

<div class="post-metadata">

**Author:** ![gwilki](https://forum.sienci.com/user_avatar/forum.sienci.com/gwilki/32/366_2.png) [@gwilki](https://forum.sienci.com/u/gwilki)\
**Post date:** [June 27, 2021, 5:16pm UTC](https://forum.sienci.com/t/iot-relay-activation/1805/14 "2021-06-27T17:16:02Z")

</div>

@Chrisjsmitty Weird, Chris. As I said, I don’t have the relay, so my ability to test is very limited. I ran your file and it ran perfectly. Might I suggest a further test on your part? Unplug the relay and just run the file in air with the router dead. This would sort of make your Mill setup like mine. If the file runs, at least we can be sure that the problem has something to do with the way the relay is handling power. I assume that the Mill controller is not plugged into the relay. Correct?

---

<div class="post-metadata">

**Author:** ![Chrisjsmitty](https://forum.sienci.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@Chrisjsmitty](https://forum.sienci.com/u/Chrisjsmitty)\
**Post date:** [June 27, 2021, 9:36pm UTC](https://forum.sienci.com/t/iot-relay-activation/1805/15 "2021-06-27T21:36:37Z")

</div>

That’s really interesting. I tried your test and it works fine with the iot physically unplugged from the control unit but with the m8 code in the gcode

---

<div class="post-metadata">

**Author:** ![Megistus](https://forum.sienci.com/user_avatar/forum.sienci.com/megistus/32/1592_2.png) [@Megistus](https://forum.sienci.com/u/Megistus)\
**Post date:** [June 28, 2021, 10:14pm UTC](https://forum.sienci.com/t/iot-relay-activation/1805/16 "2021-06-28T22:14:36Z")

</div>

Try this revised program.  
Should work for you.  
[M8TEST.nc](https://forum.sienci.com/uploads/short-url/nIObBmEkM0pCI7Xz4TrfMUBoMWW.nc) (68.9 KB)  
There’s a lot of freaky code here… What’s with all the G1’s ?  
What did you create this gcode on ?

---

<div class="post-metadata">

**Author:** ![gwilki](https://forum.sienci.com/user_avatar/forum.sienci.com/gwilki/32/366_2.png) [@gwilki](https://forum.sienci.com/u/gwilki)\
**Post date:** [June 29, 2021, 7:26pm UTC](https://forum.sienci.com/t/iot-relay-activation/1805/17 "2021-06-29T19:26:40Z")

</div>

@Chrisjsmitty Chris: I don’t have an answer for you on why the presence of the relay is causing this problem, but I am working on it.

@Megistus With respect, Wayne, I would not advise Chris to use the file you attached. It has an M0 command at its start, which will stop the run and not allow it to continue. Further, it has an M05 command that, unless Chris is running a spindle, will do nothing. It turns off a spindle.

I’m curious about your comment on all the G1 commands. I generate my gcode from VCarvePro, using grbl inch as my post processor. It generates a G1 command for every line in the file that is a cutting move, and a G0 command for fast moves outside the material. Does your program do it differently?

---

<div class="post-metadata">

**Author:** ![Chrisjsmitty](https://forum.sienci.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@Chrisjsmitty](https://forum.sienci.com/u/Chrisjsmitty)\
**Post date:** [June 29, 2021, 8:02pm UTC](https://forum.sienci.com/t/iot-relay-activation/1805/18 "2021-06-29T20:02:18Z")

</div>

@Megistus that particular file was created in easel.

@gwilki my only other thought I am going to try is upgrading the gauge of the wire and decreasing the distance between the iot and the controller to see if maybe it’s a initial power demand issue. I really appreciate everyone’s help. Other than this so far the long mill is running beautifully since I assembled it last Thursday

 ![image](https://forum.sienci.com/uploads/default/original/2X/3/33a6f753b0b98d48c9d7a762de591477440fd435.jpeg)

---

<div class="post-metadata">

**Author:** ![gwilki](https://forum.sienci.com/user_avatar/forum.sienci.com/gwilki/32/366_2.png) [@gwilki](https://forum.sienci.com/u/gwilki)\
**Post date:** [June 29, 2021, 8:13pm UTC](https://forum.sienci.com/t/iot-relay-activation/1805/19 "2021-06-29T20:13:02Z")

</div>

@Chrisjsmitty Chris: Is the Mill controller plugged into the IOT? I ask because, if you are using the IOT recommended by Sienci, its specs say the following:

Note that the IOT relay is built to handle 0-8A with 18AWG power cords and 0-12A with 16AWG cord.

The Makita router draws 6.5 amps and the Long Mill controller draws 8.8 max. So, if the Mill controller is plugged into the IOT, you are way over spec. If it’s not, never mind. 😀

---

<div class="post-metadata">

**Author:** ![Megistus](https://forum.sienci.com/user_avatar/forum.sienci.com/megistus/32/1592_2.png) [@Megistus](https://forum.sienci.com/u/Megistus)\
**Post date:** [June 29, 2021, 9:41pm UTC](https://forum.sienci.com/t/iot-relay-activation/1805/20 "2021-06-29T21:41:15Z")

</div>

Wow, That’s crazy. Yes my gcode generator only produces a G command when a change of speed is requested. Thanks for the info.

---

<div class="post-metadata">

**Author:** ![Megistus](https://forum.sienci.com/user_avatar/forum.sienci.com/megistus/32/1592_2.png) [@Megistus](https://forum.sienci.com/u/Megistus)\
**Post date:** [June 29, 2021, 10:08pm UTC](https://forum.sienci.com/t/iot-relay-activation/1805/21 "2021-06-29T22:08:35Z")

</div>

Thanks for the update. Here’s a 2nd revision to have a look at.  
[M8TEST\_REVISION2.nc](https://forum.sienci.com/uploads/short-url/jfaarT3Jpucg6MJKZPe0bmu6RcN.nc) (68.9 KB)  
The file still runs a bit freaky on [NCVIEWER](https://ncviewer.com/)  
Have Fun…

[Next page](https://forum.sienci.com/t/iot-relay-activation/1805.md?page=2)
