Introduction: 3D Printer RGB LED Feedback
When I was in high school I was a tad jealous that the Makerbot we owned, had RGB temperature feedback. After I learned enough, I decided to replicate the design and add more feedback capabilities. With this you can turn the lights off and on; change colors for pauses, temperature, prep, cleaning; or whatever you want really! This works with any 3D Printer with an Arduino or AVR board running Marlin Firmware. Click here to see the RGB LEDs working on my Robo 3D Printer:
Step 1: Tools/Materials
(tools below recommended, but not required)
3D Printer w/ PLA
RGB LED Strip
3 NPN Transitors
9 Wire Ribbon Cable
Printed Circuit Board
(below recommended, but not required)
Heat shrink Tubing
Step 2: Soldering - Transistor Board
Cut the female headers so that you have to sets of pins; one with 4 pins, and one with 5 pins. The two rightmost pins on the NPN transistors will be place next to each other in a line with the pins on the headers. The far left pins gets stretched all the way to the end of the board to be grounded.
To make this look really clean, I used a blade and rotary tool to make the PCB as small as possible. And if you want, model and print an enclose that will house the board.
Step 3: Soldering - Wires/Headers
Split the 9 ribbon cable into 4 and 5 strand sets. I recommends the four strand set it the single red wire.
Cut the male headers to that you have 4 and 5 pin sets.
Solder the 4 pin male headers to the 4 strand ribbon cable. NOTE: the one on the LED strip might be different.
Solder the 5 pin male header to the 5 stranded cable on one side only. On the opposite end of the 5 stranded cable split the two outside wire away from the inner 3. Solder the inner three to a 3 pin female header. Solder the Outer two to a 2 pin female header.
I recommend making the negative lead on the wires to identify polarity.
Step 4: Wiring/Installing
I have a picture of a crude Illustrator drawing how this is suppose to be wired.
Plug the 2 pin female header on the 5 stranded wire into Aux 12v near the X-Axis driver. Plug the 3 pin female adapter into pins 4,5,6 on the pins array labeled "servos."
Plug the other end of the 5 stranded wire into the 5 pin female end of the transistor board. NOTE: Ground (Negative) will be the only pin that doesn't line up with the 4 pin header. Plug the 4 pin adapter into the 4 pin female header with the red wire, positive, lined up with the 5 pin adapter positive wire.
This one is easy. Just plug the other end of the 4 pin adapter into the 4 pins on the LED strip. NOTE: There is a spot that is labeled 12v, be sure that is the positive end of your 4 pin adapter.
You can install if you have tested if your circuit is working, don't worry about which colors yet.
You can peel that adhesive off the back of the strip, or use clear tape to mount the lights on top of your printer. Tuck the box somewhere where your moving components will not bother the circuits.
Step 5: Coding - Configuration.h
Time to plug in. I am using another RAMPS board that is not attached to a printer, but it is not required for you to rip your 3D printer's motherboard out!
You will need a copy of Marlin that you run on your printer. If you haven't edited firmware ever I recommend finding marlin edited for your printer specifically. If your confidante enough here a link to the Marlin download: Marlin. For Robo 3D users: Robo 3D.
In configuration.h find #define TEMP_STAT_LEDS and un-comment it (remove the two forward slashes)
Step 6: Coding - Pins.h
Getting here is a little tricky.
On the right there's a drop down menu, and when you scroll down there a file called pins.h.
There you will make a copy of the existing definition and make your own for your motherboard number.
Mine is 33 so I put this:
#if MOTHERBOARD == 33
#define STAT_LED_RED 4
#define STAT_LED_GREEN 5
#define STAT_LED_BLUE 6
Step 7: Coding - Marlin_Main.cpp
Now for the big one.
The other coding steps had much less lines of code than this one so attached is a text file of the code I wrote.
Delete EVERYTHING between:
and then paste what I wrote in the text file.
Then...SMASH that upload button!
Step 8: Coding - Debugging
The start up code I implemented will flash the lights in the order Red, Green, Blue (easy to remember...RGB LED strip) then all of them will turn on and the light will be White. The wiring I here made the Green flash first, then the Red, then the Blue. So I need to switch Red and Green, but we are ENGINEERS! We will not be switching the physical wire, instead we switch the pins in the code.
Re-upload and be sure you get Red, Green, then Blue.
Step 9: How to Use
Now that you debugged everything should be working!
I changed the lights based off the Target/Current temps of the extruder and the bed.
Bellow is the key of color for temps:
Set Bed to 0, Set Extruder to 0 (Start Up/Idle) = White
At Temperature (Printing) = White
Set Bed to 1 (Idle) = Off
Set Bed to 100 (Cleaning) = Yellow
Set Bed to 69 (1 below my printing bed temp)(Pause for Prep) = Cyan
Set Bed to 71 (1 above my printing bed temp)(Print w/ no lights) = Off
Set Bed to 5 (Cooling down) = Green when bed is less then 50
Set Bed to anything but [1,5,69,70], Extruder to 200+ (Heating) = Fade from blue to red based off temp
Set Bed to anything but [1,5,69,70], Extruder to 1 (not 0) Temp (Cooling) = Fade from red to blue based off temp
Step 10: Customizing Code (Coming Soon)
I'm still trying to figure out the best way to explain how to modify the code to get different colors than what I defined. I will be updating this step in the future.