Neopixel RGBW

Questions and discussion about running MicroPython on a micro:bit board.
Target audience: MicroPython users with a micro:bit.
JimHudd
Posts: 8
Joined: Mon Mar 25, 2019 3:09 pm

Neopixel RGBW

Post by JimHudd » Mon Mar 25, 2019 3:12 pm

I'm trying to use an RGBW NeoPixel strip from my MicroBit and it works using CodeBlocks but I can't get access to the white pixel using MicroPython (https://python.microbit.org). It looks like the version of the neopixel module is an old version before the 4 colour LED's were supported. Despite a lot of Googling I'm at a loss as to whether I need to :

- import a different module
- create the strip using neopixel.NeoPixelRGBW(pin0,60) [doesn't work]
- create the strip using neopixel.NeoPixel(pin0,60,bpp=4) [doesn't work]
- give up trying to use MicroPython and look for an alternative python IDE
- Something else I've not thought of

rhubarbdog
Posts: 166
Joined: Tue Nov 07, 2017 11:45 pm

Re: Neopixel RGBW

Post by rhubarbdog » Mon Mar 25, 2019 5:11 pm

Regarding you looking for an IDE have you thought of Mu editor.
It has been written for microbit and other python environments.
There's a button to start REPL (read-eval-print-loop) and one to facilitate file transfer between host computer and microbit

rhubarbdog
Posts: 166
Joined: Tue Nov 07, 2017 11:45 pm

Re: Neopixel RGBW

Post by rhubarbdog » Mon Mar 25, 2019 5:15 pm

What's the part number of your rgbw LED?

JimHudd
Posts: 8
Joined: Mon Mar 25, 2019 3:09 pm

Re: Neopixel RGBW

Post by JimHudd » Tue Mar 26, 2019 7:38 am

Hi, the part number for the LED strip is ADA2842.

I'll take a look at the Mu Editor, thanks for that.

Regards, Jim.

rhubarbdog
Posts: 166
Joined: Tue Nov 07, 2017 11:45 pm

Re: Neopixel RGBW

Post by rhubarbdog » Tue Mar 26, 2019 9:36 am

Ask about upcoming functionality by logging an issue on github

JimHudd
Posts: 8
Joined: Mon Mar 25, 2019 3:09 pm

Re: Neopixel RGBW

Post by JimHudd » Tue Mar 26, 2019 10:32 am

Assuming I'm reading Github correctly it's already been included. My problem is that I don't know how to get that into my MicroPython code in the MicroBit python editor. Perhaps it will be clearer if I'm using an offline IDE. I'm still not 100% clear on how python "magically" knows where to get the imported modules from and how to point it at other versions.

Regards, Jim.

User avatar
deshipu
Posts: 1346
Joined: Thu May 28, 2015 5:54 pm

Re: Neopixel RGBW

Post by deshipu » Tue Mar 26, 2019 11:24 am

The online editor is ancient, and updating it involves a lot of red tape and jumping trough hoops.

Best use the Mu editor, as it includes a recent version of MicroPython, and lets you work without Internet connection.

JimHudd
Posts: 8
Joined: Mon Mar 25, 2019 3:09 pm

Re: Neopixel RGBW

Post by JimHudd » Wed Mar 27, 2019 7:51 am

Going back to the Github item I was looking at regarding RGBW support for the NeoPixel MicroPython module (https://github.com/micropython/micropython/issues/2478) I think I've misread the thread. One of the contributors stated that RGBW is supported in the driver, which I think is referring to the underlying C code for NeoPixels and not the MicroPython module. There's another comment on Github (https://github.com/bbcmicrobit/micropython/issues/500) which is requesting RGBW support but there is nothing to follo up on that, at least not that I can find.

So I think my options are:
  • Find the source for the MicroPython NeoPixel module and modify it myself
  • Look for an alternative module that has RGBW support
  • Dust off my C hat and find/write something myself
I've had a look at the Mu Editor and it's much better than the offical MicroBit MicroPython editor. Would be nice if it had an interactive debugger or a simulator though - debugging on the MicroBit is a real pain.

rhubarbdog
Posts: 166
Joined: Tue Nov 07, 2017 11:45 pm

Re: Neopixel RGBW

Post by rhubarbdog » Wed Mar 27, 2019 8:35 am

The neopixel module is written in arm thumb2 assembly i think

JimHudd
Posts: 8
Joined: Mon Mar 25, 2019 3:09 pm

Re: Neopixel RGBW

Post by JimHudd » Wed Mar 27, 2019 10:47 am

From what I can tell there's a C/C++ API for the Arduino that can be used/adapted for the MicroBit but if I need to dust off my assembler hat then so be it. Ultimately I could go to a lower level and find out the timings for sending data down an IO line to the strip, but the only datasheet I've found thus far is a fairly badly translated version from Chinese!

I'm surprised there's no updated MicroPython module but I guess someome has to write it and if there's only one person that has requested it then it's unlikely to get done.

Post Reply