Introduction: 3D Printer RGB LED Feedback

Picture of 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

Picture of Tools/Materials


Soldering Iron

Wire Strippers

(tools below recommended, but not required)

3D Printer w/ PLA

Diagonal Cutters

Rotary Tool/File

Helping Hands




3 NPN Transitors

9 Wire Ribbon Cable

Printed Circuit Board

Male/Female Headers

(below recommended, but not required)

Heat shrink Tubing

Step 2: Soldering - Transistor Board

Picture of 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

Picture of 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

Picture of 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."

Transistor Board:

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.

LED Strip:

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

Picture of 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

Picture of 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:


#define STAT_LED_RED 4

#define STAT_LED_GREEN 5

#define STAT_LED_BLUE 6


Step 7: Coding - Marlin_Main.cpp

Picture of 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

Picture of 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

Picture of 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)

Picture of 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.


GillesG9 (author)2017-12-26

Hello, I have a card MKS 1.5, where can I connect the wire?

turbochardged (author)2017-11-28

I had to go to pins_ramps.h and do this. Without it, it wouldn't verify.

//#define SERVO1_PIN 6

//#define SERVO2_PIN 5

//#ifndef SERVO3_PIN

// #define SERVO3_PIN 4


#define STAT_LED_RED_PIN 4



ThomasW263 (author)2017-10-23

Updated code (Marlin_main) that works for my Marlin (1.1.5):


//Virtual Variables
static millis_t next_status_led_update_ms = 0;
int t = 2;
int Rval = 1;
int Gval = 1;
int Bval = 1;
int LEDmax = 200;
int ExtTemp;
int BedTemp;
int ExtTarg;
int BedTarg;
//Static Colors
void off(){Rval = 0;Gval = 0;Bval = 0;}
void white(){Rval = LEDmax;Gval = LEDmax;Bval = LEDmax;}
void red(){Rval = LEDmax;Gval = 0;Bval = 0;}
void green(){Rval = 0;Gval = LEDmax;Bval = 0;}
void blue(){Rval = 0;Gval = 0;Bval = LEDmax;}
void yellow(){Rval = LEDmax;Gval = LEDmax;Bval = 0;}
void cyan(){Rval = 0;Gval = LEDmax;Bval = LEDmax;}
void magenta(){Rval = LEDmax;Gval = 0;Bval = LEDmax;}
void warmwhite(){Rval = 255;Gval = 103;Bval = 23;}

//Handle Led Stauts

