Skip to content

Instantly share code, notes, and snippets.

@adrianjost
Last active May 5, 2023 22:08
Show Gist options
  • Save adrianjost/1d42308400a1458f27810c3d8541d13c to your computer and use it in GitHub Desktop.
Save adrianjost/1d42308400a1458f27810c3d8541d13c to your computer and use it in GitHub Desktop.
Brennenstuhl / toom 433 MHZ Radio-controlled socket (Funksteckdose)
/*
Sources:
https://arduino-projekte.info/funk-sender-433mhz-auslesen-mit-arduino/
https://daniel-ziegler.com/arduino/mikrocontroller/2017/06/16/Funksteckdose-arduino/
also note, that I received protocol 3 or 5 with this script,
but the internet suggested to use 4 when sending and only 4 seems to work.
How to use:
Flash this on your Arduino and hold the button you want to read until you received 4 different values.
The order of these seem to be important.
*/
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
void setup() {
Serial.begin(9600);
mySwitch.enableReceive(0); // Receiver on interrupt 0 => that is pin #2
}
void loop() {
if (mySwitch.available()) {
int value = mySwitch.getReceivedValue();
if (value == 0) {
Serial.print("Unknown Code");
} else {
Serial.print("Read ");
Serial.print( mySwitch.getReceivedValue() );
Serial.print(" / ");
Serial.print( mySwitch.getReceivedBitlength() );
Serial.print("bit ");
Serial.print("Protokoll: ");
Serial.print( mySwitch.getReceivedProtocol() );
Serial.print(" Pulse Length: ");
Serial.print( mySwitch.getReceivedDelay() );
Serial.println("");
}
mySwitch.resetAvailable();
}
}
/*
Script to control 433 MHZ Radio-controlled outlets.
*/
#include <RCSwitch.h>
#define PROTOCOL 4
long long A_ON[] = {11788124, 12172828, 11978604, 11574188};
long long A_OFF[] = {12349996, 12473468, 11812284, 12002956};
long long B_ON[] = {12101861, 12313861, 11693109, 11602421};
long long B_OFF[] = {11879317, 12521685, 12448069, 12225221};
long long C_ON[] = {12002958, 11812286, 12473470, 12349998};
long long C_OFF[] = {11978606, 12172830, 11788126, 11574190};
long long D_ON[] = {12521687, 12448071, 12225223, 11879319};
long long D_OFF[] = {12313863, 11693111, 11602423, 12101863};
byte lastIndex[] = {0, 0, 0, 0}; // store index of last send message per channel
RCSwitch sender = RCSwitch();
void setup()
{
Serial.begin(9600);
sender.enableTransmit(3); // Pin 3
sender.setPulseLength(525);
}
void send(byte id, long long messages[])
{
sender.setProtocol(PROTOCOL);
sender.send(messages[lastIndex[id]], 24);
lastIndex[id] = (lastIndex[id] + 1) % 4;
}
void loop()
{
if (Serial.available() > 0) {
String message = Serial.readString();
if(message == "A_ON"){
send(0, A_ON);
}else if(message == "A_OFF"){
send(0, A_OFF);
}else if(message == "B_ON"){
send(0, B_ON);
}else if(message == "B_OFF"){
send(0, B_OFF);
}else if(message == "C_ON"){
send(0, C_ON);
}else if(message == "C_OFF"){
send(0, C_OFF);
}else if(message == "D_ON"){
send(0, D_ON);
}else if(message == "D_OFF"){
send(0, D_OFF);
} else{
Serial.println("Invalid Message");
}
}
}
@adrianjost
Copy link
Author

The values in the script above are tested with the following sockets:

  1. Brennenstuhl Art: 0507830
    They look similar to this model: https://www.brennenstuhl.com/de-DE/produkte/funksteckdosen/comfort-line-funkschalt-set-3x-ip20

  2. Toom Modell: 2817545
    The set I have tested with does not include the black socket that is included here: https://toom.de/p/funksteckdosenadapter-set-5-tlg/9450271
    but that's definitely the manual: https://static.toom.de/produkte/bilder/9450271/bedienungsanleitung_9450271.pdf

I guess almost all sockets in this form factor are compatible with each other. They all look very similar and for me, the two models mentioned above work interchangeably and the included remotes are compatible with each other.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment