Easter & Bank Holiday Information: Kitronik is closing for the Easter bank holidays, orders placed after the Thursday cut off will ship Tuesday 2nd April.

Using Kitronik ZIP LEDs With The BBC microbit
In this practical guide for Kitronik ZIP LEDs, we cover; what ZIP LEDs are, how they work and how to write code for them, using the Microsoft MakeCode Editor for the BBC microbit. If the technical details are not your cup of tea you can jump straight to the step by step guide and get coding straight away. adding-zip-leds-to-halo-for-microbit-870 Each ZIP stick has five addressable RGB LED’s. The name is a nod to the ZIP postal codes used in the US. Each LED can be controlled independently and all LEDs are connected using the same three wire bus. Each LED can produce a full spectrum of colours independent to all of the other LEDs on the bus. Multiple ZIP LEDs can be connected to produce longer strips. The LEDs used are based on the WS2812B part making them compatible with any WS2812B driver code. Click here to see the datasheet: https://resources.kitronik.co.uk/pdf/WS2812B-LED-datasheet.pdf

Some key features of ZIP LEDs are:

  • Each ZIP LED has a Red, Green and Blue element within the LED, and each of these can achieve 256 levels of brightness. This results in 16,777,216 possible output colours.
  • Integrated intelligent reverse connect protection, so a reverse connection of the power supply does not damage the IC in each of the LEDs.
  • Simple 3 wire connection for all LEDs.
  • LEDS can be placed up to 5m apart without the need for any additional circuitry.
room-101

How do ‘ZIP’ LEDs work?

The ZIP LEDs are connected using a three wire bus. These connects are V+ (3.5V to 5.3V), Gnd (Vss) and Data. The data is fed into the data in pin on the first LED and then out of the data out pin. This then feeds on to the next LED as shown in the graphic below which is taken from the datasheet.

circuit

The control data is made up of 24bits. These are read into the first LED. When a second set of data is sent the first set is then sent out of the first LED and on to the second. In this way the data cascades from one LED to the next. Data sets are separated by reset codes. This is shown in the graphic below (again taken from the datasheet). D1 to D4 refer to four LEDs connected to each other. as you can see the first LED has three blocks of data passed through it, the second two and last LED just one. data-cycle The data structure is as follows: Each 0 or 1 is sent as 1.25uS high to low cycle. The length of the high and low determines if it is a 0 or a 1 being sent. The times are as follows:
T0H 0 code, high time 0.4us
T0L 0 code, low time 0.85us
T1H 1 code, high time 0.85us
T1L 1 code, low time 0.4us
RET 1 code, low time >50us
 

sequence chart

 

Using ZIP LEDS with a BBC micro:bit:

Our ZIP LEDs use WS2812B LEDs meaning that the neopixel blocks for the MakeCode block editor can easily be used to control them. The following describes how to control the ZIP LEDs on our Servo:Lite board for the BBC microbit. 5623_additional_servo_lite_board_move_mini_bbc_microbit_top STEP 1: Attach a microbit to the Servo:Lite board. STEP 2: Put batteries into the Servo:Lite PCB, and turn it on STEP 3: Connect it to a computer using a micro-USB cable. STEP 4: Bring up Javascript Blocks Editor (makecode.microbit.org).   STEP 5: In the top right of the screen click on the cog. STEP 6: Select ‘Extensions’ from the menu. STEP 7: Select the ‘neopixel’ box. zip-led-add-on-inventors-kit-microbit-dialogue-870 NOTE: This will load a set of blocks compatible with Kitronik’s ZIP LEDs, which makes them really easy to code! STEP 8: Create a variable and name it ‘PixelArray’. A variable is like a container which can store information. This could be a number, a word or a piece of information you want your program to remember. STEP 9: Create the following code. This tells the micro:bit that Pin 0 is connected to 5, colour addressable LEDs. When button A is pressed, light up all the pixels red. When button B is pressed, clear the variable and show it on the LEDs. This will turn them off. 20170602_145737_resized STEP 10: The program will automatically run on the simulator. Click on the ‘A’ button on the simulator to see the LED pattern. Click on the ‘B’ button to see the message. STEP 11: Try changing the code to make a different colour. number STEP 12: as well as addressing all the LEDs on the Servo:LIte at once it is possible to set them individually, or as a group. The first pixel always has an address of 0 (see diagram below). STEP 13: Change the code under ‘On button A pressed’ to the following. This will set the first two pixels to red, the middle pixel to white and the last two to blue. 20170602_160606_resized REMEMBER: To show a change you must use a block with ‘show’ in it. NOTE: You may need to click on ‘More’ under the ‘neopixel’ toolset to view extra blocks. STEP 14: Try it out. Press A and watch the lights! STEP 15: Create the code below.
  This code shows a colour changing pattern when button A is pressed and stops when button B is pressed. NOTE: The ‘rotate pixels’ tool shifts each pixel colour onto the next pixel. When it reaches the end of the line, it goes back onto to the first pixel. STEP 16: Try it out. Press A and watch the light show! 20170602_160844_resized We have developed several products that feature ZIP LEDs, you can find links to them below:   NeoPixels® is a registered trademark of Adafruit Industries LLC.

