Interference between two libraries (rc_switch and DMDESP)

Hi,

I'm stuck on a problem. Here I have a P10 LED panel and a 433Mhz transmitter/receiver pair.

When I put the two functions in the loop and press a button on the remote control I see the code value on the P10 panel screen. It is a numeric value with 7 to 10 characters. I just split the String to see the entire value, a chunk on the first line and the rest on the second line of the panel.

The problem is that the signal reception is terrible. It only works by bringing the control closer, 1 to 2 meters, and keeping the button pressed for a long time.

It's a timer problem between the two libraries, a kind of conflict.

I say this because I already placed the panel only to react by randomly lighting up LEDs when any signal reception occurred. And then the range became tens of meters. I pressed the remote control button and saw some LEDs flash on the panel.

This means that there is nothing wrong with 433Mhz communication, I mean, nothing wrong with the TX/RX modules.

How does this code have to be so that reception of the 433Mhz signal occurs normally, that is, without the problem described above ?

Does anyone have any...try this ?

#include <RCSwitch.h>
#include <DMDESP.h>
#include <fonts/Mono5x7.h>

//----------------------------------------DMD Configuration (P10 Panel)
#define DISPLAYS_WIDE 1 //--> Panel Columns
#define DISPLAYS_HIGH 1 //--> Panel Rows
DMDESP Disp(DISPLAYS_WIDE, DISPLAYS_HIGH);  //--> Number of Panels P10 used (Column, Row)
//----------------------------------------

RCSwitch mySwitch = RCSwitch();

int cron;
String codereceiver,codereceiver_a;

void setup() {
  Serial.begin(115200);
  mySwitch.enableReceive(4);  // Receiver on interrupt 0 => that is pin #2

  //----------------------------------------DMDESP Setup  
  Disp.start(); //--> Run the DMDESP library
  Disp.setBrightness(15); //--> Brightness level
  Disp.setFont(Mono5x7); //--> Determine the font used
  //----------------------------------------

}

void loop() {

//  cron++;
  
  if (mySwitch.available()) {
    codereceiver = mySwitch.getReceivedValue();
    Serial.println( mySwitch.getReceivedValue() );
    mySwitch.resetAvailable();
  }

  codereceiver_a = codereceiver;
  codereceiver_a.remove(0,5);
 
  Disp.loop();
  Disp.drawText(0, 0, codereceiver);
  Disp.drawText(0, 9, codereceiver_a); 

}

Thanks

I'm trying like this, but in terms of range it doesn't compare to the operation of the RC.Switch alone by seeing the remote control code on the serial monitor.

if(!mySwitch.available()) {
   Disp.loop();
   Disp.drawText(0, 0, codereceiver);
   Disp.drawText(0, 9, codereceiver_a); 
  }

It may be impossible because the nodemcu is very busy managing the LEDs on the P10 panel. Therefore, you will not be able to manage the reception of the 433Mhz signal either. Maybe I can achieve my goal only if I add another microcontroller (it could be a PIC, or an ESP01) to receive the 433Mhz signal and send data through digital input pins or via the RX-TX serial to the nodemcu.

In loop, try Serial.println(codereceiver); instead.

I put it on, but it still did the same thing. And it was already there on the line: Serial.println( mySwitch.getReceivedValue() );

Placing this delay(5) improves the reception range of the 433Mhz signal. If you increase it to 6 it generates flickr on the LEDs:

if(!mySwitch.available()) {
    delay(5);
    Disp.loop();
    Disp.drawText(0, 0, codereceiver);
    Disp.drawText(0, 9, codereceiver_a);
  }

I've seen code with 2 loops, but I don't know if it would work.

On the Arduino to set timer1 = 0. we use: TCNT1 = 0;

On esp8266 nodemcu what is the command to do the same thing ? Anybody know ?

I deleted it so you wouldn't waste your time reading my silly mistakes.

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