Extensions to Espruino for WS2812 modules

Posted on
  • In the internet are some modules with WS2812 Leds. I created extensions to Espruino, written in C to support these modules.
    LED-Matrix 8*8
    LED-Circles
    Sources are available on github

  • @JumJum the githup link show 404 , can you please update

  • Done, thanks

  • @JumJum any reason for not writing a java script module to handle this ?

  • Yes, and at least first one is a very good reason ;-)

    • loved to do it and learned a lot
    • it's much faster than java script, try to rotate in java script and you will see
    • doesn't take away as many variables compared to java script

    There are already a lot of special functions inside Espruino, that could be a module. May be on a long term we will have a couple of Espruino extensions which can be used to create customized firmware by sticking together firmware modules.

  • ok - I understand - first point is the best ;-)

    I prefer to have JS solutions ;-)

    A idea to use 3 time shift came from a snippet tve gave me, this can be used to rotate / walk like this small sample shows:

    
    // large ring with 24 NPs
    var NPs = 24;
    var array = new Array(NPs*3).fill(0);
    array[0] = array[1] = array[2] = 32;
    
    function rotate() {
      array.push(array.shift());
      array.push(array.shift());
      array.push(array.shift());
    }
    
    
  • This works from left to right, but how to rotate from top down ;-)

  • right to left works too for a ring ;-)

    function rotateRight() {
          array.unshift(array.pop()); 
          array.unshift(array.pop());
          array.unshift(array.pop());
    }
    
    

    you mean using a matrix NxM and rotate the hole lines horizontal or vertical like scrolling in a loop ?

    Here are two new things for you Rotating Neopixel with trailer effect
    and Adafruit Neopixel ringlight for close-up photography
    - what do you think ?

  • I worked with a lot of optimizations for handling arrays, including Uint8. None of them was even close to compiled C.
    Yes, rotating means rotate full line or full row of a matrix. Another available option is to have a large buffer, like 16by16 and display 8by8 blocks based on input with joystick or something like that.
    BTW, there are already some functions in Espruino, that could have been done easily in JavaScript like E.sum, E.interpolate, E.variance .... If there wasn't the factor called time...

    Hmm, video looks funny. And does'nt look too complex to be done.
    But right now,my focus is to understand events deep inside Espruino.
    First step will be to create something like a Schmitt Trigger having a change event.
    May be once this is done,.... ;-)

    Tschüss für heute

  • hello, I notice you have use ws2812 led strip, as I can use , I know ws2812 is a individually addressable smd led, it have a lot of application, just like use in DIY led product, but about how to use its control agreement, here I also have so many problem in that, so I want to ask, how to control it iC, do you have any idea?

  • I'd take a look at this page: http://www.espruino.com/WS2811

    It should tell you pretty much everything you need to know :)

  • hello, I find there have discusses ws2812b flexible led strip, but as I know, it is a smd 5050 smd led, and it is born before 3 years, so maybe its function and materiel is bad than another addressable smd led now, so, here I know a kind of addressable smd led, it called SK6805-2427, because its size is smd 2427, also is can show 256 gray level and have a function of individually addressable, so it is called a best little addressable smd led all over the world. But as we can see, because it is a new product, so maybe how many way can it use, we also don't know. ok, here have some data about SK6805-2427, this new product, and if you have problem, all can ask me, and I think you will have some interesting for this new product.


    1 Attachment

  • Thanks - so this is an RGB LED addressed exactly the same as the WS2812B, except it's 2.4mm x 2.7mm?

    I'd heard of the SK6812, but that's 3.5mm x 3.5mm.

    I can't wait to see some SK6805-2427 stuff start to come out - it'll start to be really high resolution!

  • Wow they are small

  • ... and that's the SK6812. The SK6805-2427 is even smaller!

  • I was under the impression that the SK6812's are WS2812 clones (albeit with a varying number of channels - there are ones that just have cool and warm white, and ones that have RGBW ), and the timing of the control signal is close enough that most control schemes meant for WS2812 will work for SK6812 (is the 6805 the same electrically? I would assume it is, just with different package).

    Man, I have had so little time to work on the fun kind of projects lately. I've got a bunch of SK6812 RGBW and WW/CW LEDs, but they've been sitting in a bin for months without being turned on.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Extensions to Espruino for WS2812 modules

Posted by Avatar for JumJum @JumJum

Actions