4
\$\begingroup\$

I'm trying to get an RF transmitter/reciever pair from digikey to work with my Arduino Uno/Mega ADK. But it seems neither the transmitter nor the reciever example are working with any of my Arduinos. At the moment I focused on the transmitter for now (hooked up the UNO) as its more obvious to tell when its working or not. I'm using Arduino IDE 1.0.1 with VirtualWire 1.9 (the one coming with 1.0.1 didn't compile).

Now when I understand the sketch correctly this should send "hello" in an infinite loop and blink the onboard LED everytime. When I reset the Arduino UNO I can see the TX LED blink once for a very short amount of time (which is the serial.print I guess) and after that the onboard LED is just constantly glowing. I have honestly no idea why this isn't working. Everything looks correct to me.

The model name of the transmitter is QAM-TX2-433-ND but I guess this is more of a code than a hardware problem? Though here is the datasheet of the transmitter if thats of any help: http://www.quasaruk.co.uk/acatalog/DSQAM-TX2-2.pdf

This is the code of the transmitter example from the VirtualWire libary

#include <VirtualWire.h>

void setup()
{
    Serial.begin(9600);   // Debugging only
    Serial.println("setup");

    // Initialise the IO and ISR
    //vw_set_ptt_inverted(true); // Required for DR3100
    vw_setup(2000);  // Bits per sec
}

void loop()
{
    const char *msg = "hello";

    digitalWrite(13, HIGH); // Flash a light to show transmitting
    vw_send((uint8_t *)msg, strlen(msg));
    vw_wait_tx(); // Wait until the whole message is gone
    digitalWrite(13, LOW);
    delay(200);
}

And here two pictures of the hook up to the arduino: enter image description here

close up of the transmitters pin-out

EDIT: Ok so the LED problem was super simple, I just didn't specified PIN13 as output. Though I still don't know if the transmitter is acutally sending something, I have my ADK hooked up to the reciever and its running the reciever example from the VirtualWire libary. It should blink and print the "hello" message via serial but its not doing that. Now its hard to say if this is a reciever or transmitter problem now.

Reciever sketch:

#include <VirtualWire.h>

void setup()
{
    Serial.begin(9600); // Debugging only
    Serial.println("setup");
    pinMode(13,OUTPUT);
    // Initialise the IO and ISR
    //vw_set_ptt_inverted(true); // Required for DR3100
    vw_setup(2000);  // Bits per sec

    vw_rx_start();       // Start the receiver PLL running
}

void loop()
{
    //Serial.println("Recieving...");
    uint8_t buf[VW_MAX_MESSAGE_LEN];
    uint8_t buflen = VW_MAX_MESSAGE_LEN;

    if (vw_get_message(buf, &buflen)) // Non-blocking
    {
    int i;

        digitalWrite(13, HIGH); // Flash a light to show received good message
    // Message with a good checksum received, dump it.
    Serial.print("Got: ");

    for (i = 0; i < buflen; i++)
    {
        Serial.print(buf[i], HEX);
        Serial.print(" ");
    }
    Serial.println("");
        digitalWrite(13, LOW);
    }
}

Deleting the if (vw_get_message(buf, &buflen)) statment gives me alot of garbage on the serial monitor, so I can recieve atleast something.

And here two pictures of the circuit again (forgot to insert the data cable for the photo, it was connected to the second pin from left to the reciever and to pin 0 on the arduino):

enter image description here

enter image description here

And the datasheet: http://www.quasaruk.co.uk/acatalog/DSQAM-RX4-1.pdf

\$\endgroup\$
  • \$\begingroup\$ Sounds like a software problem right now to me. The fact the onboard LED is stuck 'on', looks like it might be waiting at vw_wait_tx() before it will continue operation. \$\endgroup\$ – dext0rb Dec 30 '12 at 19:37
  • \$\begingroup\$ I tried it with vw_wait_tx() commented out but I had the same result. \$\endgroup\$ – PTS Dec 30 '12 at 20:00
  • \$\begingroup\$ I had a problem using this RX module. I almost got crazy when I decided to contact Quasar. PIN 6 should be left N/c !!!!!!!! Datasheet is wrong !! Regards \$\endgroup\$ – user45947 Jun 20 '14 at 7:43
  • \$\begingroup\$ Yes, Gonzalo S, it is likely to be an AF output before the data splicer, if this module is following the trends set in other modules. However the question didn't cover this. \$\endgroup\$ – James Cameron Jun 20 '14 at 9:16
5
\$\begingroup\$

The problem seems to be rather banal.

You forgot to properly set:

pinMode(13,OUTPUT);

in the setup() function.


Incidentally, your code should actually be working, with the exception that the LED state is likely constant. It should be transmitting anyways.


Further Edit:

Ok, I've dug into the virtualwire library a bit more, and I think I see the problem

Mainly, the default configuration for the VirtualWire library TX pin is pin 12.

Basically, you have connected the transmitter to the wrong pin (in the pictures, you have it connected to pin 1).


Adding a TX activity LED to the module:

Note that this will only work properly with vw_set_ptt_inverted(true); commented out.

\$\endgroup\$
  • \$\begingroup\$ Oh thats true but shouldn't I see TX blink aswell whenever "hello" gets send? LED is blinking now but TX is still always off. Thats whats actually concering me that nothing gets send through the TX pin apparently. \$\endgroup\$ – PTS Dec 30 '12 at 20:04
  • 1
    \$\begingroup\$ @PaulGreen - Do you mean the built-in "TX" LED on the arduino? That will only blink when the serial connection to the computer has activity on it. The virtualwire library will not cause it to become active. \$\endgroup\$ – Connor Wolf Dec 30 '12 at 20:07
  • \$\begingroup\$ Remember, in your setup, you have two TX lines. The one between the Arduino and your computer, which is the one with the TX led on it. The wireless transmitter has a separate TX line, and there is no LED on that. \$\endgroup\$ – Connor Wolf Dec 30 '12 at 20:09
  • \$\begingroup\$ oh I see, I didn't know that! I will try and see if the MEGA is recieving anything now. \$\endgroup\$ – PTS Dec 30 '12 at 20:10
  • \$\begingroup\$ It should be possible to wire up another LED on your breadboard to give you a activity indication for the wireless transmitter TX line too. \$\endgroup\$ – Connor Wolf Dec 30 '12 at 20:13

protected by Dave Tweed Feb 25 '18 at 14:48

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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