In this project you will build a powerful wireless switch sensor that is capable of transmitting on/off readings from up to two tactile switches over long distances to your Raspberry Pi. This product is based on Texas Instruments CC1110 wireless transceiver which sports a micro-controller unit (MCU), memory, a sub-1GHz transceiver, an encryption engine and a USB controller (for the CC1111 based module). The product is very easy to use and transmits clear text on/off messages that can be received by your Raspberry Pi serial port via a Base Station Receiver unit.
This sensor comes with a reed switch commonly used in alarm systems for doors and windows, but it can also be used with any switch that opens/closes the circuit. It can also be used with a water sensor.
This is our second generation wireless switch sensor which has a number of advantages over generation 1:
It has all the same features as generation 1:
All of the following parts are available in our store in a single kit.
The wireless sensor will transmit on/off signals for both Button A and Button B each time either of the switches are switched.
From December 28 2015 we will ship devices with firmware that only support one switch (Button A). The reason for this is the battery lifetime on the single switch firmware is significantly better than the two switch.You can, however request the two button firmware when purchasing a wireless switch from us. You can also download the two switch firmware yourself.
The signals are received by the base station receiver. The transmitter is optimized for extremely low current consumption and battery life will depend on how many transmissions the device makes. The RF units are very powerful and should easily handle communications distances around a residential home. The transmitters come pre-configured with a unique number identifier that will be used to uniquely identify each sensor. You can find this number using the rfthermtest.pt utility described in the software section of this tutorial. This enables you to have as many wireless switch sensors as you want.
The Python code required to read the switch messages from the serial communications port of the Raspberry Pi is provided by us. We also provide the code to send the switch values 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.
The following explains how to construct the wireless switch.
Construction should take about 20 mins and does not involve complex soldering procedures. Before soldering parts to the sensor make sure you have the correct part placed in the correct position as shown in each of the following images.Solder each part as close to the sensor as possible so you don't have any parts that are protruding and could prevent the sensor front fitting snugly into the case.
Solder each part as shown and clip off the remaining wire on the underside of the board with some wire clippers.
Ignore the temperature sensor seen in the images below next to the "Tmp" label on the blue board. We've re-used the same pictures as the build is the same as the wireless temperature sensor.
Step 1: Solder the 1M
Step 2: Solder the capacitor to the sensor
Step 4: Solder the antennae to the sensor
Step 5: Solder the battery holder to the sensor
Cover the pad shown below on the left hand side in the red circle with solder. This will ensure good contact is made between the negative surface of the battery and the holder. Then solder the holder to the sensor as shown on the right hand side below. Make sure you heat up the pad with the soldering iron for a few seconds before applying solder. This will help make a solid bond between the sensor pad and the holder. Use a considerable amount of solder that covers the whole pad and each leg of the holder. Pull the holder gently with your fingers to make sure it has good contact. If it pops off then re-solder it and repeat the exercise again until it is strongly attached.
Step 6: Insert the battery
Insert the CR2032 battery taking care to insert it the right way round. +VE terminal (the larger flat surface) facing up.
Step 7: Connect the switch
Thread the two wires of the reed switch through the two holes in the case and then solder each wire end to the BtnA labelled pads. You can also wire Button B in the same fashion if you require two switches (however you will need to drill a larger hole to allow for four wires through the casing).
Before threading the antennae through its hole in the casing gently press the sensor into the casing. It is designed to be a tight fit so that the sensor does not rattle around in the case. You may need to use some gentle force to get it into the case. If you need to get the sensor out of the case at a later time you can use a screw driver or long nose pliers to lever it out of the casing.
Now thread the antennae wire through the its hole in the casing as shown below on the left hand side.
Step 7 : Close the case
Fasten the base of the case using the two screws that came with your kit as shown below (this picture was re-sued from the wireless temperature sensor build so it does not show the reed switch.
Step 8: Install the device in your environment.
This step will vary depending on the door or window you intend to use it on, but the image below will give you an idea of how to install it on a door frame. We've drilled a hole through the door frame for the wire to go through which made it more aesthetic, but did make the build more complicated because we had to solder the switch to the sensor after threading the wire through the hole. You could alternately have the wire on the outside of the door frame.
You could also extend the length of the wire and hide the sensor somewhere less visible.
Use 2 sided tape to stick the sensor to a surface.
That's it! Now you are ready to configure your Raspberry Pi to receive the on/off messages. Follow the steps outlined on our wireless sensor page.