Reading temperature sensor data with RF 433Mhz

I am trying to read the temperature from a commercial Temperature Station. The sensor transmits the signal to the station using 433Mhz. I managed to decode the temperature using SDR and the computer. Now I would like to perform the same reading using Arduino.

For this, I tried with an Arduino Nano V3 and a very cheap TX/RX from China. What puzzles me is that I am not getting any data from the RX.

First I tried with the Radiohead library. The code looks like this:

#include <RH_ASK.h>

RH_ASK driver;
int last_idx = 0;

void setup()
{
  Serial.begin(9600); // Debugging only
  if (!driver.init())
    Serial.println("init failed");
}

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

  if (driver.recv(buf, &buflen)) // Non-blocking
  {
    // Message with a good checksum received, dump it.
    buf[buflen]=0;
    Serial.print("Received(");
    Serial.print(buflen);
    Serial.print(",");
    int idx=atoi(buf);
    Serial.print(idx>last_idx ? "+" : "-");
    Serial.print(idx-last_idx);
    last_idx=idx;
    Serial.print("}: ");
    driver.printBuffer(buf, buf, buflen);
  }
}

I get nothing with this.

Secondly I tried this:

int rfdataPin = 2;

void setup()                    // run once, when the sketch starts
{
  Serial.begin(9600);           // set up Serial library at 9600 bps
  pinMode(rfdataPin, INPUT);    // sets the digital pin as input to read
  Serial.println("RF433 Carrin arduino receiver startup");

}
 
void loop()                       // run over and over again
{
 int i;

  for (i = 0; i < 100; i++) {  // Used to create a CR point after 100 counts.
  Serial.print(digitalRead(rfdataPin));
  }
  
Serial.println(" ");    // Read the pin and display the value
//delay(100);
}

This gives me the following:

1110100100100010000010010011011010000101001001000001110000000110110000000010011100000100010011000000 
0110010000000000000011101011101000000001100000100000111110100100000000000000001000000001000000000000 
0110001000000001001000000001000000000000000000100000110100000000000000000000001100000000001000000000 
0101000000000000100000000101100000000000100000010010110000011000000000000000001100000000000000000000 
1100000000100000000000000000110000000010010000000000011001000000101000100000000110100000000000000010 
0110000000100000000000000011000000000000000000000000110000100000000000000010000100000000000000000000 
0110000000000000000000000001100000000000000000000000010000000000000000000000000110000000000000000001 
0111000000001001000001000001100000000000000000000100110010010000000000000000001101000000000000000000 
1111001000000000000000100001110000000000010000000010011000000000000000000000000100000000000000000000 
0110100000000100000000000011110000010000000000000000011000000100000000000000000100000000000000010010 
0110000100000010000000000011100000000001000000001000011000000000100000000000000110000000000000000000 

I've been told to buy a CC1101 (which I did), but until I get it, why doesn't I get any data with Radiohead? Is there something that I can do to use to convert what I get from the PIN into some actual bytes?

You should be able to determine the type of modulation being used by the transmitter by looking at the SDR waterfall screen, That modulation method must be matched by your receiver.

Thanks Paul for your quick response. I think the modulation is OOK_PPM.

I opened an issue here with all the details because it is not clear to me what are the relevant details I should look at. For instance, one of the readings using rtl_433 is here. But I just focused on the last 4 lines.

When I bought it said (ASK/OOK) which should match (unless there are further details that I am missing).

Well, there may be one other problem and that is there is a huge frequency range between 433.9 and 433.999 where almost all the so-called 433 devices operate.
OOK,on-off keying would have been quite visible on the SDR waterfall, but does your SDR actually give a frequency output when you click on a signal?

The super regen receiver is the worst possible receiver is the worst possible type you could have purchased. But, on the other hand, it should have a very wide range of frequencies it can receive.

Most manufacturers use their own proprietary protocol for temperature/weather sensors.

Many have been fully decoded, and Arduino code is available to read them. If yours has not been, this tutorial is a good place to start:
https://rayshobby.net/wordpress/reverse-engineer-wireless-temperature-humidity-rain-sensors-part-1/

I managed to decode the temperature using SDR and the computer.

Please tell us about that, and state which sensor manufacturer and model number you have.

