This weekend, I made a light up, neopixel-enabled crown for my 3-year-old cousin. She always seems quite taken with my light-up contraptions so I figured it was time she had one of her own. It looks pretty cool, and I’d like to indoctrinate her into my world of blinky LEDs and making at a young age…
There are two halves to this project - the electronics-and-code side, and the actual fabrication of the crown. They fit together and you could do them in any order really. You don’t need to be an expert at either - I would say this is a fine beginner project, even if you don’t have much experience in either area.
To make the project, you will need the following tools:
- Computer with Arduino IDE
- Laser cutter and accompanying software
- Sewing machine (or hand sewing equipment + time)
- Soldering iron, solder etc.
You will also need the following materials:
- Adafruit Trinket Microcontroller
- Adafruit PowerBoost 500C Charger/Booster
- Small 3.7v LiPo Battery (around 150mAh)
- A few wires
- Neopixel /WS2812B LED Strip as long as the head circumference
- Felt sheet, ~600x200mm
- White thread Hook-and-loop tape, a ~10cm piece
- A couple of sticky pads and some clear tape
- SPST switch
Step 1: Crown Design
The first thing to do is find out the circumference of the person’s head. You want this to be roughly where the crown will sit but don’t worry too much - heads are weird shapes, the fabric is flexible, and you can make the crown adjustable anyway. The head of a 4-year old appears to average about 51cm, so that’s what I used.
Originally the plan was to 3D print the crown, but the 3D printing gods weren’t on my side when I tried that so I decided to use laser cut felt, which is more flexible and soft anyway. I designed the crown in QCAD - it’s quite simple.
Essentially it’s a rectangle as long as the head circumference, and 50mm tall, with an extra bit at the bottom to sew over the NeoPixel strip. There’s also a little extended pocket for the circuitry, and a tab at one end for some velcro to be added. Around the top as decoration I added lots of the letter M (my cousin’s name begins with an M), and removed the lines joining them to the body so they would be cut as one piece. I had to use a fairly chunky typeface for these, but they came out fine.
You can download the files I used here, but it’s probably better to make your own. You can make the design quite elaborate - as long as it will cut OK out of thin felt without breaking.
Step 2: Laser Cutting the Felt
Next, laser cut the design on a laser cutter into some felt ( I’m pretty sure mine is synthetic felt, looking at it). I used the laser cutter at Norwich Hackspace, where we have a 60W Just Add Sharks Greyfin A2 cutter, and I used Speed 20, Power 55 in LaserCut 5.3 software for those interested. NB this will almost certainly be different for your machine!.
Step 3: Sewing the Crown
Now sew the crown up. First, cut two strips of hook-and-loop tape to fasten the crown. I made the loop part a lot longer than the hook, so that it was adjustable to a degree. Sew the hook-and-loop on first, then down the top and the far end of the NeoPixel channel with a sewing machine, and then around the top of the pocket for the electronics (but leave a side open to push the NeoPixels in through)
Step 4: LED Time
Put the strip of LEDs on the crown, and cut it so it fits in the crown. You’ll have to cut the strip of LEDs where the copper connections are, so round down to the next copper strip below the length of the crown so the strip doesn’t stick out. You can use 30, 60 or 144 LED-per-metre Neopixels depending on what you’ve got. I used 30 because it’s what I had and it turned out fine, but I think the more the merrier.
Step 5: Connecting the Trinket
Each LED in the neopixel strip takes the data a microcontroller sends out, reads it, checks if the data is telling it to do something, and then passes the data along. Because of the way this works, each pixel has a data in end and a data out end.
Cut and strip 4 short lengths of wire, and attach them as follows: Solder one length to the 5v pin Solder one length to pin 1, labelled ‘#1’ (you can use another pin if you like but you’ll need to change the code). Twist the remaining 2 wires together and attach them to the GND pin.
Now you need to connect 3 of those to the neopixel strip: One of the ground wires connects to the ground of the strip The 5v pin connects to VIN on the strip The digital #1 pin connects to DIN on the strip. If you have strip with a silicone waterproof casing, you will need to cut a bit of that back with scissors before starting to solder.
I’ve found the easiest way to connect to these strips is by coating the pads with solder, coating your wires with solder, and melting them together.
Step 6: Code!
We'll be using the Arduino IDE to program the Trinket, modifying the example code available for Neopixels to make it do what we want. You can install the Arduino IDE from here if you don't already have it installed. If you haven’t worked with a Trinket before, follow Adafruit’s tutorial here to install all the additional bits you need (the Trinket isn't a standard Arduino board, but can be programmed with the Arduino software). When you’ve uploaded the blink code to the trinket and it’s working, you’re ready to do upload and modify the code.
The first step is to install the Adafruit Neopixel library to control the LEDs. They have an excellent tutorial about that here so I highly reccomend you follow that and then come back to this one.
You could stick any code you like on the crown. The example code ‘strandtest’ gives you a good idea of what the pixels are capable of. To load this, go to file > examples > Adafruit NeoPixel > strandtest .You’ll need to change a couple of things in the code: the PIN variable at the top needs to be changed to the pin you used (the default is 6), and in the strip set up code you’ll need to change it to the number of LEDs on the strip you’ve used (just count them).
You can then delete any parts of the code you don’t want. The loop function (shown as void loop in the code) calls each function (tells it to run) in succession so that you see it demo all the different functions. I decided that I only really wanted RainbowCycle as that was my favourite, so I just deleted all the other function calls and left that one in so only it runs.
Once you’re done, press the button on the trinket to put it in to upload mode, and upload your code. You should have lots of shiny lights! If you get an error, start with the strandtest code as it was at first, then gradually remove the bits you don't want/need. If you're still having problems, check out the Adafruit tutorial linked above.
Step 7: Batteries and Chargers
The last thing that’s needed is some power. I decided to purchase a proper Adafruit 500C battery charger - I usually use some Chinese unit, but I’m not about to take any chances near my cousin’s head, thanks. If you have a LiPo battery with a JST connector, you can plug it right in to the 500C. If not, you’ll need to solder it as I did, to the VBAT and Gnd pins. It’s a sensible idea to not use the VBAT and Gnd pins that are next to each other, because then the battery might short. I used the GND pin on the underside of the USB charge connector as mine as it was big and far away from anything else.
I wanted to include a power switch, so I connected a simple SPST switch to the EN and GND pins with some wire. In hindsight, a clicky button would’ve been much better for this. Then connect the - output pin on the end to the spare ground wire from earlier, and cut and strip another wire to connect the + pin on the end to the VUSB pin on the Trinket. You should see the NeoPixels light up after a moment when it’s turned on
Step 8: Final Assembly
Use some sticky pads to attach the trinket to the bottom of the battery and the battery to the PowerBoost to make a nice stack of electronics. A bit more tape around these helps secure it, insulate it from prying fingers, and keep the switch in place.
Finally, start shoving it all into the felt. I found it was helpful to put some clear tape over the end of the strip so it didn’t catch on the felt when pushing. This bit is quite hard, but with a bit of pushing and shoving it’s easy enough. Push the circuitry-stack into the pocket at the end.
I’m really pleased with the finished result. As of writing it I’ve yet to give it to its intended recipient but… it’s a rainbow light up crown and she’s a 4 year old girl so….