• General
  • Controlling DotStar LED strips with PureData

I saw this post about NeoPixels: https://forum.bela.io/d/3001-control-neopixel-with-pure-data

But what about DotStar pixels? They use SPI. For instance this strip from Adafruit [https://www.adafruit.com/product/2559](https://) and here is the datasheet [https://cdn-shop.adafruit.com/product-files/2240/SK9822SHIJI.pdf](https://)

I'm working on a project on a Bela (not the mini) right now. I do not need analog audio in. But I do want some analog in pins to use at least one fader [https://www.adafruit.com/product/5460](https://)

    drumminhands But what about DotStar pixels? They use SP

    They should be easy to add to O2L, the datasheet makes it look pretty straightforward. Do you have some that you can test?

    Actually the datasheet doesn't specify the logic high voltage or the minimum power supply voltage, hopefully 3.3V and 5V respectively are good enough. I'll see if I can put together an example for you to test in the next few days.

    OK this branch should have support for those LEDs. You can test it on Bela using /dev/spidev1.0 instead of /dev/spidev2.1 and pins P9.22 for clock and P9.18 (or P9.21??) for data. With these pins it will only work while there is no other Bela project running alongside it. If it works like that, there is one extra configuration step needed to have it working on other pins.

    Note the last section of the README about testing:

    You should test O2L (and any of the above mods and electronics) by running a Pd or Sc patch such as the enclosed ones on the host, while running this program on the board from the IDE. Once that setup is tested and works fine, in order to run a regular Bela program for audio/sensor processing alongside O2L, you will need to run the O2L program as a service on the board. See here for details on that.

    4 days later

    Sorry, I haven't forgotten about this. I'm gonna try to get to this tomorrow. At least start.

    So I successfully removed P9.30 from connecting to the Bela cape. But then I got lost in loading the tree overlay. That amount of linux is probably over my head.

    I do have a Bela Mini here too. So let's start there. Are these the right pins to connect the LED strip to the Bela Mini?

    LED Strip >> Bela Mini
    VCC >> 5v
    CI >> ??
    DI >> P2.25
    GND >> GND

    LED Strip << Bela Mini
    VCC << 5v
    CI << P2.29
    DI << P2.25
    GND >> GND

    You also need to run in the console at the bottom of the IDE:

    config-pin P2.25 spi;
    config-pin P2.29 spi_sclk;

    OK. So I first tested my strip on arduino, and they work great. All soldering good.

    Tried connecting to a Bela Mini.

    VCC (Blue) >> 5v
    CI (Red) >> P2.29
    DI (Green) >> P2.25
    GND (Black) >> Gnd


    Loaded up the IDE and ran config-pin P9.25 spi but not sure it took

    Downloaded the files. I saved a copy of local.pd to _main.pd and loaded to an empty project. Then ran the program. I see no lights on the strip and see this on screen.

    Is it trying to use the pins for the Bela non-mini? Where do I change that? Anything else I'm doing wrong? And thank you for all the help.

      drumminhands d ran config-pin P9.25 spi but not sure it took

      my mistake above, now amended. Correct lines to run:

      config-pin P2.25 spi;
      config-pin P2.29 spi_sclk;

        drumminhands Downloaded the files. I saved a copy of local.pd to _main.pd and loaded to an empty project.

        Even once you fix the config-pin commands as above, this won't work: as you have some .cpp file in the project, it won't automatically load _main.pd unless that .cpp file tells it to (and it doesn't in this case). See the last paragraph of the README:

        You should test O2L (and any of the above mods and electronics) by running a Pd or Sc patch such as the enclosed ones on the host, while running this program on the board from the IDE. Once that setup is tested and works fine, in order to run a regular Bela program for audio/sensor processing alongside O2L, you will need to run the O2L program as a service on the board. See here for details on that.

        Emphasize: "Once that setup is tested and works fine".

        If you really want to test it without running anything on the board, in the setup() function in main.cpp, after

        	if(gLeds.setup("/dev/spidev2.1"))
        		return 1;

        add:

        for(size_t n = 0; n < gRgb.size(); n += 3)
            gRgb[n] = 255; // all red. Use [n + 1] for green or [n + 2] for blue
        gLeds.send(gRgb);

        and all LEDs should turn red until you receive an OSC message.

          giuliomoro If you really want to test it without running anything on the board

          I tried it this way just as a proof of concept. No dice. No lights. I think I'm going to put a hold on testing this for a while. I can use the LEDs fine with an Arduino, so that works for my current use case. But thanks for all the troubleshooting. And if others in the future get this working, please post info here.

          11 days later

          drumminhands Looks like that was better.

          this error here is not promising. Is this a very old Bela image you are using on this Mini? When was it last flashed?

          Yes, the bela mini is an older model I had sitting around. Purchased August 2019. I updated the software on the SD card. Do I need to update anything else? Or should I just try on a newer device?