Actions

Difference between revisions of "Cheapest ever 433 Mhz transceiver for PCs"

From Just in Time

(Created page with "Several shops offer cheap 433Mhz RF remote controlled switches. These are nice, but they introduce a few problems as well: * The cheap ones all have different remote controls,...")
 
Line 31: Line 31:
 
What I typically do is use Audacity to record keystrokes on the remote. This will normally record a few repetitions of the same sequence. Playing back such a sequence only once does not work in the average case, so I normally try to find the minimum amount of repetitions that reproduce the switching behaviour and save those repetitions in a single wav-file. I can then use a command line tool such as ''aplay'' (I'm on Linux) to play that wav file to the transmitter.
 
What I typically do is use Audacity to record keystrokes on the remote. This will normally record a few repetitions of the same sequence. Playing back such a sequence only once does not work in the average case, so I normally try to find the minimum amount of repetitions that reproduce the switching behaviour and save those repetitions in a single wav-file. I can then use a command line tool such as ''aplay'' (I'm on Linux) to play that wav file to the transmitter.
  
Fun project: The script below—when run in the background—will switch off a light when my screen saver locks the screen and it will switch it on when I log in again. The light is a halogen spot that lights up the wall behind my monitor...
+
Fun project: The script below—when run in the background—will switch off a light when my Ubuntu (gnome) screen saver locks the screen and it will switch it on when I log in again. The light is a halogen spot that lights up the wall behind my monitor...
 
<source lang='bash'>
 
<source lang='bash'>
 
dbus-monitor --session "type='signal',interface='org.gnome.ScreenSaver'" | (  
 
dbus-monitor --session "type='signal',interface='org.gnome.ScreenSaver'" | (  

Revision as of 01:37, 30 December 2012

Several shops offer cheap 433Mhz RF remote controlled switches. These are nice, but they introduce a few problems as well:

  • The cheap ones all have different remote controls, using different protocols;
  • We want to control our light switches from our PC, not from the remote controls.

What if you could use a PC to transmit all the RF signals to switch on- and off all devices, and have that PC learn the signals from the remotes? As it turns out, this is very easy to do. Most of these remote control devices use a digital serial protocol of about 1Kbaud superimposed on the 433 Mhz signal. That 1Kbaud falls well within the range of what a PC sound card can generate or sample. Furthermore, receivers that extract the digital signal and transmitters that turn the digitial signals into an RF signal are readily available.

Hardware

In short, for hardware parts, all we needed was a 433Mhz transmitter/receiver pair and a usb audio-"card" (links are to ebay search results). All in all, this is less than €3,- in materials.

Next: some soldering. The result will surely not win any beauty contests and may constitute criminally inhumane treatment of innocent electronics (AKA 'CITIE', AKA 'hack'):

Transceiver433 cropped.jpg

The wiring is as follows for the transmitter (see this page for terminology):

  • GND is connected to the sleeve contact on the socket.
  • data is connecte to the tip contact (left audio channel)
  • Vcc to USB 5V, the red wire in the picture.

For the receiver:

  • GND to sleeve
  • Vcc to USB 5V, red wire
  • RxD to tip (for mechanical stability only) and to a bypass (orange wire).

The RxD connection takes some explanation. These USB sound card have a mic input connector, which normally routes the signal throug a high pass filter. Since we want the 'raw' data from the receiver without filtereing, we need to bypass that filter. Again, this is not too difficult: we needed to find the capacitor that constitutes this filter and bypass it. The capacitor in question is found with a volt meter by looking for a capacitor that is directly connected to the input (the tip contact). This is the capacitor we need to bypass, and in this particular case I've done it by soldering a wire from the tip connector to the other side of the capacitor.

Software

To be described in more detail.

The summary is that after connecting our Frankensteinian contraption, our PC will have another audio 'card'. This card is recognized (in Windows and in Linux) and can be used with a program such as Audacity to record signals from remotes and play them back to the transmitter.

What I typically do is use Audacity to record keystrokes on the remote. This will normally record a few repetitions of the same sequence. Playing back such a sequence only once does not work in the average case, so I normally try to find the minimum amount of repetitions that reproduce the switching behaviour and save those repetitions in a single wav-file. I can then use a command line tool such as aplay (I'm on Linux) to play that wav file to the transmitter.

Fun project: The script below—when run in the background—will switch off a light when my Ubuntu (gnome) screen saver locks the screen and it will switch it on when I log in again. The light is a halogen spot that lights up the wall behind my monitor... <source lang='bash'> dbus-monitor --session "type='signal',interface='org.gnome.ScreenSaver'" | ( while true; do read X; if echo $X | grep "boolean true" &> /dev/null; then aplay -D plughw:2,0 offC.wav; elif echo $X | grep "boolean false" &> /dev/null; then aplay -D plughw:2,0 onC.wav; fi done ) </source>