[SOLVED] 433mhz RF modules

Hi, I'm trying to read the RF codes from a remote a have that controls a couple of wall sockets I have.

The receiver modules I'm using are the RM1SGS

Datasheets for it can be found at http://www.e-madeinchn.com/RM1SGS.pdf.

I have used this modules before with PICs, and in fact have only chosen them as they were lying around in my toolbox.

I can't for the life of me figure out what's wrong with what I'm doing.

These modules have four pins (VDD, GND and two for communication (although only one should be used)).

I have it connected to my arduino's 3v3, and the communication pin to my arduino's digital pin2.

I'm using rf-switch library, and using the following code

Now, when I run, and try picking up the codes from my controller, nothing happens, as I can't see anything on the serial terminal.

I have looked at various places to see if i could find anything I was missing, but can't seem to find anything obvious.

The guy at http://ninjablocks.com/blogs/how-to/7501042-adding-rf-433mhz-to-your-arduino has successfully used a module that is very similar to mine, and is able to capture the codes.

Do any of you have any experience with using such module, or can tell me what you think I might be doing wrong? I've tried a lot of things so far, but honestly am running out of ideas already.

Thanks in advance,

What type of wall sockets are you trying to sniff
The Arduino RF switch library only works for devices that use the SC2262 / SC 2272 type decoding chips.
Not all wall sockets however use these chips.

It's got an HS1527 in it, but shouldn't it at least return something?

And according to their page, HS1527 is supported:

I am trying a similar thing: trying to sniff the signal that a cheap chinese made LED controller remote is sending out of 433MHz. I've tried various libraries, and checked that I can send and receive between 2 Arduinos using the VirtualWire library (http://www.airspayce.com/mikem/arduino/). This works fine.

I've also tried the 433MHzForArduino lib (fuzzillogic / 433mhzforarduino / wiki / Home — Bitbucket) using the ShowReceivedCode example:

/*
* Demo for RF remote switch receiver.
* For details, see RemoteReceiver.h!
*
* This sketch shows the received signals on the serial port.
* Connect the receiver to digital pin 2.
*/

#include <RemoteReceiver.h>

void setup() {
  Serial.begin(115200);
  
  // Initialize receiver on interrupt 0 (= digital pin 2), calls the callback "showCode"
  // after 3 identical codes have been received in a row. (thus, keep the button pressed
  // for a moment)
  //
  // See the interrupt-parameter of attachInterrupt for possible values (and pins)
  // to connect the receiver.
  RemoteReceiver::init(0, 3, showCode);
  
  Serial.println("setup done");
}

void loop() {
}

// Callback function is called only when a valid code is received.
void showCode(unsigned long receivedCode, unsigned int period) {
  // Note: interrupts are disabled. You can re-enable them if needed.
  
  // Print the received code.
  Serial.print("Code: ");
  Serial.print(receivedCode);
  Serial.print(", period duration: ");
  Serial.print(period);
  Serial.println("us.");
}

But nothing is seen printed to the serial console. What I want is the raw signal off the data pin to be read and shown to me, so I can decode what is going on. I've also tried the rc-switch library mentioned by the topic starter, following these instructions: GitHub - sui77/rc-switch: Arduino lib to operate 433/315Mhz devices like power outlet sockets.

When I measure voltage on the data pin I see it fluctuate between 0 and 1.5V depending on pressing a button on the remote. So it is definitely seeing signals!

Has anyone been able to do this? This is the module set that I am using:

(you can find many of these and similar on Ebay when you search for "433mhz")

Any hints appreciated. Thanks!

Seems you used and tried the same things I have.... I'm about to try and change receivers. Can't really think of anything else right now.

Ok, I feel silly.... :~

It turns out I was connecting data to the wrong interrupt.

After seeing this:

It finally downed on me I've been using an Arduino Uno until last night, when I decided to test my Leonardo :smiley:

Turns out interrupt 0 on Uno is Pin #2, but on Leonardo it's Pin #3

After quickly swapping the pins, it suddenly started spitting out:

Received 97915 / 24bit Protocol: 1
Received 97907 / 24bit Protocol: 1

And with that, I was able to run this very simple code to control my outlet devices:

#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();

void setup() {
  mySwitch.enableTransmit(3); 
}

void loop() {
  mySwitch.send(97915, 24);
  delay(5000);  
  mySwitch.send(97907, 24);
  delay(5000);
}

And now everything is fine.

Hope this thread helps anyone, and as for @neep, perhaps it would be worth checking your interrupts :stuck_out_tongue:

Thanks again for all the help