Construct a wireless switch or motion sensor

Project Description

This project assumes you already have a Model A or B Raspberry Pi, power supply, HD card, screen, keyboard, network etc. Raspbian Wheezy OS.

In this project I will show you how to construct a wireless switch. This project can be adapted to suit any application where you need a wireless switch communicating to the Raspberry Pi. When the switch is closed or opened a wireless signal is sent to the wireless base station receiver. The transmitter can support two separate switches off the same RF transmitter. You can connect as many transmitters as you like.

What you need

The RF parts can be purchased from the PrivateEyePi Store

  • 1 or many Wireless switches (RF05) or Motion Sensor Kit (RF07)
  • 1 x Wireless sensor kit (RF04). This is a really nice kit that contains the PCB, coin cell battery battery and casing and plug in slot for the wireless switch transmitter


  • If you choose not to use the wireless sensor kit then you may want to consider using 2 x 2mm 10 pin (RF08) headers to plug into the RF sensors in order to avoid having to solder wires directly to the RF sensors. You will also need a 3V power source (e.g.2 x AA batteries), a 10k resistor and a 100uf capacitor.

How it works

The sensor will transmit a signal to the base station when the attached switch changes state (off/on). The transmitter is optimized for extremely low current consumption so that it is able to last over a year on a single set of batteries, or 1 coin cell if you are using the wireless sensor kit (RF04) . The RF units are very powerful and should easily handle communications distances around a residential home. The antennae of the transmitter can be adjusted for longer distances, or for greater strength to compensate for walls or other physical barriers. The transmitter comes pre-configured with a unique number identifier that will be used to uniquely identify the sensor. This enables you to have as many wireless sensors as you want. Each switch that is attached to the sensor is identified as Switch A and Switch B in the serial message received by the Raspberry Pi. The Python code required to read the the serial communications stream is provided. We also provide the code to send the sensor status value to the PrivateEyePi server to be displayed on your WWW dashboard; however this is not a mandatory part of this project. If you want a wireless switch sensor for other projects then these steps will help you achieve that goal too.


1. Construct a wireless switch using the wireless sensor case kit

Build the wireless sensor kit (RF04) and plug the RF transmitter (RF05) into it. 

The RF transmitter (RF05) looks exactly the same as the receiver units (RF01) so be careful not to mix them up. The packaging of the receivers and transmitters will be clearly marked so you know what is what. If you do mix them up them some trial and error testing should solve the problem. Plug the RF transmitter into the wireless sensor case kit (as shown above).

That's it! Now you are ready to install the software.

2. Construct a wireless switch using your own parts (see optional section under "what you need" above).

Construct the circuit shown in Figure 1 below.

As shown in the figures below the construction of the wireless switch is fairly easy. The tricky part is connecting wires to the pins of the RF unit as they are spaced very close together and do not plug into a breadboard. To make it easier I recommend you solder your wires to a 2mm 10 way header that plugs into the RF unit. This prevents you from having to solder directly to the RF transmitter.

Figure 1 shows the circuit diagram for transmitting a signal for a reed switch (door contact) or any other switch. Figure 1 also shows how you run 2 switches off one transmitter. This is useful if you have a door switch and a motion sensor in the same room (or a door switch and a window switch).

Figure 1 - Two switches attached to a wireless switch transmitter

3. Construct a wireless motion sensor

Figure 2 shows how to wire a PIR motion sensor to the RF transmitter. The PIR switch sends a signal to the transistor that triggers the closing of the switch circuit attached to the RF transmitter. After the PIR timeout period the switch is opened once more.

Here are some pictures of the wireless motion sensor: