Introduction: Piecax the Poltergeist. a Troublesome Spirit in a Box.

Picture of Piecax the Poltergeist.  a Troublesome Spirit in a Box.

* { } * { } * { } * { }

Poltergeist : From the German for “noisy ghost”.
A metaphysical entity which announces its presence with rapping, banging and general mischief making.

It wasn’t easy, but I’ve got one shut up in this box. I call him Piecax. Sometimes he will lie quietly and make you think he’s gone, then startle you with frenzied knocking. Other times Piecax will have fun by echoing you. Find his favourite number and he might play you a spooky tune. Watch the video to see Piecax in action.

Thanks and credit go to JKestner whose Knock Block gave me the inspiration for this project.

Step 1: The Box

Picture of The Box

I did this first so I wouldn’t be waiting for varnish to dry once I’d built the circuitry.

I started with a cheap softwood box from a craft shop.  I clamped a rotary sander upside-down in a vice and rounded the corners and smoothed the sides, starting with a coarse sanding sheet and finishing off with fine.  A final rub over with very fine paper and I had a smooth rounded box but a bit of a boring colour.

To bring out the grain I gave it two coats of walnut woodstain  and then for the gloss, three coats of yacht varnish.  The first coat was diluted with thinners to make it soak into the wood and give it more hardness and a good base for the other coats.

A quick raid on my sons' lego sets and I had a casket fit for a ghost.

Step 2: The Electronics

Picture of The Electronics

*  This section has gone missing.   *
*  I'll re-write when I get a chance.  *

Step 3: The Mechanics

Picture of The Mechanics

The various parts are stuck on with contact adhesive (that’s the type where you apply a thin coat to both surfaces, wait a few minutes, then it sticks hard immediately you put the parts together.)  The sounder is glued to the lid so it picks up the vibrations directly as the top is tapped.

For the ‘knocker’ I used a small 3V DC motor with a piece of brass strip bent fixed to the shaft.  I bent this to shape with a pair of pliers so it was a push-fit onto the shaft.   Be careful as you push it on as the plastic back of the motor is likely to push out, so put a hard object on the end and push against that.

The motor came with a solar cell kit and had the plastic clip with it.  Alternatively you could use a piece of split overflow pipe with one side sanded down, or use double-sided sticky foam to attach the motor to the box.  Later on, I added solder to the end to give a good solid knock.  A bit of trial and error is required to give the best weight.

Step 4: Putting the Ghost in the Box.

Picture of Putting the Ghost in the Box.

With the box size I used, everything goes in pretty easily and neatly. You will need to adapt the layout if you use a different size or shape of box.

The battery is held in with double-sided sticky foam so it can be replaced.  The circuit board in held in the same way, and has to go in before the motor if you're using a small box.

Gluing a small piece of brass strip to the lid where the knocker hits gives a sharper knock and helps the knocker to return quickly.  The final picture shows a piece of foam glued in to dampen the 'clunk' when the arm returns.

Click HERE for information about the standard training video for containment of supernatural beings.

Step 5: The PicAxe and Code

Picture of The PicAxe and Code

The code is here as a PicAxe .BAS file and as a Word document.  There are loads of comments throughout to explain what's going on in the program.  It uses 252 memory bytes of the 256 available.

20 knocks will give a 30 second sleep and then a series of 50 rapid random knocks; Long enough to put the box down in front of someone and tell them the spooky story of what it contains before it bursts into life.
13 knocks will play a tune which strikes fear and horror into the hearts of many - the 'Adams Family' theme tune.

I've used a PicAxe 08M microcontroller which comes as a blank chip and needs to be programmed. To do this, you will need a programming lead and the free programming editor software. Both the PicAxe chip and the lead are available from Tech Supplies in the UK or see HERE for other countries.
Once you have the lead, you only need a PicAxe, two resistors and whatever sensors and output devices you choose to have a full PicAxe development kit which can program any of the PicAxe range, so you can design your own projects.

The PicAxe was initially developed for the educational market in UK schools but is being widely used by hobbyists. The PicAxe is based on various PICs but with bootstrap code to interpret the downloaded programs and handle the programming side. They come in all flavours from this suprisingly powerful 8 pin package up to full blown 40 pin.
Look at the manuals and datasheets on the PicAxe site to see the full capabilities. Programming of the chip is via a serial link and done in-circuit. It takes about 20 seconds and you don't even have to unplug the lead to run the program.
I've been in electronics since the early eighties and I've never found a programming environment where the coding / simulation / proving cycle is so simple. Documentation and support from the forum is excellent and there are many robotics enthusiasts using the chips. Control for servos, steppers, ADCs etc are built in to the BASIC-like programming language as well as a host of other goodies. You can also simulate the circuit before you build, and do real-time debugging on a running controller. Look out for more PicAxe based projects from me.


