FluidNC LED Musings

If anyone wants to try this, I pushed up my changes to the usermod-fluidnc branch in my fork. I’m sure I’ll be making some tweaks, but it’s functional.

If you’ve never played with WLED before, you should probably try it out with a standard build before going down this path. There’s a lot to WLED but it’s super fun.

If you’ve compiled FluidNC yourself before, this works the same way using PlatformIO. There are some extra steps for the web portion (like installing Node JS). More details are here:
https://kno.wled.ge/advanced/compiling-wled/

I just added a platform_override.ini file with these contents:

[platformio]
default_envs = esp32dev_fluidnc

[env:esp32dev_fluidnc]
extends = env:esp32dev
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32.build_flags} -D WLED_RELEASE_NAME=\"ESP32_FluidNC\"
  ${esp32.AR_build_flags}
  -D USERMOD_FLUIDNC

I’m not entirely sure how to apply this otherwise yet. This is on the latest unreleased 0.16 version. If anyone has suggestions, I can try it. This is why I’m hoping to get this added to the official codebase at some point so this can be simplified a bit. I can provide firmware builds if that helps, but I’m not sure what to do with them.

Once it’s installed and WLED is running, you’ll need to set the rest up. I’m certain I’m missing parts here. WLED is super configurable but that means there’s a bit to setup.

Configuration

In the WLED app, under Config menu:

WiFi Setup

Update the settings to connect to the same network as FluidNC.

LED Preferences

Under Hardware setup, setup your strip with the appropriate settings and number of LEDs. These values will differ depending on the controller and strip you are using.

Usermods → FluidNC

  • Enabled - Checkbox to enable the usermod.
  • FluidNC URL - The URL/IP address of the FluidNC controller. I’m currently using an IP address. Originally, I couldn’t get it to work with fluidnc.local and I haven’t tried since.
  • FluidNC Port - The TCP/Telnet port of the FluidNC controller (typically 23).
  • CNC X Width Mm - Usable X width in mm of the CNC machine. Mine is 875.
  • CNC X Position LED Width - Number of LEDs to overlay the position. Use an odd number. I have it set to 5 which on a 60 LED/m strip is about the width of the bottom of the LR3 core.
  • CNC X Position Offset Mm - Offset in mm from the leftmost LED to the endmill. This is hard to measure. It’s easiest to set the position LED width above to 1, and adjust until it looks right. Mine is set to 60.
  • CNC X Position Reverse - Checkbox if the LED strip starts at the max X position. I have this checked because my strip starts at X max.
  • LED Strip Length Mm - Length in mm of the LED strip from the middle of first LED to middle of last LED. I have a 1 meter strip but this measures 973mm.

Presets

Create presets with the following IDs for each state. You can play around with what effect you like. I have some crazy effects right now, because I can.

  1. Idle
  2. Home
  3. Alarm
  4. Hold - I’m using the Breathe effect to blink between yellow and black. This is red would be good for Alarm as well.
  5. Run
  6. Jog
  7. Unknown

Note that if the effects are moving in the wrong direction (like if the effect moves in the opposite direction when homing X), you can check the “Reverse direction” checkbox in the Segment configuration.

If anyone has any questions or suggestions, let me know.

8 Likes