LilyPad and Protoboard Wrist Mounted Controller
Let's take the Colour Stealing circuit, actually let's take the version with a microphone.
Sound Reactive and Colour Stealing Circuit
Made with Fritzing
But let's add more. The problem is I'm out of pins. (I don't mess with RX/TX.) If I want more pins I have to go with the LilyPad Arduino Main Board. If I go with a LilyPad then I need power regulation and signal level shifter to handle the NeoPixels. But now I can add a rotary encoder for even more twiddly controls. Hooking the rotary encoder up to the physical interrupt pins I get something like this.
LilyPad pinout marked up
Made with Fritzing and edited in post
Why am I connecting the rotary encoder up to the interrupt pins? Because I want to use the rotary encoder as a mode selector, and if stuck in a long animation I want it to be able to detect the mode change and react.
This is my first time using a rotary encoder so I found a great explanation of how they work, and tried the sample code, but I wasn't getting great results. (Sometimes a clockwise-turn would be detected as anti-clockwise, and vice-versa.) So I went with the more complicated, port polling technique that gives better results from Adafruit, named as
updateEncoder()
. I added code to it to update a mode variable on change detected. And then connected that function up to the interrupts in setup()
. // Call updateEncoder() when any high/low change seen
// on interrupt 0 (pin 2), or interrupt 1 (pin 3)
attachInterrupt(0, updateEncoder, CHANGE);
attachInterrupt(1, updateEncoder, CHANGE);
In order for the mode variable to be usable to break out of loops it needs to be marked
volatile
, and included in the loop condition.volatile int currentMode = 0;
for (j=0; j<256*5 && (currentMode == rainbowMode); j++)
But back to the physical. Even with the extra inputs I still have many free pins left for future additions. The circuit looks something like this.
Rough circuit with various inputs, level shifter board, and NeoPixels
Made with Fritzing
But that's pretty messy, isn't it? Wouldn't it be great if there was a way to get a neater arrangement? People have tried various setups, like the ProtoSnap boards, or 3D printed holders. But they all spread the connections out. Whereas the Circuit Playground Proto Gizmo elevates things to a new level. It's a brilliant idea. But it doesn't fit the LilyPad. Both in that the boards have different diameters, but also the pin-holes have different diameters.
Luckily the LilyPad
Thankfully other people have made their own versions of the ProtoBoard already, like this Prototype PCB for LilyPad Arduino.
And here is where we get into comparisons. The Circuit Playground pin-holes are M3. I'm unwilling to admit how long it took me to realise that the M basically stands for Metric Measurement, because the M3s are to fit holes 3mm in diameter. The Adafruit Flora (on the right in the photo below) also has 3mm holes.
The original LilyPad Main Board and Protoboard (on the left) both have 1mm holes. I couldn't find any M1 screws and nuts. (But I guess I could probably still solder on headers.)
The newer LilyPad Arduino Simple and LilyPad Main boards (top row, in the middle) have 2.5mm holes. And so fit M2.5s.
The newer Protoboard I found (red, in the middle) has 2mm holes. M2s.
So I ordered a bunch of M2 10mm standoffs, and M2 6mm screws. (The thickness of the two boards makes up the difference.)
LilyPad and Flora boards
Photo by chebe
With all the pieces I needed in front of me I (messily) soldered up the protoboard with;
And headers for;
- Adafruit Electret Microphone Amplifier breakout
- Adafruit Flora Color Sensor
- LilyPad Button Board
- NeoPixels
- Ground, 3V power
Protoboard (underside)
Photo by chebe
LilyPad with standoffs, and Protoboard (topside)
Photo by chebe
Have you noticed a problem yet? If you look back at the pinout you'll see that the SCL/A5 is right in front of the LilyPad FTDI Basic Breakout pins used for programming the LilyPad. As it is, even with the narrower M2 standoffs, I had to trim one of the pins ever so slightly for it all to fit. (You can see it in the photo above.) It's a good thing the standoffs are removable, because otherwise reprogramming it becomes a problem. Once the standoff and screws are removed, use a crocodile clip to complete the circuit around the breakout board.
LilyPad with FTDI breakout attached, and crocodile clip connecting SCL pins
Photo by chebe
But once we're finished programming it packs up neatly. And now it's ready to connect everything up!
LilyPad controller all connected up
Photo by chebe
As for the colour sensor and trigger (push button), I stitched them on to some elastic to fit on a finger, and connected with thin silicone wire to the headers on the protoboard.
Colour sensor and button in 'glove' arrangement
Photo by chebe
But how am I going to wear my wearable microcontroller? In the interests of being modular, I'm going to wear it as a watch, that I can take apart. I got some 50mm MDF wheels that happen to be the exact diamater of the LilyPad (yay metric!). I spray-painted it black, and glued some folded-over bias binding to it, to fit the width of a leather wristband I'd bought many years earlier.
Wrist strap components
Photo by chebe
To attach the wrist strap to the electronics I'm using double-sided gel tape, that has a very firm hold, but can also be pulled apart without damage.
Wrist strap with gel tape ready for electronics
Photo by chebe
Simply press the electronics on top, and all done.
Wrist controller all assembled
Photo by chebe
Here's the whole system; wrist controller connected to power regulation and signal level shifter board and NeoPixel matrix. For the longer runs of wire I'm using thicker silicone wire that I have loosely plaited.
Overall it has the same problem as watches, in that the heavier section has a habit of shifting around, but if it annoys too much I suppose I could always stick it in place. The nice thing is that it all disassembles cleanly, making everything (not soldered to the protoboard) reusable.
Wrist Controller in the middle of it all
Photo by chebe