Haunted Portrait for Less Than $20
by jptrsn in Circuits > Arduino
10826 Views, 98 Favorites, 0 Comments
Haunted Portrait for Less Than $20
I'm a huge Halloween nerd, but living in an apartment has certain limitations. No yard, no storage, no trick-or-treaters, and very little in the way of opportunities to creep people out. And that's the best part of Halloween: creating something that's off-putting, that sends shivers down your spine, or that makes you do a double-take because you're not sure if you actually saw what you think you saw.
So with this in mind, I tried an experiment this year to see if I could make something small, cheap, easy, and that wouldn't look out of place year-round, but could be selectively creep-tastic.
And what's creepier than an old-fashioned portrait? Almost nothing! There are some great instructables on this site for portraits with eyes that follow you, but I wanted something even worse. Here's a little summary of what I came up with...
A nice, framed portrait of someone famous and/or old-fashioned, hung on the wall. When you walk up to it, or walk past it, there's a brief flash of something sinister lurking behind the face, but you have to work hard to catch it. They've got something similar at the dollar store using a cheap lenticular print, but it looks like cheap plastic, and doesn't work in dimly-lit environments.
Tools & Materials
You won't need much for this instructable. Here's a list. All the links are similar to what I bought, but I can't guarantee the seller, so use your discretion. I get most of my electronics from eBay, but Amazon, DigiKey, SparkFun, Adafruit, and many other suppliers can be used.
Tools
- Black and white laser printer (it might work on inkjet, but I haven't tried)
- Glue gun & glue
- Utility knife
- Soldering iron & solder
- Inkscape, or another graphics program. (I like inkscape because it's free.)
Materials
Electronics
- 12v LED tape (about 12 to 18 inches worth) ($1)
- Arduino Nano or clone ($2)
- Ultrasonic distance detector HC-SR04 ($1)
- 12v power supply (can be a wall-wart style, you don't need much current) ($1)
- 2.1mm barrel jack connector (optional, but makes the whole thing tidier) ($1 for 10)
- 4 pin female header (optional if you've got it handy) ($1 for 10)
- Ribbon cable (again, optional if you've got it. Any wire can be used, but ribbon cable makes it a bit neater)
Miscellaneous
- Parchment baking paper, or tracing paper ($1)
- Aluminum foil ($1)
- A shadow-box frame from the dollar store ($3)
- Vinyl shelf liner ($1)
- Glue stick
- Scotch tape
- A sheet protector (the plastic sleeve that holds a piece of paper in a binder)
I didn't buy everything expressly for this project - in fact, I had everything but the shelf liner and frame, which both came from the dollar store. If I had to ball-park a figure, I'd guess it would be around $15 for the whole project buying from the cheapest available sources, and more if you're going for convenience. If you've got any of this stuff hanging around (and I suspect you might, as I did), it'll be far less. I ended up spending about $10 in total on things bought specifically for this project.
Set Up Your Photo
Look up a good, old-fashioned image on Google images. I particularly like this one of Charles Darwin from Wikimedia Commons. Then, import it into inkscape, and set the opacity of the image to 75%. You can add an oval crop to it if you like.
If you're not familiar with how to use inkscape, there are some great tutorials out there. You basically need to know how to import a photo, draw an oval, set an image mask, blur a border, manipulate layers, and draw a bezier curve. Some of these will pop up later, and they're just generally good skills to have.
Once you've got your image looking the way you want, you'll need to add a layer on top of it. We're going to put a skeleton on that layer, so we can line things up properly. I used this site to pose the skeleton with the same angle, then grabbed a screen shot.
Add it to the new layer, and move/scale it so it lines up with the photo underneath. You really want to focus on the eye sockets and nose, and make sure those are in line. Setting the layer's opacity to about 50% temporarily really helps this step. I went a bit further and traced the skeleton to a path, then modified the colours and layout a bit. It's all really up to you, but if you don't want to bother going through all the hassle, just download the svg file linked to this step.
I also experimented with using a line drawing of the skeleton, or having photo-realistic black and white behind. I'm still not sure which I prefer, but they're both pretty cool. My personal favourite uses a relatively dark skeleton image to block out light, but with this design, you can mix and match until you find a combination that you like.
You can embellish your image with whatever you'd like. I found a font called Jellyka Vampire Street that I really like, so I used it for the image caption.
If that's too much work, you can just download the svg file linked to this step, and open it with Inkscape. Export each layer separately as a page.
Downloads
Get Printy
I had some issues printing with inkscape - it wasn't respecting the image opacity settings. To get around this, I exported a png for each image. You're going to need two images: one of the portrait itself, and a second of the skull. Hide one layer, show the other, then export the picture. Swap layers, then do the same. You'll now have two images that you can print out.
Give them both a print, and stack the skull behind the photo. Hold it against a window and check your alignment. You should be able to see a faint outline of a skull behind the photo - that's what we're looking for.
I found that my printer paper was a bit too thick to get the effect I was going for. I didn't have any tracing paper on-hand, but I do have parchment paper in my kitchen. Tear of a big piece, and carefully cut out an 8.5x11 inch sheet. I found the easiest way to do this was to place a regular sheet on top of the parchment, line up one edge, then fold the other edge over, and cut along the fold with a sharp utility knife.
Once you've got your paper cut out, load it on the top of the paper stack in your printer, and print out the photo one more time. You'll notice that the quality of the print is pretty lousy, but in this case, that's actually a bonus - it looks aged and decrepit. For additional aging, you can throw the parchment printed-side-up into an oven on 350 for about 5 to 10 minutes. Don't worry, parchment is designed for baking, so you're not really running a risk of fire here. It will just add a bit of brown to the paper, making it look extra-old. I have a sneaking suspicion that this might also help the toner bond to the parchment paper, but I haven't investigated this idea.
Finally, you'll need to print the oval outline, as we're going to be using that to get the oval cutout on the photo matting, and using it as a guide to set up our light ring. You can also mark the top of this sheet, both inside the oval and on the outside edge of the paper.
Matte Your Glass
Since we're adding lights and an Arduino behind the glass, we'll need to add some matte to the frame. This is actually a bit more complicated than it seems at first, since we need to ensure that light can't get through. We can fix this issue with simple Aluminum foil, and a roll of shelf-liner from the dollar store in your favourite colour. I went with white, but black, or a nice Victorian pattern wallpaper would work just as well. Be aware that the adhesive side of the liner is what will show through the glass, so if you're using wallpaper, you'll need to glue the front to the glass somehow. This seemed like a lot of work, so I didn't bother with it.
First, we need a piece of shelf liner larger than the glass of the frame. Lay the glass on the liner, and cut off a piece with about a half inch overhang on all sides. Then channel your best "applying-a-screen-protector" personality, because we need to apply this thin sheet of vinyl to the glass. Peel the edge off the liner, lay it on your clean glass, and smear it down with your thumb. Peel a bit off the liner, and repeat. Keep going until you've got it smoothly applied with no bubbles or gaps. You can use a rag or paper towel between your thumb and the shelf liner to help it slide and apply even pressure.
Now we need to apply foil to the back of the shelf liner. Use a glue stick to apply glue to all edges (get them well covered), and in quite a ways from the edge. You don't need to glue the center, but you want to ensure that every part of the matting that won't be cut out for the oval has glue and Aluminum foil attached securely.
You should end up with a piece of glass that looks reflective from the back, but from the front it will be a smooth white, with no light coming through at all.
Cut Out the Oval
Let your glue stick dry for a while (I gave mine about 2 hours), so that the Aluminum foil is well secured. Grab your printout of the plain oval, and carefully cut out along the line. You'll be using both pieces of the oval paper outline, so try not to destroy anything during the cutting process.
Take the outer edge piece, and set it aside. Use the oval to layout where you'll cut your matting. Align it so that the border is an equal distance from each edge, and decide which end will be the top. Mine ended up being about forty-something millimeters from the top and bottom, and something else from the edges.
Once it's in place, trace it out onto the foil using a permanent marker. Then carefully cut along the traced line with a sharp blade - a utility knife with a fresh edge works well. You want to go through both the foil and the matte - if it's tearing the foil, your blade isn't quite sharp enough.
Get the full oval cut, then use the blade of your knife to lift one edge of the shelf liner and foil. Peel back the liner, and make sure that it doesn't tear into the matte that you're leaving on the glass. Take your time, and do your best to keep any glue from getting onto the back side of the newly-exposed glass.
Once this is all done, take a look at your glass from the front. You should have a nice smooth single-colour matte, and behind it is a hidden layer of Aluminum foil that will block all light from creeping through, except in the oval where we want it.
Build the Backing
Now that we've got our glass matted and ready, we need to add the sheet protector which will be holding our papers, the ring of lights, and keeping everything together.
Slide the exterior of the oval (the paper with the big hole in the middle) into the sheet protector, with the top of the paper at the top of the sheet protector. Now align the cutout holes, and throw some tape on the edges of the sheet protector to adhere it to the backing. It's really important to avoid taping anywhere along the top edge where you'll be sliding paper in and out.
Now you've got a base to glue your edging to, so we'll need to make some edging. I cut out strips of card stock about 1cm thick - use the depth of your frame as a guide to how wide you want the border - it should sandwich nicely between the glass and the back panel.
Glue the strips together to get a long single band. I went with three, but could probably have gotten away with two. Once you've got the single long strip, use your hot glue gun to glue it around the edge of the oval opening so that it covers it - a little wider is also fine. Start at the bottom, and work your way around, but don't join the two edges yet - we'll do that once we've got the LED strip in place.
Attach the LEDs
I haven't had the best of luck with the adhesive on the back of my LED strips, so I used some hot glue to keep things in place. If you're happy with the double-sided adhesive that comes on your tape, then just go with that.
Solder a couple of power wires to the positive and ground terminals of your LED tape. Length isn't critical at this point, so just go with long (I used about a foot of length here). Starting at the opening in the edge card stock that we glued in an oval shape, adhere the LED strip to the edging using your favourite adhesive. Once you've made it all the way around, cut off the excess LED strip (you'll probably need about a foot and a half in total).
Wire Up the Circuit
Start on a breadboard, and check that the circuit works before soldering it together. You can use perf board if you want, but I just wired everything together directly off the Arduino's pins, since the circuit is really simple.
Since the pins on the Arduino can't supply a ton of current, and let's be honest, everyone wants a ton of current, we'll use a basic NPN transistor to switch the load (i.e. the LEDs) on and off. You can use a 2N3904, but that's limited to only 200 mA of current (although it did happen to be the only NPN transistor in the library I was using to generate this schematic).
A better choice would be a PN2222, since they're capable of delivering a whopping 1 ampere, which is more than enough current. Slap a 10k resistor between pin A3 and the base of the transistor (so you don't draw more current than the microcontroller can deliver), wire the emitter to ground, and put the LED strip in series between +12V and the collector.
Now for the ultrasonic detector. I used a cheap HC-04 from eBay, which has both a signal and echo pin. There are some other ones out there with just a signal pin, and I'm not 100% sure how they work, but they should be simple enough to connect. You'll connect the ECHO pin of the HC-04 directly to D7, and the TRIG pin to D8. I used a 4 pin header with about 8" of ribbon cable (although I'd recommend leaving more), with 5V, TRIG, ECHO, and GND. This lets me disconnect the HC-04 and have the frame look somewhat normal. I may end up building a lamp-style light fixture onto this frame in the future, and I'll hide the sensor in the lamp unit, so having it be easy to disconnect really is handy.
I created a layout in Autodesk Circuits.io, but came across a couple of limitations I'm not fond of. First, I can't use a custom component in a breadboard or schematic layout, so I had to use the 3 pin ultrasonic sensor in place of the HC-SR04, and it's highly likely that the circuit as shown won't work properly. Secondly, I can't embed it here, which was a bit of a surprise, considering Autodesk's and Instructables' close relationship (hopefully they'll fix that soon). For now, you can check out the guaranteed not to work circuit at https://circuits.io/circuits/2750320-haunted-port...
Attach the +12V source to the RAW pin on the Arduino, connect all the grounds, and you're done. The circuit really is that simple, I promise.
Code
The code is really simple. Basically, the distance detector looks for something within 1 meter of it, and converts the distance to a PWM value to send to the LED strip. If the distance doesn't change, the LED illumination will gradually decay until they turn off, or until it reads a new value. If you get within 10 cm of the sensor, they come on full brightness.
The nice thing about low-cost hardware from China is that they don't always get everything working exactly as you'd expect. That means that the distance sensor will sometimes pick up a false reading. Sounds bad, but when you shut off all the lights at night and all of a sudden Darwin's ghost creeps at you, you'll laugh and thank lousy quality control for giving you such a spooky effect inadvertently.
You can see the full source code on Arduino Create here.
/** Sadly, CodeBender is shutting down. Maybe try Arduino Create for a cloud-based solution. **/
If you haven't tried CodeBender before, and you work on more than a single machine, you really ought to give it a whirl. Really great platform for cloud coding, and lets you share code really quickly and easily. In fact, if you go through their 5 step setup guide (which takes about 20 seconds), you'll be able to program your Arduino using this sketch right from within this Instructable.
I don't work for CodeBender, I promise, but I really dig what they're doing.
Tidy It Up
Now you can cut reliefs into the frame to accommodate a 12V barrel jack and a 4 pin header for the HC-04. I put the power lead on the bottom, where it's not particularly well-hidden, but if you've got a better place you can stash it, go right ahead.
Stick everything in place with hot glue, close up the back, then stand back and admire your handiwork. Turn off the lights, stand in front of the portrait as still as you can, and watch the effect. It's really quite cool.
If you build one, please post a comment, share any changes you make to the images or code, and creep the heck out of small children and the elderly. Or just your friends.
Then, after Halloween, just un-plug the power supply and hang your beautiful (okay, maybe I'm being generous here) photo and enjoy.