Receiving RF Remote signal is not working

I have this set of remote controlled sockets by Ucomen

And I would like to control the sockets like I used to do with my Intertechno sockets. I tried to find protocols online but couldn't. So I decided to try and record the sent sequences with a 433MHz receiver and replay them later to see if that would work. But I can't even seem to get the signals. I am using the rc-switch library by sui77 and tried the ReceiveDemo_Simple

#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()) {
    
    Serial.print("Received ");
    Serial.print( mySwitch.getReceivedValue() );
    Serial.print(" / ");
    Serial.print( mySwitch.getReceivedBitlength() );
    Serial.print("bit ");
    Serial.print("Protocol: ");
    Serial.println( mySwitch.getReceivedProtocol() );

    mySwitch.resetAvailable();
  }
}

But it's not printing anything when I press the buttons on the remote. I don't know what to do. Any tips?

More info is required about the devices than is presented at that link. For example, how do you know they are even 433 MHz devices? Is there some Euro standard that applies?

Can be different frequency or modulation, could be even 2.4Ghz.
Anyway, try this code:

#define MINIMUMDURATION 50 //minimum low or high signal duration for a valid signal in microseconds
#define MAXIMUMDURATION 20000 //maximum low or high signal duration for a valid signal
#define MINIMUMSILENCE 30000 //minimum low period after a complete signal in microseconds
#define MAXEDGES 800 //maximum samples, limited by RAM
 
int timings[MAXEDGES];
int edges = 0;
long signalstart = 0;
long signalend;
long interval;
boolean validSignal = true;
boolean captureFinished = false;
 
void setup() {
  Serial.begin(9600);
  pinMode(2, INPUT);
  pinMode(6, OUTPUT);
  digitalWrite(6, LOW);
  while (digitalRead(2) == LOW) {}
}
 
 
void loop() {
  if (!captureFinished) {
    if (signalstart == 0) {
      signalstart = micros();
    }
    while (bitRead(PIND, 2) == HIGH) {}
    signalend = micros();
    interval = signalend - signalstart;
    //Serial.println(interval);
    if (interval > MINIMUMDURATION && interval < MAXIMUMDURATION ) {
      timings[edges] = interval;
      edges++;
    }
    else {
      edges = 0;
      validSignal = false;
      captureFinished = true;
    }
    if (validSignal) {
      while (bitRead(PIND, 2) == LOW && (micros() - signalend) < MINIMUMSILENCE ) {}
      signalstart = micros();
      interval = signalstart - signalend;
      if (interval > MINIMUMDURATION && interval < MAXIMUMDURATION ) {
        timings[edges] = interval;
        edges++;
      }
      else if (interval >= MINIMUMSILENCE) {
        captureFinished = true;
      }
      else {
        validSignal = false;
        captureFinished = true;
      }
    }
    if (edges >= MAXEDGES - 2) {
      captureFinished = true;
    }
 
  }
 
 
  else {
    if (validSignal && edges > 10) {
      captureFinished = false;
      Serial.print("Signal captured with ");
      Serial.print(edges+1);
      Serial.println(" edges");
      Serial.println("-");
      for (int i = 0; i <= edges; i++) {
        Serial.print(timings[i]);
        Serial.print(" ");
      }
      Serial.println(" ");
      Serial.println("-");
      Serial.print("int intervals[] = {");
      for (int i = 0; i < edges; i++) {
        Serial.print(timings[i]);
        Serial.print(", ");
      }
      Serial.print(timings[edges]);
      Serial.println("};");
 
      
      Serial.println("Sending signal");
      delay(3000);
      boolean high = false;
      for (int i = 0; i <= edges; i++) {
        if (high) {
          digitalWrite(6, LOW);
          high = false;
        }
        else {
          digitalWrite(6, HIGH);
          high = true;
        }
        delayMicroseconds(timings[i]);
      }
      digitalWrite(6, LOW);
      Serial.println("...sent");
    }
    else {
      captureFinished = false;
      validSignal = true;
    }
    edges = 0;
    signalstart = 0;
  }
 
}

So, which of the hundred possible, are you using?

It says "Frequency: 433.92 MHz" on the back of the remote

1 Like

It says 433.92MHz on the back of the remote. I am not very well versed with RF stuff, what is the modulation?

Ok, then chances are good.
Most common modulation is OOK (ASK) and all receivers can receive that. Different story with FSK. I think you didn't mention what receiver you have.
But try with the sketch I posted.