I still have a lot of work to do here but I thought I’d share my progress in a thread in case other people find this useful. Full disclosure I am not a software engineer and there are probably much better/more streamlined ways to accomplish this if you actually know what you’re doing.
I’ve finally got my table up and running using Bart Dring’s TMC2209 Pen/Laser controller (new version) running FluidNC (and a ton of direct/indirect help from the wonderful people here in the forums). Unfortunately I quickly realized that there is no native ‘playlist’ support in FluidNC, so I set out trying to control it via Home Assistant since the board has wifi capabilities and can accept commands via TCP/Telnet (and for the fun of it).
Thus far I’ve worked out the ‘control’ side of the equation and now need to work on robustness and automation.
This involved using a mix of Home Assistant, the Node-RED add-on, and the HACS add-on.
All communication is done via TCP nodes sent to the FluidNC IP:port (port 23)
Home, Pause, & Resume are done with simple button nodes (via the HACS “Node-RED Companion” add-on) that send the associated GRBL commands to a TCP node.
Status and Current Pattern are from a simple Inject node that sends ?
on repeat every 3 seconds. This info is parsed and saved to a couple Sensor nodes. You can also add machine speed and % completion here since this is all included with ?
(e.g. <Run|MPos:0.000,531.170,0.000|FS:1414,0|SD:99.98,/sd/wavy_noise.gcode>)
For the pattern list, I have an Inject node send $SD/List
which gets parsed/filtered into an array of pattern names. This array gets sent to Input_Select
which was previously setup in the Helpers section of HA using a single filler Option of “none”. This gets overwritten with the actual pattern list once the initial inject node is ran and can be updated dynamically. I think this could be reduced in size quite a bit using a Template node, but that is above my current skill level.
Starting a pattern is done via the Events:State node which captures the pattern name from Input_Select
and is then sent through a Template node to append the GRBL command to the pattern name (i.e. $SD/Run=/{{pattern name}}
Exported flow in JSON format is attached here:
SandTableFlowJSON.zip (2.7 KB)
I believe the only additional palette used, aside from Node-RED Companion, was node-red-contrib-string in order to help format the incoming strings.
One thing to watch out for if you start messing with this is that these commands need a carriage return added on and the end. Depending on how you’re sending them, this could be as simple as adding \r
to the end of a string command or it might need to be formatted as JSON (e.g. “$SD/List\r”).
Next things to work on are robustness to ensure I’m not trying to send a new pattern while a current one is still running, general stability, and then starting the automation aspect to continuously cycle through the list of patterns. The latter will probably be a challenge of its own but I feel like all the components are there and it’s just a matter of ‘arranging’ them in the right order.
Edit: I thought I’d also share the YAML code for the lovelace card since it shows some of the HA entities used:
SandTableLovelaceCard.zip (510 Bytes)