How can I control addressable RGB LEDS?
-
-
Hi, 1ri wrote the original code and shared with me. I added another color to the existing code, please see this this post and it should explain everything you need. If you need the files, let me know with a private IM and I'll get them to you.
https://forum.duet3d.com/topic/14411/gpio-pins-on-duex5-useage/10
-
Can you state the real goal here? There is likely a better way.
For example, how about an ESP8266 or ESP32 that monitors the printer and does what you want with the lights according to printer state. NOTHING in the G-Code...
Anyway, what's the goal?
-
@Danal I guess the main goal was to have bed lighting color that I could change using DWC. Then the idea of interfacing it to the printer to change color depending on the printer status came to mind. I am fairly new to Arduino, Raspberry Pi, etc. and when it comes to coding, if I can't find an example to go by, modify, etc. I end up reaching out to others. I struggle to write from scratch and then only basic, simple stuff but I'm slowly learning. If I had a Duet3 board I'd look into the Dotstars instead. You mention these two Wireless type boards and I've seen them before but wasn't sure of being able to make them work for this or how to interface to the Duet. You also mention monitoring the printer status but I wouldn't really know where to begin. I'm always up for a challenge and if you know of better ways to do this please share with me. BTW you have a nice, well written web site, I spent the better part of an hour there a week or so ago!
-
@wkellyo Awesome thanks i will look at this closly today and maybe i will have more
question -
I have an LED RGB strip connected directly to fan outputs on the duex5.
The colours are controlled by macros depending on the state of the machine.
Red for startup, bed levelling etc
Green for printer ready but idle
Blue for printing.
Of course other colours could be used for other states.I also have Red, Green and Blue sliders that can be adjusted in real time if I want to display them.
I'm just waiting now for the object model to include variables so I can change the LED from 1 colour to another gradually.
Hope that helps
-
Thanks folks! That helps.
Dotstar on Duet3, with various macros that Duet/RepRap firmware auto-invokes, like start.g, pause.g, etc. that will be one of the "cleanest" ways to have events on a Duet change lighting, with everything direct attached to the Duet itself.
Having said that, it will also be VERY easy to produce a device that polls a printer for status, and has menu choices that tie printing, heating, idle, etc, etc. to colors or other states on one or more NeoPixel or Dotstar strips.
This opens the door to the lights being on the printer, or being in another room. As long as the printer is network reachable.
Would there be interest in this? As a free download that runs on off-the-shelf hardware costing $20 to $40 USD? I want to orient it toward a couple of hardware options that are not going to require soldering (or very little). Not just a collection of boards...
-
@appjaws Nice even better can you share how you connected them to duex5 and the code please ?
What kind of RGB did you use i have WS2818? -
@appjaws what pin's did you use gpio or which one's
-
@matej1006 I connected the RGB wires to the fan outputs negative pins for fan 3,4 and 5 and the common wire to the positive .
the LED settings were then added to config.g:-; LED Lighting
M950 F3 C"duex.fan3" Q500 ; create fan 3 on pin duex.fan3 and set its frequency for LED Red
M106 P3 C"RGB Red" ; set RGB Red to P3
M950 F4 C"duex.fan4" Q500 ; create fan 4 on pin duex.fan4 and set its frequency for LED Green
M106 P4 C"RGB Green" ; set RGB Green to P4
M950 F5 C"duex.fan5" Q500 ; create fan 5 on pin duex.fan5 and set its frequency for LED Blue
M106 P5 C"RGB Blue" ; set RGB Blue to P5I just bought a strip from amazon, my system is 24V so I bought a 5 meter reel of DC24V LED Ribbon.
Hope this helps -
@appjaws mm ok thenyour strip isn't same as my, i have only 3 cabel to connect i have 2 wire for supply voltage and one for digital input.
So i guess i will need to add arduino anyway . thanks
Greetings Matej
-
This is a link for the 12V version at £8.50
JOYLAND 12V Flexible RGB LED Strip Lights 300 Units 5050 LEDs, Non-Waterproof LED Tape Multi-Colors LED Strips Light Pack of 16.4ft/5m
by Joyled -
@appjaws Link don't work
-
@appjaws said in How can I control addressable RGB LEDS?:
JOYLAND 12V Flexible RGB LED Strip Lights
just do a search in amazon for JOYLAND 12V Flexible RGB LED Strip Lights
-
I have recently setup the E3D Toolchanger with a Duet2 Wifi and Duex5 boards. I also upgraded to the RRF3 firmware and had a question regarding setup of Neopixel lights with these boards. I am wondering, what is it about the Duex5 board which requires an additional Arduino to control the LED lights. From first inspection, I would have thought the PWM pins on the Duex5 along with M950 and M150 gcode would have been enough to control the LED lights. What is it about the arduino board that makes it a necessary component?
-
For normal non-addressable RGB LEDs, you’re exactly right. However, if you want to use fancy individually-addressable LEDs like Neopixels, an Arduino offers a convenient way of controlling them via existing libraries.
-
@whopping-pochard said in How can I control addressable RGB LEDS?:
For normal non-addressable RGB LEDs, you’re exactly right. However, if you want to use fancy individually-addressable LEDs like Neopixels, an Arduino offers a convenient way of controlling them via existing libraries.
That makes sense. Thanks for clearing it up. I'll play around with both.
-
Neopixels have tricky timing requirements, which means that unless you use DMA to SPI, you have to stop all other processing while writing to them.
The Duet 3 main board supports Neopixel strips directly, because the CPU on that board had a spare SPI channels that we could dedicate to Neopixel support, and enough RAM that we were able to dedicate some to a Neopixel DMA buffer. Duet 2 doesn't have a spare SPI channel.