All the details about this particular sensor are in this issue I raised: Aureol HG04641A - Temperature Station from Lidl (IAN: 307350) · Issue #2014 · merbanan/rtl_433 · GitHub

I am also wondering if using PPM reader could be a good approach. At least now I am getting some numbers (that I don't how to convert into bytes).

#include <PPMReader.h>

// Initialize a PPMReader on digital pin 3 with 6 expected channels.
byte interruptPin = 3;
byte channelAmount = 1;
PPMReader ppm(interruptPin, channelAmount);

void setup() {
    //Serial.begin(115200); // 9600
    Serial.begin(9600);
}

void loop() {
    // Print latest valid values from all channels
    for (byte channel = 1; channel <= channelAmount; ++channel) {
        unsigned value = ppm.latestValidChannelValue(channel, 0);
        Serial.print(String(value) + "\t");
    }
    Serial.println();
    delay(20);
}

gives values such as:

1028
1028
1028
1028
1028
1028
1028
0
1028
1028
1028
1028
1028
1028
1028
1028
1004
1004
1004
1004
1004
1004
1004
1004
1004
1004
1004
1004
1004
1004
1004
1972
1972
1972
1008
1008
1008
1008
1008
1008
1008
1008
1008
1008
1008
1008
1000
1000
1000
1000
1000

You are wasting your time with RadioHead, RC-Switch and the like.

Before an Arduino can decode that sensor, you first need to understand the basic protocol, then write code that measures and interprets the pulse widths and timing. The Rayshobby tutorial explains how to do that.

Here is another approach, using an SDR: Amateur-SIGINT/Amateur Signals Intelligence.pdf at master · LucaBongiorni/Amateur-SIGINT · GitHub

I am starting to see some light with the following code:

const int timeThreshold = 500;
const int intPin = 2;  // Only PINS 2 and 3 can handle interrupts in arduino nano.

volatile bool flag = false;
volatile unsigned long ISRGap = 0;
volatile unsigned long ISRTimeStart = 0;



void setup()
{
	pinMode(intPin, INPUT_PULLUP);
	Serial.begin(9600);
	attachInterrupt(digitalPinToInterrupt(intPin), timeMeasurement, FALLING);  // queremos empezar a contar cuando cae la señal.
 }

// LOW to trigger the interrupt whenever the pin is low,
// CHANGE to trigger the interrupt whenever the pin changes value
// RISING to trigger when the pin goes from low to high,
// FALLING for when the pin goes from high to low.

void loop()
{
	if (flag == true)
	{
    if (ISRGap < 1580 and ISRGap > 1400)
    {
      Serial.print(0);  
    }
    if (ISRGap < 2580 and ISRGap > 2400)
    {
      Serial.print(1);  
    }    
    if (ISRGap > 4400)
    {
      Serial.println();  
    }    
    flag = false;
	}
}

void timeMeasurement()
{
	if (micros() - ISRTimeStart > timeThreshold)
	{
    flag = true;
    ISRGap = micros() - ISRTimeStart;
    ISRTimeStart = micros();
	}
}

So I am measuring the times between falling flanges.

I am getting something like:

000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000100101111010000010000111000100111
000100101111010000010000111000100111
000100101111010000010000111000100111
00010010111101000001000011100010011
000000
0



1
0
0
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100101111010000010000111000010110
000100101111010000010000111000010110
000100101111010000010000111000010110
00010010111101000001000011100001011
00
1


000
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100101111010000010000111000010110
000100101111010000010000111000010110
000100101111010000010000111000010110
00010010111101000001000011100001011
0
0

Where I can see something similar to what I am expecting from here:

[00] {36} 12 f4 10 99 90 : 00010010 11110100 00010000 10011001 1001
[01] {36} 12 f4 10 99 90 : 00010010 11110100 00010000 10011001 1001
[02] {36} 12 f4 10 99 90 : 00010010 11110100 00010000 10011001 1001
[03] {35} 12 f4 10 99 80 : 00010010 11110100 00010000 10011001 100

where the following is the sensor identifier:

00010010 11110100

and the third is the temperature measurement:

00010000 10011001
    ^^^^ ^^^^^^^^ Temperature 2's complement