Control your Elro switches from your Raspberry Pi

The 433send program allows you to control wireless switches by Elro using a 433.92 MHz transmitter such as this one.

Connecting the transmitter to the Raspberry Pi GPIO header:

‘VCC’ pin to 3V3 (pin #1)
‘Data’ pin to GPIO0 (pin #3)
‘GND’ to GND (pin #6)

First, download and install WiringPi. WiringPi allows you to easily control the Raspberry Pi’s GPIO pins:

https://projects.drogon.net/raspberry-pi/wiringpi/download-and-install/

Then, download 433send.cpp and put in (for example) the WiringPi example directory (~/wiringPi/examples)

Change the key[] variable according to the dipswitches on your Elro switches.

Compile it:

g++ -o 433send 433send.cpp –I/usr/local/include  -L/usr/local/lib -lwiringPi

Usage:
Execute as root!
sudo ./433send -d <device number> -s 1|0
-d: device number.
-s: 1 = on, 0 = off.
Devices:

A = 1
B = 2
C = 4
D = 8
E = 16

Example: sudo ./433send -d 4 -s 1 (turn on device C)

Credits:

Original source written for Arduino by Piepersnijder: http://gathering.tweakers.net/forum/view_message/34919677

This entry was posted in Electronics, Raspberry Pi and tagged . Bookmark the permalink.

8 Responses to Control your Elro switches from your Raspberry Pi

  1. Heiko says:

    Great work! I did a rewrite to Python + RPi.GPIO which can be found here:
    http://pastebin.com/aRipYrZ6

  2. David says:

    Thank you very much for this extremely helpful post!!!!!!!!!!!!!!!

  3. Jarrin says:

    Thank you!! You helped me out :D

  4. Daniel says:

    Thank you for this post.

    how can i set the key as an parameter?

    Thanks in advance

  5. Mr.T says:

    Do you also control them through a website?

    ( if so, how?)

  6. michel says:

    Sounds cool! Gonna try it!

  7. Andy says:

    Hi, pretty cool, exact what i am looking for… which kind of transmitter can or should i use? (your link to ebay is not valid any more) and i can connect this transmitter directly to the RPi?

  8. Thomas says:

    Great tool.

    I have updated you code to be more flexible on the key.

    string mykey2 (“10101″);
    int key_std = 0;

    while((opt = getopt(argc, argv, “k:d:s:”)) != -1)
    {
    switch(opt)
    {
    case ‘k':
    // mykey.assign(optarg); — char mykey[20] does not work
    mykey2.assign(optarg);
    key_std = 1;
    break;
    …..

    if(key_std == 1)
    {
    for (int kx=0; kx<5; kx++) // read key from argv into array
    {
    key[kx]=mykey2[kx]-48; // string mykey2 ("10101");
    }
    }

    // printf("key: %d-%d-%d-%d-%d %d %d\n",key[0],key[1],key[2],key[3],key[4],ab,onoff);

    There is on strange behavior, which you may be able to help on.
    My power plug is switching the state regardless of the command.
    I.e. if I just send '-s 1' multiple times it goes on / off / on / off / … etc.
    I would have expected that the power plug once being on, would not change if I am sending again a on command.

Leave a Reply to Mr.T Cancel reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>