Introduction: Pulsing Hubby Detector

This project uses an RF receiver module to trigger a pulsing LED Heart when the transmitter comes within range. I made this for my fiance for Valentine's Day this year.



I have yet to fully test the range, as I haven't actually taken the transmitter out of our apartment building since I just finished it today. The transmitter/receiver pair that I used is hypothetically capable of up to 500 feet, though that is the open space line of sight range. I haven't yet added antennas to either the receiver or transmitter box, but that should hypothetically improve the current range.

Attachments

Step 1: Tools and Supplies

Tools Needed:

Soldering Iron
Dremel
Drill (or fairly large drill bit for the Dremel)
Screwdriver

Supplies
2 LEDs (1 red for the heart, another any color for a power light for the transmitter)
Printed Circuit Board (I used 276-159 from RadioShack)
2 5v Voltage Regulators (7805 or similar)
2 9v batteries
2 9v battery clips
2 project boxes (I used 270-1803 for the receiver, and a small 3x2x1 or so box for the transmitter)
2 SPST switches (I used 275-645)
2 8 pin DIP sockets (I used 276-1995)
2 PIC 12f683 (you can get a few of these as a free sample from Microchip)
2 Resistors (value depends on the LEDs you use, somewhere around 100ohms for typical LEDs from the 5v regulated voltage)
A small piece of plastic (preferably cloudy, or translucent)
wire
and last but most importantly
RF transmitter and receiver (I used RF-KLP-434 from Sparkfun, which was 11.95 for the pair)

Step 2: Breadboard Testing

I set this up as a simple circuit on two breadboards (some people on the Sparkfun forums reported having problems getting the receiver/transmitter to work if they were only a few inches apart.)

The RF modules work fairly simply. You just provide them voltage (around 5v for the receiver, and up to 12v for the transmitter) and the signal on the transmitter's data pin is replicated on the receiver.

In my circuit the data pin on the transmitter is being driven by an output on the PIC. I intend to work more on the PIC program to provide an actual data protocol, but in order to actually get this done this weekend, the transmitter PIC currently just sends a high signal for 500ms, then goes low for 500ms, and repeats as long as it's switched on. There is an LED attached to the output pin to give a visual feedback of the pulse so you know the circuit is working.

The receiver is equally simple at present. The data pin goes to an input on the PIC. The PIC waits for a high signal, then pulses the LED as long as the signal is high. When the input signal is low, the PIC waits for 500ms, then polls the input again.

Here's the code for now: *NOTE* The actual loop to make the LED pulse was taken from an example on the Sparkfun forums by user cheesy and just modified to make it run slower

Transmitter:
#include<12F683.h>

#use delay(clock=4000000,int=4000000)
#use fast_io(A)
#fuses nomclr

void main()
{
set_tris_a(0);
while(1) {
output_high(pin_a4);
delay_ms(500);
output_low(pin_a4);
delay_ms(500);
}
}

Receiver:
#include<12F683.h>

#use delay(clock=4000000,int=4000000)
#use fast_io(A)
#fuses nomclr

void main()
{
unsigned int i, j, k, step;
set_tris_a(0);
while(1) {
while (input(pin_a3)) {
step = 1;
j = 0;
do
{
for(; j < 100 && j >= 0; j += step)
{
for (k = 0; k < 10; k++)
{
OUTPUT_HIGH(PIN_A1);
for (i = j; i != 0; i--);
OUTPUT_LOW(PIN_A1);
for (i = 100-j; i != 0; i--);
}
}
step *= -1;
j += step;
} while (j > 0);
}
delay_ms(500);
}
}

Step 3: Assembly (pt 1)

I assembled the transmitter circuit first. The connections are fairly simple.

The +9v lead from the battery goes to the switch, which goes to both the transmitter (to run it straight from 9v) and the 7805 voltage regulator. The regulated voltage goes to the PIC.

Pin 2 of the PIC goes to the the LED (via a limiting resistor) and the Data pin of the transmitter.

When the switch is flipped on, the LED begins to blink (every 1/2 second) and the transmitter begins transmitting.

I've left the antenna pin unconnected for now, but I may add an antenna.

Step 4: Assembly (part 2)

The receiver is a similar circuit.

The +9v goes to the switch, then to the voltage regulator. The regulated 5v goes to the PIC and the receiver. The data pin of the receiver goes to pin 4 of the PIC.

Pin 6 of the pic is connected to the LED (should be through a limiting resistor, which I forgot on the first go around, I'll have to add it in later.)

Step 5: Final Assembly

I drilled holes in the cases for the standoffs to hold the circuit boards, and in the sides of the boxes for the switches.

I used the Dremel to cut out a heart shape on the top of the receiver box.

The plastic I used to cover this was just a thin scrap from a package. I used some coarse sandpaper to scratch/distress the plastic so that it wasn't completely clear, and would diffuse the LED light a bit. I then glued this piece of plastic to the inside of the receiver lid. (the light looks better than it does in the pictures, it diffuses fairly well through the plastic)

Closed up all the boxes and tested it out.

Step 6: Testing and Future Directions

Right now I can get maybe 90-100 feet of range with the receiver sitting in my 2nd floor apartment. Since the antenna pins on both the receiver and transmitter aren't connected to anything, I may try to find some small antennas to attach to them to see how much I can increase the range.

I briefly considered just using a 555 timer to generate the transmitter pulse, but decided that since I intend to improve the PIC code it would be preferable to use the PIC in both the receiver and transmitter. (also, using the 555 timer would have required a couple more components to generate the pulse)

I want to implement a simple serial ping so that I can avoid the noise that occasionally randomly triggers the receiver with the current code since I'm just checking for a high input.

Attachments