Control NeoPixels on M5Stack Core2 AWS edukit



  • I flashed my M5Stack Core2 AWS edukit version with UiFlow.

    The docs indicate that the SK6812 LEDs are controlled with GPIO25:

    SK6812-LED
    ESP32 Chip GPIO25
    SK6812-LED DATA

    I tried this code to test them out, and while the code runs without error, the lights never come on:

    from machine import Pin
    from neopixel import NeoPixel
    
    pin = Pin(25, Pin.OUT)  # Pin 25 to drive NeoPixels
    print("Creating NeoPixel object")
    np = NeoPixel(pin, 10)  # create NeoPixel driver on GPIO25 for 10 pixels
    np[0] = (255, 0, 0)     # set first pixel red, full brightness
    np[1] = (0, 128, 0)     # second pixel green, half brightness
    np[2] = (0, 0, 64)      # third pixel blue, quarter brightness
    np[3] = (255, 255, 255)
    np[4] = (255, 255, 255)
    np[5] = (255, 255, 255)
    np[6] = (255, 255, 255)
    np[7] = (255, 255, 255)
    np[8] = (255, 255, 255)
    np[9] = (255, 255, 255)
    np.write()              # write data to all pixels
    print("done")
    

    Anyone have ideas how to access these LEDs with micropython?



  • It looks like these LEDs are not supported in UIFlow, and the NeoPixel micropython library didn't work.

    I was able to build new firmware using PlatformIO and flash the FactoryTest application here:

    https://github.com/m5stack/M5Core2/tree/master/examples/core2_for_aws/FactoryTest

    This has an example of using the FastLED library to control these RGB LEDs.



  • I've got exactly the same problem with UIFlow (V1.7.1). I've also tried the Core2 UIFlow firmware V1.6.6 and it doesn't work either.

    I also cannot get a M5Stack RGB LED strip or a 3 RGB LED unit to work in any of the ports (A, B, or C) on the bottom2.

    The bottom2 ports are working correctly because I've used other units to check them and everything works as expected.

    EDIT: As @greenleaf wrote the FastLED library can control the RGB bar correctly. However, I directly used the Arduino Core2 library in a simple sketch and could control the bottom2 LED bar with FastLED, no PlatformIO firmware, etc. needed.

    EDIT2: I cannot get any M5Stack LED strips or units to work using FastLED with the A,B or C Ports on the Core2. I have tried many different pins but it doesn't work.



  • Use UIFlow V1.6.5 for the Core2 and..... everything works

    I can now have the built-in AWS Core2 bottom LED bar lit up, by using it as a RGB LED strip on pin 25.

    I can now have M5 RGB units and strips on any of the ports A, B, or C.

    These 'simple' firmware regressions are really starting to annoy me!

    I suppose there are plenty of things which don't actually work in V1.6.5 vs. V1.7.1.....



  • Hi guys

    I think I found the issue. By default M5Core2 (running UIFlow 1.7.1) does not enable the internal 5 volts boost, therefore the LEDs are not powered.

    @greenleaf when I add the following two lines to your Python code it works for me:

    from m5stack import *
    power.setBusPowerMode(0)
    

    @veryalien for UIFlow add: Hardwares - Power - Set bus power mode (0), then use RGB LED unit set to Custom and SDA/TX set to 25 and Number set to 10.
    0_1609857130429_UIFlowRGBLED_20210105.png

    Happy Stacking!
    Felix



  • @felmue
    Thanks for the info, with the bus power mode set to 0, it's all working, including RGB strips and units on ports A, B and C!
    You don't need to do a custom neopixel setup as there are already RGB blocks under Hardwares, which now work with the RGB Bars on the Core2.



  • Hello @veryalien

    you are welcome and thank you for confirming.

    And yes, you are correct, the RGB blocks under Hardware work just fine. (I thought I've tried that and it did not work, but now I just tried again and it works fine with the RGB blocks under Hardware.)

    Cheers
    Felix



  • Setting bus power mode 0 is very important as it makes other sensors work correctly.
    I didn't notice that the analogue value from my light sensor wasn't going below about 300, even in darkness. Now that I've set the power mode, it is now reading darkness as 0.0 and very bright light as nearly 1024, which is correct.

    So I'll still regard the power mode change as a regression as it is going to affect voltages and therefore sensor values over the mbus.

    Is this change and the implications described anywhere?

    Perhaps the setup block should be doing this by default in UIFlow and then people could override it with a Set bus power mode 1, if needed, immediately afterwards.



  • Hello @veryalien

    starting with bus power mode 1 (aka using external 5 volts) is important if one wants to use modules like the Ethernet Module which can power everything from a single power supply (and w/o the need for USB).

    If the setup block sets bus power mode to 0, the system would shut itself off in that scenario, before the user code can set it back to 1.

    To be honest, I don't know what the best approach for UIFlow should be to make it simple and powerful enough for different scenarios.

    BTW: one of the reasons I personally do not use UIFlow - too many areas which I cannot control.

    Thanks
    Felix