Make your 3D printer tons cooler and more functional by adding LEDs the printer controls itself!
This method will work for almost any 3D printer and you don’t need to do any complex electrical work or mess with the firmware. This is the complete guide from selecting which LEDs to use, over control options, to configuring things to be automatically controlled!
Hey, you know what all the cool kids are into these days? LEDs. You’ve got them in warm white, cool white, RGB full color, whatever you want, and once you have some on your 3D printer, not only do they light up your work area and the print itself, but you can also use them to show some simple status information about what’s going on. This is going to work for pretty much any 3D printer, the wiring is super simple and you don’t even need to mess with firmware settings to have these LEDs automatically controlled by the printer in a somewhat intelligent fashion. So follow along and learn what LEDs I like to use, how to wire them into your 3D printer’s control board and which options you have make them useful. Let’s go!
So let’s start out with what LEDs make sense for us here. You’re probably going to be powering these LEDs from your printer’s built-in power supply, they don’t add a ton of load, so unless you’ve got a power supply that’s already struggling or you’re trying to add an obscene amount of LEDs, you’re probably going to be fine. The LEDs most of you will think of are probably LED strips, they’re a centimeter wide, they’re flexible, and have some double-sided tape already applied on the back, so you can just stick them anywhere you want, bend them around corners or even wrap them around aluminum profiles.
The LEDs themselves are these little guys on here, you can get them with different brightnesses, different shades of white or in any other single color and, of course, in RGB, which is basically a red, green and a blue LED combined into one, and you can control each color individually. So the common LED strips are a good choice, they are incredibly cheap, you can get a five meter long spool for just a few bucks and you can cut that into smaller sections every three LEDs. Even though the sticky tape on the back does adhere well when you stick them down, I like to add a dab of hotglue or superglue to the ends to keep them in place permanently.
Another type I also really like are these LED rings, they are originally intended to get that tacky BMW angel eye effect on your car, but because you can get them in different sizes, you’re going to find one that is the perfect size to fit around your hot end. These come on a rigid PCB, so you don’t have to worry about mounting too much, if you want, you can of course make a 3D printed adapter to fit stuff perfectly, but you can also just epoxy or zip-tie them to your carriage. These have a nice, even light that highlights details as they are being printed, but you definitely should not pick a ring that is much too large, since that will light up everything around your toolhead, but leave the very center in the dark. Now, those two run off of 12V so they’re somewhat specific to this use, another option I kinda like are basic LED spots, they come in the shape of a Halogen spot and these work really well if you have your 3D printer in any sort of an enclosure, you drill a few holes, pop ‘em in and basically hook them up like any other light fixture.
It’s a different approach, but just to throw it out there, there are always different options.Now, how do you wire the LED strips and rings up? The simplest way would be just to head over to your printer’s power supply, add a pair of wires and connect that straight up to your LEDs. If your printer is using a 24V power supply, which is somewhat common is nicer machines, you will need to add a small buck converter in line that will drop the 24V to 12, basically you hook up the input side to the power supply, adjust the potentiometer on them until the output has 12V, and then connect the rest. So hooking stuff up directly might be perfectly fine, as soon as you switch on the printer, the LEDs also light up, but you can go quite a bit further. If you just want a simple switched LED that is on when the hotend is hotend, so when the machine is working, you can try and see if your printer has a switched hotend cooling fan that turns off when the hotend is cold, don’t confuse that with the part cooling fan though, that’s different. Usually the output for the hotend fan has bit of extra capacity and you could wire some LEDs directly into that output, in parallel with the fan.
It’s not really elegant, though. So what you can do instead for full control is to use a spare pin that’s routed out somewhere on the board. You should be able to find a graphic like this that shows which physical, exposed pins correspond to which Arduino pin numbers. You can use both so called digital pins that either only have a number or are called D12, D13 etc, or the analog pins should there be any spares, they are always called A1, A2 and so on. On the RAMPS, you have all these pins, on the RAMBo, there’s this extension header, the MKS Base has few pins next to the endstop connectors – and, on many boards you can even use unused endstop ports or the pins on the LCD connector to get an few extra control signals. But if you do that, keep in mind that the firmware might already be configured to use those signals for their original purpose, which means we can’t easily use them for other stuff.
Your best bet is always to use spare pins that are otherwise unused.Now, these pins are directly connected to the microcontroller, so they can’t drive any significant load by themselves. Instead, you’ll need to add some sort of driver module. Of course, you can use the classic Arduino relay module if you fancy that “clank” every time it turns on or off, but since we’re only switching DC current with the same ground reference as the control board, a MOSFet does the job much better. While, of course, you can use a bare MOSFet or even a bipolar transistor, using one of these ready-made boards gives you the all the circuitry and screw connectors and they’re like 50ct each.
I’m going to be using this homemade board from a few years ago, which does the exact same thing. You connect your spare pin from the control board to “signal”, a spare ground to ground, you can also grab ground from the power supply if you don’t have an extra one on the board, and then wire in your 12V supply on the input and the LED on the output side. The RGB strips only have a single positive line, so you only have to hook that up once, but you do have to connect each individual color line to the negative output side of a switch module. And that’s the hardware done!
Now, actually, you can right away try out if the hardware is working by sending a single line of gcode to your printer – that is M42, P, then the pin number you used, and S255. If you used an analog pin, you’ll need to get the according digital pin number according to this table. And as a bonus, try the same thing with S126 – if your pin can do pulse width modulation, the LED should now be at just below half brightness and you’ll be able to dim it using any value between 0 and 255 for the S setting. If the LED turned off completely, then that pin can only do on and off, which, honestly, is still fine.
If you’re not getting any reaction from the LEDs at all, double-check your wiring and if that doesn’t help, maybe try a different pin. So we’ve got full control over the LEDs through the firmware, which is great, now how do we make them smart? Some firmwares like Smoothieware let you define conditions when the printer should turn on or off certain things, but we’re just going to weave the controls into every print’s gcode.
It’s simple, it’s automatic once it’s set up, but there are a few things to watch out for. For the simplest implementation, we’re going to use the start and end gcodes, but of course you can customize this however you want it, like if you have two extruders, have the printer light up differently for each one. But to start out, we’re going to head into the start and end gcode settings of your slicer. Depending on how many LEDs you hooked up, you’ve got a ton of different options, I’m just going to walk you through what I’d set up for a ring light on the toolhead and an RGB LED strip somewhere else, illuminating the rest of the machine.
At the very start of a print, I want to indicate that the printer is preparing and heating up, so I’ll add M42 S, then the pin for the red part of the RGB strip, S255, and the same thing for the green, to mix yellow light. Just to be sure, I’ll also add the gcode to turn all other light off. Then you’ll have the homing and autoleveling parts of the startup, and once that’s done, I want to switch it to a pure red. Now, the important thing is to add an M400 line before our next lighting-related gcode, because of some whacky logic, Marlin doesn’t always run gcode one line after another, but might run some stuff in advance as soon as it’s stored in its buffers, and the M400 will just say, ok, before you run anything after this, make sure that you are done with everything else. And that includes homing or heating up.So, M400, then M42 P, pin for green, S0 to turn it off.
Then we’ll have the M190 line, which pauses until the heated bed is hot, if you have one, and M109, same thing for the hotend. So once those lines are done, the printer will start the actual printjob, and for that I just like to have a nice, white light on the entire machine, so another M400 just to be sure and then an M42 for the LED ring, the green and the blue part of the strip and you’re in business! Now, once the print is done, we can actually use the LEDs to tell us when the printbed is cold enough to remove a part.
So what usually works is this: You let your printer run whatever moves it does to move the bed forward and the printhead out of the way, and then we first set the LEDs to, for example, green, and then to blue once everything is cool. So first off, turn everything off but the green LEDs, then use M190 R25, or 30, and by using the R instead of what would usually be S and then the temperature, the printer now waits for the bed to cool down as well. Now another M400, so at this point the bed is guaranteed to be at 25, 30, whatever degrees Celcius, M140 S0 to turn it off all the way without waiting, and your M42s to turn off green and turn on blue.If you want, you can add a timer until the LED shuts off on its own, that is G4 S, and then the time in seconds, M400, and then the M42 to turn off whatever LED is still on.
So this is what the entire thing looks like now: Even without an LCD we get a ton of information on what the printer is up to and you’ll never have to your phone as a flashlight again to get a better look at how your prints are looking.Again, all the materials are linked in the video description, it’s all pretty cheap stuff, so if you’re looking for a quick project that’ll make you 3D printers cooler and more usable, give it a go!
If you’re running into trouble, check the forums at discuss.toms3d.org, I think that’s the exact type of help and advice the forums should be ideal for. If you found this video helpful, give it a thumbs up, get subscribed to see more like it and if you feel like directly supporting the channel, head over to Patreon to get access to monthly hangouts and more. That’s it for today, thanks for watching and I’ll see you in the next one!
🛒 Here are all the materials you’ll need!