Dr. Tape Head is the perfect spooky companion when you're working late in the lab! He uses Amazon's Polly service to read out text from a Google Sheets spreadsheet, populated by the IFTTT service and gathered from Twitter, SMS messages and camera motion alerts. He's even integrated with Google Assistant so you can remotely dictate tailored messages to spook those pesky trick-or-treaters.
Between notifications his Lego-framed glowing eyes, heavy breathing and LED VU meter mouth leave you in no doubt that he's still lurking in the shadows. As he speaks his moving eyes fire laserbeams through an eerie cloud of vapour, generated by a relay-controlled USB pump and a slightly hacked e-cigarette.
His Raspberry Pi brain controls all of these functions, with speech and sound effects blaring from a pair of earphone-mounted speakers, connected up via a Pimoroni pHAT Beat amplifier
His head started life as a fencing mask, his mannequin body contains a long-lead power supply and his mad scientist hair is hand-crafted from vintage cassette tapes.
It's tricky to describe such a complex individual in words and pictures, it's definitely worth watching him in action on the video (https://youtu.be/mykrJEozIoM if you can't see the embedded version).
EarsThe first body part I assembled were the ears - in this case a broken old pair of Sony headphones. After taking out the existing headphone drivers I drilled a 30mm hole in each side, then simply hot-glued in two small but powerful speakers.
To make the assembly easier I soldered some jumper cable connectors to the speakers, having had a chilling premonition that I'd be assembling & dismantling this project multiple times.
EyesFor the eyes I started with a single ping-pong ball, building a Lego frame so that it would swivel eerily back & forth on a Technic axle that I'd poked through. This was only meant to be a prototype but it worked so well that it didn't make sense to use anything else for the final build.
Next I took two more pieces of axle and hot-glued a laser diode and a ghost-white LED to each. This meant that the lasers would swivel with the eyeballs, while the LEDs would make the orbs glow.
To make the axles swivel on command I cable-tied a small servo to the frame, one that I knew would work well with the Raspberry Pi, and linked it up with technic pieces - it took a bit of lego-trimming and code-wrangling but I ended up with glowing, moving laser eyes, a really satisfying mini-build.
As a finishing touch I dismantled a cassette tape and super-glued the little wheels to the eyeballs, giving them some nice retro character.
At this point I was tempted to just put the eye assembly in a pumpkin and have done with it, but a distant analogue voice made me press on...
MouthI thought the mouth would be easy, and had a clear idea of what I wanted to do - a transparent cassette would stick out horizontally through the fencing mask, and the smoke would come out of the tape itself. This idea was scuppered early on however, when I tried to cut a test hole in the mask - it stands to reason looking back, but I discovered that fencing masks are extremely tough! (Well duh) After trying all the tools I have and not making a single impression I decided to regroup and change design.
The lighting for the mouth comes from a Pimoroni pHAT Beat, an audio amplifier for the Raspberry Pi that has its own built-in VU meter. The plan was to use the VU meter for the mouth, and connect up the earphone-speakers as outputs. The pHAT Beat is designed to fit directly on top of a Pi, but as usual I needed it to be somewhere else, so connected it up with a ribbon of jumper cables, checking which ones would be needed on pinout.xyz.
I then hot-glued the pHAT Beat to a semi-transparent cassette tape, which gave it a bit more shape and analogue style. In an ideal world I'd have figured out how to change the LED colours and make them all red instead of green-amber-red, but this can always be changed at a later date.
SmokeIt's cool to have lasers in a project, but I thought it'd be much better if you could see their pew-pew traces as well as the red dots they project. The cats of course would disagree, they're only interested in the dots. Rather than wait for a foggy night or invite smoky relatives round I decided the project should generate its own smoke or vapour, so that the lasers would be more visible and sinister.
I began by ordering a cheap USB-powered 5v air pump from Amazon - it was poorly reviewed as an air bed inflater but as none of the reviewers had tried it as a smoke pump for laser eyeballs I decided to give it a try.
Next was generating the "smoke" - I figured I'd buy the cheapest e-cigarette pen I could find, connect it to the pump inlet & use a servo to press its "go" button, importantly using 0% nicotine vape liquid. This was a grand but over-complicated plan, and a work colleague simplified it overnight by telling me about an e-cig that uses "suck" rather than a button to turn on - and he had a spare. This made things much easier, all I had to do was turn on the pump & this would in turn start the vapour generation, stopping as soon as the pump stopped. It worked a treat in testing so I moved on to something trickier - connecting everything up.
ConnectionsAs I said earlier the pHAT Beat audio board was connected to the Pi's GPIO, and took up quite a lot of the pins. I needed to share some of these GND and 5v pins for other things, so added in a Pico Hat Hack3r, which is essentially a GPIO splitter that gives you two sets of pins (but all connected to the same pins on the Pi).
This made things easier, and I was able to add in the connections to the servo easily. Next I needed to control the lasers and pump, both of which run on 5v. I knew I was pushing my luck power-wise on the Pi already, so decided to power them separately, from a USB power bank (initially). To control them from the Pi I added a Sparqee relay into the mix - a very handy little board that you program just like an LED, but that acts as a switch for an external power source. I split open a short USB extension lead, exposing & snipping the positive cable, and extended the cut ends so they could be wired to the relay board. The lasers and pump were both wired to USB plugs, so I added in an old hub, meaning they'd both be powered together. Another reason for doing this was that both the e-cig and the lasers had to only be on for short periods to avoid damaging them, and also there's no point firing lasers without smoke, and vice versa.
After a successful test assembly there was nothing else for it but to bring on the fencing mask and start fitting things in place.
HeadI'll remember two main things about fencing masks from this build - they're too tough to cut through and really awkward to work with! This one only cost me £5 at a charity shop though and inspired me to make this project, so I'm not complaining at all.
I fitted in the eyes assembly first, after stripping down the Lego frame to the minimum. Being unable to cut holes, the only way I could find to attach it was by poking wires through the mask & frame then twisting them round. This was extremely fiddly but held the Lego in place nicely.
Next I added in the pump, just behind the eyes so that the smoke would pour out roughly where the lasers were firing. To do this I poked a thin threaded rod from one side of the mask to the other, fixing the pump to the rod with cable ties - not especially elegant or apocalypse-proof, but certainly functional.
The cassette mouth was similar, I drilled small holes in the tape and secured it with modelling wire.
Next was the Pi itself, which was fitted into a chopped down case (to make room for the Pico HAT Hack3r) and just cable-tied to the support at the back of the mask.
Knowing it would be awkward I was careful to hot-glue and tape all of the connections to one another before I started, and given the amount of post-assembly surgery I had to do inside the head with actual forceps this was definitely a good thing.
Amazingly everything still worked afterwards, I was especially pleased that the laser beams and smoke both made it through the mesh of the mask with no real reduction of power.
BodyWhy couldn't Dr. Tape Head go to the Halloween party? He had no body to go with.
I'd planned all along to use an old mannequin to support the head and give clothing options, and the mask had fitted perfectly when I tried it a few weeks back. Of course that was before it was stuffed full of electronics - it now had no chance of fitting because of the "bollard" on top.
Five minutes with a hacksaw soon took care of that though, leaving a gaping hole and revealing a hollow fibreglass torso - grisly! Here I added in a 5m mains extension lead at neck level (just in case he fancies a trip outdoors) and topped that off with a night light / USB Charger combo that I picked up on instinct in Lidl last week. This worked out brilliantly as I now had decent USB power for both the Pi and Lasers/Pump, with the added bonus of extra illumination inside the head.
Hair & WardrobeI loved the look of the fencing mask, but wanted it to have a bit more personality, specifically some crazy hair, like Doc from Back to the Future. To continue the analogue-audio theme I decided on using cassette tape for this, as it kind of looks like hair and there's no shortage of it in this house.
I'll admit I had help - cutting C90 cassette tapes (each of which is over 100 metres long) into short lengths took quite a while, but was a nice rainy-day family activity. I then took a hood from an old sweatshirt and stuck strips of double-sided tape all over it, sticking the cassette tape lengths to it one at a time. This also took quite a while but was worth it for the final effect, a full cassette tape wig!
Lastly was wardrobe - what does an "evil" doctor wear? As Phineas & Ferb fans the answer was obvious, black turtleneck & lab coat, a la Dr. Doofenschmirtz. The final touch was a glowing EL wire cassette, pinned to the shirt - this was my very first published project back in 2013 so it was nice to be able to use it again (and incredible it still works).
Perilous Polly & PythonI developed the code as I went along, creating Python scripts for the individual functions like moving the servo and turning on the relay, this meant I could test the individual parts of the build and more easily see which one had broken (which happened several times).
To make the good doctor speak I set up and configured Amazon Polly, an awesome text-to-speech service with lots of different voices and options. The setup's not too bad, but is a little bit involved if you're not already set up with Amazon Web Services - either way though if you follow catqbat's guide as I did you'll be up & running in no time. For me it worked best using PIP3 instead of PIP when installing the modules, omitting the Sudo when installing boto3, but your experience may vary depending on your setup.
Now I had a talking head, brilliant - but I needed a way to feed it text, rather than relying on hard-coded phrases. I had a vision of standing the project outside, then being able to send it tailored messages to trick-or-treaters ("Are you Harry Potter? Take some candy from the bucket, tiny wizard!").
I decided (for reasons we'll come to) that I'd like the doctor to read out text from a spreadsheet on Google Sheets, so that it would be read out straightaway if new text was added. The first thing was setting up a spreadsheet on my Google Drive, which was easy, and then getting some Python code to extract the text, which was fairly straightforward. To achieve this I followed Dilan Jayasekara's guide, which takes you through the steps needed on the Google Developer Console as well as providing code examples. I used some sample code to access the data from a specific cell, then added in a loop to the python code and a few twiddly bits so that only the latest entry would be read out, and only once.
At this point I could manually add text to the Google Sheet and the doctor would read it out, usually within about 10 seconds. Now I needed to add in extra options to get text into that spreadsheet.
It's Creepy and It's Kooky, It's IFTTTUsing the IFTTT (IF This, Then That) service I set up a number of "applets" so that defined triggers from one of my connected web accounts would generate text in the spreadsheet automagically, with the good doctor then reading it out within about 15 seconds. I set up triggers on the following IFTTT services...
- Google Assistant - Perfect for dictating spookily specific messages remotely from a phone or Google Home device (in the video it's our Retro-Fitted Home Mini).
- WebHooks (Maker Event) - ideal for taking inputs from another Pi, in our case a MotionEyeOs camera outside the house calls a web hook as soon as motion is detected, and the doctor speaks "There's something outside". Perfect for pranking visitors as they approach the door!
- Android SMS - with IFTTT running on a cellphone you can pass the sender name and SMS content directly into the spreadsheet, for this build this enables me to send myself a text message and the doctor reads it out.
- Date/Time - Useful for an hourly "6pm and all's well" check, or to have the doctor declare, "Zoinks it's sunset, vampires will be out soon"
- Weather Underground - great for announcing changes in the current weather, like "look out, it's about to start raining"
- Twitter - Endless possibilities with this one, as you can capture the text of all tweets from a specific user, or use other search criteria like mentions and follows. In my case anything tweeted by @GuardianNews or @FactSoup is read aloud by Dr. Tape Head. Obviously you need to be careful which twitter accounts you have read aloud if there are children present!
...and the great thing is you can customise the IFTTT Action using ingredients and text of your choosing, so you can really add some colour to the notifications. So for Halloween we can set the system to read out a stock spooky phrase whenever motion is detected, but we can also have visitor-specific text read out by using SMS or Google Assistant.
With the above working I pasted in the code from my earlier experiments, making the doctor move his eyes, generate smoke and fire lasers before and after each notification. I also added in a couple of lines of PyGame code, one to make the "Pew Pew" sound while the laser is firing (masking the noise of the air pump), and one to make a "heavy breathing" sound on a loop while the system is waiting for a new notification. Which is a bit freaky in the dark.
There's a fair bit of setup involved in the above, but none of it's all that technical if you take your time and follow the guides - the final Python script I used is on GitHub (it's functional but far from perfect, I'm still learning!)
The End of Dr. Tape Head?I really enjoyed this project, building something with a theme was great fun, and I managed to achieve most of the vision I'd first had when I scooped up the bargain fencing mask. I also learned a lot about working with Google and Amazon web services in Python, which will be useful for future builds I'm certain.
Dr. Tape Head is surely looking forward to hanging out on the porch at Halloween, but will live on afterwards too, with his ability to read out customised notifications and entertain cats with his laser eyes he'll be a valuable asset in the workshop all year round.
Included above is my daughter's concept art - I wouldn't be at all surprised if she turned the character into a graphic novel, I can just imagine Dr. Tape Head on a crusade to rid the world of all streaming services and return civilisation to the simpler times of analogue audio.
Happy Halloween 2019 everyone, be safe!
My other Old Tech. New Spec projects are all on Hackster at https://www.hackster.io/martin-mander/projects and on our YouTube channel at bit.ly/oldtechtube
More details and a contact form are on our website at http://bit.ly/OldTechNewSpec. and you can find us on Twitter @OldTechNewSpec.
Comments