Introduction: Virtual Hide-and-Seek Game

About: Old dog still learning new tricks.

Our grandkids love to play hide-and-seek but they don’t really have many good spots indoors. I decided to make a virtual hide-and-seek game so they could still have the fun of the hunt. In my version, one will hide an item with an RF receiver and another one will use an RF transmitter to hunt for it. The transmitter is almost identical to the one I described in an earlier Instructable except it only has one button. The RF receiver activates a small voice record/playback module like the one I used in my Slot Machine Instructable. The message I recorded says: “Here I am. Come find me, come find me.” There are a variety of ways to play the game, including seeing who can find the item using the fewest number of button pushes. Or, each kid can have 1 minute to try and find it. If they don’t find it then the next kid gets a minute, and so on.

Step 1: RXC6 RF Receiver

In my previous Instructables with RF receivers I used the RXB6 to convert the data to TTL format and a microcontroller to decode the incoming messages. The receiver in this project is an RXC6 module which does all of the decoding of the RF message so a microcontroller is not needed. In fact, part of the setup process is to specifically pair the transmitter with the receiver. Once paired, the module is capable of decoding up to four different keys from the same transmitter. We only need one output for this project but you may need to check all four outputs to determine which one is activated by the code you choose. The code in the software matches an existing remote I have and activates the D0 output.

The setup for the RXC6 module has a soldering part and a button pushing part. As you can see in the picture above, there are a couple of solder pads on the back of the boards. For this project we leave both pads open because we want just a momentary high pulse when the signal is received. The second mode latches one output high until the code for a different key is received. When that happens, the first output goes back low and the new output latches high. The third mode latches the matching output high the first time a key is pressed and toggles it back low the next time the same key is pressed.

There is also a small pushbutton on the front side of the module. To clear all transmitter pairings press and hold the button. The LED will come on after a few seconds. Continue to hold the button until the LED goes out. To pair a transmitter with the module press and hold the button until the LED comes on then release the button. After that, press any key on the transmitter. The LED on the module should blink a couple of times if the pairing works. Most common 433-MHz transmitters will work. The two pictured above are samples of ones I have successfully paired.

Step 2: Hardware

The transmitter runs on a coin battery (2032) so low power consumption is key. Most of that is accomplished in the software but it is helped by the fact that the ATtiny85 normally runs on the 1-MHz internal clock. The rule is that lower clock frequencies require less power and 1-MHz is perfect for the transmitter logic.

The actual RF transmitter module I like to use is an FS1000A that is commonly available. It comes in both 433-MHz and 315-MHz versions. The software doesn’t care which one you use, but you need to make sure that the receiver board operates at the same frequency. Most of my projects use 433-MHz devices because that is what is used by the various inexpensive wireless devices I have accumulated. The transmitter board layout shown in the picture fits nicely into an old pill bottle. It’s not pretty but good enough for what is needed.

The receiver is also built into an old pill bottle. The entire thing, including the rather large 18650 battery holder, is hot glued to a large wooden craft stick. The speaker for the sound module is just a surplus 8-ohm one (4-ohms would work too). Part of the bottom of the pill bottle is cut out to allow the sound to be heard well. The sound module is the inexpensive ISD1820. Because everything runs at the battery voltage, no regulators are needed and no voltage divider is needed between the RF module output and the sound module trigger input. As can be seen in the pictures, I added a small battery charger board so that I can use a standard USB phone cable to recharge the 18650 battery without removing it from the holder.

Both the transmitter and receiver modules work better with the proper antennas but they are often not supplied. You can buy them (get the correct frequency) or you can make your own. At 433-MHz, the right length is about 16 cm for a straight wire antenna. To make a coiled one, take about 16 cm of insulated, solid core wire and wrap it around something like a 5/32-inch drill bit shank in a single layer. Strip the insulation off of a short straight section at one end and connect it to your transmitter/receiver board. I’ve found that the wire from a scrap Ethernet cable works well for antennas.

Step 3: Software

The transmitter software is a slightly modified version of the ATtiny85 RF remote from an earlier Instructable. The only modifications are a slight change in the bit and sync times, a change in the three byte code that is transmitted, and the removal of the routines to handle three other keys.

The transmitter software uses common techniques to put the chip into sleep mode. In that mode it draws less than 0.2ua of current. The switch input (D1) has the internal pull-up resistor turned on but it doesn’t draw any current until a switch is pressed. The input is configured for interrupt-on-change (IOC). When the switch is pressed, an interrupt is generated and it forces the chip to wake up. The interrupt handler performs about 48msec of delay to allow the switch to debounce. A check is then made to verify that the switch was pressed and the switch handler routine is called. The transmitted message is repeated several times (I chose 5 times). This is typical of commercial transmitters because there is so much RF traffic on 433-MHz and 315-MHz out there. The repeated messages help to ensure that at least one gets through to the receiver. The sync and bit times are defined at the front of the transmitter software but the data bytes are embedded in the switch handler routine.