Automated Spindle and Vacuum Power Control Box

Not sure if this has been done before, either way, here’s my take on things.

TL;DR
Grey plastic box thingy (with lights) that turns Makita router and dust collector motors on and off automatically by way of signaling a Home Assistant (home automation server) when Pin 15 on the Onefinity Breakout Board Adapter goes high, which in turn will control two off-the-shelf smart switches.

Primary Responsibility
Act as a signalling device to my home automation software so it can turn the smart plugs (switches) on and off accordingly
NOT intended to control the motors directly, only to signal something else to do that process
Allow manual override of all signals (physical safety switch) to prevent motors from turning on when not desired
Optional: Allow easy manual control of both spindle and vacuum motors in case of malfunction

Main Guts:

  • ESP32 (ESP-WROOM-32 model) Microcontroller (WiFi and Bluetooth)
  • ESP32 screw terminal breakout board
  • x1 Red, x1 Green LED
  • Double Pole —> Single OR Double Throw Toggle Switch
  • Custom mains power extension cord with a double-gang box containing a light switch which controls a duplex power socket
  • Custom designed square-ish box in FreeCAD and 3D printed
  • Assorted wire, solder and coffee

IoT Devices

  • Sonoff S32 Smart Switch Flashed with ESPHOME (Makita router)
  • TP-Link Kasa Smart Switch (dust collector)
  • Ikea TRÅDFRI Shortcut button (smart push button) connected to Home Assistant via MQTT to manually control the dust collector motor

Home Automation
Raspberry Pi 4

  • Home Assistant 2022.9.6 (FREE and open source)
  • ESPHOME add-on for Home Assistant
  • Node-Red for Home Assistant (flow-based development tool for visual programming)

Ancillary devices

  • Onefinity Breakout Board Adapter, SKU: 3001013
  • Custom made extension cord with a double-gang electrical box at one end which contains a light switch and dual power outlets
  • USB 5v mobile phone charger and cable for powering the ESP32 microcontroller

Basic Workflow and Operation
When the toggle switch is moved, this signals my home automation server to talk back to the control box and tell the microcontroller to turn on or off either of the LEDs. This process is separate and independent from anything dealing with the CNC machine. The ONLY function of the toggle switch is to turn one LED off and turn the other one on. Back and forth, that’s it.

With the toggle switch in the safe (green LED) position, the home automation software will ignore all signals from the CNC and do nothing.

In the unsafe (red LED) position, anytime a 3.3v signal is detected from pin 15 on the CNC, the automation server will send a “turn on” signal to two different smart switches. And if a zero voltage is detected, the switches get sent the “turn off” command.

NOTE: If the safety toggle switch is turned to safe (green) AFTER a program has started on the CNC, the router and vacuum will NOT turn off after the program is finished and will require manual intervention.

If this control box ever fails or is in safe mode (ignoring the CNC signals), then simply pressing the Ikea button will turn on the vacuum, and the Sonoff smart switch has a manual override on/off button built into the side and will do the same. This way I can run the vacuum for cleanup separately from the CNC control.

And, here’s the pictures. I will be happy to provide the ESPHOME and Node-Red configurations if needed. Let me know if anything isn’t clear or I missed something. Cheers!

2 Likes

Wow that is some kinda fancy, Love the way that in the end all you see is the grey box a switch and 2 lights, so clean. Good job hopefully one day I’ll be able to figure out how to build one of my own Rob

2 Likes

I was thinking about doing something like this but using Solid State Relay dc to ac instead of microcontroller , Which settings in the menu you had to modify to make this work?

Hey Forrest,

if I understand you correctly, you want that normally the milling motor and the dust extraction are switched on and off by the CNC controller, but you want to be able to get manual control over them at any time, is that right?

What I don’t understand then, is why you need a microcontroller and a home automation server to do this. This seems to me like chartering a A380 to visit your neighbor to have a beer in the house next to you :slight_smile:. I think all you need to make this happen is two relays and a few DPDT switches (and two LEDs if you like).

Please don’t get me wrong, I am someone who thinks about things you can do with microcontrollers every day. But I would not use one if i can accomplish the task more easily in another way. I can think of more demanding tasks for justifying the use of a microcontroller.

Can’t you can simply connect two relays to ‘tool-enable’ (pin 15), so that the devices are switched on and off by the CNC controller, and bypass the state of the relays with two switches, if you want to control them manually?

Further reading

1 Like

Relays should work just as well as the smart plugs I used, as long as they can use 3.3 volts for the signal.

The only setting I had to make on the Onefinity is under SettingsTool and configured “tool-enable-mode” drop-down list to “lo-hi

1 Like

That’s great to hear , I’ll try to use ss relay with 3v dc minimum input and ac output.

you want to be able to get manual control over them at any time, is that right?

Correct. The TP-LINK smart plug that I use for the dust collector is on the other side of the shop, so I needed something like the Ikea smart button to send a signal for turning it on/off manually when needed. And, as noted, the Makita router is plugged into a Sonoff smart plug attached to the CNC table and I can just push the manual override button on the Sonoff if I ever want to turn just the router on/off.

why you need a microcontroller and a home automation server to do this
Can’t you can simply connect two relays to ‘tool-enable’ (pin 15), so that the devices are switched on and off by the CNC controller

You don’t need an automation server to do this. I have been using Home Assistant for a few years and it just made sense to have it control everything. So, using regular relays, with an extra toggle swith as you mentioned, should work just fine. The only thing with this is making sure the relays support 3.3 volts for triggering (and not more like 5 or 12 volts), and you will have to either connect both dust collector and the spindle to one big relay, or two smaller ones where you will have to split the 3.3v output from the 1F, or daisy chain the relays together. And, if not mistaken, there are regular looking power strips that have screw terminals where you can connect a wire from things like a 3.3v signal from the 1F, and will turn multiple outlets on or off.

I can think of more demanding tasks for justifying the use of a microcontroller

Absolutely agree. I went this way because:

  1. At this working stage of the project, it was pretty easy and quick to make it functional without needing any low level programming like trying to emulate a keyboard the way the incredibly awesome Control panel you linked has to do. All I wanted when I started this was to be across the shop or upstairs and have my spindle and vacuum turn themselves off when the program finishes.

  2. Although the microcontroller is really acting as a overly-powered relay right now, I have immediate plans to add both a temperature/humidity sensor, and a air quality sensor, and still have more than enough inputs and outputs remaining on the microcontroller for other things that don’t have to do with anything directly associated with the CNC machine like lights, sirens, or a coffee machine.

  3. Even in today’s world, an ESP32 is only $5-8 USD with plenty in stock, and the less powerful ESP8266 controllers are only about $3-4 each.

1 Like

Hey Forrest,

thank you for the details!

I understand, you control your dust collector wirelessly and your home automation server is already there anyway.

I’m more someone where everything is laid with cables. Since I was only interested in home automation from a security point of view when it first appeared, I never considered using it. The only exception is the smart control of my radiators, there I have an older system with wireless valve controllers and wireless window sensors with a central controller, but it only controls the radiators, and I think I will use something else when I move.

Some time ago, I took an in-depth look at all the smart home wireless protocols that have come onto the market and found that there are no secure ones. To my knowledge, there is only one wireless technology that is truly secure: WiFi (if configured correctly).

Your ESP32 is a microcontroller equipped with quite a bit of peripherals like WiFi and Bluetooth. But still you use an Ikea switch for the dust collector. Do you use WiFi and Bluetooth of the ESP32 for something?

I think many here appreciate it when people post their setups, thank you!

PS: OT: The discourse.org forum software which runs here offers a comfortable quoting function. If you mark any part of the posting you want to reply to, a little grey field appears which says “ Quote”. If you click on this field, the marked part is inserted in your compositor window and gets the attribution (post/author) inserted automatically!

I know of 3 major wireless technologies when it comes to IoT devices; WiFi, Zigbee and ZWave. I don’t have any ZWave devices and the Ikea smart buttons are using the Zigbee communication protocol and radio frequencies. The ESP32 controllers are only using WiFi for connectivity. So

Obviously nothing is totally hacker-proof, but to my knowledge, Zigbee uses encryption during transmission as does WiFi. I have not done any direct comparisons between the two in relation to security, but feel more than comfortable using Zigbee. Just to note, other things that use Zigbee include my Philips Hue and Ikea light bulbs.

I am only using an Ikea button for the dust collector because they were inexpensive and I had a few extra just sitting around. I am not using Bluetooth on the ESP32, but just the WiFi radio only for connecting to the automation server. The software loaded on the ESP32 is called ESPHOME and only uses WiFi. Here’s a quick diagram that may help:

Brilliant and thanks!

2 Likes