A couple of months ago, playing around with my new Raspberry Pi Zero W and thinking about some of my upcoming summer ed tech events, I decided that I wanted to make something that would fully take advantage of the compact size of the Pi Zero, that was somewhat useful, and that I could take with me and share with my maker friends during my summer tech travels.
|Me & grandma celebrating!|
I loved the idea of making something wearable and blinky, and also wanted to figure out a way to incorporate the use of my grandmother's hi-tech embroidery machine. Right away I thought it would be fun to embroider the Raspberry Pi logo and from there I realized that a tote bag would be the way to go for my first wearable project.
Now, I know some readers are going to chime in and suggest that I should have used something other than my Pi Zero to create my "wearable", and at first I did look around at some of my other options, but realized that the point wasn't to buy new toys-- rather, I wanted to see what I could create with the materials that I already had available to me.
Here are the materials that I used and the process that I went through to create my first Raspberry Pi "wearable"-- the Pi Tote.
- Raspberry Pi Zero W
- 8" female to female jumper cables
- 5 mm clear white LEDs
- 1 yard of heavy cotton fabric for main outer pieces of bag
- 3/4 yard of patterned cotton fabric for inside pieces of bag
- 1/3 yard of solid cotton fabric for bottom of bag
- Embroidery thread and Brother "Dream Machine 2" embroidery/sewing machine
My Process:Step 1
After some playing, we had our image uploaded to the machine and converted into a line drawing. I embroidered my first design and, happy with the outcome, I took it home to start experimenting with the electronics, while I set my grandmother with the task of finding a simple tote bag pattern that we could use to sew our own bag which would include a pocket that I could use to conceal the computer and cords.
Embroidered Raspberry Pi logo prototype in hand, I started exploring the different ways that I might be able to make my raspberry light up.
The first iteration involved programming random pulsing LEDs on the Sense HAT's LED matrix, but the square shape of the matrix didn't allow for much flexibility in where the LEDs would be placed and trying to shine the matrix through the embroidery only provided a dull glow from the fabric.
I cut a couple of holes around the edges of the embroidered logo, popped a couple of LEDs through the holes from behind the embroidered patch, and connected the cables to the Pi. I ran a simple blinking program to test the lights and decided this design was a winner!
Next I focused on coding the LEDs to blink. I wasn't sure at first how exactly I wanted the LEDs to look, so I started by just making sure I could get them all to blink one at a time. After some consultations with my very creative family, I decided that what I really wanted was for the LEDs to pulse randomly inside the raspberry (which also meant a couple of changes to the embroidery design later).
I'd never used a pulse command, but hoped something existed and went to the gpiozero documentation to see if there was something there that I could use. Indeed, I quickly found information on how to pulse an LED. I tested one and had no problem getting it to pulse-- woohoo! Off the top of my head I didn't know how to make an action happen randomly, so I started off by coding my LEDs to pulse one after the other. This looked okay, but program was getting long and messy and it still wasn't exactly what I wanted.
I started googling for the Python commands that would help me pulse my LEDs randomly and wasn't finding what I wanted. Luckily, it didn't take long for me to remember that Ben Nuttall included tutorials on the 'random' commands in his PiCamera worksheets, so I headed to the Raspberry Pi website to look back at the "Getting Started with PiCamera" lesson. I ended up creating a list of my own for the very first time (called 'lights' and which included each of the LEDs I had connected to the Pi) and programming my Pi to randomly pulse an LED from the list in a forever loop. This program ended up doing exactly what I wanted and was, thankfully, a much neater bit of code than I'd started off with!
With my code ready to go, I needed to get moving on the bag itself. My grandmother found a pattern we thought might work for a couple of beginners (my grandmother is a very skilled seamstress, and was a great resource for helping someone like me, with a only a couple of sewing projects under her belt, but she'd never done a bag so we wanted to start with something simple). I picked out some fabric I liked and we started working our way through the pattern. Several days into the cutting, pinning and sewing, as we were working through the steps, we realized that the pattern we'd chosen was not as intuitive as we'd hoped and when we hit a wall that we were struggling to get over, I scrapped the half of the bag we had done and started searching out an easier pattern... on YouTube.
The first video that popped up looked super simple (a pattern from DIYer Loepsie), so, with just a week before ISTE (the first event at which I wanted to be able to use my new blinking bag) I went back to the fabric store and we started again. I had to do a few calculations in order figure out how much material to buy (a good math test for myself!), especially after making one small adjustment to the measurements provided in the video (I used three fabrics instead of two), but otherwise the instructions in the video were super simple to follow (much more so than the original pattern we bought) and in about 3 hours, we had a tote bag made!
|Several iterations of raspberry|
Once my design was ready, I embroidered the final Raspberry Pi logo onto a swatch of outer fabric to make into pocket for the bag. The size of the swatch was measured with the intention of having enough room to house my Pi Zero W and the jumper cables needed to attach the LEDs onto the pocket.
Adding the pocket onto the bag design turned out to be a pretty simple endeavor. We sewed lining onto the back of the pocket, hemmed the edges and then sewed three sides onto the center of the bag.
The final step was to string the LEDs through holes & test the final product. I ended up sliding the LEDs through the holes on the front of the bag and then attaching the cables from the back side of the pocket. This kept the LEDs securely in place and prevented a lot of sliding around.
The first time I connecting everything, I used a 4" female/female cable attached to an 8" male/female cable attached to the LED (mainly because that's what I had in my tool box). With this setup, the cables proved to be too long and took up too much space in the pocket for me to be able to hide everything as neatly as I wanted. With the pocket so tightly packed with equipment, it also made it difficult to maneuver my hand around and get the LEDs secured. So I did have to do a little more shopping; I purchased 8" female to female cables so that all I needed was two jumper cables per LED, rather than four. This proved to be a much cleaner setup, and left enough room for me to squeeze my hand into the pocket and get all of the LEDs connected to the Raspberry Pi.
|Editing rc.local file|
battery worked fine, but while at ISTE I tried connecting to VNC viewer to no avail. Not sure if it was the spotty wi-fi network, but this kink in my plans led me to researching how to program my Pi to run a specific program on boot up. This was something I'd tried learning several months back with no luck. Somehow, this time around, and on a time crunch, I was finally able to find the directions in the Raspberry Pi documentation that allowed me to set up my Pi to run my pulsing light program on boot up by adding just one line of additional text to the rc.local file.
Just a couple of hours before the Raspberry Pi Jam at ISTE, I had my blinking tote bag running beautifully!