FluidNC sand table automation/control via Home Assistant (work in progress)

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.

HA_dashboard_sm

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)

3 Likes

Thanks for sharing your progress on this project! I happen to run HA and nodered already, and the idea of integrating a zenxy with it would be friggin awesome. I wish I could be some help with coding this, but my skills in nodered are more on the “learn as needed” level… and what you have already is stretching my readily available knowledge.

I agree, what you have so far already has most if not all the parts needed to assemble/arrange into a “smarthome sandtable” that does some really cool things. With your ? feedback implemented already, I imagine automating consecutive gcodes is just a matter of putting in some busywork on the HA end. I can imagine this growing into something very attractive for HA users… like have it draw images to represent current weather… a birthday image to wake up to on the appropriate day(s)… you name it. I’d love to see that happen; and will do whatever easy/busywork may help. You have a github for this yet?

my skills in nodered are more on the “learn as needed” level

I’m pretty much exactly the same. It has been challenging at times but coming together little by little with lots of googling and trial and error.

like have it draw images to represent current weather… a birthday image to wake up to on the appropriate day(s)

This is something I’ve been wanting to figure out as well! I was wishing for a way to draw basic images for the holidays like Christmas trees/winter scenes or having it draw out basic images of cartoon characters that my daughter is obsessed with. Does anyone know if Sisyphus’s code is open source? I believe they have a feature that allows you to draw your own images with their app. I’ve only done a cursory search on this (like converting svg images to gcode) since I’ve been more focused on the HA side of things.

You have a github for this yet?

Unfortunately my experience with github is limited to downloading releases/repos and reading through wikis. I wouldn’t even know where to start with setting something up for this project, but I’ll definitely give additional updates here as I make more progress.

Hi All,
Well i havent even finished the lowrider3 build yet and i so want to build one of these, as i have been growing bonsai’s for years. Not so much lately as i live on a boat now.
There is only one place on the boat i could fit this and thats the main saloon table!

But the boat does also run HA and i love the idea of this, please keep us informed of your advancements.

I would love to do this as well. once i finish the LOWRIDER.

ONE PROJECT AT A TIME CHRIS, ONE PROJECT AT A TIME CHRIS, ONE PROJECT AT A TIME CHRIS, ONE PROJECT AT A TIME CHRIS,ONE PROJECT AT A TIME CHRIS, ONE PROJECT AT A TIME CHRIS, ONE PROJECT AT A TIME CHRIS, ONE PROJECT AT A TIME CHRIS, ONE PROJECT AT A TIME CHRIS,