Kitronik's suggested additional learning

6 Lesson Plans For ZIP Halo For BBC microbit

Unlock your students potential with these 6 free Lesson Plans for ZIP Halo for the BBC microbit. These resources are classroom ready but they can also be used by anyone who wants to learn how to use the addressable LEDs of the ZIP Halo.

16 comments

Cullen Lewis

Cullen Lewis

Thank you for your question, these could be controlled with an Arduino and the base LEDs used are WS2812B so any Arduino library that can control those LEDs should be able to control our ZIP LED strips and so on. There are a few of them out there but I believe Adafruit do a Neopixel library that is well thought of.

Don Whalen

Don Whalen

Can this be programed with arduino? If so what library?

Mark Donnison

Mark Donnison

Hi Torben, they can be coded with the NeoPixels extension. I hope this helps.

Torben Kristensen

Torben Kristensen

Hi. Just bought some ZIP Halos (24LED) , but I can't find any extensions for them. Only for the HaloHD(60). Help, please…

Mark Donnison

Mark Donnison

Hi, Sorry to hear that you are having an issue. If you contact our support team, they will be able to help you troubleshoot the problem: support@kitronik.co.uk

Erneeraq

Erneeraq

Hey Kitronik. I recently bought my ZIP LED. And through lots of coding it now only shows 2 colours. Red and Green. Even after coding it to show Rainbow colours. Anyway you can help me? Regards Erneeraq Lennert

Mark Donnison

Mark Donnison

Hi Tom, this URL PDF should contain the information you require for connections: https://www.kitronik.co.uk/pdf/35129-zip-strip-datasheet.pdf. If it is unclear or if you would like some guidance, our support team are always on hand to offer some direct assistance: support@kitronik.co.uk

Tom

Tom

I have purchased the zip hex leds and I do not know how to connect them to a microbit using wires to power and program all 5, any help?

Mark Donnison

Mark Donnison

Hi John, yes it is exactly as you have stated above. The unused end is for attaching other ZIP LED sticks, arcs, rings etc and can just stay as is if only using the stick that you have.

John Gordon

John Gordon

Hi Mark. So, one end of the ZIP Stick has 4 tabs GND, DIN, 5VDC and GND and the other end has 4 tabs GND, DOUT, 5VDC and GND. Do I connect the DIN to the PO pin, the 5VDC to the 3V pin and one of the GNDs to one of the 0V pins? It would appear, from the flashing 101 image on the Kitronik website, that nothing is connected to this other end. Thanks. John

Mark Donnison

Mark Donnison

Hi John, the guide here has the information you need. https://www.kitronik.co.uk/blog/using-kitronik-zip-leds-bbc-microbit/ Although it is the servo light that is pictured, the instructions are the same. If you use P0 to control the ZIP LEDs you can use the exact same code. Please note that the MakeCode Editor has just relaunched with a new look so the blocks now look a little different but still function as they did previously.

John Gordon

John Gordon

I recently bought a 5 LED Zip Stick. It did not come with any instructions, so I went to the guide on the Kitronik website but the instructions there referred to using a Servo:Lite board, which would not fit in with my project. Which pins of my Micro:bit do I use for my Zip Stick and how do I program it?

Mark Donnison

Mark Donnison

Hi Peter, Sorry, not at the moment but it is on the list!

Peter Whitehouse

Peter Whitehouse

any Micropython equivalent code please?

Mark Donnison

Mark Donnison

Hi Kari, in your code, there will probably be a line of code in an 'on start' block that defines which micro:bit output pin is being used, how many LEDs there are and what LED format the LEDs are. This will all be in one NeoPixel code block and your values will probably be P0, 5 and RGB (GRB format). For 16 LEDs it should be P0, 16 and RGB (GRB format). I hope this helps.

Kari Santos

Kari Santos

Hi – I am having trouble programming additional LEDs – I have added a string of 16 neopixels, and they light white on reset, but won't change colors like the first 5 – can you show a program that has more LEDs attached.

Leave a comment

All comments are moderated before being published