Duet3D Logo Duet3D
    • Tags
    • Documentation
    • Order
    • Register
    • Login

    How can I control addressable RGB LEDS?

    Scheduled Pinned Locked Moved
    Duet Hardware and wiring
    11
    35
    3.6k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • wkellyoundefined
      wkellyo
      last edited by

      Happy New Year!
      Fellow DIY'rs, I'm reaching out to anyone that can steer me in the direction of how to make use of a fan connector or other output of the Duet2 or Duex5 to drive an Arduino that controls addressable RGB leds. I can work with arduino code, and understand electronics fairly well. I don't understand the Duet2 board's capability that well yet.

      I want to use them in my interior lighting and be able to change the color via a slider, macro or other web based methods using DWC. I have built a BLV MGN Printer complements of Mr. Ben Levi's design and it uses three neopixel (WS2812) rings on the front of the printer and they are driven by an arduino nano from the duet2's "conn_sd" pin 10. I'm guessing this is outputting I2C data. It works great and shows printer status.

      I've purchased a strip of 300 RGB leds and just playing around have them programmed to cascade, show rainbow colors etc. I have plenty of arduinos of various flavors, I just need some direction how to make the Duet send out I2C information on one of the outputs. Thanks in advance!

      1riundefined 1 Reply Last reply Reply Quote 0
      • SIamundefined
        SIam
        last edited by

        look here:

        Duet I2C

        Hypercube-Evolution-Hybrid, Piezo Orion, Orbiter
        Duet WiFi 1.02 or later + DueX5
        RepRapFirmware for Duet 2 WiFi/Ethernet 3.4.0beta4 (2021-09-27 11:30:36)
        Duet WiFi Server: 1.26
        Duet Web Control 3.4.0beta4 (2021-09-27)

        1 Reply Last reply Reply Quote 0
        • wkellyoundefined
          wkellyo
          last edited by

          Thanks Slam, I'll have to try wrapping my head around this as it might be a bit over my skill level without a lot of research and I still might not get it. Would you happen to know which outputs on the Duet/Duex are able to send out I2C data? Are all of the various outputs carrying this data? If you have any examples or other links of maybe someone that has done this I'd much appreciate it.

          1 Reply Last reply Reply Quote 0
          • daaveryundefined
            daavery
            last edited by

            the BLV interface doesn't use i2c, it uses the existing paneldue serial/JSON interface. you might look at the M150 command which controls addressable LEDS from Gcode

            1 Reply Last reply Reply Quote 0
            • wkellyoundefined
              wkellyo
              last edited by

              Thanks for the clarification, Daavery. I was googling tonight and found this: Github LED site and even an arduino sketch that looks doable using the M150 GCode. I could make some Macro's to change the lights. I guess where I'm puzzled is where to connect the arduino GPIO to the Duet. I'm guessing I have to use a particular output and make it available using the minus commands I've seen. Do you know?

              3mmundefined 1 Reply Last reply Reply Quote 0
              • 3mmundefined
                3mm @wkellyo
                last edited by

                @wkellyo

                Do a DotStar search here on the DUET3D forum. There are 18 messages related to using DotStar on the DUET controllers.

                3mm

                There are 10 types of people: Those who understand binary and those who don't.

                1 Reply Last reply Reply Quote 0
                • wkellyoundefined
                  wkellyo
                  last edited by

                  3mm thanks for the pointers, I've never heard of them but there sure is a lot of good reading and seems to be better supported. I think I'll head that way.

                  1 Reply Last reply Reply Quote 0
                  • 1riundefined
                    1ri @wkellyo
                    last edited by

                    @wkellyo

                    Given the ease of programming the WS2812b type RGB LEDs in the arduino environment, here's what I've done:

                    • set an output PIN for use with M42
                    • Connect this output pin to an analog input pin of the arduino. In my case I use an ESP32 which can bé easily purchased.
                    • Monitor the input of the arduino to see what values ​​it gives according to the values ​​set on the M42. Depending on whether it is 8 or 32 bits the sampling may be different
                    • Decide what values ​​I use and why (Warm up, start, print, ....)
                    • Program the Arduino with the FastLED library that will assign a color / effect according to the value of the input PIN
                    • Write a macro in the DUET for each output value of the PIN that connects to the Arduino
                    • Call the Macro in order to provoke the output by the DUET PIN which will be sampled by the Arduino and execute the code to put the LEDS in the color chosen in previous steps.
                      I have it that way and set different scenarios for Standby, warming, cooling, calibrating, printing and off. I call macros from confit.g at printer startup or from G-code generated by Slic3r. Alternatively I can enable them from the PanelDue.

                    Hope it helps as Google Translator helps me 😜

                    1 Reply Last reply Reply Quote 1
                    • wkellyoundefined
                      wkellyo
                      last edited by

                      1RI, thank you so much for the information, I figured there was a way that even I could understand, this really helps a lot and I even have a few ESP32's laying around besides Nano's, Unos and even a few Mega Arduino's.

                      1riundefined 1 Reply Last reply Reply Quote 1
                      • 1riundefined
                        1ri @wkellyo
                        last edited by

                        @wkellyo
                        glad that it served you.

                        wkellyoundefined 1 Reply Last reply Reply Quote 0
                        • wkellyoundefined
                          wkellyo @1ri
                          last edited by

                          @1ri , would you be willing to share code you have created? While I understand the concepts you've outlined, any specific code for an arduino, macros, etc. would sure help me out as I could see the examples. Maybe you could zip what you have into a single zip file and attach to this post or message me and I'll give you my email address. I'm not much of a programmer but by using examples, I can usually figure stuff out. Thanks so much in advance and if you chose not to, there's no harm in asking.
                          Kelly

                          1riundefined 1 Reply Last reply Reply Quote 0
                          • 1riundefined
                            1ri @wkellyo
                            last edited by 1ri

                            @wkellyo

                            for sure,

                            I attach a file with the .ino I use and a folder with the macros that send the value to pin P100 (GPIO1 on DUEX5) or duex.gp1 for RRF3.
                            Once the arduino is programmed, it prints the value it receives from the Duet via the serial port by sending the M42 commands to it.
                            This makes it easier to adjust the values that need to be compared with the Arduino to display each color using the serial monitor.

                            As you can see, the comments inside the macros and the .ino file are in Catalan, as it is my native language, but Google Translator is quite efficient in Catalan. 😉

                            best regards

                            I put the link in my drive because I couldn't upload a zip file. If anyone can guide me in how to do it, I would be very grateful

                            Zip File

                            Solved!! Just read this post to see that ZIP files are not supported....

                            wkellyoundefined 1 Reply Last reply Reply Quote 0
                            • wkellyoundefined
                              wkellyo @1ri
                              last edited by

                              @1ri, Bless you! I took a look at the files and other than the task of translating (as you said Google should work very well) I am confident I can make it all work. I have a Duet2 and a Duex5 in my printer so I have lots of available outputs. My goal at first is to simply be able to turn the lights on and off and change the colors via DWC using macros which should be easy enough since you have provided the macros I can modify. I also will have to modify the Arduino code somewhat, probably make it even simpler. Later I may try making them animate when the printer is being used. Thank you so much again!

                              Kelly

                              1riundefined 1 Reply Last reply Reply Quote 0
                              • 1riundefined
                                1ri @wkellyo
                                last edited by 1ri

                                @wkellyo

                                With this in mind, in a configuration like ours with Duet2 + DUEX, only PINs 100-103 are available on the GPIO & I2C connector in the DUEX5, which are not so many.

                                In RRF3, which will be effective from now on, I use this command to set the PIN in order to be able to use it later with the M42 of the macros.

                                M950 P0 C "duex.gp1", which may be the value of gp1 to gp3 depending on the GPIO to be used

                                1 Reply Last reply Reply Quote 0
                                • wkellyoundefined
                                  wkellyo
                                  last edited by

                                  I messed around with all this today and actually have it working. The Arduino file was a definite challenge as the translation wasn't perfect and I had several errors that had to be fixed. But, it works and now I can tweak it all out to my liking and install the LED strips into the bed light diffusers. Thanks again!

                                  Kelly

                                  dc42undefined 1 Reply Last reply Reply Quote 0
                                  • dc42undefined
                                    dc42 administrators @wkellyo
                                    last edited by

                                    I'm glad you got it working. FWIW, Duet 3 supports DotStar LED strips natively.

                                    Duet WiFi hardware designer and firmware engineer
                                    Please do not ask me for Duet support via PM or email, use the forum
                                    http://www.escher3d.com, https://miscsolutions.wordpress.com

                                    daaveryundefined 1 Reply Last reply Reply Quote 0
                                    • daaveryundefined
                                      daavery @dc42
                                      last edited by

                                      for reference adafruit DotStar LEDs are APA102(or SK98225) LEDs so any APA102 4 wire LEDS will work

                                      1 Reply Last reply Reply Quote 0
                                      • matej1006undefined
                                        matej1006
                                        last edited by

                                        can @1ri or @wkellyo share with me how do you guys did g-code on duet how it's look please

                                        wkellyoundefined 1 Reply Last reply Reply Quote 0
                                        • wkellyoundefined
                                          wkellyo @matej1006
                                          last edited by wkellyo

                                          @matej1006

                                          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

                                          matej1006undefined 1 Reply Last reply Reply Quote 0
                                          • Danalundefined
                                            Danal
                                            last edited by

                                            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?

                                            Delta / Kossel printer fanatic

                                            wkellyoundefined 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            Unless otherwise noted, all forum content is licensed under CC-BY-SA