Avatar for AdaMan82

AdaMan82

Member since Aug 2018 • Last active Nov 2022
  • 5 conversations
  • 22 comments

Most recent activity

  • in Projects
    Avatar for AdaMan82

    Thanks so much for this! I'll let you know how it goes!

  • in Projects
    Avatar for AdaMan82

    I'm in the process of trying to make an LED coat like this one for a party next week. I'm driving 500 WS2811s with this poor little espruino pico because it's all I've got right now. I have no issues with powering them all, I have that figured out. What I am struggling with is generating the patterns. Too much math is happening to push out 3*500 random numbers to make the LED light change snappy. Basically it's a slideshow. It all works fine, just slow as hell.

    What I want to do is either output a 25 light pattern x 20, but I can't figure out how (or if its even possible).

    Anyone have any advice on how to do it? I thought about concatenating the array into a larger array (thus saving a bunch of math steps), or just trying to output the same array multiple times in one go using require("neopixel").write but cant seem to make it happen.

    If there is no solution, I'll just use static patterns, but it would be cool for them to be animated.

    Pic attached for desired outcome.

  • Avatar for AdaMan82

    I guess I'll post this for others to find since I figured it out as I was making this post.

    So despite making sure I don't execute at boot event after reset, I couldn't seem to clear my code from flash without doing E.setBootCode() which I understand might be problematic if my code crashes.

    I solved the problem by re-flashing the firmware and it seems to have fixed it.

    • 12 comments
    • 3,041 views
  • in Pico / Wifi / Original Espruino
    Avatar for AdaMan82

    Sorry, been out of town for a bit. I will clarify the situation here and in the OP. The power is fine for I would say somewhere in the 24 hour range. I tested it friday eve, then Sat aft it didn't work anymore. I had been having ongoing issues with power drain for a while, so I figured it must be the LEDs. The main issue is that when I leave things on the power drained even though there was no real appearance of activity.

    As allObjects indicated above this would be consistent with the LEDs draining it at 300mah. Past certain point it doesn't work anymore.

    I don't need to turn more than 10 on at any time, so I don't need more than 4xAAs. Because I'm using garbage batteries, voltage output is about 5v, so its fine for the WS2812Bs. I prefer AAs vs. custom battery pack because I don't want to charge the thing all the time, I want to be able to swap out AAs and drive on. (its for a game).

    It seems like the relay is the answer at this point.

    I'll post process.env to satisfy your curiosity tomorrow night!

  • in Pico / Wifi / Original Espruino
    Avatar for AdaMan82

    I did save it, and thanks for that, will remove the onInit();

    And yes i am using neopixels. I was suspecting the LEDs were drawing power despite being off. Is there a way to get the espruino to cut power to them without a relay, or is that the only option?

  • in Pico / Wifi / Original Espruino
    Avatar for AdaMan82

    I am using an Espruino to run a project with 3 buttons and an LED light strip. One of the buttons increases an led light position by flashing the next light on the strip. The other decreases an led light position by flashing the next light on the strip in an opposite direction, and the last button randomly illuminates 10 lights between the first light and the current position for a minute or two. Unless a button was recently pressed all lights should be off. The project is powered by 4x AA batteries.

    And everything works great, except for some reason, the battery dies after an hour or two even if the lights are off. I'm guessing I'm failing to implement deep sleep properly. As far as I can guess I am not violating any of the 5 conditions in any way that deep sleep should not execute eventually.

    So why is this happening? I've included my code below. Also deepest apologies for my shitty code. I'm not a coder or anything, I just made it work.

    Goes without saying a simple on/off switch would solve the problem but I have one, and I keep forgetting to turn it off so I'd love a software solution.

    var rgb = new Uint8ClampedArray(300*3);
    var rando = new Uint8ClampedArray(10); //array to store 10 random numbers
    var position = 200;
    var k = 0;
    var pos = 0;
    
    //Add function
    digitalWrite(B7,1);
    pinMode(A8, "input_pulldown");
    setWatch(function() {
    doAdd();
    }, A8, { repeat: true, debounce : 100, edge: "rising" });
    
    //Subtract function
    digitalWrite(B3,1);
    pinMode(B3, "input_pulldown");
    setWatch(function() {
    doSub();
    }, B3, { repeat: true, debounce : 100, edge: "rising" });
    
    //Random function
    digitalWrite(B4,1);
    pinMode(B5, "input_pulldown");
    setWatch(function() {
    doRand();
    }, B5, { repeat: true, debounce : 100, edge: "rising" });
    
    function setPosition() {
         pos = (position*3)+2;
         rgb[pos] = 10;
    }
    
    function doAdd() {
      position++;
      doPosition();
      setDeepSleep(1);
    }
    
    function doSub() {
      if (position > 20) {
        position--;
      }
      doPosition();
      setDeepSleep(1);
    }
    
    function doPosition() {
    setPosition();
    require("neopixel").write(B15, rgb);
    k = setTimeout (doOff,300);
    }
    
    function onInit() {
    doOff();
    }
    
    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);
      setDeepSleep(1);
    }
    
    function setRand() {
    setOff();
    var colourio = 0;
      for (var i=0;i<rando.length;i++) { //puts data into rando array
        rando[i] = parseInt(Math.random()*(position+1)); //put a random number into one of the array positions
          if (i>0){
            for (var t=0; t<i; t++) { //checks to see if the LED has been selected randomly
              if (rando[i] == rando[t]){
                  i=i-1;
              }
            }
          }
      }
    rando.sort(function(a, b) {
      return a - b;
      });
    console.log(rando);
    console.log(position);
      for (var w=0;w<rando.length;w++) {
         pos = (rando[w]*3);
         rgb[pos] = 10;
      }
    setDeepSleep(1);
    }
    
    function doRand() {
      clearTimeout();
      k = 0;
      setRand();
      require("neopixel").write(B15, rgb);
      k = setTimeout (doOff,120000);
    }
    
    onInit();
    
    • 22 comments
    • 6,623 views
Actions