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:

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: 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

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

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

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:


#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.

Arduino All The Things! Contest

Participated in the
Arduino All The Things! Contest

Full Spectrum Laser Contest 2016

Participated in the
Full Spectrum Laser Contest 2016



    • Indoor Lighting Contest

      Indoor Lighting Contest
    • Metal Contest

      Metal Contest
    • Make It Fly Challenge

      Make It Fly Challenge

    25 Discussions


    Tip 2 months ago on Step 5

    Just updated my firmware with this and found some inconsistencies with Marlin 1.1.9.
    Coding Pins.h, no longer needs editing, but pins_Ramps.h needs the following added:
    #ifndef BOARD_NAME
    #define BOARD_NAME "RAMPS 1.4"

    Underneath this, add:
    #define STAT_LED_RED_PIN 4
    #define STAT_LED_GREEN_PIN 5
    #define STAT_LED_BLUE_PIN 6

    Then use the updated code supplied by ThomasW263 in the post below


    1 year ago

    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);
    5 replies

    Reply 8 months ago

    Thanks a bunch, I just updated to Marlin 1.1.9 and didn't know my code was broken. Came here and found that you already fixed the problem! Thanks so much!


    Reply 1 year ago

    Thks for this code working for me, but not completly ... my pins are good (RED PIN is RED PIN, BLUE is BLUE and GREEN is GREEN, tested with M42) but i dont have the good colors at start ! is : green, blue, cyan, in your code is red, green, blue ... can you help me (marlin 1.1.7) ?


    Reply 9 months ago

    finally i used transistors ... working with relay but noisy ... ;)


    Reply 1 year ago

    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!


    1 year ago

    Hi ! Thks for this amazing tutorial ! Do you think we can use 5v relay (5v vcc using servo pins and can support 12v on power) rather than NPN transistor (cause i have relay and not transistor)


    1 year ago


    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 TEMP_STAT_LEDS


    #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...

    2 replies

    Reply 1 year ago

    Simply copy that lines from pins-RAMPS.h

    #define STAT_LED_RED_PIN (your Pin-Number)
    #define STAT_LED_BLUE_PIN 35 (your Pin-Number)

    to your configuration.h. It should look like

    #define TEMP_STAT_LEDS
    #define STAT_LED_RED_PIN (your Pin-Number)
    #define STAT_LED_BLUE_PIN (your Pin-Number)

    Of course you have to replace (your Pin-Number) with your real Pin-number :)

    Edit: STAT_LED_GREEN_PIN isn't implemented in Marlin yet (April, 27th 2018)


    Question 1 year ago on Step 2

    Its a great tutorial from you !!!!!!
    Have you a schematic of de pcb what do have wired ?


    1 year ago

    Hi very good project, do you have the stl box ?


    1 year ago

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


    1 year ago

    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

    #define STAT_LED_BLUE_PIN 6

    #define STAT_LED_GREEN_PIN 5


    1 year ago

    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.


    1 year ago

    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.

    1 reply

    2 years ago

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


    3 years ago

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

    Thanks J.