You are reading a single comment by @Robin and its replies. Click here to read the full conversation.
  • Alright I've got it all figured out. For whatever reason, (either by design or by fluke) my strip defaults to on, so on init I need to turn everything off before doing things off the battery pack. The reason is the draw is too high which makes the lights appear to be out or red when on. I anticipated this, but I did not anticipate the lights to be on by default. Here is how I executed the code to turn everything off, so I could then start turning what I want on:

    var rgb = new Uint8ClampedArray(300*3);
    
    function setOff() {
      for (var i=0;i<rgb.length;i+=3) {
         rgb[i  ] = 0;
         rgb[i+1] = 0;
         rgb[i+2] = 0;
      }
    }
    
    function doOff() {
      setOff();
      require("neopixel").write(B15, rgb);
    }
    function onInit() {
    doOff();
    }
    
    onInit();
    

    Wiring as per below. Moving the resistor also had an effect on how strong the lights that I wanted to turn on would be when I wanted them on.

    I can now turn the lights on at will. Big success.

    Thanks again for everyone's help.

  • Sat 2018.08.11

    AdaMan82,

    re: 'my strip defaults to on'

    Not sure of this comment in the Neopixel datasheet, but it might explain why, . . . if taken literally.

    SK6812
    https://cdn-shop.adafruit.com/product-fi­les/1138/SK6812+LED+datasheet+.pdf

    2nd to last page: "Note: high starting, in order to send data"

    Maybe by design as data pin is tied high, quick stream of 1111....1111 pulses, or maybe a quick self test to assure that each Neopixel can work, perhaps.

    In any event, although you haven't specified the extent of your programming background, it is always a good practice to initialize data to a known state before using it, as you have demonstrated in your code snippet. Then there shouldn't be any surprises, as you also found out.


    I'm still puzzled at the wiring and don't have many ideas here. Need Electronics Engineering knowledge assistance here.

    Did you remove line @Gordon's suggestion:

    pinMode(B15,"af_opendrain")

    Since the 1K is now in series on the data line, it shouldn't hurt, maybe round the edges or shorten the amplitude of the data pulses a bit, but am puzzled as to why the LED's intensify once on the data line. Sounds like the Pico is trying to source current and there is an upper limit of 25ma

    See: http://www.espruino.com/datasheets/STM32­F401xD.pdf
    p.59
    Each GPIO pin can source or sink only 25ma
    Total max all pins is 120ma


    Is it possible you are powering with both the USB connector and the battery at the same time?

    I remembered there was a comment on this, but unable to locate on the current page

    http://www.espruino.com/Pico

    See comments near schematic.

About

Avatar for Robin @Robin started