Decode and Send 433Mhz with Arduino

Hi all,

I’m using a FS1000A transmitter, a MX-RM-5V Receiver and attempt to switch on a 433Mhz plug (remote included) but failed switch on and off.
The code is from this link:

Having the receiver code uploaded to Arduino Uno (1st), open Serial Monitor, then press button On (switch 1) below is what shown in serial monitor:

On 1:
Decimal: 349491 (24Bit) Binary: 000001010101010100110011 Tri-State: 00FFFFFF0101 PulseLength: 170 microseconds Protocol: 1
Raw data: 5308,152,528,156,528,156,528,152,532,148,536,492,188,152,532,496,188,152,532,492,192,152,528,496,188,156,532,492,188,152,532,496,188,152,528,156,528,496,188,496,192,148,532,152,532,492,192,492,192,

For button off (switch1):

Off 1:
Decimal: 349500 (24Bit) Binary: 000001010101010100111100 Tri-State: 00FFFFFF0110 PulseLength: 170 microseconds Protocol: 1
Raw data: 5304,156,532,152,540,136,548,136,548,132,548,472,204,144,532,496,200,136,552,472,216,124,556,468,212,132,552,476,204,136,548,476,204,140,548,128,556,128,552,128,556,124,552,140,544,140,540,140,544,

Fill in the Binary Numbers for On and OFF, PulseLength =170, Protocol=1, to the transmitter code as
shown below:

/*
Based on the SendDemo example from the RC Switch library

*/

#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();

void setup() {
Serial.begin(9600);

// Transmitter is connected to Arduino Pin #10
mySwitch.enableTransmit(10);

// Optional set pulse length.
mySwitch.setPulseLength(170);

// Optional set protocol (default is 1, will work for most outlets)
mySwitch.setProtocol(1);

// Optional set number of transmission repetitions.
// mySwitch.setRepeatTransmit(15);
}

void loop() {
// Binary code - button 3
mySwitch.send(“000001010101010100110011”);
delay(1000);
mySwitch.send(“000001010101010100111100”);
delay(1000);

}

Upload the code to 2nd Arduino.

Open the Serial monitor of the receiver(1st Arduino board), picture link below:

The serial monitor of the receiver prints what is sent from the transmitter but why the plug isn’t switching on and off as it supposed to??

Thanks,

Freddy

Where is the receiver code?

Receiver code:

/*
  Example for receiving
  
  https://github.com/sui77/rc-switch/
  
  If you want to visualize a telegram copy the raw data and 
  paste it into http://test.sui.li/oszi/
*/

#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()) {
    output(mySwitch.getReceivedValue(), mySwitch.getReceivedBitlength(), mySwitch.getReceivedDelay(), mySwitch.getReceivedRawdata(),mySwitch.getReceivedProtocol());
    mySwitch.resetAvailable();
  }
}

The receive code only writes stuff out to serial monitor. You need to include code to control the connected switch.

Look at the wiki and examples to see how to control switches.

Thanks for replying!, will add some code soon!, thanks!

Just a thought try changing

const unsigned int RCSwitch::nSeparationLimit = 4300;

in RCSwitch.cpp

try a few different values between 2000 and maybe 27000

you might pick up your signal as a different protocol, try sending the code as that protocol instead.

as a example for me i had to change it to 2000 to pick up protocol 4 codes correctly.

Best of luck!

groundFungus:
The receive code only writes stuff out to serial monitor. You need to include code to control the connected switch.

Look at the wiki and examples to see how to control switches.

Actually shouldn’t be the Transmitter code has the same purpose as the remote? so when the transmitter starts transmitting, the relay inside the plug should be switching on and off according to this code:

/*
  Based on the SendDemo example from the RC Switch library
  https://github.com/sui77/rc-switch/
*/

#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();

void setup() {
  Serial.begin(9600);
 
  // Transmitter is connected to Arduino Pin #10 
  mySwitch.enableTransmit(10);

  // Optional set pulse length.
  mySwitch.setPulseLength(170);
 
  // Optional set protocol (default is 1, will work for most outlets)
  mySwitch.setProtocol(1);
 
  // Optional set number of transmission repetitions.
  // mySwitch.setRepeatTransmit(15);
}

void loop() {
  // Binary code - button 3
  mySwitch.send("000001010101010100110011");
  delay(1000); 
  mySwitch.send("000001010101010100111100");
  delay(1000);
 
  }

This code from this link works: