Micro Pixel Edge on BBC Micro Bit

Just got my first BBC Micro Bit. Also got a Micro Pixel Edge. I’m trying to follow this YouTube Video https://www.youtube.com/watch?v=CDszhKTR3TM but it doesn’t jive with what I actually see on screen at
https://makecode.microbit.org/
I see a NeoPixel at pin… but it won’t mate with the On Start or Forever block?

Then I found this, https://makecode.microbit.org/pkg/microsoft/pxt-neopixel#create but again I just can’t make it work? Where is the “Set strip to…” hidden?

First time using this type of coding interface. I’d switch to Micro Python but there isn’t much info out there for the Micro Pixel edge? I found this but don’t really understand it, https://github.com/proto-pic/micro-bit/blob/master/micropixeledgerandomcolours.py
I have coded in python before, quite a bit actually on my raspberry Pi’s. I’m no noob but no expert either.

Any links to tutorials or useful info greatly appreciated. Micro Bit and or Micro Pixel.

Found this, http://microbit.org/guide/python/ was right in front of me the whole time. Will help with the Micro Bit for sure. Still haven’t found and really good info for the Micro Pixel Edge though. Maybe I just need more patience. ;)

Also found this https://codewith.mu/ downloadable editor. No having to do it online.

Went here, https://shop.pimoroni.com/products/micro-pixel-4x8-neopixel-board-for-bbc-micro-bit and tried to right click and save the sample code but all I get is HTML documents? I have no idea what your supposed to do with those? Opening them in a browser just shows gibberish. I can’t make any sense out of it anyway.

What I’d like, and am looking for is the Micro Python API for the Micro Pixel Edge or Micro Pixel Board for the Micro Bit.

There are cautions about using full brightness, as it could damage the Micro Bit. I want to avoid doing that.

I "think’ I just found what I’m looking for, http://microbit-micropython.readthedocs.io/en/latest/neopixel.html
It may take me a while to wrap my head around it, but I think I might be finally getting somewhere.

This is a heck of a chronicle! It looks like the example code relies on NeoPixel but doesn’t give any indication where you should obtain, or how you should install that library. Unfortunately my experience with the Micro:Bit is still effectively zero so I’m going to be as useful as a chocolate teapot here :(

The brightness warning is odd- Micro:Bit’s own Edge-Connector documentation seems to suggest a maximum current limit of 90mA - http://tech.microbit.org/hardware/edgeconnector_ds/

That puts my ballpark estimations for ws2812 current draw - using the datasheet specified maximum of 20mA per element - waaaaaaaaaay past the stated maximum output current of the Micro:Bit. In theory the 10 pixel Micro:Pixel Edge should peak at 600mA, yet it doesn’t carry the same warning ( although the 32pixel .version can run up to nearly 2A in theory).

For Unicorn HAT we provide a software library that internally limits the brightness to avoid simply browning out the Pi, but it looks like this board just relies on the generic NeoPixel library for Micro:Bit.

I’ll look into this and see if we can get a definitive guide for software setup linked from the product page, and some clarification on current draw. It being a third-party product shouldn’t excuse us from good aftersales support!

The warning is on this page, for Micro Pixel , https://shop.pimoroni.com/products/micro-pixel-4x8-neopixel-board-for-bbc-micro-bit That’s the 4 x 8 so I’m probably fine on the Edge going to full brightness, only 10 LEDs.

I got it lit up in the pattern I want. Just have to figure out how to have the colors move across from led to led, scroll across.
R,Y,G,B,W,R,Y,G,B,W
Y,G,B,W,R,Y,G,B,W,R
G,B,W,R,Y, G,B,W,R,Y
etc. Without repeating my code over and over. I’m making progress so I’m happy. I tried to take apicture but it just bloomed all white, even at half brightness.

from microbit import *
import neopixel

# Setup the Neopixel strip on pin0 with a length of 10 pixels 
np = neopixel.NeoPixel(pin0, 10) 
np[0] = (128, 0, 0) # set to red, half brightness
np[1] = (128, 128, 0) # set to yellow, half brightness
np[2] = (0, 128, 0)  # set to green, half brightness
np[3] = (0, 0, 128) # set to blue, half brightness
np[4] = (128, 128, 128) # set to white, half brightness
np[5] = (128, 0, 0)  # set to red, half brightness
np[6] = (128, 128, 0) # set to yellow, half brightness
np[7] = (0, 128, 0) # set to green, half brightness
np[8] = (0, 0,128)  # set to blue, half brightness
np[9] = (128, 128, 128) # set to white, half brightness
np.show()
while True:
    display.scroll('Hello, World!')
    display.show(Image.HEART)
    sleep(2000)

Also a warning here, http://microbit-micropython.readthedocs.io/en/latest/neopixel.html

At the moment these sites implicitly suggest it’s okay to draw 480mA (20mA * 3 elements * 8 pixels) from the Micro:Bit which is a little bit more than the 90 the Micro:Bit datasheet claims.

I mean it may be okay with 8 pixels, I don’t know, but then the Micro Pixel Edge has 10 and doesn’t include a warning. I suspect it should probably carry one.

Anyway none of this actually helps you get set up, so I’m glad you’re making progress.

I’m using quarter brightness for now, 64. Just to be safe and save on battery drain. One drawback to the online micro python editor, http://python.microbit.org/v/1 is I don’t see any check code option? So no way to tell what went wrong when I run it on the Micro Bit, and it doesn’t work? No way to see what happened? No simulator/virtual Micro bit on the left either?

I’d use the other block editor if I could make head or tails out of it?

Made a bit of success. I got the colors to cycle, not as fast as I would like though, and only happens at the end of the message on the Micro Bit LED.

# Add your Python code here. E.g.
from microbit import *
import neopixel

# Setup the Neopixel strip on pin0 with a length of 10 pixels 
np = neopixel.NeoPixel(pin0, 10) 

while True:
   
    np[0] = (64, 0, 0) # set to red, quarter brightness
    np[1] = (64, 64, 0) # set to yellow, quarter brightness
    np[2] = (0, 64, 0)  # set to green, quarter brightness
    np[3] = (0, 0, 64) # set to blue, quarter brightness
    np[4] = (64, 64, 64) # set to white, quarter brightness
    np[5] = (64, 0, 0)  # set to red, quarter brightness
    np[6] = (64, 64, 0) # set to yellow, quarter brightness
    np[7] = (0, 64, 0) # set to green, quarter brightness
    np[8] = (0, 0, 64)  # set to blue, quarter brightness
    np[9] = (64, 64, 64) # set to white, quarter brightness
    np.show()
    
    display.scroll('Happy Holidays')
    display.show(Image.XMAS)
    sleep(1000)
    
    np[1] = (64, 0, 0) # set to red, quarter brightness
    np[2] = (64, 64, 0) # set to yellow, quarter brightness
    np[3] = (0, 64, 0)  # set to green, quarter brightness
    np[4] = (0, 0, 64) # set to blue, quarter brightness
    np[5] = (64, 64, 64) # set to white, quarter brightness
    np[6] = (64, 0, 0)  # set to red, quarter brightness
    np[7] = (64, 64, 0) # set to yellow, quarter brightness
    np[8] = (0, 64, 0) # set to green, quarter brightness
    np[9] = (0, 0, 64)  # set to blue, quarter brightness
    np[0] = (64, 64, 64) # set to white, quarter brightness
    np.show()
    
    display.scroll('Happy Holidays')
    display.show(Image.XMAS)
    sleep(1000)
    
    np[2] = (64, 0, 0) # set to red, quarter brightness
    np[3] = (64, 64, 0) # set to yellow, quarter brightness
    np[4] = (0, 64, 0)  # set to green, quarter brightness
    np[5] = (0, 0, 64) # set to blue, quarter brightness
    np[6] = (64, 64, 64) # set to white, quarter brightness
    np[7] = (64, 0, 0)  # set to red, quarter brightness
    np[8] = (64, 64, 0) # set to yellow, quarter brightness
    np[9] = (0, 64, 0) # set to green, quarter brightness
    np[0] = (0, 0, 64)  # set to blue, quarter brightness
    np[1] = (64, 64, 64) # set to white, quarter brightness
    np.show()
    
    display.scroll('Happy Holidays')
    display.show(Image.XMAS)
    sleep(1000)
    
    np[3] = (64, 0, 0) # set to red, quarter brightness
    np[4] = (64, 64, 0) # set to yellow, quarter brightness
    np[5] = (0, 64, 0)  # set to green, quarter brightness
    np[6] = (0, 0, 64) # set to blue, quarter brightness
    np[7] = (64, 64, 64) # set to white, quarter brightness
    np[8] = (64, 0, 0)  # set to red, quarter brightness
    np[9] = (64, 64, 0) # set to yellow, quarter brightness
    np[0] = (0, 64, 0) # set to green, quarter brightness
    np[1] = (0, 0, 64)  # set to blue, quarter brightness
    np[2] = (64, 64, 64) # set to white, quarter brightness
    np.show()
    
    display.scroll('Happy Holidays')
    display.show(Image.XMAS)
    sleep(1000)

I could reduce the sleep time or take it out I guess? That makes it hard to see the tree image at the end though. I can’t figure out how to make the Micro Pixel run independent or the Micro Bit led? So the lights are scrolling while the message is being displayed. Happy enough to get this far though. I’m a lot father ahead than I was yesterday.

Settled on this, Happy, shift, Holidays, shift, Happy, shift, Holidays, shift, show tree shift, repeat.

 from microbit import *
import neopixel

# Setup the Neopixel strip on pin0 with a length of 10 pixels 
np = neopixel.NeoPixel(pin0, 10) 

while True:
   
    np[0] = (64, 0, 0) # set to red, quarter brightness
    np[1] = (64, 64, 0) # set to yellow, quarter brightness
    np[2] = (0, 64, 0)  # set to green, quarter brightness
    np[3] = (0, 0, 64) # set to blue, quarter brightness
    np[4] = (64, 64, 64) # set to white, quarter brightness
    np[5] = (64, 0, 0)  # set to red, quarter brightness
    np[6] = (64, 64, 0) # set to yellow, quarter brightness
    np[7] = (0, 64, 0) # set to green, quarter brightness
    np[8] = (0, 0, 64)  # set to blue, quarter brightness
    np[9] = (64, 64, 64) # set to white, quarter brightness
    np.show()
    
    display.scroll('Happy')
        
    np[1] = (64, 0, 0) # set to red, quarter brightness
    np[2] = (64, 64, 0) # set to yellow, quarter brightness
    np[3] = (0, 64, 0)  # set to green, quarter brightness
    np[4] = (0, 0, 64) # set to blue, quarter brightness
    np[5] = (64, 64, 64) # set to white, quarter brightness
    np[6] = (64, 0, 0)  # set to red, quarter brightness
    np[7] = (64, 64, 0) # set to yellow, quarter brightness
    np[8] = (0, 64, 0) # set to green, quarter brightness
    np[9] = (0, 0, 64)  # set to blue, quarter brightness
    np[0] = (64, 64, 64) # set to white, quarter brightness
    np.show()
    
    display.scroll('Holidays')
        
    np[2] = (64, 0, 0) # set to red, quarter brightness
    np[3] = (64, 64, 0) # set to yellow, quarter brightness
    np[4] = (0, 64, 0)  # set to green, quarter brightness
    np[5] = (0, 0, 64) # set to blue, quarter brightness
    np[6] = (64, 64, 64) # set to white, quarter brightness
    np[7] = (64, 0, 0)  # set to red, quarter brightness
    np[8] = (64, 64, 0) # set to yellow, quarter brightness
    np[9] = (0, 64, 0) # set to green, quarter brightness
    np[0] = (0, 0, 64)  # set to blue, quarter brightness
    np[1] = (64, 64, 64) # set to white, quarter brightness
    np.show()
    
    display.scroll('Happy')
        
    np[3] = (64, 0, 0) # set to red, quarter brightness
    np[4] = (64, 64, 0) # set to yellow, quarter brightness
    np[5] = (0, 64, 0)  # set to green, quarter brightness
    np[6] = (0, 0, 64) # set to blue, quarter brightness
    np[7] = (64, 64, 64) # set to white, quarter brightness
    np[8] = (64, 0, 0)  # set to red, quarter brightness
    np[9] = (64, 64, 0) # set to yellow, quarter brightness
    np[0] = (0, 64, 0) # set to green, quarter brightness
    np[1] = (0, 0, 64)  # set to blue, quarter brightness
    np[2] = (64, 64, 64) # set to white, quarter brightness
    np.show()
    
    display.scroll('Holidays')
        
    np[4] = (64, 0, 0) # set to red, quarter brightness
    np[5] = (64, 64, 0) # set to yellow, quarter brightness
    np[6] = (0, 64, 0)  # set to green, quarter brightness
    np[7] = (0, 0, 64) # set to blue, quarter brightness
    np[8] = (64, 64, 64) # set to white, quarter brightness
    np[9] = (64, 0, 0)  # set to red, quarter brightness
    np[0] = (64, 64, 0) # set to yellow, quarter brightness
    np[1] = (0, 64, 0) # set to green, quarter brightness
    np[2] = (0, 0, 64)  # set to blue, quarter brightness
    np[3] = (64, 64, 64) # set to white, quarter brightness
    np.show()
    
    display.show(Image.XMAS)
    sleep(3000)
1 Like

Getting back to the current limit thing, I would think it wouldn’t be an issue if you were using one of the Bat Bit cases. The 3V comes in via the 3V edge connector pin. Power to the Micro Pixel would come from the Bat Bit not the Micro Bit. It’s only an issue if power is via the USB port or the JST jack. It may only be an issue if its powered via the USB port, there is a 5V to 3V regulator in there some where. If the JST feeds 3V right from the batteries to the 3V edge connector PIN, its only the track size that limits current. And how big your batteries are. ;)

1 Like

This is true! Possibly why the Bat Bit is mentioned on the product page.

•When powered from a battery, the KL26 is not powered up (and note that the System LED will not light up when powered from battery)
http://tech.microbit.org/hardware/powersupply/
http://tech.microbit.org/hardware/

So I should be Ok to bump up the brightness as I’m using batteries. JST not Bat BIt. Except that the code runs as soon as you plug in the USB jack. And you have to plug in the USB to upload your file. Just temporarily remove the Micro Pixel edge I guess. I won’t be running this program much after New Years, but future reference.

Answer is to make the brightness a variable B. Then set the default value to B = 32 or something low. Then adjust it with the buttons. Red would be (B, 0, 0), green (0, B, 0) etc. Just have to cap it at 255 some how. Used to know how to do that in Python.

lol, was playing with my Micro Bit and noticed if my Micro Python file error’s, the error message is displayed on the LED matrix in a scrolling message. If your watching and paying attention. The LED matrix is only 5 dots by 5 Dots, remember your very first dot matrix printer, it’s worse than that lol. And it only scrolls the message once. At least it says what line in the code. I had a really hard time reading the full message, you only see one letter at a time as it scrolls by. Better than nothing though as your running your code in the blind, you can’t connect a monitor.