pbecker83 (author)2010-10-31

Finally got around to building my own called "Terminal" The Haunted Mummy. Awesome build Andygadget. Love it.



EdmilsonL (author)pbecker832016-11-11

Hello please send me source code for Terminal" The Haunted Mummy send for my email thanks

AndyGadget (author)pbecker832010-11-01

A like the solid thump and really good vibration you've got with yours.
Are you using a motor or a solenoid for the knocker?
(And ta for the mention at the end #;¬)

beme2013 (author)2013-09-13

Hilarious! Love it :D

madbutler (author)2011-10-29

Hi Andy how is your scope coming along. Have you had a look at Admiral Aaron Ravensdales instructable? I have just spoted it/ His uses 2 piezo sounders, put still uses one like you did as a mic. Do you think there is a change in the 08m2's programing language that has an issue with changing it back to an output as he used a second piezo to play the sound while his code is very similar? I still would love to get this going with one piezo to cut the cost down so students can make this awesome instructable

Thanks again for this great project

ps Are you working on any other 08m2 inventions using this great new chip with touch capabilities and a bigger memory?

Here is my version with the latest PicAxe 08M2 Chip.
Thanks for your instruction AndyGadget...
I do some changes in the speaker / microphone section and add a flash signal durin knock!

Admiral Aaron Ravensdale

jessyratfink (author)2011-09-01

This is fantastic! I don't know how I missed this one.

AndyGadget (author)jessyratfink2011-09-01

Thanks Jessy.  It needs updating as the parts list appears to have disappeared at some point and there's a problem when using  the latest version of the microcontroller, but I'm on it.

Hi I just finished my version of your poltergeist and use the 08m2 chip. I change the code a little and use a single microphone and a speaker. I also add a flash with works with the knock.
I hope i found until next week some time to post it here. But you can see it still on my website pls change into english language!


Can I possibly get the code and diagram for the change made to get this going with the 08m2 chip.

Here is my version with the latest PicAxe 08M2 Chip.
Thanks for your instruction AndyGadget...

botronics (author)2011-10-23

I built a box "Don't Open Till Doomsday" based on the Outer Limits episode with the same name.I shorten the program just to do the knocking and change the port I/O.  Added a opamp to boost the signal from the piezo.  Works very well. Thanks for sharing. I still need to make "the creature" that lives inside using Sculpey III. Photos at this link.

madbutler (author)2011-08-08

Does anyone know how to get this going with the new 08m2 chip, I have changed the names to c.4 etc and mic input but it does not work nothing happens? I have students that love making the knock box at my school but new chips wont work.

AndyGadget (author)madbutler2011-08-08

It shouldn't be a problem - I thought the PE accepted the old pin syntax for the 08m2 as well as the new and the old code should have worked as well as your version.  I'm off to work now but will swap mine for a 08m2 later and investigate.
It's great that you're using this as a school trainer.  That's what the PicAxe was primarily for.

madbutler (author)AndyGadget2011-08-09

It does program the chip with the old code but the piezo does not respond. I changed the pin names and the input further down the code and does the same thing. I also tried it in second knock box with a bs270 mosfet and the mosfet got extremely hot you could smell it cooking, yet changing it back to the old chip it worked fine. Dont know if this information helps you with any problem solving. Thanks for your time

AndyGadget (author)madbutler2011-08-09

Thanks for the extra information.
What you describe is very strange.  I'll definitely look into it.  
I didn't get a chance to try this tonight - Should do tomorrow though.

AndyGadget (author)AndyGadget2011-08-11

I spent some time on this tonight and there is something strangely different with the 08m2.  I didn't get the transistor heating you were seeing, but I couldn't get it to respond to the piezo knocks.  If I manually took the input high it would only produce one knock no matter how many times I triggered it.  I'll continue at the weekend.  (Maybe it's haunted #;¬)

madbutler (author)AndyGadget2011-08-11

Thanks for the time you are spending on this. I have been looking at different things. I added an led to the piezo and it flashes when the piezo is tapped each time, so it seems to pick up the knocks, but not record them. I dont know too much about programming but is the memory allocation different on the m2 chips and the m2 information notes mention some command replacements but I cannot see any in the script that needs changed. It also mentions peek commands but this means nothing to me (yet)

thanks again

AndyGadget (author)madbutler2011-08-11

The 08m2 has more memory for peek and poke, but the addresses I used in the original are part of that, so not the problem.  The weird thing is that it's not recording the knocks.  I can see the input on my 'scope (as you're doing with the LED) and the levels are there.  I'll get it sorted at the weekend - It's one of those annoying things which should work . . . but isn't.

AndyGadget (author)AndyGadget2011-08-14

It looks as though the PIC the 08m2 is based on is a bit fussier when it comes to it's inputs (although the levels I'm seeing with a 'scope should be triggering it). A bit of signal conditioning is needed to get this working again, rather than the 'it works so I'll leave it as it is' approach I used initially. The code timings are also different between the 08m and 08m2 so the loops need adjusting. I'm working on this.

A bit of tidying up in in order though.
Add the lines :-
LOW Knock
immediately after the declarations section, at the top of the man code.
This will sort your FET heating problem and also grounds a pin which was floating as an input before. It would have overflowed the memory on the 08m. Also tie physical pin 4 (I3) of the chip to ground. 
(The 'LOW knock' is a quick fix.  The gate should really be pulled down via 1K or so to keep the FET turned off when the pin is an input.)

I'll let you know when I've sorted it.

madbutler (author)AndyGadget2011-08-14

I have been experimenting I added a readadc on the pin and assigned it to b9 and changed the mic to b9 to see if it would play something back. it does but irrigular to taps given to the piezo. Reading through the manual the 08m2 has a calibadc where the variable receives the adc reading i dont know if this can be used instead to read the mic pulses as it does on the readadc. There is also a Count pulses on an input pin command but I guess this would just count them and not give the same rhythm back. You are such a knowledgable chap this info is probably miles off track.

AndyGadget (author)madbutler2011-08-14

Readadc may be the way to go, but I'm still trying to work out why the existing code isn't detecting the good high level on the input pin.  I had a setback today when my 'scope started fizzing and the display collapsed - EHT breakdown, which it occasionally does on humid days. 
I'm away for a couple of days but will pick this up on Wednesday - It's bugging me!

madbutler (author)AndyGadget2011-08-25

Just wondering if you got back to looking at this? I don't blame you if you put this in the too hard basket. Its been bugging me too.

With my limited electronic knowledge I added a transistor to boost the signal, but this made it over sensitive (recorded knocks and every other vibration) and then you cant play it back through the piezo. Tried even a capacitor with similar luck. It seems it needs just a little stronger signal but my lack of knowledge to do this lets me down.

AndyGadget (author)madbutler2011-08-26

I intend to get to the bottom of this as I can see no reason it shouldn't work, but my problem at the mo is that my 'scope made a final "fzzzzzt POP!" the other day.  I'll definitely let you know once I've got this sorted and found a fix.

mischka (author)2011-05-24

LOL, you made my day, boy!

project dude (author)2011-05-18

Love the project! Just wondering if you have a supplies list or something like that so i know what to get. Thanks.

AndyGadget (author)project dude2011-05-18

Now that is strange - I'm sure that step 2 used to have a whole chunk of text including notes on the electronics and a parts list.  It looks like the Instructables editor may have eaten it.  (Strange things have been happening with the recent 'upgrades'.)
Closest thing is the graphic or PDF of the schematic in step 2.  The piezo is just a standard disc type.  The motor is a cheap 3V one (although I found this started to stick after a while so it's been replaced with a solenoid).  The FET is any logic-level switching N channel enhancement MOSFET.
All the Picaxe stuff is explained in step 5.

project dude (author)AndyGadget2011-05-18

Thanks a bunch for the reply! I viewed this before and I seem to remember a parts list, but i couldn't remember what was on it. Thanks for the reply. :)

stringstretcher (author)2011-03-20

I need one of these! Love the idea, and you have explained it very well. Thank you! Can you program a "call and response?" In other words, can the box answer your "Shave and a haircut" knock with "two bits?" I have never tried programming a microprocessor like this. Oh boy, a new hobby!

Thanks for the nice words.
There's 4 bytes of program space left so no room for more features without sacrificing existing ones.  You could very easily replace either the random knocking or the "spooky tune" with a "Two Bits" response for 5 knocks by changing just a couple of lines of code.
Have a look back through the other comments for how some others have implemented this idea.
The PicAxe is one of the easiest microcontrollers to get into. It's not as fast as the AVR or Arduino gang, but it's got an excellent programming environment and great support from the main forum.  I'm using the simplest one here but the range goes up to a 40 pin one which runs at 64MHz.

Tedfi (author)2011-01-23

I would like to go to Michaels and look for the box. Does anyone know what size this one is?

AndyGadget (author)Tedfi2011-01-23

The box is 23/8 x 21/4 x 37/8 (HxWxL) outside dimensions.
Take 1/2" off each for internal.
Go bigger by all means, but smaller would be tricky.

Mine came from a UK store called Hobbycraft (and they don't stock them anymore), but I'm sure you can find similar in the US.

Tedfi (author)AndyGadget2011-03-11

Dear AndyGadget,

My friend is helping me build this but neither of us can program in basic. What do we do now? Is there a way around it?


AndyGadget (author)Tedfi2011-03-12

You do not have to do any programming as I have included the code (program) in the Instructable - Piecax.bas. What you DO need is the programming lead and a PicAxe 08m which I refer to in the final step.

Tedfi (author)AndyGadget2011-03-12

Dear AndyGadget,

I gave him your reply and he says that he does not have a basic program to do the programming. He says that when he plugs the cable in he will need a program like basic. He does not understand and I am totally illiterate. What do I tell him... S O R R Y for being so stupid.

AndyGadget (author)Tedfi2011-03-13

It sounds like he's missing the Programming Editor - He can download it HERE. This will allow him to transfer the program to the device via the programming cable.

playfulplans (author)2011-03-05

Amazing. Period!

madbutler (author)2010-11-03

excellent project I have built this with a 8m chip and the kids love it.

Any idea about how to adapt this to an picaxe 18m2 chip as it has more memory to add more songs to different knocks etc and pins can be set to in/out. I know how to change knock amounts and tunes, but I do not know how to change the first part to get it working. Ive been experimenting on a breadboard with no luck. Any help would be appreciated.
I have set up:
pin 1 = pin 14
Pin 2 = pin 3
pin 3 = pin 10
Pin 5 = Pin 6
Pin 7 = Pin 2
Pin 9 = Pin 5


AndyGadget (author)madbutler2010-11-03

Hi Madbutler, I haven't had a chance to play with the 18M2 yet, but pin addressing is similar to the X2 range where you address a pin as (port).(pin), so chip pin 1 is C.2 - Refer to the pinout diagrams in manual 1. I/O pins will automatically be an input until you perform an output command on them. Also, make sure you don't get mixed up with physical pin numbers and the logical pin assignments (e.g. 08M chip pin 4 is Input3).

Sooo . . .  I haven't tested this but if you use the top 3 RHS pins on the chip, I think this would work :-

#picaxe 18m2              'Put at the top - Tells the prog. edit. which chip we're using

symbol mic = pinc.1    'Chip pin 18 - Microphone input (can also be output)
symbol knock = c.0     'Chip pin 17 - Knock motor output
symbol led = c.7          'Chip pin 16 - Indicator LED for testing
(further down)
input c.1                          'Define mic as input to detect knocks

madbutler (author)AndyGadget2010-11-03

Thanks for that info, im a few steps closer to getting it going but it does some weird things, like when i tap on the piezo sounder the light flashes and only if the led stays on the motor pulses twice and waits 4-5 seconds and pulses again and keeps doing this until i tap it again. I had a scan through the script and cant see anything there that might confuse the program.

by the way your instructables are really awsome, hope to see more cool things to do with the picaxe chips. i will be having a go at the tic tac instructable once i hunt down a slide resistor

pbecker83 (author)2010-11-02

I used a vibrating pager motor like the one seen here ( . I glued it to the bottom circuit board and let the hole thing lay free inside the casket. Looking forward to any future makes. Starting to eyeball your "TicTacTunes".


AndyGadget (author)pbecker832010-11-03

I didn't think of using a pager motor - Nice one!

project dude (author)2010-10-09

about how much did this project cost?

GASHLYCRUMBTINY (author)2010-09-02

First of all...............OMG OMG THAT IS SOOOOOO COOL!!!! xD do u think this is a project a 1st timer could do? I know how to solder n stuff, and can build a basic circuit..... Again! So COOL!!!!!!

Thanks ;¬)
This is ideal for a first timer as the circuit is so simple - Look at the circuit diagram.  It would be better for a beginner to make the circuit on a slightly larger board (and use a correspondingly bigger box) to get practice at laying out a board, but it is an easy one to do.
The PicAxe microcontroller I've used is an excellent way of getting into programming.   You would have to buy the programming cable for the PicAxe, but once you have it you can program any of the PicAxe range of chips.  Full details are in the last step.
Any problems, post here and I'll help.


One (or more) of these I have to have!

However... the Picaxe site seems to have two different 8 pin chips:


What is the difference between them, and which should I use?
Thanks in advance.

Those are part numbers for PICs, not PicAxes. Although the PicAxe is based on a PIC it also has boot code and an interpreter already burnt into it.
What you need will be called a PicAxe 08M.
(Which site are you using?)


Good choice - You're in the UK then.
What you need is the 08m chip from HERE.
You can get just about everything you need for the project from there - Don't forget the FET and, the piezo they sell should do the job (but slightly deeper than the one I used. 
If you bought the 08m proto-board, you might just be able to build the whole project around that.

Sorry about my silly questions, I'm a bit new to this. I've just realised that the two different types of 8 pin chips are because one has a music capability and the one you recommend is that one - because it is 08M! M for music! Should have known. D'oh!

About This Instructable




More by AndyGadget:Quick Clamp / Release ViceSimple Effective Mouse CatcherAuto-lock mod for smartphone case
Add instructable to: