RadioHead recv function always return false

Hello,

I'm trying to analyze a 433Mhz signal from a remote control using a receiver module and a remote control to send the signal.

Here is my code for the receiver :

#include <RH_ASK.h> // (fait partie de Radiohead)
#include <SPI.h> 

// Create Amplitude Shift Keying Object
RH_ASK driver(2000, 11, 12, 10, true);

void setup()
{
  Serial.begin(9600);
  
  if (!driver.init()) {
    Serial.println("Couldn't initialize RadioHead driver");
  } else {
    Serial.println("Successfully initialized RadioHead driver");
  }
    
 
  
}

void loop()
{
  uint8_t buf[RH_ASK_MAX_MESSAGE_LEN];
  uint8_t buflen = sizeof(buf);

  int digitalRead11Value = digitalRead(11);

  Serial.println(digitalRead11Value);

  if (driver.recv(buf, &buflen)) // Non-blocking
  {
      driver.printBuffer("Got:", buf, buflen);
  }

}

My problem is the "driver.recv" function is always returning false, I tried to print the value of digitalRead(11) and when I press my remote button to send the signal it's printing something different. It behave like this below

************ REMOTE BUTTON NOT PRESSED ************

16:14:26.282 -> 0
16:14:26.282 -> 0
16:14:26.315 -> 0
16:14:26.315 -> 0
16:14:26.315 -> 0
16:14:26.315 -> 0
16:14:26.315 -> 1
16:14:26.315 -> 0
16:14:26.315 -> 0
16:14:26.315 -> 1
16:14:26.315 -> 1
16:14:26.315 -> 1
16:14:26.349 -> 0
16:14:26.349 -> 0
16:14:26.349 -> 1
16:14:26.349 -> 0
16:14:26.349 -> 0
16:14:26.349 -> 0
16:14:26.349 -> 0
16:14:26.349 -> 0
16:14:26.349 -> 0
16:14:26.349 -> 0
16:14:26.349 -> 0
16:14:26.382 -> 0
16:14:26.382 -> 1
16:14:26.382 -> 0
16:14:26.382 -> 0
16:14:26.382 -> 1
16:14:26.382 -> 0
16:14:26.382 -> 0
16:14:26.382 -> 1
16:14:26.382 -> 0
16:14:26.382 -> 1
16:14:26.415 -> 1

************ REMOTE BUTTON PRESSED ************

16:14:26.415 -> 0
16:14:26.415 -> 0
16:14:26.415 -> 0
16:14:26.415 -> 0
16:14:26.415 -> 0
16:14:26.415 -> 0
16:14:26.415 -> 0
16:14:26.415 -> 0
16:14:26.415 -> 0
16:14:26.415 -> 0
16:14:26.448 -> 0
16:14:26.448 -> 0
16:14:26.448 -> 0
16:14:26.448 -> 0
16:14:26.448 -> 0
16:14:26.448 -> 0
16:14:26.448 -> 0
16:14:26.448 -> 0
16:14:26.448 -> 0
16:14:26.448 -> 0
16:14:26.481 -> 0
16:14:26.481 -> 0
16:14:26.481 -> 0
16:14:26.481 -> 0
16:14:26.481 -> 0
16:14:26.481 -> 0
16:14:26.481 -> 0
16:14:26.481 -> 0
16:14:26.481 -> 0
16:14:26.481 -> 0
16:14:26.481 -> 0
16:14:26.514 -> 0
16:14:26.514 -> 0
16:14:26.514 -> 0
16:14:26.514 -> 0
16:14:26.514 -> 0
16:14:26.514 -> 0
16:14:26.514 -> 0
16:14:26.514 -> 0
16:14:26.514 -> 1
16:14:26.514 -> 1
16:14:26.514 -> 1
16:14:26.514 -> 1
16:14:26.548 -> 1
16:14:26.548 -> 1
16:14:26.548 -> 1
16:14:26.548 -> 1
16:14:26.548 -> 1
16:14:26.548 -> 1
16:14:26.548 -> 1
16:14:26.548 -> 1
16:14:26.548 -> 1
16:14:26.548 -> 1
16:14:26.581 -> 1
16:14:26.581 -> 1
16:14:26.581 -> 1
16:14:26.581 -> 1
16:14:26.581 -> 1
16:14:26.581 -> 1
16:14:26.581 -> 1
16:14:26.581 -> 1
16:14:26.581 -> 1
16:14:26.581 -> 1
16:14:26.581 -> 1
16:14:26.614 -> 1
16:14:26.614 -> 1
16:14:26.614 -> 1
16:14:26.614 -> 1
16:14:26.614 -> 1
16:14:26.614 -> 1
16:14:26.614 -> 1
16:14:26.614 -> 1
16:14:26.614 -> 1
16:14:26.614 -> 1
16:14:26.647 -> 1
16:14:26.647 -> 1
16:14:26.647 -> 1
16:14:26.647 -> 1
16:14:26.647 -> 1
16:14:26.647 -> 1
16:14:26.647 -> 1
16:14:26.647 -> 1
16:14:26.647 -> 1
16:14:26.647 -> 1
16:14:26.647 -> 1
16:14:26.680 -> 1
16:14:26.680 -> 1
16:14:26.680 -> 1
16:14:26.680 -> 1
16:14:26.680 -> 1
16:14:26.680 -> 1
16:14:26.680 -> 1
16:14:26.680 -> 1
16:14:26.680 -> 1
16:14:26.680 -> 1
16:14:26.714 -> 1
16:14:26.714 -> 1
16:14:26.714 -> 1
16:14:26.714 -> 1
16:14:26.714 -> 1
16:14:26.714 -> 1
16:14:26.714 -> 1
16:14:26.714 -> 1
16:14:26.714 -> 1
16:14:26.714 -> 1
16:14:26.714 -> 1
16:14:26.747 -> 1
16:14:26.747 -> 1
16:14:26.747 -> 1
16:14:26.747 -> 1
16:14:26.747 -> 1
16:14:26.747 -> 1
16:14:26.747 -> 1
16:14:26.747 -> 1

Can someone help me ?

Receiver module is this one : Kit émetteur-récepteur 433MHZ - Articles retires | GO TRONIC

For the posted code to work, even in principle, the transmitter needs to be running RadioHead (properly configured) as well.

RF remote controls often, but not always, use encoding that the RCSwitch library can decode. Post a link to the one you have.

Hello and thanks for the answer!

Here is the controller : https://www.somfy.fr/produits/1810649/telecommande-telis-1-rts-noir

That remote may use one of the RCSwitch protocols. Try the library and see if it recognizes the protocol.

If that doesn't work you may have to "sniff" the signal following the general ideas in this tutorial: Reverse Engineer Wireless Temperature / Humidity / Rain Sensors — Part 1 « RAYSHOBBY.NET

I will do it tomorrow :

  1. Thanks you a lot for the help and the energy !
  2. The article you linked is super interesting, thanks for sharing :slight_smile:

Good night!

By the way I have a remote like that (sun shade controller), and I did sniff the signal when I got it. I vaguely recall that it is very much like the RCSwitch protocol, but I never got around to doing anything with it.

The Arduino can easily mimic most RF remote protocols, but there are many of them. Some have been decoded, so you might try searching for "Arduino decode RF XXXX" where XXXX is the model number or type of your remote.

Hello,

I tried the rc-switch library but the "available()" seems to always return 0, I did some search and it returns 0 when there is no message to process...

Maybe my 433mhz receiver is not on the same frequency ? It is possible that not a single remote in my house trigger the available() ?

Here is my code, i remove the available() for testing purpose

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

  delay(500);
}

The output look like this :

