Making Suwako Moriya’s Hat: Part 2

A continuation of the previous post, Making Suwako Moriya’s Hat: Part 1.

So it’s been a while since I posted about this, but now it’s done (and have been for a while), so let’s continue! If you only want to see a demo, there’s a video in the end.

After doing some basic stuff with coding and the 8×8 matrices, I took a little break while being busy with some other things. When I finally got some free time, I started on the other end, making the actual spheres that would be the eyes. I figured the easiest way would be to 3D print spheres.

My first try was to make a sphere, and have pipes going from the surface down to the LED matrix that would be placed in the middle of the sphere.

The first sphere I designed, with pipes to each LED

The first sphere I designed, with pipes to each LED

I used 123D Design to create a dome with 64 pipes to the edge. Was easy enough, just that I didn’t have any way to print it… Then a friend suggested 3DHubs to me, a site where you can find people near you that prints your models on their 3D printers for a fee. Unfortunately my sphere was big and the pipes used a lot of material, and the price was just too expensive. That’s when I got the idea to cut down the pipes to be shorter, but not too short, the matrix still has to fit inside. Doing that saved loads of material, and I could get it down to 180SEK ($21) for one dome at the cheapest place.

Unfortunately it was very hard to print right and still took a long time, and I quickly discovered that it didn’t really work as I had hoped, the pipes were leaking light, as can be seen in the video below. It’s also really really huge.

I decided to give up on the 8×8 matrix, the spheres were just too large and too expensive to print at higher detail. I decided to try with a 6×6 matrix instead, but I couldn’t find that dimension and figured I would have to create one myself. A friend of mine had suggested buying LEDs from Ali Express, and I bought loads of the same chip that’s used in NeoPixels for cheap, about $16 per 100 LEDs. These come in blocks of 10×10 LEDs, unless they break while shipping. Which they did. I ended up using superglue to glue LEDs back together to create a 6×6 matrix.

The only issue was soldering. I never soldered in my life, and I didn’t want to spend too much on tools. All I got was a cheap solder iron with adjustable temperature and inaccurate hands. It was extremely frustrating experience and took almost a week per matrix since I couldn’t stand working on it for too long (having to desolder several times, since the solder pads were really close to each other). I think I spent around 5 – 6 hours of soldering on each matrix. And since the solder pads were so close to each other, I couldn’t use straight wires since they would break however I tried, and had to bend them. I was really worried the soldering would break during me walking around.

From previous experience using white, thin pipes didn’t work very well. My next idea was to make a thin, white dome and a solid inner part made out of black material.

The inner part

The inner part

It was still quite expensive to make, but it worked a lot better than the old model. Unfortunately, the brightness on the surface wasn’t very great, it worked in a dark room but would probably be near invisible outside.

I started looking around for ideas, and that’s when I found the best thing possible, in the local hobby chain store. There was this clear Christmas ball that had an inner wall in the middle that could be removed. And amazingly, it had the exact same dimension as the sphere I made for the 6×6 matrix, meaning it would fit just perfectly!

Unfortunately, being in the middle of the summer, it wasn’t in stock. But they had it in their warehouse, and a week later I could go and collect them. I bought some white, acrylic spray paint and painted one side of the inner wall white, and the inside of one of the domes white, but prior to painting I drilled a small hole for the wires to enter the sphere. Placing the LED matrix on the wall and closing worked alright, but needed some effort. I didn’t have to use any glue or anything, since the wires would actually fit just enough into the dome that it would push the matrix against the wall. After some testing, it worked really great and it was extremely bright. Nice!

Well then. Now we have the LED matrices and the eyes. What about the hat? This was a bit harder.

I figured I would buy some thick paper in the same hobby store, but how would I cut it? Since Suwako’s hat isn’t really a top hat, I can’t just roll it up. Luckily, I figured if I made a cone of a specific size and cut that in half it would work. Said and done, after doing some calculation, cuttings and gluing, I had a Suwako hat. But the paper looks really ugly and doesn’t look as a proper hat at all. I got some fabric, but how would I cut the fabric and wrap it around the hat? Since I had already assembled the paper, I figured it would be a bit harder. And I wasn’t very happy with the hat either, as it was a bit smaller than I had hoped, since the papers dimension was a limiting factor (the store only had sheets of 64x46cm).

I went to a store that specializes in paper and paper products, and found a thick sheet of paper that were 100x70cm, perfect. But I wanted to do the perfect cuts too, and be able to visualize the hat before assembling. Back to 123D design we go!

Model of the hat

Model of the hat

I modeled up a hat with the dimensions I wanted and made hole for the eyes. But how do I make a template out of it? With Pepakura Designer, of course! Pepakura is a software to import 3D models and make paper crafts of them by unfolding the 3D model onto 2D. Usually I’d guess it wouldn’t be used on this kind of scale, but it’s worth a shot! Unfortunately, it didn’t like the STL’s that 123D Designer exported. There were tens of thousands of faces, and Pepakura warned for this. The resulting unfold was rather messy. I talked to a friend of mine on Steam that I makes paper craft and I’d figure also know about Pepakura. They looked at it for a bit and cleaned it up, and I got back the template. Thank you!

Obviously I didn’t have a printer that could print to a 100x70cm sheet, but luckily Pepakura can split a template up into several A4’s, that I assembled and cut out from the sheet, and cut out some bigger parts from the fabric. After some work, I had a hat assembled. Unfortunately I’m rather bad at creating stuff with my hands so the hat got a bit skewed but it wasn’t very noticeable. Inserting the eyes were quite hard to get right, and I had to have the matrix powered on to know the correct orientation. Unfortunately the hole wasn’t always oriented properly with the eye (using the arrow eyes for orientation), but that was easily fixed in code later, as long as the arrow pointed top, left, right or down and not in between. Unfortunately it was a bit hard and I didn’t manage to get it completely right, but it still turned out alright.

Then, back to the code! I had most things worked out, except for the Android app. And it was only a few days left for the convention. It was some hectic days, but after a while, it was all done!

Going to the convention was a weird experience, since I got there by taking a 4 hour bus. But to get to the bus I had to take the local tram to the larger bus station. Some people looked a bit confused at me, but no one really cared at all. Hat in action

It worked really well during the convention, but it was rather heavy and uncomfortable to wear, since the hat would press down and bend my ears at all time. Sadly, my fear of soldering slightly came true on the second day, when one of the eyes started acting up, where the colors wouldn’t be the proper color or the LEDs weren’t bright. A friend at the convention suspected it being a power issue, and might as well, but after accidentally putting the hat down a bit too hard, it started working again!

It was fun and I enjoyed making it, but I’ll probably make something that’s easier on my ears next time! Source code is still available on GitHub!

Making Suwako Moriya’s Hat: Part 1

Suwako Moriya and her hat

Suwako Moriya and her hat

Some months ago, around October, I was Skyping with a friend late at night and we started to talk about Touhou, Suwako Moriya and Arduinos. Having wanting to do something with Arduinos for a long while—my last project being my RFID-enabled door lock—I decided make myself Suwako’s hat, but with LED’s inside the eyes of the hat. My plan is to wear it at NärCon, Sweden’s largest convention.

The next day I went to a local store that sold Arduinos and a small variety of different components, and bought myself an Arduino Uno and a small 8×8 LED matrix to test with. The staff at the store didn’t know what color it was since it wasn’t specified anywhere, but it turns out it was a red LED matrix, not exactly what I wanted since I wanted RGB, but it was good enough to test some ideas with.

Next up was finding something to make the eyes from, where I could mount the LED matrices inside. It was hard to find, but in the end I found a Gashapon-style vending machine at my local food store that had large enough capsules to fit LED matrices inside. I bought two of them and planned to paint them white.

The LED matrix had some issues though, when put close to a surface, the dots would bleed together, not creating the effect I want.

