From RepRap
Revision as of 07:04, 6 October 2018 by Glenn (talk | contribs) (+Category:Electronics)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


Many people want to add in various LEDs to their printers, as lighting or indicators or a bit of "Bling"

LED basics

  1. A standard LED (light emitting diode) is a two legged electronic device that emits light of a certain color.
  2. They have polarity, ie a + (Anode) and a - (Cathode) leg. They will only work when plugged in the correct way.
  3. They come in a variety of sizes and shapes and colors.
  4. These are current driven devices, what that means practically is that you need to use a resistor in series with the LED to restrict the amount of current that can flow threw the device, or they will take to much current and burn out and can damage a controlling IO pin.
  5. They only have two states, on and off. To control the brightness PWM (pulse width modulation) is used to rapidly turn the LED on and off.
  6. RGB leds, these are simply 3 LEDS, one red, one green and one blue in one device. They normally come with four legs. They come in either common cathode or common anode varieties. Ie all the + (anonde) or all the - (cathode) lines are connected together.

LED strips

There are lots of types of LED strips

  1. Simple one color strips, these are just a series of surface mount single color LEDS on a flexible PCB strip. They come in a variety of LED sizes and number of LEDs per meter and colors. They have the current limiting resisters in built.
  2. RGB LED strips, are same as the Simple one colour strips but with independent a red,green and blue channels.
  3. LED strips with chips. Often called WS2812B, SK6812 or neopixel These are individually addressable LEDs and any LED can be set to any color. These are not directly usable on a ramps, they require very accurate timing which interferes with the normal operation of the machine.

Connecting a non controlled LED

To add some LEDs that are always on when the power is on, you just need to calculate the correct resistor value using ohms law and wire it directly to your power supply. Eg. using a 12volt power supply, one LED with forward voltage of 1.8v and a current of 20ma. Ohms law says Resistance=Volts/Amps Therefor in this example R=12-1.8/0.02 = 510 ohm. For a more detailed explanation with more examples see this youtube video https://www.youtube.com/watch?v=Ksj2vtwi3y0&t=611s

Connecting a single controlled LED

This is identical to connecting a LED to an arduino see http://www.ladyada.net/learn/arduino/lesson3.html Pick an unused RAMPS IO pin and control it with M42

Connecting a single controlled RGB LED

This is the same as a single LED, but uses 3 IO lines, one per color. see https://learn.adafruit.com/adafruit-arduino-lesson-3-rgb-leds/overview

Connecting a controlled 12v RGB Strip

see http://www.instructables.com/id/3D-Printer-RGB-LED-Feedback also see https://www.youtube.com/watch?v=fb3hrjEiE3s&t=0s

Manual control of LEDs

M42 P{pin it plugged into} S{0-255 see http://reprap.org/wiki/G-code#M42:_Switch_I.2FO_pin These can also be added to start and stop gcode scripts as needed.

Marlin LED Support

in Configuration.h Look at RGB LED / LED Strip Control. This Adds the M150 command see http://reprap.org/wiki/G-code#M150:_Set_display_color Also look at Printer Event LEDs for firmware control of the RGB LEDS. From the Configuration.h

* During printing, the LEDs will reflect the printer status:
*  - Gradually change from blue to violet as the heated bed gets to target temp
*  - Gradually change from violet to red as the hotend gets to temperature
*  - Change to white to illuminate work surface
*  - Change to green once print has finished
*  - Turn off after the print has finished and the user has pushed a button