Go Down

Topic: RF module 1cm range (Read 329 times) previous topic - next topic

PK_

Hello,
I'm playing with the Arduino for about a month, and I've stucked :( 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!

jremington

For informed help, please read the "How to use this forum" post and follow the directions.

PK_

RF MODULE
433MHz RF ARM AVR AM ASK/OOK


TRANSMITTER CODE
Code: [Select]
//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
Code: [Select]
//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 tried with many power sources: my PC, external power supply and even powerbanks.

Interference? 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?

CrossRoads

Have you put antenna wires on them? 17cm of 30 gage single strand wirewrap wire worked on my project, transmitter is a remote powered from single LiPo powering a 8MHz Promini, receiver is 5V powered and receives from up to 50 feet away in a large open room.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

PK_

Yes I have and the distance has increased to ~7m. The thing that really annoy me is, that it has worked fine without any antennas or higher voltage, now it don't. Everything is same as in the first test.

jremington

#5
May 31, 2017, 05:40 pm Last Edit: May 31, 2017, 05:50 pm by jremington
Quote
Everything is same as in the first test.
Obviously, everything is not "the same".  You have not figured out what changed.

I get about 300 meters line of sight range using those modules, and balanced dipole antennas, as shown below (33 cm from tip to tip, connect inner ends to ANT and GND on each module):



ElCaron

I tested those once and I can confirm jremington's range. It penetrated two walls and a good 100-200m of forest and shrubberies. I used either straight wire of appropriate length, or a spring antenna from Aliexpress, but certainly not more.

Go Up