2km Long Range RF

319 views
Skip to first unread message

Paul Ma

unread,
Jan 16, 2017, 2:32:30 AM1/16/17
to virtualwire
Hi everyone,
I am newbie in this area so apologizes for silly questions.
I have a 2KM Long Range RF and arduino UNO ( as receiver ) and arduino Mega2560 ( as transmitter) trying to send simple data. My researches lead me to use VirtualWire and I using VirtualWire version 1.15 ( downloaded from here ).
It sounds like I am not receiving anything. Any help would be appreciated.

Here is the code for Transmitter:
#include <VirtualWire.h>

    int RF_TX_PIN = 2;

    void setup()
    {
      vw_set_tx_pin(RF_TX_PIN);
      vw_setup(2000); // Transmission speed in bits per second.
    }

    void loop()
    {
      const char *msg = "hello";
      vw_send((uint8_t *)msg, strlen(msg));  // Send 'hello' every 4000ms.
      vw_wait_tx();
      delay(4000);
    }

and code for receiver:
#include <VirtualWire.h>

    int RF_RX_PIN = 2;

    void setup()
    {
      Serial.begin(9600);
      Serial.println("setup");
      vw_set_rx_pin(RF_RX_PIN);  
      vw_setup(2000);
      vw_rx_start();
    }

    void loop()
    {
      uint8_t buf[VW_MAX_MESSAGE_LEN];
      uint8_t buflen = VW_MAX_MESSAGE_LEN;
      if(vw_get_message(buf, &buflen)) // non-blocking I/O
      {
        int i;
        // Message with a good checksum received, dump HEX
        Serial.print("Got: ");
        for(i = 0; i < buflen; ++i)
        {
          Serial.print(buf[i], HEX);
          Serial.print(" ");
          //Serial.print(buf[i]);
        }
        Serial.println("");
      }
    }

Thanks

James Hamilton

unread,
Jan 16, 2017, 2:45:16 PM1/16/17
to virtu...@googlegroups.com
Wow, they haven't provided too much documentation for that tx/rx pair, have they?

Have you soldered the pads on the underside with the desired "address" code?  It looks like these chips are meant to encode both address and data, but those specific boards are set up for hardwired address (via the solder pads) and then 4 data bits (D0-D3).  For proper communication, the address pads need to match on the TX and RX side, and I suspect that it does not behave nicely if the pads are left unsoldered (floating).

I would try testing using a similar layout shown in the images that come with the "manual", using push-buttons on the TX side and LEDs on the RX side (no Arduino needed) to test to make sure that any signal is moving between the TX/RX paid before trying to send data across.

Also, VirtualWire has been deprecated in favor of RadioHead: http://www.airspayce.com/mikem/arduino/RadioHead/

Cheers,

~James

--
You received this message because you are subscribed to the Google Groups "virtualwire" group.
To unsubscribe from this group and stop receiving emails from it, send an email to virtualwire+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Mike McCauley

unread,
Jan 16, 2017, 3:28:59 PM1/16/17
to virtu...@googlegroups.com, Paul Ma
Hello,

VirtualWire is not designed for use with that kind of device.
You probably dont even need an Arduino with that one, if you just want to send
1 to 4 switch positions.

VirtualWire is now obsolete and replace by RadioHead.

On Sunday, January 15, 2017 11:32:30 PM Paul Ma wrote:
> Hi everyone,
> I am newbie in this area so apologizes for silly questions.
> I have a 2KM Long Range RF
> <http://wiki.seeed.cc/2KM_Long_Range_RF_link_kits_w_encoder_and_decoder/>
> and arduino UNO ( as receiver ) and arduino Mega2560 ( as transmitter)
> trying to send simple data. My researches lead me to use VirtualWire and I
> using VirtualWire version 1.15 ( downloaded from here
> <https://www.pjrc.com/teensy/td_libs_VirtualWire.html> ).
--
Mike McCauley VK4AMM mi...@airspayce.com
Airspayce Pty Ltd 9 Bulbul Place Currumbin Waters QLD 4223 Australia
http://www.airspayce.com
Phone +61 7 5598-7474

Fazeleh Kazemian

unread,
Feb 26, 2017, 9:02:52 PM2/26/17
to virtualwire
Hi
I use

FS1000A / XY-MK-5V 433Mhz TX/RX Module (WIFI)

So I can't use virtualwire and I have to use RadioHead ?
Why is RadioHead better that virtualwire?
Thank you

James Hamilton

unread,
Feb 26, 2017, 9:14:02 PM2/26/17
to virtu...@googlegroups.com
You don't have to switch to RadioHead, but it is a better option.  It is developed by the same person who wrote VirtualWire, and it has many improvements.  VirtualWire is no longer being maintained.  Some information on the added benefits of using RadioHead instead of VirtualWire are addressed on the VirtualWire homepage:

Documentation for RadioHead is on its homepage:

Cheers,

~James

--

Fazeleh Kazemian

unread,
Feb 26, 2017, 9:35:52 PM2/26/17
to virtu...@googlegroups.com
How long can we send by virtualwire and this new library?
Can I send integer or string by RadioHead ? because I could sent them by virtualwire and usually I miss my character!

--
You received this message because you are subscribed to a topic in the Google Groups "virtualwire" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/virtualwire/VY8NveWo3jE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to virtualwire+unsubscribe@googlegroups.com.

Mike McCauley

unread,
Feb 26, 2017, 9:43:50 PM2/26/17
to virtu...@googlegroups.com
VirtualWire is obsolete and no longer maintained. Radiohead is more flexible and modern and maintained. You choose 


Sent from my iPhone
--
You received this message because you are subscribed to the Google Groups "virtualwire" group.
To unsubscribe from this group and stop receiving emails from it, send an email to virtualwire...@googlegroups.com.

Fazeleh Kazemian

unread,
Feb 27, 2017, 9:53:58 PM2/27/17
to virtu...@googlegroups.com
Thank you so much, I'm using Radiohead now but I was wondering if I could send integer, I have two integer and I want to send them to another arduino and receive them and save them as two variables. Would you please help me?

To unsubscribe from this group and stop receiving emails from it, send an email to virtualwire+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to a topic in the Google Groups "virtualwire" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/virtualwire/VY8NveWo3jE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to virtualwire+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages