Enter Your Electronics & Design Project for a chance to win a $100 Shopping Cart! | Project14 Home | |
Monthly Themes | ||
Monthly Theme Poll |
You already might know that I occasionally have trouble focusing my thoughts while trying to get work done.
And it's been hard keeping up with all of these element14 challenges, while my thoughts were so scattered.
So my wife thought of a solution: The Thinking Cap!
We have actually had this project on our list for quite a few years, as a nice fun thing to create together.
We even bought the colander for it back then. Unfortunately we never found the time to work on it.
Until now! With a bit of motivation from element14 really putting the pressure on us with the Wearable Tech Challenge! I mean, if not now, then when?
The main idea of the build was to have something quite techy/nerdy mad-scientist looking, with lots of wires, circuits, and of course flashing LEDs.
The colander makes for the perfect hat-like starting point and provides a really nice silvery electronic-like base.
When I mentioned this challenge, and our outstanding project to my dearest (Naomi) yesterday afternoon, she said it would need some cool flashing lights, ideally something based on tilting your head.
That's when I remembered that element14 had sent me a BBC Micro:Bit recently, complete with a battery pack to power it.
So I thought I could probably wire up some tilt sensors and use some leftover battery powered Christmas lights for the effects.
Now imagine my happy surprise when I started programming the micro:bit (at www.microbit.org) and it turned out the micro:bit already includes an accelerometer that can very easily detect tilting to whatever direction you choose!
The drag and drop blocks were surprisingly easy to work with and it was easy to quickly build a little application to do the cute little animations I was looking for.
The connections on it are also very nice in that the mad-scientist-look patch cables with alligator clips can just clip directly onto it!
The other thing that fell into place very nicely was that the micro:bit's 3 volt (2-AA) battery pack is exactly the right voltage to run the Christmas lights. So all I had to do was use patch cables to go from the micro:bit and onto the clips in the Christmas light battery packs.
I then programmed up a little LED effect to flash one string of lights when tilting left, and the other when tilting right. In the meantime it would show a somewhat animated LED display on the micro:bit's built in array of red LEDs.
Once that was complete, the assembly could begin.
This was a family project, involving all of us!
Charlie Kat was supervising, while Linus (in the back by the window) stayed safely out of the way.
I used clear hot glue to hold the LEDs in place through the colander holes, hiding the wires on the inside.
I then glued the battery packs on the inside too.
The micro:bit with the clips actually fit quite nicely between a couple of lights so I hot glued it to them.
The nice thing about the hot glue is that I can peel it off later if I want to use the micro:bit for another project in the future.
After I completed the process of glueing the lights and the controller in place, Naomi took over and added the artistic flair to the project. This is when things really started to take shape
One thing she then made me add is that big Emergency Stop button, actually wired to the micro:bit 3v and controlling a couple of LEDs at the top.
That also turned out to be easy, with a few bits of wire into the connector to the LEDs, and patch cords clipped to the big screws on the emergency stop button.
Most of the props on the Thinking Cap were scavenged pieces from old electronics - circuit boards from old toys and light bulbs, wires from random places, some cat-5 wire bits, and LEDs with neat coloured twisted wires from old computers.
Some parts were newish - the colander was a dollar store item, if I recall correctly; the LED Christmas lights were swiped from where they were recently adorning the house. I already had the patch cables, which also were not super expensive when I bought them.
element14 was kind enough to provide me with the micro:bit that controls the whole thing.
This is what the finished project looks like:
Naomi made me model it too...
Here is a link to the micro:bit code I used for this project:
https://makecode.microbit.org/_irs9t2h7mYgu
You can use "edit" to use it as a starting point for your own project.
It shows up as Javascript, but once you choose "edit" you can click on "blocks" if you prefer that style. I quite like using the blocks interface because I already look at enough code for my work every day
What's neat is that you don't even need a micro:bit to try this out - they have a simulator you can do all the testing with!
I made a minor tweak to the program to get a better left/right arrow display, so here is the final code in Blocks format:
I'll embed the code here too, so you can cut 'n paste if so inclined.
let tilt_right = false let tilt_left = false input.onGesture(Gesture.TiltLeft, function () { tilt_left = true for (let i = 0; i < 20; i++) { pins.digitalWritePin(DigitalPin.P0, 1) basic.pause(100) pins.digitalWritePin(DigitalPin.P0, 0) basic.pause(100) } tilt_left = false }) input.onGesture(Gesture.TiltRight, function () { tilt_right = true for (let i = 0; i < 20; i++) { pins.digitalWritePin(DigitalPin.P1, 1) basic.pause(100) pins.digitalWritePin(DigitalPin.P1, 0) basic.pause(100) } tilt_right = false }) pins.digitalWritePin(DigitalPin.P0, 0) pins.digitalWritePin(DigitalPin.P1, 0) tilt_left = false tilt_right = false basic.forever(function () { basic.clearScreen() if (tilt_right == true && tilt_left == true) { images.iconImage(IconNames.Chessboard).showImage(0) } else if (tilt_right == true) { images.arrowImage(ArrowNames.East).showImage(0) } else if (tilt_left == true) { images.arrowImage(ArrowNames.West).showImage(0) } else { images.iconImage(IconNames.No).showImage(0) images.createImage(` . . # . . . . # . . # # # # # . . # . . . . # . . `).showImage(0) } })
I hope you enjoyed watching the video as much as we enjoyed creating it!
ps, I need to give mad props to Naomi for directing, editing, and producing the video!
Best,
-Nico and Naomi
(This might be a new adventure in the works for us)
Top Comments