void handle_status_leds(){
if (ELAPSED(millis(), next_status_led_update_ms)) {
next_status_led_update_ms += 500; // Update every 0.05s
for (int8_t cur_extruder = 0; cur_extruder < EXTRUDERS; ++cur_extruder) {
ExtTemp = thermalManager.degHotend(cur_extruder);
ExtTarg = thermalManager.degTargetHotend(cur_extruder);
BedTemp = thermalManager.degBed();
BedTarg = thermalManager.degTargetBed();
//Fade Leds On when starting up
if(Rval+Gval+Bval == 3){
//length of delay
for(int r = 0; r<LEDmax; r++){Rval = r;analogWrite(STAT_LED_RED_PIN, Rval);delay(t);}
for(int r = LEDmax; r>0; r--){Rval = r;analogWrite(STAT_LED_RED_PIN, Rval);delay(t);}
for(int g = 0; g<LEDmax; g++){Gval = g;analogWrite(STAT_LED_GREEN_PIN, Gval);delay(t);}
for(int g = LEDmax; g>0; g--){Gval = g;analogWrite(STAT_LED_GREEN_PIN, Gval);delay(t);}
for(int b = 0; b<LEDmax; b++){Bval = b;analogWrite(STAT_LED_BLUE_PIN, Bval);delay(t);}
for(int b = LEDmax; b>0; b--){Bval = b;analogWrite(STAT_LED_BLUE_PIN, Bval);delay(t);}
for(int w = 0; w<LEDmax; w++){Rval = w; Gval = w; Bval = w;analogWrite(STAT_LED_RED_PIN, Rval);analogWrite(STAT_LED_GREEN_PIN, Gval);analogWrite(STAT_LED_BLUE_PIN, Bval);delay(t);}
if((BedTarg == 71)||(BedTarg == 1)){off();}
if(BedTarg == 100){yellow();}
if(ExtTarg == 0){warmwhite();}
if((ExtTarg != 0)
&&(BedTarg != 1)
&&(BedTarg != 69)
&&(BedTarg != 71)
&&(BedTarg != 100)){
if((ExtTarg >= ExtTemp-TEMP_HYSTERESIS)
&&(ExtTarg <= ExtTemp+TEMP_HYSTERESIS)){white();}
else if((BedTarg == 5)&&(BedTemp <= 50)){green();}
int MidTemp = (((EXTRUDE_MINTEMP)-40)/2);
if(ExtTemp < 40){blue();}
if(ExtTemp > EXTRUDE_MINTEMP){red();}
if((ExtTemp > 40)&&(ExtTemp < MidTemp)){
Rval = map(ExtTemp,40,MidTemp,0,LEDmax);
Gval = 0;
Bval = LEDmax;
if((ExtTemp > MidTemp)&&(ExtTemp < EXTRUDE_MINTEMP)){
Rval = LEDmax;
Gval = 0;
Bval = map(ExtTemp,MidTemp,EXTRUDE_MINTEMP,LEDmax,0);
//Write to LEDs
analogWrite(STAT_LED_RED_PIN, Rval);
analogWrite(STAT_LED_GREEN_PIN, Gval);
analogWrite(STAT_LED_BLUE_PIN, Bval);
KyleS222 (author)ThomasW2632017-11-16

This code came close to working for me, but put my Marlin / Skynet in an infinite loop, rebooting it over and over.. Was there something more to this code that I should have taken note of? thx for the contribution!

enikka (author)2017-10-29


I tried to follow your tutorial, but I'm having a few issues, first of all I have a more recent version of Marlin...

I activated both :



#define RGBW_LED
#define RGB_LED_R_PIN 34
#define RGB_LED_G_PIN 43
#define RGB_LED_B_PIN 35
#define RGB_LED_W_PIN -1

But i get the error :

"TEMP_STAT_LEDS requires STAT_LED_RED_PIN or STAT_LED_BLUE_PIN, preferably both."

Any idea? I didn't found where to define these...

MichaelK6 (author)enikka2017-11-11

I have the same problem :/

msmith145 (author)2017-09-29

Awesome job This looks really cool and I really want to add this to my printer but I'm getting an error trying to compile. It says that the 'STAT_LED_GREEN' at the very bottom of your code that I inserted in the Marlin_main.cpp was not declared in this scope.

DavidN17 (author)2017-09-14

I love this! Such a cool way to see what a printer is doing, without looking at the screen..... and get a light show to boot :) I'm trying to get this to work for my Hypercube Evo build, but I get "orange flagged" for the downloaded text file at the point of "ExtTemp = degHotend(cur_extruder);" It's telling me degHotend was not declared in this scope. I'm assuming the two or three lines following this will also flag afterwards, and that it's just a simple naming change, but not sure how to go about correcting it. I would greatly appreciate any help and I'm using Marlin 1.1.4 if that helps narrow the problem down.

DavidN17 (author)DavidN172017-09-15

Dead/ not monitored instructable?

schlegelii (author)2016-11-30

Do you have any recommendations for doing this with a RUMBA board? My biggest issues is the pins to use and there locations.

bulb66 (author)2016-01-13

Nice Instructable defo going to add this to my printers, can I ask do I need a specific NPN transistor?

Thanks J.

LVMJohnson1996 (author)bulb662016-01-13

Thanks, 2n3904h331 is what I used on this one.

can i also use 2n2222a transistors for higher current applications?

like longer led strips, etc...

rmomberg (author)2016-01-16

Awesome Work. I am in the process of building a custom prusa, and was thinking about adding something like this.

my thoughts was just to make leds for how long the printing process was. (eg a led for every 10% or something like that. could be customizable) but that might need different custom electronics.

anyway. this is good work. keep it up.

LVMJohnson1996 (author)rmomberg2016-01-17

Ooo. That sounds cool. You could do that the same way I mapped color to the temperature. The same variable that moves the progress bar on an LCD controller could do the same thing with the lights.

We will have to work on that!

About This Instructable




More by LVMJohnson1996:3D Printer RGB LED Feedback
Add instructable to: