Decoding a remote

If this is in the wrong category I'm quite happy to move it. I just do not understand where to put this.

I want to read a remote control and decode it.

I installed the RCSwitch library and opened the sketch from it.

The remote says 433.92Mhz on it. I am using a MX-RM-5V which from data sheets is 433.92Mhz.

Yet when I operate the remote I get no display whatsoever on the serial monitor.

I know the receiver and UNO are working as I can it to get a print on the monitor when using a different sketch and an FS1000A.

I changed the sketch to the "RecieveDemo Simple" just to try and get something displayed on the monitor. Nothing.

I'm at a loss , the remote works, the uno and MX-RM-5V work and unless the remote or the MX-RM-5V are telling lies and one of them is on a different frequency I've no idea what could be wrong.

I will much appreciate advice.
I am using the data pin 2
Thanks John

=====================================================

/*
  Simple example for receiving
  
  https://github.com/sui77/rc-switch/
*/

#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();
  }
}

Hello
Do you have more information about the modulation type used?

I can it to get a print on the monitor when using a different sketch and an FS1000A.

Please post the "different sketch" and whatever is printed.

Even if the remote uses some version of the RCSwitch protocol, it may be one of the several variants that the default library example does not recognize. A general approach to decoding remotes is described in this tutorial: Reverse Engineer a Cheap Wireless Soil Moisture Sensor « RAYSHOBBY.NET

The receiver/transmitter modules, the cheap items from ebay, use ASK.

The Remote that I am wanting to decode, is a Smartware product. Found nothing on-line to tell me the type of modulation.

I've emailed them and hope they help.

All the YouTube examples use the cheap 433Mhz receiver I have and work fine, obviously though they are using different makes of remote.

This is the type of receiver that I'm using.

Thanks Paul for suggesting this.

John

433mhz

Hello, Thanks for your interest and offer to help.

Hopefully I've included the correct bits that you asked for.

The different sketch is from my rain alarm I am making.

// Include RadioHead Amplitude Shift Keying Library
#include <RH_ASK.h>
// Include dependant SPI Library 
#include <SPI.h> 
int J;    // number of loops it waits if no signal before sounding alarm.
int buzzPin = (7); // buzz pin
int buzzOn =(3000);
int buzzOff =(2000);
int RedOff =(1000);
int redPin = (4);
int greenPin = (5);
int yellowPin = (2);
int delayTime = (500); // time programe waits before moving on. 
int noSignal = (1000);
int M;  // count for length of buzz if moist
int MoistBuzzTime =(12000);



//  D11--------------------------Data

// Create Amplitude Shift Keying Object
RH_ASK driver (256,  11,  12);
 
void setup()
{
      // Setup Serial Monitor
    Serial.begin(9600);

  if (!driver.init()) Serial.println("init failed");
  
      pinMode ( buzzPin, OUTPUT);
      pinMode ( redPin, OUTPUT);
      pinMode ( greenPin, OUTPUT);
      pinMode ( yellowPin, OUTPUT);
    
      digitalWrite(greenPin,HIGH); 
 
  
}

 
void loop()
{
    // Set buffer to size of expected message
    uint8_t buf[1];
    uint8_t buflen = sizeof(buf);
    uint8_t i;
    // Check if received packet is correct size

    if (driver.recv(buf, &buflen))
    {
      
      // Message received with valid checksum
//      Serial.print("Message Received: ");
//      Serial.println((char*)buf);  
      J = -1;    
    }
    
 else    {  J = ( J + 1);}

   if (J > 21) { goto End;}  
   if (J == 21){                       


//    Serial.println ("No Signal");
   
        digitalWrite(buzzPin,HIGH);   // continuous buzz for signal lost.   
        digitalWrite(greenPin,LOW);  
        digitalWrite(redPin,HIGH);  
        digitalWrite(yellowPin,LOW);
//        delay ( noSignal);
        goto End;} 
       
                                                                                                          
else {
        
if (J < 21)

{
//  Serial.println("ON");
digitalWrite(greenPin,HIGH);

}
   }   

    String rcv;


    for  (int i = 0;  i < buflen; i++) {
      rcv +=  (char)buf[i];
      
    } 
 Serial.println( rcv);
  { if (rcv=="D") 
 
{ digitalWrite(buzzPin,LOW); 
  digitalWrite(redPin,LOW);  // buzzer off as it is dry.
  digitalWrite(yellowPin,LOW);
  (M = 1) ;}
  
  else
  
  if (rcv=="W")                  // buzzer for wet
 
{ digitalWrite(redPin,HIGH);
digitalWrite(buzzPin,HIGH);
digitalWrite(yellowPin,LOW);
//delay(buzzOn);
//digitalWrite(buzzPin,LOW);
(M = 1) ;
//digitalWrite(redPin,LOW);
//delay(RedOff); 
//Serial.println( " Wet Buzz");
}

else

if (rcv=="M") 
 
{ 
//  M = (M+1);
  if (M == 1){ (M = 2) ;
 
  digitalWrite(buzzPin,HIGH);
  digitalWrite(yellowPin,HIGH);}
  digitalWrite(redPin,LOW);  // Turn it off just in case it is on.
  
  
delay (MoistBuzzTime);      // Moist buzz time to be decided
digitalWrite(buzzPin,LOW);
//delay(250);
//Serial.println( " Moist Buzz");
}


}  
End:
Serial.println( J);
delay (delayTime);



}
   

The output shown "D" it is dry. The numbers are a count before a no signal alarm is raised. If the signal drops and and it rains the washing will still get wet. :cloud_with_snow: :open_umbrella:

"Even if the remote uses some version of the RCSwitch protocol, it may be one of the several variants that the default library example does not recognize. "

This had occurred to me which is why I used the "RecieveDemo Simple" ( The Sketch in my original post) when the "RecieveDemo Advanced" did not give a readout. My understanding of the "Simple" Sketch is that it will give an indication that it has received something even if it does not decode it.?

Thanks John

Sorry, we seem to have a misunderstanding. I thought that the "different sketch" produced output when you pushed buttons on the remote.

The method shown in the link I posted will help you understand what is going on with the remote.

:grinning: :smiley:

Although These forums are often useful, it is also difficult for each other to know exactly what another person is meaning.

I've had some success or sorts, although still not working correctly.

When I get a chance I'll post the new sketch and what is happening.

Just to finish this off , I tired a number of other things and some suggestion but some were going far too deep for me and I opted for a simpler option.

I purchased a cheap Key fob from China with 4 matching receivers.

Thank you to everyone who tried to help.

John
fob