This week I am going to Makersphere at St Mary Magdalen’s Catholic Primary School run by the amazing Lara Lowe and Jan Clemo, two teaching assistants at the school who (amongst many other things) run an after school coding club. Find them on twitter: https://twitter.com/MaryMagsPiClub
I am running a micro:bit workshop and have decided to make a micro:bit shiny belt that my workshop participants will be able to change the colour of by sending it radio messages.
This is the finished result!
Note on terminology:
Neopixel is a brand name by Adafruit. I haven’t used Adafruit neopixels, I used WS2812B RGB lights. I have used the Neopixel library on the micro:bit make website.
Create a belt that
- I could open and escape from (toilet!)
- Is mobile and therefore could be powered by batteries
- Could be controlled by a micro:bit
- The main brains would fit in my pocket
- WS2812B RGB strip of lights, long enough to wrap around your waist and overlap slightly. I used part of this strip: MENGCORE® 4M 5V 60Leds/M 240pixels programmable WS2812B RGB 5050 LED strip Individually addressable dream color Waterproof IP67 PCB Black
- Terminal blocks x 3
- Male to female jumper wire x 2
- 3 x AA battery box for the neopixels
- 2 x AAA battery box with JST connection for the micro:bit
- micro:bit x 1
- micro:bit edge connector x 1 (optional)
Thanks to David Whale this project was possible to do using batteries. Initially I tried using a 5V USB battery pack. But after asking Twitter for advice David came to the rescue and showed me I needed to a) ground the micro:bit with the neopixels and b) have similar power going to the neopixels and the micro:bit. The micro:bit’s out pins don’t produce enough power to control neopixels that are being powered by 5V. So I brought the neopixels power down to 4.5V by using 3xAA batteries to power them.
My light strip came with handy connectors like so:
This solves requirement 1 of having a detachable point to the belt. I can escape without pulling out batteries!
- Strip the connectors to get some bare wire
- Insert the wire into 3 terminal blocks. Screw down the blocks on each wire
- Insert the micro:bit into a breakout board (edge connector)
- Connect the female end of a female-to-male jumper wire to Pin 1 on the edge connector
- Screw the male end of the jumper wire to the Din connection on the terminal block
- NOTE: You don’t need the edge connector. You could strip the end of the jumper wire and poke the frayed wire through the pins in the micro:bit, sticking them on with cellotape. See my bracelet project where I did just that (link to come)
- Connect the red wire from the AA battery pack to the 5V wire in the terminal block
- Connect the female end of a jumper wire to 0V on the edge connector
- Chop off the other end of the jumper wire and strip it to expose the wire
- Now we’re connecting three wires together: to the final ground wire in the terminal block connect the ground from the micro:bit (0V on the edge connector) and the ground (black wire) of the AA battery box
- A close up of the terminal block:
- Plug the AAA battery holder into the JST connector of the micro:bit
- Plug the connection to the rest of the light strip
Setup some simple code to test the lights
- Add the package Neopixels (Advanced > Add Package > Neopixels)
- Create a Variable called np (Variables > Make a Variable)
- Under the “on start” block add the following code
- Get the Input “on button A pressed” and add the following code
Download the code to your computer then upload it to your micro:bit
Unplug the micro:bit from your computer before running the code – this will test the belt on battery power alone. Press A!
My goal is for people to send me colours and the belt will change to that colour. Watch this space for more code!