Kitronik ZIP Halo for the BBC micro:bit - MicroPython Examples

BBC micro:bit halo kitronik micropython neopixels pyrhon ZIP

The Kitronik ZIP Halo screws neatly onto the front of the BBC micro:bit and features 24 RGB light-emitting diodes (LEDs) arranged in a circle. Each LED can be individually addressed, allowing control of each LED's colour and brightness. The Halo has two screw holes to mount materials like perspex or timber in front or behind - this allows the LEDs to shine through cutouts or to light up specific areas, arranged in a circle, eg simulate a spinning wheel, or light up numbered cut-outs, or just highlighting segments on a round board set behind.

The Kitronik ZIP LEDs can be programmed in the same way as Adafruit NeoPixels, as documented in the BBC micro:bit  MicroPython documentation found online at:

 Things to remember:

  • The ZIP LEDs will need an external power source, which can be plugged into the Kitronik ZIP Halo using a battery pack fitted with a JST connector. This can also power the attached BBC micro:bit, but the micro:bit won't power the Halo.
  • You need to create a NeoPixel object, and then use clear() to turn off all the LEDs at once, and write colour brightness (between 0 and 255) information to the pixels by addressing the NeoPixel object. Then just use show() to turn on the LEDs and show the changes.

Although there's examples included with the NeoPixel MicroPython documentation, here's a couple specifically taking advantage of the circular format of the Halo. Among the many editors you can use with MicroPython there's the mu editor, the online one, and plugins for other editors and browsers.

Make a blue light go round and round the Halo

from microbit import *
import neopixel

num_of_pix = 24
np = neopixel.NeoPixel(pin0, num_of_pix) # create a NeoPixel object on pin0

p = 0 # set pixel pointer to 0
while True:
    np[p] = (0,0,60) # set the RGB values to be blue (red=0, green=0, blue=60)

    # if p is at the 24th ZIP LED, go back to 0 (back to the the start of the circle)
    if p < 23:
        p += 1
        p = 0


Make the blue light accelerate by tilting the Halo and micro:bit to the right, and slow down when tilted to the left

from microbit import *
import neopixel

num_of_pix = 23
np = neopixel.NeoPixel(pin0, num_of_pix)
p = 0 # set pixel pointer to 0
while True:
    x = accelerometer.get_x() + 1024
    a = x//100
    p += 1
    if p >= num_of_pix:
        p = 0
    np[p] = (0, 0, 70)
    sleep(30 - a)


Adding additional devices and ZIP LED arrays to the Halo

Don't forget that you can add more ZIP LED arrays to the Halo, to make more complex light shapes - you can find these on our store here.

The Halo exposes connections for additional ZIP arrays to be connected, ie marked as ZIP_EXT. To control these extra ZIP LEDs just requires num_of_pix to be increased.

For example, if you add a physical array of 5 ZIP LEDs:

  • num_of_pix in the above code needs to be changed from 24 to 29.
  • The if statement will need to check if p < 28 instead of p < 23
  • The added ZIP LEDs lighting up when the value of p is between 25 and 29.

The contacts marked p1 and p2 can be used to connect to input devices such as sensors or switches, as they are connected to the p1 and p2 pins of the attached micro:bit.

Older Post