Introduction: Zombie Detector
When I was going to college I worked at Knott’s Berry Farm and when Halloween fell on a weekend we drew a big crowd. We all dressed up and had some fun with it and most of the customers appreciated the effort. One of the “coin girls” where I worked came perfectly styled as Morticia Addams. Back then the Goth look hadn’t been invented (unless you counted Moona Lisa) so on her way to work she got an exaggerated eye-roll from a guy in the car next to her at a stop light. She stared back at him and gave him a big smile – fangs and all. Apparently the look on his face was priceless.
In the same spirit I thought about saving this post until sometime around Halloween but then I remembered that the Zombie Apocalypse could happen at any time. When I showed this to the grandkids I told them that it detects their pulse if they are alive but no pulse meant that they were a Zombie. It can be used as an elimination game (kind of a weird version of musical chairs) if you have a crowd. One way we played it was to pass it around the table. If you got a “human” response you got a coin, if not you paid a coin. The kids always like games that involve coins.
Step 1: Hardware
The schematic is shown in the diagram included above. The “detector” part is a simple capacitive touch switch commonly advertised as a TTP223. I picked up a set of 10 for next to nothing but there is a bit of an issue with them. The modules are advertised as working from 2.5 volts to 5 volts but they do not. What I found was that anything less than 4.75 volts caused the module to latch in the “On” state. I wanted to run the entire project using a pair of AAA batteries (about 3 volts) so I had to figure out the problem. After checking out the chip on the module I determined that the blank pair of solder pads is supposed to have a capacitor that determines the sensitivity. The recommended range is from 0 to 50pf with the sensitivity increasing as the capacitance is reduced. I could not get it to work by shorting the pads (0pf) but it worked well with 22pf and 47pf capacitors that I have. With the 22pf value I easily got the module to work at 2.5 volts.
The other main component of this project (other than the PIC microcontroller) is an 8x8 LED matrix. Originally I used a plain matrix but had to add a pair of shift registers to address the rows and columns and had to multiplex them to get a complete display. I then discovered an inexpensive LED module that came attached to a circuit board with a MAX7219 LED display driver chip. The driver chip accepts serial commands which it then uses to turn on the desired rows and columns. The chip also does the multiplexing automatically so that burden is removed from the microcontroller. That discovery reduced both the hardware and the software complexity.
Step 2: Project Box
I wanted a translucent red filter to cover the LED matrix. I could have cut a piece from some red Plexiglas I have and then glued it into a project box but chose to do a bit of re-purposing instead. The box I built it in is a container that once held a bunch of .22 bullets. Most of these containers are clear plastic but I have a couple that are red. Not too elegant but the grandkids don’t care about elegant.
Step 3: Software
The software is pretty simple. Timer0 is allowed to free run and the value is checked whenever the touch sensor is detected. I arbitrarily decided that the Zombie display would come up if the Timer0 count is less than 100. Given that Timer0 is 8-bits, that means that the “human” display will happen for values from 100-255. That’s a ratio of about 3:2 and can be easily changed in the software.
When a touch is detected and a display type determined, the appropriate routine is called to send data to the LED matrix. To do this, a series of commands are sent as 8-bits address and 8-bits data. The registers that may be addressed are defined in the front part of the listing. A couple of them are used to initialize the matrix (e.g.: brightness) and one is used to turn the entire matrix on/off. The matrix can operate in a mode where BCD (binary coded decimal) will display the appropriate number. The Init routine turns that off so that we can control the individual LEDs. The other part of the initialization is to set the column limit. We want all eight columns so the scan limit is set to 7.
There are eight registers that are used to enable the desired individual LEDs – one register for each column. A “1” in a data bit will enable that column LED. As mentioned earlier, no multiplexing is required in the software. The “human” display is a beating heart. After the proper bit patterns are sent to the matrix, the beating is simulated by simply turning the matrix on/off (with delays in between) for as long as the touch sensor is active. The Zombie routine displays a fixed “X” pattern until the touch is removed.
That’s it for this post. Check out my other electronics projects at: www.boomerrules.wordpress.com