433 Mhz RF and TF on 1 Arduino board

Hello there I want to ask If there is a possibility to test the communication between transmitter and reciever (both 433 Mhz) on one Arduino board only (I have Arduino Uno there is 5 V and 3,3 V). I have already read somewhere that the signal can´t be transmitted and received "simultaneously". Is it possible to make some delays on the software side, or is it really the problem of the hardware?
I just wanted to know If I can measure the temperature from the sensor DHT11 using TF and RF. and 1 Arduino board. I appreciate any answer, thanks.

Hardware problem - the microcontroller can only do 1 thing at a time, so it can't both send and receive over a software serial like interface to two 433 MHz modules together.

CrossRoads:
Hardware problem - the microcontroller can only do 1 thing at a time, so it can't both send and receive over a software serial like interface to two 433 MHz modules together.

Nitpicking perhaps, but it should be possible to multiplex transmit and receive at the bit level. That is, set the transmit state high or low, read the receive state, repeat. Thus it could be argued that this is a software problem.

I don't know that the commonly used data link libraries (e.g. Radiohead) do this. The difficulty is that dumb link modules require a protocol layer (sync, error detection, etc) to achieve reasonable reliability which complicates writing fine grained non-blocking code.

You need two Arduinos or similar to test a pair of the inexpensive 434 MHz TX/RX modules.

The RX modules require several bits to be received before the internal gain stabilizes appropriately.

It looks I will have to buy the second Arduino board but before I do that I am going to study something in the documentation of Arduino and also those Modules. Nothing is actually multitasking, every single step is a sequence of some information so for me logically it is possible to transmit something, store it in some variable and after some delay Recieve it with the Receiver and display it. But I will keep in my mind everyone´s opinion.

logically it is possible to transmit something, store it in some variable and after some delay Recieve it with the Receiver

No. Radio waves are light and travel at the speed of light, with just 3 nanoseconds delay per meter of travel.

The practical usefulness of your test is debatable :wink: The practical learning experience is however good.

In your test scenario, you know when you send a bit so you can immediately read it back. However, in real life, with separate transmitters and receivers, that will not be the case. But you can make use if it for your 'test'.

I'm a practical person and started the same way as you're going now; in my case using a button to toggle a led using the TX and RX module on one Arduino.

I encountered an issue when I started expanding; one can not (reliably) send e.g. 8 'ones', you need to send an alternating pattern of zeroes and ones for a single bit.

Chapter 2.0 in http://www.airspayce.com/mikem/arduino/VirtualWire.pdf might shine some light on it. And there is this more theoretical document: http://wireless.murata.com/media/products/apnotes/tr_swg05.pdf?ref=rfm.com (which is outsize my league :wink: ). I found both via the virtialwire website.

Hope this helps.

My idea is coming from this czech website https://www.gme.cz/data/attachments/dsh.772-146.1.pdf
where I have found an example of connecting the transmitter and the receiver in the same board.

Because the best and the simplest way how to find these two devices working is to place them on one board.
Hope I will succeed somehow I think it is possible without using any library.

If you just want to test the modules, pulsing the txPin and reading the rxPin will work.

I wrote this when I got my modules and only had one Uno.

/*
  demo sketch for 433Mhz RF link (ITEAD STUDIO)
  devices: http://wiki.iteadstudio.com/433Mhz_RF_Link_kit

  NOTES:
  ** I was a bit worried about the pin layouts on the PCBs, specifically the TX as the above link shows a slightly different pinout
     Seems to be correct though
  ** Received data is inverted on both data pins of the RX module
  ** Reading consecutive data results in random data
*/


// pin definitions
#define PINBUTTON1  4
#define PINBUTTON2  5
#define PINRX433   11
#define PINTX433   12
#define PINLED     13

void setup()
{
  Serial.begin(9600);
  pinMode(PINBUTTON1, INPUT_PULLUP);
  pinMode(PINBUTTON2, INPUT_PULLUP);
  pinMode(PINRX433, INPUT_PULLUP);
  pinMode(PINTX433, OUTPUT);
  pinMode(PINLED, OUTPUT);
}

void loop()
{
  blink();
  //withButtons();
}

void withButtons()
{
  static int previous = HIGH;

  // read button and send data
  int b1 = digitalRead(PINBUTTON1);
  if (previous != b1)
  {
    digitalWrite(PINTX433, b1);
    previous = b1;
    Serial.print(F("Send: "));
    Serial.println(previous);
  }
  delay(50);

  // read back
  int rcvd = digitalRead(PINRX433);

  // set LED
  digitalWrite(PINLED, rcvd);

  // report back
  Serial.print(F("Received: "));
  Serial.println(rcvd);

  delay(1950);
}

void blink()
{
  // send data
  digitalWrite(PINTX433, !digitalRead(PINTX433));

  // short delay required
  // can't delay too long as it will pick up rubbish
  delay(50);

  // read back
  int rcvd = digitalRead(PINRX433);

  // set LED
  digitalWrite(PINLED, rcvd);

  // report back
  Serial.print(F("Send / Received: "));
  Serial.print(digitalRead(PINTX433));
  Serial.print(F(" / "));
  Serial.println(rcvd);

  // after testing withButtons() that sometimes gives inconsistant result
  // test if blink also gives inconsistent results; it will if we either send only ones or only zeroes (not really blink)
  if (digitalRead(PINTX433) == rcvd)
  {
    Serial.println(F("EQUAL"));
    //for (;;);
  }

  // wait a bit
  delay(950);
}

The comments were clear enough for me when I wrote it; not sure if they still are :wink:

Note that you can not reliably transmit data like this.

sterretje:
If you just want to test the modules, pulsing the txPin and reading the rxPin will work.

I was thinking about this and came up with this simple minded sketch to transmit and receive a PWM signal from a single Arduino. The thought was to use PWM because that is implemented in hardware so the transmit signal could be set up and left running. Then the software is free to go off and measures the parameters of the received signal without any fancy task multiplexing.

One feature of this implementation is that, watching the serial output terminal, one can see bursts of errors in the received signal, supporting the idea that robust communications with these modules requires more sophisticated coding and error detection. In my testing it was also apparent that the receiver tended to get lost at the very low or very high percent duty cycle settings.

/*
  Test inexpensive 433 MHz OOK receiver and transmitter pair using single Arduino.

  Sketch sets a PWM signal to the transmitter then measures the pulse duty cycle 
  from the receiver and prints both transmit and receive parameters to the serial port.
*/

#define pwmOutPin 3   // PWM output pin - goes to transmitter data input
#define pwmInPin 8    // PWM input pin - from receiver data output
#define ledPin 13     // Uno LED pin for activity indictor
#define pwmInTimeout 10000  // pulsein timeout in microseconds

boolean ledState = LOW ;

void setup() {
  pinMode(ledPin, OUTPUT) ;
  Serial.begin(115200) ;
}

void loop() {
  /* Cycle through PWM values 0-255 */
  for (int pwmOutValue = 0; pwmOutValue < 256; pwmOutValue++) {
    /* Toggle LED each time PWM value is set to indicate activity */
    ledState = !ledState ;
    digitalWrite(ledPin, ledState) ;
    
    /* Set PWM output value to transmitter */
    analogWrite(pwmOutPin, pwmOutValue) ;
    delay(100) ;
    
    /* Measure duration of received PWM signal */ 
    int pwmInHigh = pulseIn(pwmInPin, HIGH, pwmInTimeout) ; // Measure duration of pulse high
    int pwmInLow = pulseIn(pwmInPin, LOW, pwmInTimeout) ;   // Measure duration of pulse low

    /* Print transmitted and measured received duty cycle */
    Serial.print(pwmOutValue * 100 / 256) ;   // Print PWM out as percent
    Serial.print(" ") ;
    Serial.println(pwmInHigh / ((pwmInHigh + pwmInLow) / 100)) ;  // Print PWM in as percent
    delay(100) ;
  }
}

Yes, OOK is not great really. Transceiver modules are the way to go, programmable modulation type,
baud rate, bandwidth and channel with proper packets.