01:25:38.503 -> Unknown encoding.Raw data: 732,
01:25:38.503 ->
01:25:38.503 -> Unknown encoding.Raw data: 2296,
01:25:38.503 ->
01:25:38.503 -> Unknown encoding.Raw data: 2500,
01:25:38.503 ->
01:25:40.060 -> Unknown encoding.Raw data: 16,
01:25:40.093 ->
01:25:40.557 -> Unknown encoding.Raw data: 908,
01:25:40.590 ->
01:25:41.054 -> Unknown encoding.Raw data: 1212,
01:25:41.087 ->
01:25:41.550 -> Unknown encoding.Raw data: 108,
01:25:41.583 ->
01:25:42.080 -> Unknown encoding.Raw data: 132,
01:25:42.113 ->
01:25:42.577 -> Unknown encoding.Raw data: 32,
01:25:42.610 ->
01:25:43.074 -> Unknown encoding.Raw data: 204,
01:25:43.107 ->
01:25:43.571 -> Unknown encoding.Raw data: 140,
01:25:43.604 ->
01:25:44.068 -> Unknown encoding.Raw data: 2416,
01:25:44.101 ->
01:25:44.564 -> Unknown encoding.Raw data: 5340,
01:25:44.597 ->
01:25:45.061 -> Unknown encoding.Raw data: 20,
01:25:45.094 ->
01:25:45.557 -> Unknown encoding.Raw data: 376,
01:25:45.591 ->
01:25:46.054 -> Unknown encoding.Raw data: 136,
01:25:46.087 ->
01:25:46.584 -> Unknown encoding.Raw data: 3236,
01:25:46.617 ->
01:25:47.081 -> Unknown encoding.Raw data: 11752,
01:25:47.114 ->
01:25:47.577 -> Unknown encoding.Raw data: 44,
01:25:47.611 ->
01:25:48.074 -> Unknown encoding.Raw data: 56,
01:25:48.107 ->
01:25:48.571 -> Unknown encoding.Raw data: 564,
01:25:48.604 ->
01:25:49.068 -> Unknown encoding.Raw data: 9296,

Whenever I press the button the RawData goes up, means that there is some kind of data behind received no ?

The RCSwitch library does not recognize that encoding. However, the encoding may be of that basic type.

There are many variations of the basic RCSwitch encoding, and several are built in to the library. It is also possible to add a new one to the library. They differ in a couple of timing constants.

See Add_New_Remote_Part_2 · sui77/rc-switch Wiki · GitHub

The sniffing procedure described in the "rayshobby" link will make it very clear what you have.

Thanks you,

I'm gonna test it!

Ok been trying all day to understand this new thing :smile:

I recorded 3 samples of my controller signal and entered them here rc-switch raw data viewer to have a better view of the signal, then i followed Add_New_Remote_Part_1 · sui77/rc-switch Wiki · GitHub

If i'm right i'm facing this case :

WARNING: Modern remotes use more complex inter-data sync signals. Rcswitch can not deal with those kind of signals (e.g. 2 syncs bits, that may be equal or different, or a gap, followed by a train of short up-downs, followed by a second gap). If that is your case, your only chance is to use a modified rcswitch version that allows re-playing fixed sequences.

It is a 2 syncs bits signal no ? It might be too advanced for me for a first try ?

Here are the recorded signals :

680,616,1308,620,664,616,668,612,676,608,672,1248,1320,1264,664,620,664,608,1324,616,668,608,668,616,672,624,668,600,668,620,668,620,668,624,652,604,26836,2504,2516,2480,2544,2464,2548,2468,2544,2472,2540,2468,2556,2460,2536,4796,1308,1256,1304,1256,696,596,672,612,1312,1260,1312,1256,664,612,684,608,1320,616,660,1264,1300,624,668,612,672,1256,1312,620,676,612,664,1256,684,608,660,624,1308,1256,1312,1256,1312,612,696,592,672,1256,1316,608,680,1244,672,628,1312,616,660,620,672,616,668,608,676,1256,1308,1268,664,608,680,604,1316,612,672,620,664,616,668,616,660,632,672,608,668,608,688,604,668,588,26856,2496,2520,2480,2532,2476,2540,2472,2528,2472,2552,2464,2536,2472,2544,4780,1304,1268,1304,1260,668,628,652,612,1320,1256,1304,1264,660,620,672,616,1312,604,668,1268,1316,612,656,624,668,1260,1308,616,672,612,680,1244,668,608,680,608,1320,1264,1308,1244,1324,608,668,608,672,1256,1320,608,680,1248,676,604,1320,612,668,620,664,612,676,616,668,1252,1308,1272,664,608,668,620,1312,616,660,612,696,596,684,592,688,604,688,600,680,596,672,616,676,588,26948,2504,2524,2488,2528,2488,2532,2476,2536,2468,2536,2480,2548,2460,2536,4788,1312,1256,1324,1248,680,596,680,612,1320,1252,1308,1268,664,616,680,608,1300,616,680,1260,1308,612,676,612,680,1240,1320,604,680,608,668,1264,672,608,688,604,1308,1260,1312,1264,1300,624,660,624,668,1252,1312,620,680,1252,672,604,1308,620,676,620,656,608,680,616,672,1252,1320,1252,664,620,668,612,1312,628,668,608,668,612,676,620,672,616,664,608,680,612,680,600,688,572,26876,2508,2504,2484,2540,2480,2524,2484,2536,2468,2536,2464,2552,2472,2532,4784,1308,1260,1304,1264,676,600,660,628,1304,1272,1304,1268,648,624,672,612,1304,628,656,1268,1304,624,660,616,672,1256,1320,608,668,608,680,1248,680,612,668,608,1324,1252,1312,1252,1308,620,664,620,668,1252,1312,616,684,1248,672,608,1328,592,680,612,672,612,668,608,676,1252,1312,1256,676,612,672,612,1312,616,672,616,656,624,672,608,672,616,668,608,672,620,668,624,660,592,26844,2508,2512,2484,2540,2472,2536,2472,2552,2468,2540,2472,2536,2484,2524,4800,1308,1252,1312,1260,664,616,676,620,1312,1244,1312,1256,672,612,684,600,1320,616,668,1260,1300,628,668,612,680,1248,1308,620,660,620,680,1244,680,616,664,624,1320,1236,1332,1236

2540,2484,2532,4780,1316,1252,1312,1260,668,612,668,612,1324,604,668,620,680,1236,680,616,664,616,1316,1252,1312,1248,1324,620,656,1260,1312,612,672,1252,1328,612,652,1260,1316,1260,1312,1252,1316,616,668,600,684,1244,1344,588,688,1232,680,616,1320,604,664,616,668,612,684,604,668,1256,1312,1252,680,616,672,596,1320,612,680,612,676,608,668,608,684,604,684,596,680,604,676,616,676,576,26856,2516,2516,2492,2528,2480,2528,2480,2536,2468,2548,2460,2556,2460,2544,4788,1320,1244,1316,1252,676,620,668,612,1316,608,668,616,672,1256,672,612,664,628,1304,1252,1320,1248,1316,612,672,1256,1328,600,672,1260,1316,616,668,1248,1320,1252,1324,1240,1328,612,664,620,672,1244,1320,612,676,1248,684,596,1332,616,668,600,684,608,680,604,672,1256,1324,1236,684,604,684,604,1316,616,672,612,672,604,672,624,684,592,680,616,668,604,680,612,672,584,26844,2504,2532,2476,2528,2480,2536,2464,2552,2456,2544,2476,2528,2472,2536,4788,1312,1252,1320,1256,676,604,668,620,1308,612,676,612,672,1256,676,604,676,612,1308,1256,1308,1256,1316,612,688,1236,1308,628,668,1248,1324,608,672,1248,1324,1256,1316,1244,1312,612,676,612,672,1256,1316,608,672,1252,684,600,1304,632,664,616,664,616,668,616,668,1264,1316,1256,660,608,680,608,1320,604,684,604,668,612,692,592,688,596,676,616,668,608,672,616,676,584,26984,2508,2504,2492,2536,2472,2544,2476,2544,2456,2544,2476,2552,2464,2532,4788,1308,1260,1304,1264,672,612,668,620,1312,616,668,608,676,1256,680,608,676,608,1320,1244,1320,1248,1312,624,660,1268,1308,612,672,1256,1324,608,668,1248,1320,1260,1320,1248,1308,620,668,608,684,1244,1332,608,668,1236,700,592,1328,604,680,600,684,620,660,612,668,1264,1328,1232,676,612,684,596,1320,612,684,596,684,616,668,604,680,604,684,604,680,608,680,608,668,584,26856,2508,2512,2488,2524,2484,2532,2468,2540,2480,2532,2472,2552,2460,2540,4784,1304,1256,1324,1236,680,616,672,616,1304,616,680,616,656,1264,668,616,684,596,1308,1256,1316,1252,1316,612,676,1248,1308,624,668,1252,1316,616,664,1260,1320,1244,1316,1256,1308,612,680,608,672,1248,1324,600,680,1244,688,600,1328,600,688,604,668,620,656,620,672,1252,1312,1252,672,620,668,612,1316,616,672,608,668,608,688,604,668,616,680,608,668,604,680,608,672,588,26836,2504,2520,2484,2544,2468,2548,2464,2540,2472,2536,2472

672,612,680,600,680,592,26844,2504,2520,2484,2532,2476,2528,2480,2544,2468,2548,2464,2544,2468,2552,4776,1308,1260,1320,1256,668,608,1312,1260,680,596,1324,1256,664,620,668,612,1316,1256,1324,600,664,616,664,628,664,1260,1312,608,688,1224,1348,1252,668,612,1312,1252,1312,1252,1328,600,676,604,680,1260,1300,624,664,1264,672,612,1316,608,680,600,680,616,676,600,676,1252,1324,1240,680,612,680,600,1324,608,676,608,680,608,676,608,684,600,672,608,676,616,668,612,680,580,26868,2500,2520,2484,2544,2460,2540,2468,2536,2480,2544,2468,2536,2468,2528,4784,1316,1252,1308,1264,676,604,1320,1252,672,616,1312,1248,672,620,660,620,1308,1268,1308,612,668,616,664,608,676,1260,1312,616,664,1256,1312,1260,672,604,1324,1252,1324,1252,1312,604,676,608,672,1256,1308,616,668,1256,672,612,1316,608,680,608,668,620,668,612,688,1232,1332,1232,692,596,680,608,1316,612,664,632,668,600,692,596,672,612,676,612,672,600,696,596,668,596,26848,2508,2516,2484,2536,2472,2556,2464,2568,2440,2556,2452,2540,2480,2540,4784,1324,1248,1312,1256,664,612,1336,1240,692,592,1300,1268,672,608,676,612,1316,1256,1324,604,676,612,676,604,688,1236,1312,616,668,1252,1328,1244,688,600,1324,1240,1324,1252,1320,600,692,596,680,1256,1316,600,684,1252,684,596,1316,608,704,588,668,612,676,612,676,1244,1320,1260,680,596,684,600,1316,608,696,596,676,608,696,588,668,616,676,608,676,612,672,612,672,588,26848,2508,2512,2488,2536,2468,2544,2464,2532,2484,2548,2452,2548,2468,2544,4776,1312,1256,1308,1264,664,616,1304,1260,688,596,1304,1264,688,592,676,620,1308,1260,1312,608,672,612,672,620,664,1248,1312,620,672,1252,1308,1256,672,620,1320,1244,1312,1240,1332,608,672,612,684,1248,1320,596,684,1244,692,592,1336,592,680,604,684,600,680,608,664,1244,1340,1236,672,616,680,608,1324,596,688,596,676,620,660,612,676,620,668,608,676,600,684,608,668,588,26988,2504,2528,2480,2532,2476,2532,2480,2540,2468,2552,2456,2548,2472,2532,4788,1316,1260,1300,1260,688,596,1328,1244,672,608,1324,1252,680,600,676,620,1300,1260,1320,608,672,612,676,612,668,1248,1316,620,672,1256,1324,1228,688,608,1320,1252,1316,1248,1320,608,672,616,676,1252,1324,608,668,1248,692,592,1332,588,688,608,684,600,680,604,684,1244,1316,1248,680,612,684,600,1316,604,688,604,684,604,676,604,680,608,684,596

Could you take a look ?

Sorry, I'm not motivated to dig in that deeply. Maybe someone has already figured out that remote, or one like it, and posted the information on the web. Worth a search.

I understand, I will try and look.

thanks a lot for your help! take care

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.