I decided to continue with just creating something with LED matrices and worry about the actual hat and eyes later on. Since I didn’t like the LED matrix being single color, I decided to take a look at RGB LEDs. That’s when I found NeoPixels, and while the same store I bought the original matrix had some NeoPixel products, they didn’t have the 8×8 RGB NeoPixel Matrix. Fortunately a Swedish online store does stock them and other Adafruit products, so I ordered two 8×8 NeoMatrix and I had them two days later. Hooking them up to the Arduino wasn’t all that hard but I had to replace all my code so far to use the NeoPixel and NeoMatrix library instead.

These things are bright!

These things are bright!

One issue though, according to the specifications of the LED matrices they use a lot of power, about 60mA per LED that’s set to full brightness on white, that’s 3.84A for one panel and 7.68A for two panels, if all LEDs were set to full white! Fortunately I wont be using all LEDs at once, but even 32 LEDs on full light (16 LEDs on each panel) would end up at 2A. An AA battery for example would discharge in about 1 hour at that rate, but I don’t expect to use full brightness (the above picture is at 3% brightness), so it’ll probably last for a while. Since I’ll be wearing this hat for 4 days at NärCon, having it powered on when I’m not sleeping, I got myself two 12000mAh USB battery packs just in case. The plan was to use both batteries at the same time, one powering one of the LED matrices and the Arduino itself, and one powering the other matrix. So I ended up buying two mini-USB breakout boards to tap into the power of the batteries, unfortunately I never got it to work since I don’t think those battery packs are made for stuff like this, only one of the LED matrices would power on (occasionally, both matrices would power on), and with my limited knowledge of electronics I couldn’t figure it out, perhaps it was an issue with how I connected the grounds. In the end I decided to use only one battery pack for everything while the other is charging.

I started making a simple animation with regular eyes that randomly looks around. The plan is to have different kind of animations and different kind of eyes, as well as different colors.

But having it work on its own is boring, right? Remote control! I bought a cheap IR receiver and control set at the local store, planning to use that to control which eyes are on and what colors, but that only gives limited options and would be awkward to use. So I head back to Lawicel, the Swedish retailer of Adafruit stuff, and bought the nRF8001 Bluetooth LE chip! The plan is to use my OnePlus One to control eyes, colors and other stuff, and when that’s implemented I would head on to make an Android Wear app for my LG G Watch R so I can control the hat from my watch. Implementing Bluetooth was quite hard at a first glance, especially since I don’t really know C++. I found some examples that I tried to modify to fit my project, but it just wouldn’t work, the LED matrices would just flash and misbehave. Took me a week of thinking to figure out what was wrong, and in the end it turns out I had ran out of RAM, since the Arduino only has 2KB of RAM and I was storing the eye patterns in a bad way, using around 192B RAM, which I later could optimize down to only 24B after someone in #arduino pointed out that I should use bitshifting instead.

Android app draft

Android app draft

The Android application is currently pretty much a draft and not much to see. When it’s done you should be able to select which eye to draw on each matrix or to enter random mode. You should also be able to select the color, or put it in fade/random color mode.

The hard part for me would probably be how to make the actual hat and eyes. For the eyes I’ve been thinking 3D printing would be my only choice, and I have to find a makerspace that would let me use their 3D printer for this. I have done some 3D modeling in Autodesk Maya trough my high school years, but it was quite a while ago and this time I’d have to use something free like Blender. The fact that I never done anything to be 3D printed before makes it even harder. My idea so far is to make a sphere that can be taken into two parts, much like those Gashapon capsules. I’m uncertain on how to solve the color bleed issue, but the plan was to have small pipes from each LED on the matrix to the surface of the sphere, but I’m unsure if that would work.

I have released all the source code on GitHub, but be warned I don’t know much about C++ and electronics like these, so there might be some weird stuff going on.

Lastly, below is a video of my progress so far with “random mode” and color fading. It still needs a lot of tweaks, obviously the eyes should not change that often. Currently it has a 3% chance of changing every tick, and there are about 50  – 60 ticks every second, so it changes pretty fast, but it’ll be updated later on to a much saner value. Stay tuned for part 2!