Help me Turn my 3D printer into a lightsaber

Hey! I’m Jack

Yes you read the title right, I want to turn my 3D printer into a lightsaber.
Although I don’t want to mislead you, so to clarify no I am not breaking down my printer and using it to make a hilt. :sweat_smile: Though that might be cool.

Maybe a good way of simplifying this idea would be to say “hey I want the neopixel lighting in my room to act like a lightsaber, how can I do this?”

What I am trying to figure out, is a way to integrate the ProffieOS or the fonts/styles used with it into a pre-existing module that allows the firmware of the printer to set off reactive NeoPixel lighting.

Although I would love to add more feature beyond that like maybe just random droid or starship noises that occur say maybe every 10% completion of the print or something.

The idea came from one of those videos like This

I checked the internet far and wide and it did not look like anyone had even talked about it before.

Upon beginning the quest that this idea set me upon I have been presented with several problems. I have gone into more detail below but first to summarize the issues.

  1. The Hardware
  2. Fonts & styles
  3. Firmware integration

Hardware

So for the Hardware this is where I honestly have know idea what to do. I thought right away why not just use a Proffie board however, I soon realized there was little I could do to integrate it with the other systems other than just power on and off. I thought maybe using and Arduino board could work but not even sure if ProffieOS would run on one of those. Then on the other end if I use a Proffie board is there a way I can have it controlled by a raspberry pi?
Essentially I need a way to emulate a lightsaber and its styles/fonts with the motion being replaced by system commands. Maybe there is someway to emulate an accelerometer to react to the commands and output them as movement to the board?

Fonts and Styles

For the fonts and styles, I realize I will need to assign a config for what lighting should happen when the system tells it too. I have actually spoken to an style and font artist or two about maybe commissioning a few fonts that could be used for this project exactly! But the issue is how I could convert or use the profiles so instead of interpreting movement into styles, the program/board would be interpreting system commands into styles. One larger issue is the current firmware (next section) does not have anything to do with sound yet, so I also need figure a way to have the fonts communicate the same way I will need the styles to communicate.

Firmware intergration

So I am using a program for my printer called Klipper, essentially it is the OS for the printer. Currently a Alpha of a module exists for reactive lighting at a minimal level, you can find that here! Essentially when the printer is in different states or actions the effects on the printer change so this is really close to what I am trying to achieve. But the issue is that I have no Idea how to have the code written for Proffie talk to the code written for the module. I will do my best to write it myself but am at a bit of a loss as at this point I do not understand how the Proffie profiles work. If anyone has some documentation I could see or suggestions or even know how I could do this I would love to hear your ideas :slight_smile:

I think this brings us back to the need for a way to emulate a lightsaber and its styles/fonts with the motion being replaced by system commands. In the end I will do everything and anything to achieve this Idea I have!

I think it could be really cool and will accept any and all help or suggestions you might have!

(side note: my brain is a bit scattered so let me know if anything doesn’t make any sense and I will do my best to clarify!:smiley: )

TL;DR
Essentially I am currently working on a project where I would like to essentially work neopixel lightsaber styles and fonts into reactive neopixels on my 3D printer. Eventually turn this into an official user mod on github for all makers to love and have fun. Any help or suggestions are more than welcome.

Some more random information if you are interested.

I am using a Voron Trident (in progress) and an Ender 3 Max.
Favourite Star Wars episode either ROTS or ROTJ

Cheers!

Jack

If you’re just looking for the lighting, it’s not overly difficult to rip out the proffieos style library and run it on something else. You can look at the test.c code in styles/ to see an example of code that runs styles with only a fraction of proffieOS.

Integrating a Proffieboard really isn’t that hard either though. You can just hook it up to the main board through a serial port and send commands to it. This is exactly how the ProffieOS workbench controls a proffieboard when connected over bluetooth, and commands like “on”, “off”, “clash” etc. already exists.

Sound is actually significantly harder to port to new hardware. It’s possible, but requires hardware and a interrupt- or dma-driven approach. In addition It takes a fair amount of CPU and SD card bandwidth.

Any specific suggestions on alternate hardware?
I was thinking maybe I could even use a raspberry pi zero or Adafruit Prop-Maker FeatherWing. Do you think one of those would work? Maybe both working together?

Maybe the pi could help with the CPU bandwidth by giving the setup its own dedicated CPU. The FeatherWing has an audio driver that could also work… right?

also thanks for the response, I didn’t even think about straight up just using the proffieos style library :sweat_smile:

Now I just have to figure out how to get the Led module to talk with it.

For alternate hardware, anything that runs a real OS (like linux) is going to make things easier, since it will already have some decent audio drivers. Then all you need to do is to rip out the proffieOS sound routines and make them send samples to the alsa device and you should be set. (more or less)

I’m not sure what kind of interface any featherwing audio library would have, but it will probably require more work to interface it with the ProffieOS code. It’s also harder to debug than something running in linux where you can just run GDB on it very easily.

Alright! yeah I’ll probably grab a Pi then I’ve seen people use them to drive neopixels before. The Raspberry Pi Zero 2 W should work right? I think all I would have to do for sound would be changing a few things in the device tree.

By alsa device are you talking about the device that would be driving the sound or? Not too familiar with the term alsa.

And alright I’ll scrap the featherwing :smiley:

Using a proffieboard is still going to be the simplest option, but that said, if you want to use a PI, then you’ll want to use a library like pulse, jack or alsa that provides an easy way to feed out samples to the sound device.

I’m not sure what mean by “device tree” though.

PI zero might not be the best choice though, it doesn’t seem to have an audio out port by default.

I would love to grab a proffieboard but unfortunately sourcing one in Canada would run me around 135-150$. (duties, fees, taxes, shipping) shipping in Canada is not fun
If all else fails I will grab one but would like to keep this at a lower budget for now.

by Device tree, I mean the BIOS/config of the pi, essentially you can setup some of the GPIO pins to output to a audio driver board (about 4$)

It does not have a audio out, however I can take care of that using the GPIO pins.

I’m going to order the driver board and the NeoPixels soon so I can start some testing :smiley:

You may want to consider a NanoPI which has audio output without a hat.

I just realized I forgot to add something Important. :sweat_smile:

So the 3D printer setup I am running, already runs through a raspberry Pi 4B 4GB
(which host the web UI) to the printers mainboard.

I kept thinking this whole time I needed to have external hardware to do this, but correct me if I’m wrong, but would I not just be able to use some of the extra GPIO pins for the Neopixel interfacing and the already existing audio port for the sound?
Only issue here is that I kind of wanted hardwired speakers attached to the bottom of the printer with the rest of the electronics but that should be an easy fix.

Anyways if I’m thinking about this correctly then I can just sideload the neopixel control with the existing module and proffie library using something like pulse, jack or alsa. And then not worry about multiple devices talking together (and the bandwidth that would take.) I will have to experiment to ensure it does not interfere with the operation of the 3D printer but this is sounding like it would work well.

If that is all good now comes the fun part of me figuring out how to get the sound routines and the lightsaber styles to talk with the module :stuck_out_tongue_winking_eye:

The Pi4 can certainly handle the audio part.
If it was me, I would probably use a 5v-tolerant teensy to drive the neopixels instead of hooking them up directly to the PI GPIO pins this would be to protect the PI from anything bad happening from getting 5 volts in the wrong place… It takes a little bit of extra coding, but I’ve done that before.

Awesome!

Love the tree btw that is so awesome.

by 5v-tolarcance you mean with like a setup with the 1k resistor right? I was thinking about grabbing a teensy 4.1. Would that do the job? Honestly out of all of them it seems to be the most affordable from what is available.

No, I meant a Teensy that has 5v-tolerant pads. This includes Teensy 2.x, 3.2 and 3.5. Teensy LC also has a pad specifically for neopixel driving which outputs a 5V signal. A resistor between the neopixels and the controller is also a good idea.

By pads are you talking about some kind of capacitor or rated circuitry on the pcb? If not mind linking me to some kind of documentation so I can learn about them? I have been searching everywhere and have only found mostly forum posts asking if the teensy works with 5v.

I might have to find an alternative as it looks like all of those models are out of stock everywhere, with restocks scheduled for April or may. Plus the massive amount of scalping going on, I’ve called about 12 different distributors this afternoon. :unamused:

*Note: while writing this I was able to get my hands on and order 2 Teensy-LC (they were the only in stock non scalped boards I could find) Looks like this shop was hidden from google but suggested by the manufacturer so YAY!

In your project

what I gathered is you used the OctoWS2811 to use splice ethernet cables for power & control of the neopixels? So would that be the best thing for me to do if I was to connect them with the teensy? Seems kind of ingenious if that is what you are doing!

By “PAD”, I mean one of the soldering-pads on the board. Those pads are generally hooked up directly to some pin on the processor. It’s the processor pins themselves that are 5v-tolerant, it’s not the board that makes it 5v-tolerant. “5v-tolerant” means that the processor is ok with you giving it an 5-volt input signal, even though the processor itself works with some other voltage. (Usually 3.3 volt.) You can read the data sheet for the processor to find these things out.

I used to use OctoWS2811 boards, but the last two years I’ve been using my own design, which is basically 4 OctoWS2811 boards and a Teensy 4.1: