Spent a week or so trying to control the Lidl Remote Sockets I bought with pre-written code found on the net but to no avail. Eventually worked it out for myself. If anybody else is wondering how to do it I've posted an example below. A fair chunk of it has been taken from other examples, so I can't take complete credit for it. Either way, an Uno, an Ethernet Shield and a set of 433Mhz Transmitter/Receivers are definitely cheaper than http://www.steckerchecker.com/ which SilverCrest recommend. Instructions on setup contained in commented code. Hopefully somebody will find it of use!
/*
SilverCrest 91210 RCS AAA3680 - A IP20
Below code will transmit on and off signals to SilverCrest 91210 Remote Electrical Sockets
I've taken some bits of code from various websites (mostly from rayshobby.net and randysimons.com)
Recorded the wave signatures (instructions taken from those websites)
Cut the end off an old sent of headphones and plugged into Line-In on PC. Recorded with Audacity on 48000Hz Sampling Freq.
Receiver set up to +5 and GND on Arduino and Rec pin sent to 39K Resistor (I only had a 47K resistor but worked ok).
39 K resistor sent to Headphone (left or right) and 10K resistor. 10K resistor sent to Gnd Arduino and Gnd from Headphone.
Recorded wave signature defined as Long (1) and Short (0), the shortest worked out at roughly 18 samples at 48000Hz 18/48000=375ns (found 373 worked better).
Each Long signal was about 3 times the length of the Short and the delay between sequences was rougly 6 times the short length.
Sequence had two distinct sub sequences -
1. 4x with an another Short and a Short delay
2. 4x with and another Long (extra long) and an extra long delay
Below setup as two Button Pins (each button pin 1 is sent to arduino pins 5 and 8 and pin 4 sent to ground)
Button 1 sends the signal
Button 2 cycles through the functions (A, B, C, D and Master)
433Mhz Transmitter set up on pin 3
LED on pin 13 flashes while sending signal
*/
#define BUTTON_PIN1 5
#define BUTTON_PIN2 8
#define RF_DATA_PIN 3
#define SHORT_DELAY 373
#define LONG_DELAY (3*SHORT_DELAY)
#define TOTAL_DELAY (SHORT_DELAY + LONG_DELAY)
#define SYNC_DELAY (6*SHORT_DELAY)
#define EXTRALONG_DELAY (3*LONG_DELAY)
unsigned long signal;
unsigned long signalA1 = 0b110101100100001101110000;
unsigned long signalA0 = 0b110111001010000100010000;
unsigned long signalB1 = 0b110101100100001101110100;
unsigned long signalB0 = 0b110111001010000100010100;
unsigned long signalC1 = 0b110101100100001101111100;
unsigned long signalC0 = 0b110111001010000100011100;
unsigned long signalD1 = 0b110111001010000100010010;
unsigned long signalD0 = 0b110101100100001101110010;
unsigned long signalM1 = 0b110111001010000100011010;
unsigned long signalM0 = 0b110101100100001101111010;
boolean onOff;
int Plug;
void setup() {
pinMode(RF_DATA_PIN, OUTPUT);
pinMode(BUTTON_PIN1, INPUT_PULLUP);
pinMode(BUTTON_PIN2, INPUT_PULLUP);
pinMode(13, OUTPUT);
Serial.begin(9600);
Serial.println("Ready");
onOff=0;
}
void loop() {
if (digitalRead(BUTTON_PIN2) == LOW) {
Plug = Plug + 1;
if (Plug == 5){
Plug = 0;
}
Serial.println(Plug);
}
if (digitalRead(BUTTON_PIN1) == LOW) {
onOff = !onOff;
ActivatePlug();
}
}
void ActivatePlug() {
unsigned long signal0 = 0;
unsigned long signal1 = 1;
if (Plug == 0){
if (onOff == 0) {
signal = signalA1;
}
else if (onOff == 1) {
signal = signalA0;
}
Serial.print("A ");
Serial.println(onOff);
}
if (Plug == 4){
if (onOff == 0) {
signal = signalM1;
}
else if (onOff == 1) {
signal = signalM0;
}
Serial.print("Master ");
Serial.println(onOff);
}
if (Plug == 1){
if (onOff == 0) {
signal = signalB1;
}
else if (onOff == 1) {
signal = signalB0;
}
Serial.print("B ");
Serial.println(onOff);
}
if (Plug == 2){
if (onOff == 0) {
signal = signalC1;
}
else if (onOff == 1) {
signal = signalC0;
}
Serial.print("C ");
Serial.println(onOff);
}
if (Plug == 3){
if (onOff == 0) {
signal = signalD1;
}
else if (onOff == 1) {
signal = signalD0;
}
Serial.print("D ");
Serial.println(onOff);
}
Serial.print(Plug);
Serial.print(" ");
Serial.println(onOff);
Serial.println(signal, BIN);
// for (unsigned char j=0; j<5; j++) { //repeat the whole thing 5 times
for (unsigned char i=0; i<3; i++) { // repeat 1st signal sequence 3 times
for (unsigned char k=0; k<24; k++) { //as 24 long and short signals, this loop sends each one and if it is long, it takes it away from total delay so that there is a short between it and the next signal and viceversa
unsigned long d = ((bitRead(signal, 23-k)) == 1 ? LONG_DELAY : SHORT_DELAY);
digitalWrite(13, HIGH);
digitalWrite(RF_DATA_PIN, HIGH);
delayMicroseconds(d);
digitalWrite(RF_DATA_PIN, LOW);
digitalWrite(13, LOW);
delayMicroseconds(TOTAL_DELAY - d);
}
//send the short 0 signal in the 1st sequence and the pause between repeats
unsigned long d = (SHORT_DELAY);
digitalWrite(13, HIGH);
digitalWrite(RF_DATA_PIN, HIGH);
delayMicroseconds(d);
digitalWrite(RF_DATA_PIN, LOW);
digitalWrite(13, LOW);
delayMicroseconds(SYNC_DELAY);
}
for (unsigned char i=0; i<3; i++) { // repeat 2nd signal sequence 3 times
for (unsigned char k=0; k<24; k++) {
unsigned long d = ((bitRead(signal, 23-k)) == 1 ? LONG_DELAY : SHORT_DELAY);
digitalWrite(13, HIGH);
digitalWrite(RF_DATA_PIN, HIGH);
delayMicroseconds(d);
digitalWrite(RF_DATA_PIN, LOW);
digitalWrite(13, LOW);
delayMicroseconds(TOTAL_DELAY - d);
}
// send the extra long 1 signal in the 2nd sequence and long pause between repeats
unsigned long d = EXTRALONG_DELAY;
digitalWrite(13, HIGH);
digitalWrite(RF_DATA_PIN, HIGH);
delayMicroseconds(EXTRALONG_DELAY);
digitalWrite(RF_DATA_PIN, LOW);
digitalWrite(13, LOW);
delayMicroseconds(EXTRALONG_DELAY);
delayMicroseconds(SYNC_DELAY);
}
// }
onOff != onOff;
}