rps icon indicating copy to clipboard operation
rps copied to clipboard

RETEKESS TD157 support

Open klasik16 opened this issue 1 year ago • 0 comments

I am looking for solution to triger pagers of RETEKESS TD157 series.

Hardware which is used: Arduino mega 433 receiver and transmiter Logic Analyzer RTL-SDR dongle

Software: Arduino IDE PulseView URH

Reserch timeline:

2024/10/30

  1. Read message using RCSwitch Library and emulate signal- failed

There is code whitch one was used:

#include <RCSwitch.h>

RCSwitch mySwitch = RCSwitch();
unsigned long lastReceivedTime = 0;  // Variable to store the last received time
const unsigned long cooldownPeriod = 1000;  // 1 second cooldown period
const unsigned long replyDelay = 10000; // 10 seconds delay before sending a reply
bool messageProcessed = false;  // Flag to indicate if a message has been processed
bool replySent = false; // Flag to indicate if a reply has been sent
unsigned long lastReceivedValue = 0; // Store the last received value

void setup() {
  Serial.begin(9600);  // Start serial communication
  mySwitch.enableReceive(0);  // Enable receiver on pin 0
  pinMode(12, OUTPUT); // Set pin 12 as output
  digitalWrite(12, HIGH); // Set pin 12 high at initialization
}

void loop() {
  // Check if there is any signal received
  if (mySwitch.available()) {
    unsigned long receivedValue = mySwitch.getReceivedValue(); // Get the received value

    // Check if the value is valid (not 0)
    if (receivedValue == 0) {
      Serial.println("Received Unknown Code");
    } else {
      // Check if enough time has passed and if a message has not been processed
      if (millis() - lastReceivedTime >= cooldownPeriod && !messageProcessed) {
        Serial.print("Received: ");
        Serial.println(receivedValue); // Print the received value

        // Convert the integer to binary and print
        Serial.print("Binary: ");
        Serial.println(toBinary(receivedValue, 24)); // Call the function to get 24-bit binary representation

        // Update the last received time and value
        lastReceivedTime = millis(); // Update the last received time
        lastReceivedValue = receivedValue; // Store the last received value
        messageProcessed = true; // Set flag to indicate a message was processed
        replySent = false; // Reset reply sent flag
      }
    }

    mySwitch.resetAvailable(); // Reset the available state
  } else {
    // If no message is available, reset the processed flag after the cooldown period
    if (messageProcessed && (millis() - lastReceivedTime >= replyDelay)) {
      sendReply(lastReceivedValue); // Send the same received message
      replySent = true; // Set flag to indicate reply has been sent
      messageProcessed = false; // Reset the flag to wait for the next message
    }
  }
}

// Function to send a reply signal
void sendReply(unsigned long replyValue) {
  mySwitch.enableTransmit(13); // Enable transmission on pin 13
  mySwitch.send(replyValue, 24); // Send the reply value as 24 bits
  Serial.print("Reply sent: ");
  Serial.println(replyValue); // Print the reply value
}

// Function to convert integer to binary string for a specified bit length
String toBinary(unsigned long num, int bits) {
  String binaryString = "";
  for (int i = bits - 1; i >= 0; i--) {
    binaryString += String(bitRead(num, i)); // Read each bit and append to the string
  }
  return binaryString; // Return the complete binary string
}

There is result of several buttons what i received:

1st pager:
Received: 4276242
Binary: 010000010100000000010010
Reply sent: 4276242
2nd pager:
Received: 4276258
Binary: 010000010100000000100010
Reply sent: 4276258
3rd pager:
Received: 4276274
Binary: 010000010100000000110010
Reply sent: 4276274
999 Call:
Received: 4292223
Binary: 010000010111111001111111
Reply sent: 4292223

The application it self receives messages but i am not able understand them and when i send them as received no action with devide is happening. I dont understand something. probably reading of signal is made wrong. Its looks like for this model RCSwitch lib is not fits. Tha pagers iside WF480RA chip.

2024/10/30 2) Read singal using Logic analyzer and generate signal manualy (Without library)- failed

i connected logic analyzer to receiver data pin and recorded signal with PulseWiev There is first pager signal image Purchased RTL-SDR dongle to analyze signal better.

2024/11/01 Succes. In image we see that device sends 25 bits instead of 24 as rcswitch supports. Will analyze other pagers and encode binary.

klasik16 avatar Oct 30 '24 08:10 klasik16