Transmission trouble with RX/TX modules

Hello!
I’m using RX 433mhz and TX 433mhz. They both worked properly 2 weeks ago, but since yesterday I’m having an issue which I could not identify the cause. I don’t receive anything from the emitter. I try to use the transmitter and receiver simple examples (in Virtualwire library), but the result is the same.

Here is the emitter’s code:

// transmitter.pde
//
// Simple example of how to use VirtualWire to transmit messages
// Implements a simplex (one-way) transmitter with an TX-C1 module
//
// See VirtualWire.h for detailed API docs
// Author: Mike McCauley (mikem@airspayce.com)
// Copyright (C) 2008 Mike McCauley
// $Id: transmitter.pde,v 1.3 2009/03/30 00:07:24 mikem Exp $

#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
    vw_set_tx_pin(12);
}

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

    digitalWrite(13, true); // 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, false);
    delay(200);
}

Here is the receiver’s code:

// receiver.pde
//
// Simple example of how to use VirtualWire to receive messages
// Implements a simplex (one-way) receiver with an Rx-B1 module
//
// See VirtualWire.h for detailed API docs
// Author: Mike McCauley (mikem@airspayce.com)
// Copyright (C) 2008 Mike McCauley
// $Id: receiver.pde,v 1.3 2009/03/30 00:07:24 mikem Exp $

#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

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

void loop()
{
    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, true); // 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, false);
    }
}

The most weird thing is in the serial monitor instead of “setup”, I just receive “se”.
Could someone help please?

What pin are you using on the receiving end?

I'm using the digital pin 11 to receive data.

What happens when you take out,

vw_set_ptt_inverted(true); // Required for DR3100

I removed this line but there's no change :frowning:

The most weird thing is in the serial monitor instead of "setup", I just receive "se".

This here is an indication that your arduino is crashing. Could be a memory issue. Let me ask you this, from when you had it working to now, was anything changed? Any wires moved, did you drop the arduino, did you change the power supply, anything at all?

You have two arduinos, so does the problem tranfer over if you swap boards?

HazardsMind:
This here is an indication that your arduino is crashing. Could be a memory issue. Let me ask you this, from when you had it working to now, was anything changed? Any wires moved, did you drop the arduino, did you change the power supply, anything at all?

It is? I had the issue of not always getting a full response from rx/tx on a bluetooth module, but found that inserting delay(200) in the code fixed the problem. Should I be concerned?

instead of "setup", I just receive "se".

You only get "se", so it could be a memory issue. If you want, add in the delay. If anything you'll get the full "setup" but will it fix the problem totally, I dont know.

@HazardsMind & tbradt Thank you for your answers ,
I have been using the 2 arduini since a month, I’m a newbie :slight_smile: .I have never dropped them. Even I switched them, the issue remains.
The good news is your suggestion about the delay work, now I have the full word “setup”.
But I haven’t receive the message “hello”?

It seems as if the receiver is either crashing, or locking up with interrupts disabled, at some point shortly after calling setup().

To find out where it’s happening, I suggest you put a delay(10) call in after each Serial.print to allow time for the transmission to complete before the sketch moves on, and then do the same for additional print statements after each call until you find where it’s stopping. Then you can look at the source for the call in progress when the problem happens, and look for possible reasons for it to hang/crash, adding debug within the library if necessary to find out exactly where it’s going wrong. It might be something simple like a wiring fault or electrical problem preventing the RX module from responding properly, but once you know what’s happening you’ll be better placed to figure out why it’s happening…

Try this, vw_set_rx_pin( 8 ); and move the receiving wire to pin 8.

To find out where it's happening, I suggest you put a delay(10) call in after each Serial.print to allow time for the transmission to complete before the sketch moves on, and then do the same for additional print statements after each call until you find where it's stopping.

I'd prefer a Serial.flush() after each Serial.print(). Assuming that you are using 1.0+, flush() blocks until the serial data has been shifted out. Similar to what delay() does (preventing other things from happening) but only until the data has been sent.

Thank you all,

I have tried all your suggestions but until now I don't receive anything.
I tested the entire program and I noticed that all the Serial.print that are outside the void.setup() [exactly after "vw_setup(2000)" ], don't print at all.
Maybe it's a problem with the boards but before buying new ones I'd like to download another Virtualwire library to see...

Just to inform those who were helping me that my programs are working now :slight_smile:
I just remove my arduino software and download a new one !!!