Go Down

Topic: Library for RF remote switches (Read 73049 times) previous topic - next topic


Here in the Netherlands several stores sell RF remote switches, so you can switch lights etc. using a RF remote control. These remotes operate at 433MHz.

A while ago, I made a simple library to be used in conjunction with the common 433MHz RF modules to simulate these remotes, and to use an Arduino board to switch my lights. The library can simulate various remotes sold here in the Netherlands. These remote all use the same principles, and vary only in timing and specific codes. The base class can easily be extended to accomodate other (similar) remotes.

I really have no idea if these kind of products sold elsewere use the same principles. Perhaps they operate at different frequencies (868MHz?), which might work well.

Download: http://randysimons.com/overige/browsable/433MHz/ArduinoRemoteSwitchLibrary.7z

Basic setup:

Some images of compatbile devices:

I also have a sketch to receive and decode these signals on the arduino, but this requires some extra hardware. (scheme, photo). However, some comments in this code is in Dutch...


Anyone know if this protocol would be compatible with wireless X10 modules?
A quick look indicates X10 also uses 433MHz.
"Data is not information, information is not knowledge, knowledge is not understanding, understanding is not wisdom."
~ Clifford Stoll


Its not at all clear to me what the protocol is, I wonder if fuzzilogic can say more about it.


Jul 15, 2008, 09:32 am Last Edit: Jul 15, 2008, 09:35 am by Fuzzillogic Reason: 1
Its not at all clear to me what the protocol is, I wonder if fuzzilogic can say more about it.

I don't know about wireless X10 (is it standardized?), but these remotes use chips like the LP801B,  HX2262, PT2262 and M3E. The datasheet of the PT2262 explains the underlaying protocol.


I am trying this library on the elro wireless home control system (sold at action and various diy stores)

The remotes of this system have a HX2262 chip inside, so I figured it should work. The elro remotes have 8 buttons labeled on and of for devices A-D. Remotes and switches have a 5 bit system address, switches have an additional 4 switches to select A,B,C or D

There are also dimmers available for this system. pressing either of the on or off buttons toggles the light. Long pressing the on button cycles the brightness.

The actionswitch class works reasonably for this system. For dimmers, sending on and off signals work as they should. I think the dimming cycle should also be accessible if i'd play with the repeat length.

The switches however only work halfway. Switching the light ON works when sending an OFF signal, switching the light of does not work.

Any ideas?



Thanks for Great Library.

I have a few RF Remote Relay Plugs and have managed to read and log the codes using the Show_received_code.pde.

The RX And TX Modules, Plugs and Remotes are all 433mhz AM

These are the Transmitted codes for the  Remote Control Switch 3-pack From Clas Ohson


A      1 ON      172771      325us

A      1 OFF      177145      325us

A      2 ON      175687      325us

A      2 OFF      175686      325us

A      3 ON      176659      325us

A      3 OFF      176658      325us

B      1 ON      408967      325us

B      1 OFF      408966      325us

B      2 ON      411883      325us

B      2 OFF      411882      325us

B      3 ON      412855      325us

B      3 OFF      412854      325us

C      1 ON      487699      325us

C      1 OFF      487698      325us

C      2 ON      490615      325us

C      2 OFF      490614      325us

C      3 ON      491587      325us

C      3 OFF      491586      325us

D      1 ON      513943      325us

D      1 OFF      513942      325us

D      2 ON      516859      325us

D      2 OFF      516858      325us

D      3 ON      517831      325us

D      3 OFF      517830      325us

How do I transmit this code for example?

172771    325us

Would I need the interrupts? a receiver wont be required..

Thanks In Advance



Fuzzyllogic, could you explain the use/meaning of device, address and system code in the examples below:

 //Switch off KaKu-device 10 on address M  kaKuSwitch.sendSignal('M',10,false);
 //Switch on Action-device B on system code 1.
 //Switch on Blokker-device 7.

I am trying with a remote switch of another make and I am completely lost as of how to modify the code.



Oct 23, 2010, 08:25 pm Last Edit: Oct 23, 2010, 08:37 pm by Fuzzillogic Reason: 1
@Morphor: I don't have a clue why it doesn't work. If you happen to have a second arduino, you could use show_received_code to verify that the arduino-synthesized code is identical to the real remote.
An digital oscilloscope or data logger is quite handy in this kind of situations, as you can monitor the actual inputs and outputs of the transmitter and receiver.

@DARRELL: have a look at the Retransmitter-example, which simply retransmits a (recognized) received code.

For transmission you don't need special interrupts, other than the one Arduino uses for delay(). But that one is standard anyway.

Relevant code sniplet, based on the example:

#include <RemoteSwitch.h>
unsigned long code;
code = receivedCode;
code |= (unsigned long)period << 23;
code |= 3L << 20;

This will transmit a signal on pin 11, where receivedCode and period are the values you've already found.

@Marlar:  "device", "address" etc are arbitrary terms used by the remotes themselves. They are all based on the PT2262-technique, and thus have 12 trits data words.
KaKu for example designates 4 trits for "group", and 4 trits for "device". But other marques use different trits, don't have groups at all or use the term "address".


The information in the start post is a bit outdated, but I can't edit it anymore. The current version 2.0 of the library (same link) is capable of receiving codes as well, with apart from the 433MHz-receiver no extra hardware at all! Included in the library are some examples and a photo of the (very easy) set-up.  :D


Hi Fuzzillogic.
that's interesing material.  Thanks for sharing.



Wich kind of modulation (ASK/OOK) should be used to interface with such remote controls?
My local electronic components dispenser only has ASK or OOK only emitters and receivers.

Thanks in advance.



Hi there, I'm a bit of a newbie to all of this, so I was wondering, do I need a separate 433MHz transmitter, or can I use the one from the remote? Also, on the Elro's I have, there's a jumper bit to encode your remote with a 5 on/off code so that you don't accidentally switch your neighbours lights off, if he has the same system. But I can't find this encoding bit anywhere in the code, so how will that work?


Thanks a lot
i added a post about my setup http://linux-utils.blogspot.com/2011/01/arduino-remote-control-outlet.html

Remote Control AVIDSEN

        ON           OFF
A      265353      265349
B      266325      266321
C      266649      266645
D      266757      266753
E      266793      266789

Go Up