Post by phervier on Mar 14, 2016 20:40:27 GMT
- these Strips are easy to install as they need only three wires for any number of leds
- they are easy to command with an arduino board with only on pin needed
So I will described the Hardware and Software changes needed to install it on you G2S printer.
The Hardware :
You may buy The Ledstrip from any provider, just take care to choose WS2812B Leds as they are the most efficient version.
Power supply :
As a Led may consume 0.3W by itself a large number of them will require a specific appliance to supply the 5V to the strip.
I have taken a cheap one like this one : ebay DC DC 5V 15W. It may drive a ledstrip of 50 Leds (50 * 0.3W = 15W).
If you need more Leds you should rather take a power supply that deliver 5V directly from sector, not to overload the main 12V power supply.
This device directly plug on the available pin of the 12V power supply.
Command :
There is only two free connectors available and so two output from the ATmega2560. I have choosen the one at the corner, labelled X-min on the GT2560N schematic and connected to the output pin 22 on the Atmega but you may also choose the Y-min connected to the pin 26. As the power comes from an other source, you only need to connect the external pin of the connector (the red wire on the picture).
;
Then connect this wire to the DI connector of the LEDSTRIP. I put an optional 470ohm resistor between the two to avoid short circuit for the ATmega
Then connect the 5V and the GND from the DC DC power.
You may cut the ledstrip as you wish, just do it on the metalic strip between leds, but after that you would have to resolder them.
The Software :
You should use the last version of the G2 G2S PRO Marlin 1.10 version .
In the Configuration.h just uncomment the #define LEDSTRIP line
The settings of this options are :
#define LEDSTRIP_PIN 22 // added in place of X_min first connector on GT2560
#define LEDSTRIP_NLED 36
#define LEDSTRIP_NSEGMENT 3 // LEDS maybe divided in segments for ease of use
#define LEDSTRIP_TYPE WS2812B
//#define LEDSTRIP_EXCHANGE_RV // somehow necessary
#define MSG_LED_LIGHTING "Lighting"
The segments are build with (LEDSTRIP_NLED / LEDSTRIP_NSEGMENT) sequentials LEDS. Each Segment may be addressed separately, and have a specific LCD menu. The title of this menu is defined by MSG_LED_LIGHTING.
After adjusting the settings, you should add the Fastled libray to the arduino Ide before compiling.
Usage :
The Ledstrip management use the M150 command that is normally used for changing screen color.
parameters of the command :
- S for segment 1 2 3... , 0 for all
- P for power 1 is on 2 is half on 3 is off
- R for red value (from 0 to 255)
- V for green value (from 0 to 255)
- B for blue value (from 0 to 255)
Exemple :
"M150 P1" turn on all ledstrip with saved color (by default linen white)
"M150 P2" turn on even led all ledstrip with saved color (by default linen white)
"M150 R130 V50 B80 S1" change the color of segment 1 and store this color value for this segment
"M150 S1 P2" turn on half of the leds in segment1 with saved color for this segment (Seashell by default)
"M150 R30 V70 B10" change the color of entire ledstrip and save this color for futur use