RF module and 1cm range

Hello,
I'm playing with the Arduino for about a month, and I've stucked :frowning: I've got: 2 Arduinos, RF transmitter, RF reciever, button and LED. My project is very simple - when I'm pressing the button, LED connected to another Arduino is turning ON. For about a day I was able to control LED from another room and everything worked fine. Yesterday I backed to my project again, and the distance that I was able to reach had shrinked to 1 meter! Today it suprised me with 1-2 centimeters max range. I'm guessing that tomorrow it won't work completely. The best thing is, that I've tried

  1. changing RF modules to new pair
  2. changing power supplies
  3. soldering an external 17cm antenna
  4. even changing the Arduinos.

Anybody can tell me what the hell is going on? It is the same code, same room, and exacly same desk as with the first test.

Thank you!

You have not provided details of your RF modules
You have not posted your program
You have not said how the whole thing is powered - maybe the batteries are flat?
You have not said if it is possible that there is local interference from something else.

...R

I've thought that it's unnecessary if everything worked fine at the first time, but here is what you want:

RF MODULE

433MHz RF ARM AVR AM ASK/OOK

TRANSMITTER CODE

//Arduino UNO (transmitter)

#include <VirtualWire.h>

#define PK_DATATX 12
#define PK_BUTTON 4

#define PK_LED LED_BUILTIN

void setup()
{
    vw_set_tx_pin(PK_DATATX);
    vw_setup(2000);

    pinMode(PK_LED, OUTPUT);

    pinMode(PK_BUTTON, INPUT_PULLUP);
}

void loop()
{

  char *PK_message="";
  
  if(digitalRead(PK_BUTTON)==LOW)
  {
    PK_message="LED12";
	digitalWrite(PK_LED, true);
    vw_send((byte *)PK_message, strlen(PK_message));
    vw_wait_tx();
    digitalWrite(PK_LED, false);
    delay(100);
  }
}

RECEIVER CODE

//Arduino NANO (receiver)

#include <VirtualWire.h>

#define PK_LED LED_BUILTIN
#define PK_DATARX 4

boolean PK_state=false;

void setup()
{
    vw_set_rx_pin(PK_DATARX);
    vw_setup(2000);
    vw_rx_start();

    pinMode(PK_LED, OUTPUT);
}

void loop()
{
    byte PK_buffer[VW_MAX_MESSAGE_LEN];
    byte PK_lenght = VW_MAX_MESSAGE_LEN;

    if (vw_get_message(PK_buffer, &PK_lenght))
    {
      String PK_command;
           
    	for (int i=0; i < PK_lenght; i++)
      {
	      PK_command+=char(PK_buffer[i]);
    	}

      if(PK_command=="LED12") 
      {
        PK_state=!PK_state;
        digitalWrite(PK_LED, PK_state);
      }
    }
}

I've said that I had tried with many power sources: my PC, external power supply and even powerbanks.

Interference? I don't know - that's the reason why I'm asking someone who could have similar problems in the past. But... as I said, it worked about a weak ago without any problems, a day before yesterday it worked for max 1 m, and today it is 1 cm. Interference is increasing from day to day?

Now that I can see what devices you are using I can say that I have no experience with them. If I had known that at the outset I would not have wasted your time.

...R

Ok, finally found a link to an Ebay seller that has these. You could have shortened the response time by
a link to your actual devices.

The link shows power from 3 volts to 12 volts. What are you using and did you try 12 volts?

The picture shows NO antenna is connected to either board. Did you connect correct length antennas?

Since the receiver is super regenerative, is there something to adjust it's frequency? If the receiver is drifting in frequency, that would explain the reduction in distance. Do you have documentation to set the receiver to match the transmitter frequency?

Paul

I'm sorry... next time I will be better prepared to post here.

I've tried with 12 V power supply and 17 cm soldered antenna - now it works at a distance of ~7m. The receiver has got a screw to adjust frequency, but it's glued on the top, so I don't think if that could be a solution (not to mention that I've tried with 4 completely new recievers and transmitters).