Custom Neopixel Event Integration with Marlin for Zen XY

Hello everyone,
I am building ZenXY table, currently neopixels around the outside of the sandbox.

I would eventually like to get to the point where the neopixels are displaying colors on certain LED based on where the ball is, and colors based on the speed of the ball.

I am aware of the feature in marlin to create custom g-code commands in the menu, but that limits me to just one color for all the neopixels. Is there any way to display custom neopixel events, or use events from libraries such as the FastLED library on the Marlin Menu? Or am I better off just using a separate arduino for the neopixels for now.

I think it would be really cool if I could run neopixels patterns right from my Reprap LCD, so if anyone has any advice please let me know.

We have talked about this a few times and it is actually pretty complicated to interact with the gocde. You can pretty easily inject some color changing code yourself but ball tracking is not easy and would probably have to be a standalone application, even then syncing it up is not easy.

1 Like

As for a separate arduino, an esp32 running wled is how I do it. Cheap and effective. Just not in sync with the ball. But honestly, my favorite patterns are the ones where half the lights are one color and the other is another, to cast different shadows on the peaks and valleys.

2 Likes

A bit out of the box, but if your Arduino/Pi/ESP32 that controlled the lights was also the g-code sender, it could take a look at the coordinates and feedrate in the g-code as it is sending the commands. There would be some lag due to the Marlin queue, but most of the time it would be pretty close.

2 Likes

Thanks for the response - are there any resources/tutorials about how to do this? I am fairly inexperienced with Marlin, I’ve just been learning from these forums and youtube as I build my table.

Would the easiest way to inject color-changing code to adapt/duplicate the neopixel startup test to whatever color pattern I choose and assigning it to the LCD menu?

Thanks for the response, running wled from an arduino uno is probably how I will set it up for now - Definitely single/2 color neopixel lighting setups look the cleanest with the sand, but I think it would be cool to have the option to upgrade when I want to.

I am with Heffe and highly recommend wled, but if you enable the RGB in Marlin https://marlinfw.org/docs/gcode/M150.html

Wled won’t work with an uno. It has to be an esp32 (better) or esp8266 (good). These chips are very inexpensive on aliexpress/banggood, or a few dollar more and quick shipping from the amazon. They have much faster processors than the uno, builtin wifi and bluetooth (but AFAIK, there are no BT functions with wled). Then you can control them with a web page, or the wled app from the app store (which is basically the same as the website, but finds it automatically instead of messing with the router).

1 Like

That is really neat. And the I parameter means we might be able to play with that on it’s own. Dang. Something like turning every led a background color, and then determining which one the marble is closest to to turn it on, and the previous one off would be possible.

I feel like I have too much stuff on my todo RN, but this would be possible. I wonder if it skips the planner or not.

IMO, this would not be as magical as you think though. It is a neat feature, but an external controller has a lot of neat features this wouldn’t.

2 Likes