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

    Help creating NeoPixel LSD-language

    Scheduled Pinned Locked Moved
    Gcode meta commands
    neopixel arduino copro ws2812b
    4
    28
    1.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.
    • rjenkinsgbundefined
      rjenkinsgb @o_lampe
      last edited by

      @o_lampe said in Help creating NeoPixel LSD-language:

      A multiplexer would need a few extra pins and it has to be a level-shifter, too. Furthermore it wouldn't take workload from the Duet, it would quadruple it (in my case).

      It would need some extra pins, yes. Two pins for four banks, three for eight etc.

      As for workload - it is virtually zero.
      The firmware converts the gcode parameter to the required data, then sends it using a hardware SPI port and DMA - so the whole data-output routine is hardware and uses zero CPU time or resources.
      It just needs to interpret and convert the gcode line when that is read.

      For an external unit, the hardest part would be getting the command string to it, from whichever Duet.

      I had considered, for another application, using the Duet LED output as a kind of communications link to a slave SPI in the add-on MCU.

      That can send as many words of definable data as is needed, using colour values for a small number of "LEDs" as the command data; 24 bits or more each, depending on the data format.

      Commands like your example above could be sent by a string that, as far as the Duet is concerned, just sets colours on four LEDs.

      Robert J.

      Printers: Overlord pro, Kossel XL+ with Duet 6HC and "Frankentron", TronXY X5SA Pro converted to E3D toolchange with Duet 6HC and 1LC toolboards.

      zaptaundefined o_lampeundefined 2 Replies Last reply Reply Quote 0
      • zaptaundefined
        zapta @rjenkinsgb
        last edited by

        @rjenkinsgb said in Help creating NeoPixel LSD-language:

        As for workload - it is virtually zero.
        The firmware converts the gcode parameter to the required data, then sends it using a hardware SPI port and DMA - so the whole data-output routine is hardware and uses zero CPU time or resources.

        If the goal is to have animations such as shifting heart beat, it requires frequent updates with each LED has a different color than its neighbors so I don't think the duet is a good fit (vs offloading to an external processor as @o_lampe plans to do).

        1 Reply Last reply Reply Quote 0
        • o_lampeundefined
          o_lampe @rjenkinsgb
          last edited by

          @rjenkinsgb said in Help creating NeoPixel LSD-language:

          using a hardware SPI port and DMA - so the whole data-output routine is hardware and uses zero CPU time or resources.

          I have to take your word for it.
          But then I'm asking myself, why there is a limitation of 60 LEDs in the RRF- STM branch?
          And does it also apply for a Duet2 where I could only use BitBanging mode?

          Nevertheless, the concept of having a second MCU (which takes over less timing critical tasks) can come handy for other FW-features as well.
          Today I'll try the OTG USB port, see if it can feed the Arduino nano with power and data.

          rjenkinsgbundefined 1 Reply Last reply Reply Quote 0
          • rjenkinsgbundefined
            rjenkinsgb @o_lampe
            last edited by

            @o_lampe said in Help creating NeoPixel LSD-language:

            But then I'm asking myself, why there is a limitation of 60 LEDs in the RRF- STM branch?
            And does it also apply for a Duet2 where I could only use BitBanging mode?

            I'd guess the limit is down to buffer size, and power consumption?
            60 LEDs with a 32 bit value each is 240 bytes, plus four bytes each for start and stop codes, plus buffer pointers etc. so roughly 256 bytes RAM.

            And for a direct board connection, the 5V regulator has to feed the LEDs, which may be the more critical restriction.

            That's for DotStar LEDs, which use SPI clock and data.
            I went through the V3.3 firmware and they were the only LED option I could find; no mention of neopixels.

            If your board supports firmware 3.3, it should work via DMA regardless of the exact board type.
            [That's for the "official" RRF branch - no idea what the STM32 capabilities are, or what connectivity the hardware designers have included]

            I'm not saying any one approach is "best", just going over possibilities to achieve the end result, and as a programmer it's an interesting idea!

            Robert J.

            Printers: Overlord pro, Kossel XL+ with Duet 6HC and "Frankentron", TronXY X5SA Pro converted to E3D toolchange with Duet 6HC and 1LC toolboards.

            o_lampeundefined 1 Reply Last reply Reply Quote 1
            • o_lampeundefined
              o_lampe @rjenkinsgb
              last edited by

              @rjenkinsgb said in Help creating NeoPixel LSD-language:

              the 5V regulator has to feed the LEDs,

              The limit regarding current consumption is much lower than 60 LEDs. 8-10 LEDs with full brightness is max. (YMMV)
              I'm sure it's related to SPI buffer size. So there is a limited resource worth to preserve for other tasks.

              1 Reply Last reply Reply Quote 0
              • o_lampeundefined
                o_lampe
                last edited by

                I got some reaction from the Arduino, when using RX/TX @57600 Baud. But I'd need a levelshifter here, I guess.

                Over USB, I got no feedback whatsoever. Tried different M575 settings.
                Maybe have to rewrite the Arduino Code, but IIRC the serial port 0 is the same as USB?

                1 Reply Last reply Reply Quote 0
                • o_lampeundefined
                  o_lampe
                  last edited by

                  @rjenkinsgb
                  beside the Seeedstudio Xiao, I also found the DFRobot Firebeetle M0 which has a huge 12MB +16MB storage capacity and a small breadboard area. (for level shifters and power distribution?) The storage would be big enough for some Bitmaps or other animated NeoPixel stuff.
                  I would then only have to call the right animation, which I'll have predefined in flash.

                  alt text

                  Not sure yet how to program it. Maybe the bootloader is specific for robotics-stuff?

                  rjenkinsgbundefined zaptaundefined 2 Replies Last reply Reply Quote 0
                  • rjenkinsgbundefined
                    rjenkinsgb @o_lampe
                    last edited by

                    @o_lampe
                    Nice!

                    That works with the Arduino IDE again, you just need to add the appropriate DFRobot SDK file; the instructions & file link are in the Audio photo album project section.

                    Robert J.

                    Printers: Overlord pro, Kossel XL+ with Duet 6HC and "Frankentron", TronXY X5SA Pro converted to E3D toolchange with Duet 6HC and 1LC toolboards.

                    o_lampeundefined 1 Reply Last reply Reply Quote 1
                    • o_lampeundefined
                      o_lampe @rjenkinsgb
                      last edited by

                      @rjenkinsgb said in Help creating NeoPixel LSD-language:

                      Audio photo album project

                      RE audio: beside bitmaps and animations I could store some background music, too!
                      The sand table is pretty noisy with only 1 ball, but 4 ball-ballet definitly needs some sound.

                      I read a comment about a broken arduino library link. I hope it's sorted out now...

                      1 Reply Last reply Reply Quote 0
                      • zaptaundefined
                        zapta @o_lampe
                        last edited by

                        @o_lampe said in Help creating NeoPixel LSD-language:

                        Not sure yet how to program it. Maybe the bootloader is specific for robotics-stuff?

                        Very nice find. I bookmarked it. For IDE I suggest to check platformio. They support many CPUs and platforms and provide an very functional and auto updatable development environment on top of VSCode.

                        https://docs.platformio.org/en/latest/platforms/atmelsam.html

                        o_lampeundefined 1 Reply Last reply Reply Quote 1
                        • o_lampeundefined
                          o_lampe @zapta
                          last edited by

                          @zapta
                          The DFRobot board isn't listed (yet) in PlatformIO. I'm not sure, if it would support the extra flash?
                          Furthermore, PlatformIO seems to work on Linux systems. That's not my favourite OS, especially when it's text-based. I hate to search the web for every config-line and almost have to beg for read/write permissions as normal user.

                          zaptaundefined 1 Reply Last reply Reply Quote 0
                          • o_lampeundefined
                            o_lampe
                            last edited by o_lampe

                            For those who want to install the DFRobot firebeetle M0 files for Arduino IDE:
                            don't use the link provided in their Wiki!
                            Instead use this link
                            http://download.dfrobot.top/firebeetle/package_DFRobot_test_index.json

                            Then open the boardmanager as usual and search for dfrobot. You will see several firebeetle packages, choose the M0 and your ready 🙂

                            o_lampeundefined 1 Reply Last reply Reply Quote 0
                            • o_lampeundefined
                              o_lampe @o_lampe
                              last edited by o_lampe

                              LOL, all the example files have comments in chinese 😁
                              I knew I'd have to learn it one day...

                              There are many examples for fastLED- library, all about WS2812B strips 🎆

                              1 Reply Last reply Reply Quote 0
                              • zaptaundefined
                                zapta @o_lampe
                                last edited by

                                @o_lampe, platformio runs seamlessly on all three major platforms, and you can open the same project on each one of them with no modification.

                                As for DFRobot, a platform io library search suggests support https://platformio.org/lib/search?query=dfrobot

                                Also, you can add it yourself as described here or in your project tree. https://community.platformio.org/t/how-to-include-arduino-library-in-platformio/15146

                                Learning platformio is a great investment. Once you set it up (e.g. on VSCode), you would not go back to the Arduino IDE. I used it on Arduinos, Teensys and Pico. For the Pico for example, it support hardware debugging with another Pico acting as the debugger. There is also a great community around it.

                                My 2c. 😉

                                1 Reply Last reply Reply Quote 0
                                • o_lampeundefined
                                  o_lampe @o_lampe
                                  last edited by

                                  @o_lampe said in Help creating NeoPixel LSD-language:

                                  Yes, I've seen that too and there is a "NeoPXL8 friend" for it, that allows us to control up to 8 strips w 250 LEDs each!
                                  I haven't digged deeper into this, if it would coop with Duet/gcode.
                                  Very promising indeed...

                                  I received the NeoPXL8 friend and it's the most overpriced gadget I bought so far.
                                  It comes with a HCT245 8-bit transceiver which works as level shifter. No further brain, as far as I can see.

                                  zaptaundefined hlwerschnerundefined 2 Replies Last reply Reply Quote 0
                                  • zaptaundefined
                                    zapta @o_lampe
                                    last edited by zapta

                                    It's time for Neo Pixels to come out of the box with 3.3V compatible inputs.

                                    o_lampeundefined 1 Reply Last reply Reply Quote 0
                                    • o_lampeundefined
                                      o_lampe @zapta
                                      last edited by

                                      @zapta
                                      Some people use it with 3.3V, but they had to lower V+ too. (less brightness). I had no success with it, because I didn't have a good 3.3V external power supply.

                                      1 Reply Last reply Reply Quote 0
                                      • rjenkinsgbundefined
                                        rjenkinsgb
                                        last edited by

                                        You can convert a 3.3V logic signal to 5V using just a 2N7000 and a pullup resistor:

                                        Connect the gate to 3.3V power, source to the 3.3V signal and drain is the 5V logic output; add a resistor from that to 5V power to give the "high" level, eg. anything from 2.2K to 10K.

                                        Robert J.

                                        Printers: Overlord pro, Kossel XL+ with Duet 6HC and "Frankentron", TronXY X5SA Pro converted to E3D toolchange with Duet 6HC and 1LC toolboards.

                                        1 Reply Last reply Reply Quote 0
                                        • hlwerschnerundefined
                                          hlwerschner @o_lampe
                                          last edited by

                                          @o_lampe Hi, I am wondering if your primary mentioning of a "descriptive language" to control NeoPixels/Dotstar has seen any progress? I am currently adding some stripes to my machine and finally have decided to use an arduino to do the work of controlling the stripe colors and link the arduino via serial comm to a client app (for the time being, I test all stuff with the PC, but there is no problem to attach that small arduino to the Duet3 SBC (Raspberry 3+).

                                          So far, what is that LSD doing 😉

                                          o_lampeundefined 1 Reply Last reply Reply Quote 0
                                          • o_lampeundefined
                                            o_lampe @hlwerschner
                                            last edited by o_lampe

                                            @hlwerschner
                                            Not much I'm afraid. I wanted to engrave some acrylic strips and animate them with NeoPixels. But i got so distracted by commissioning and upgrading the new Co2 laser, that I almost forgot, why I bought it 😉
                                            In the meantime, I stumbled across a four color LED strip, which looks quite nice, too.
                                            Now I'm trying to figure out, if designing a 4-fold NeoPixel LED strip would be possible. So I'm looking into the smallest possible footprint of programable LEDs.
                                            4-colorAcryl.jpg

                                            I should mention, that this isn't my work. I found it on a discord channel about the K40-laser from the member @raineroe

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