Go Down

Topic: Remote controlled power sockets (Read 9954 times) previous topic - next topic


Can someone point me in the right direction please. I want to read, from the receiver in one of the sockets, the value of a binary signal which indicates which button has been pressed on the remote and  to print it on the serial monitor. The signal to be read is about 2.5v square wave and converts to various numbers according to which socket is being addressed. The marks are 1028microseconds long and the spaces 370 if my terminology is right.The signal is 29ms long. Arduino Uno.


Does it look like this?

- Starts with 1Time HIGH + 31Times LOW
- Followed by 32 Bits like this:
   3Times HIGH + 1Time LOW == 0
   1Time HIGH + 3Time LOW == 1
- Repeats as long as the button is pressed.

Then you can use the RCSwitch lib :)


That was fast. Thank you. Yes the waveform is exactly like that. I'm picking it up from an ic  KX002 pin 13. Just going to look at what I downloaded from the link.

I'll be back
Thanks again


Hi again,
On trying to upload to the board I get 'RC switch does not name a type' error message.
What am I doing wrong?


Sounds like you didn't include the lib in your sketch.

Code: [Select]

#include <RCSwitch.h>

Or it's not located at the right place. The files should be located like this:
Code: [Select]

(...path depending on your system...)/Arduino/libraries/RCSwitch/RCSwitch.cpp
(...path depending on your system...)/Arduino/libraries/RCSwitch/RCSwitch.h
(...path depending on your system...)/Arduino/libraries/RCSwitch/examples/

Did you try the ReceiveDemo_Simple example? Which Arduino IDE version do you have (it should work with 1.0 and 022)?


Sorry to be a pain.
I have tried rcswitch.h and cpp files everywhere but still get this error messsage. - ReceiveDemo_Simple.cpp:7:22: error: RCSwitch.h: No such file or directory
ReceiveDemo_Simple.pde:-1: error: 'RCSwitch' does not name a type
ReceiveDemo_Simple.cpp: In function 'void setup()':
ReceiveDemo_Simple.pde:-1: error: 'mySwitch' was not declared in this scope
ReceiveDemo_Simple.cpp: In function 'void loop()':
ReceiveDemo_Simple.pde:-1: error: 'mySwitch' was not declared in this scope

Arduino v1
I'm only trying the simple example. Shoiuld the path etc be in the actual code?

No rush and thanks for your patience


No big deal, you're welcome :) did you install a arduino library before?

You should have (or create) a "libraries" folder in your arduino sketchbook folder and extract it there. To find the sketchbook folder first, go to "File" => "Preferences" in the arduino IDE, it should say something like this (depends on your operating system and language):

Code: [Select]

C:\Dokumente und Einstellungen\sui\Eigene Dateien\Arduino

This is how it should look like extracted:

After that close and re-open the arduino IDE, because it only scans the libraries folder on startup. The example sketch should work then as it is.


I was recently experimenting with remote controlled power sockets, and here is a post about how to do it with an Arduino and an RF transmitter:

and a video:
DIY electronics project at http://rayshobby.net


Hi Rayshobby.
Thanks I'll look at your link next but this is for Sui?? Hamburg. Brilliant. Don't know what I was doing wrong but came back to it, loaded receive simple and MAGIC HAPPENED!
Received 1520621 / 24bit Protocol: 1
Received 1520622 / 24bit Protocol: 1
Received 1520622 / 24bit Protocol: 1 etc.......All the different codes from each of 9 buttons. A good English word is Gobsmacked
Many thanks


Ok, finally I found a simple and general method to work with basically any off-the-shelf remote controlled power sockets. The idea is to first use an RF receiver + sound card + audio recording software to sniff the remote control signals, then 'play it back' using an Arduino + RF transmitter to simulate the remote control. I wrote a blog post about this method, which you can find at:
It also includes a demo of Internet-based control of devices using an existing OpenSprinkler board.
Hope this is useful :)



DIY electronics project at http://rayshobby.net

Go Up