2

Good afternoon! This question is still relevant to me. I use the receiver module in conjunction with arduino. I want to use my own transfer protocol and now I need to accept it. I tried to use various libraries, but all without success. I need to somehow select a sequence of pulses and then determine their values ​​(zero or one) by the duration of the pulses. But first, I need to determine the beginning of the signal from the preamble (12 pulses at the beginning). I wrote a program that draws a graph where you can see the entire sequence. Is it possible to define this preamble without using libraries, for example, to make a cycle that will measure the length of the pulses, and there are 12 times the duration of the pulses will be the same, then this is the preamble, followed by digital data.

#define IN_PIN 2
void setup() 
{
  Serial.begin(115200);
}

void loop() 
{
  bool s = digitalRead(IN_PIN);
  Serial.println(s);
}

enter image description here

enter image description here

2
  • 1
    it is not possible to guess what is wrong ... we do not know what you connected, how you connected it, and what code you ran
    – jsotola
    Jul 15, 2021 at 17:26
  • I am trying to plot a graph and see the low and high levels there, which I transmit with my transmitter. To do this, I use the program to read data from the analog port of the arduino, to which the 433 MHz receiver module is connected. However, nothing is accepted.
    – Антон
    Jul 16, 2021 at 9:25

1 Answer 1

1

It is not working because of:

SPEED

Consider the frequency of the 433Mhz device vs. the speed of the serial monitor. The device sends signals with pulse width in the range of tens of microseconds while the serial monitor can't display that fast.

Your code should analyze the signals, clean the noise (the output of the device is very noisy) and figure out the protocol. All that is done by dedicated libraries such as rc-switch which is very extensive and robust compared to just reading a pin and plotting the output.

DIGITAL

The recover device is outputting a digital pulse which based on it's pulse width changes one can figure out the sequence of numbers sent by the remote control. Each such ASK protocol has it's timing characteristics which you should follow in order to decode the code.

If you want to experiment with that vs. using a ready made library you should start with a code similar to the example below.

void setup() {
  Serial.begin(6000000);
  attachInterrupt(digitalPinToInterrupt(1), handleInterrupt, CHANGE);
}

void loop() {
}

void handleInterrupt() {
  bool s = digitalRead(1);
  Serial.println(s);
}

Just pay attention to the timing issue, this code will show a lot of data but not necessarily (almost for sure) not all the data, but you can avoid the serial print and use the data for analysis.

4
  • Thank you. But unfortunately I can't get absolutely anything with your code. I tried to figure out the library, but I didn't get any data. As I understand it, the library works strictly according to a certain protocol, and the pulses that I send, it takes for noise, maybe.
    – Антон
    Jul 17, 2021 at 4:25
  • Also the module you are using is limited to ASK so if you are sending anything else it will not be detected. As for code sample, not that it's listening on interrupt pin 1 (PA23_TC4-W1 on MKR 1010 WIFI), check with your Arduino what pin number it should be showing in order to work and transmit from a compatible device or remote control.
    – Nino
    Jul 17, 2021 at 8:02
  • Как то мне здесь помог человек при решении подобной задачи, он поделился кодом, который из частот уровня лишь частоту 1 кГц и уже на ней сигнал анализировался. Это было Гомодинное обнаружение. Сейчас я не знаю заранее точной частоты, которую нужно построить, пробовал использовать код, на обнаружение 1 кГц, но он не обнаруживает мой сигнал. Мне нравится этот код тем, что он позволяет установить АЦП ардуино в режиме прямого преобразования, то есть обрабатывать сигнал очень быстро. Подскажите, как можно оставить этот режим работы АЦП, но убрать выделение сигнала 1 кГц?
    – Антон
    Jul 17, 2021 at 12:40
  • @Edgar Bonet, I used your code to detect a 1 kHz harmonic signal. Tell me how I can use it to detect a rectangular pulse with a duration of 640 μs?
    – Антон
    Jul 18, 2021 at 3:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.