433MHz Simple RF Link Kit

Hi

Is there anyway to use an Encrypt Key on the <VirtualWire.h> Arduino code?

https://www.google.com/search?q=Grove+-+433MHz+Simple+RF+Link+Kit&client=firefox-a&hs=0af&rls=org.mozilla:en-US:official&tbm=isch&tbo=u&source=univ&sa=X&ei=-k1IUra5DOTC2QX_koGoCA&ved=0CEsQsAQ&biw=1191&bih=683&dpr=0.9

Demo Code I found.
TX

#include <VirtualWire.h>
 
//Grove - 315(433) RF link kit Demo v1.0
//by :http://www.seeedstudio.com/
//connect the sent module to D2 to use  
#include <VirtualWire.h>
 
int RF_TX_PIN = 1;
 
void setup()
{
  vw_set_tx_pin(RF_TX_PIN); // Setup transmit 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 400ms.
  delay(400);
 
}

RX

#include <VirtualWire.h>
 
int RF_RX_PIN = 0;
 
void setup()
{
  Serial.begin(9600);
  Serial.println("setup");
  vw_set_rx_pin(RF_RX_PIN);  // Setup receive pin.
  vw_setup(2000); // Transmission speed in bits per second.
  vw_rx_start(); // Start the PLL receiver.
}
 
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("");
  }
}

Is there anyway to use an Encrypt Key on the <VirtualWire.h> Arduino code?

You can encrypt the data before sending it, and decrypt it on the other end. The VirtualWire library doesn’t do encryption/decryption nor does it care that you have encrypted the data to be sent.

So if I were to use two sets of module at 433mhz in my home, how do I have the rx module's read
the different data? Would I have to some how Encode/decode or auto learning like they use one
Garage Door Openers Transmitter.

how do I have the rx module's read the different data?

What different data? Do you mean the encrypted data? The VirtualWire library reads the number of bytes you tell it to read. It really doesn't care if those bytes are were encrypted before being sent. A byte is a byte.

Would I have to some how Encode/decode or auto learning like they use one
Garage Door Openers Transmitter.

The rolling code used in garage door openers has nothing to do with encryption. It's probably time to change out of the tap dancing shoes and talk about your specific project.

What I want to know is if you were to have (arduino to 433hmz TX to Rx 433hmz arduino) and you had
another one in the same room. (arduino to 433hmz TX to Rx 433hmz arduino).
How do you keep them from interfering with each other on the Rx input of data.

Project one =(arduino to 433hmz TX to Rx 433hmz arduino) Sending data = (1234). Receiver = (1234).

Project two =(arduino to 433hmz TX to Rx 433hmz arduino) Sending data = (abcd). Receiver = (abcd).

How do I know is the data from project one going to get to the Receiver = (1234) and not go to the
Receiver = (abcd) Project two?

What I want to know is if you were to have (arduino to 433hmz TX to Rx 433hmz arduino) and you had
another one in the same room. (arduino to 433hmz TX to Rx 433hmz arduino).
How do you keep them from interfering with each other on the Rx input of data.

You buy better radios.

How do I know is the data from project one going to get to the Receiver = (1234) and not go to the
Receiver = (abcd) Project two?

You don't. If you have two people talking to you at the same time, how do you keep track of who said what? The problem is that you don't. The fact that one person wasn't intending to talk to you doesn't matter.

You get what you pay for. You paid very little, and that's what you got.

How do I know is the data from project one going to get to the Receiver = (1234) and not go to the
Receiver = (abcd) Project two?

You put a unique identifier in each data packet which the receivers look for. All the receivers listen to the single transmitter. A data packet for receiver "a" might start with an "a" like "a1234", "b" receiver data might start with a "b" like "b1234", etc.

A data packet for receiver "a" might start with an "a" like "a1234", "b" receiver data might start with a "b" like "b1234", etc.

Of course, the data might arrive looking like "a1b1232344", and then you've got a mess on your hands.

No, the Virtual Wire library uses Manchester Coding which has inherant error detection in it .
You either get the correct result or in this case, you wont get any data output.
And thats the other issue, if both transmitters transmit at once , neither transmission will be received.
If its necessary to have to separate radio channels in close proximity, then you need 2 separate radio channels
which could be done by using both 433 and 315 Mhz radios.

You could do it with the same channel but you would have to implement some sort of reverse message protocol requiring TX & RX facilities at both ends.

One possible scenario is where the receiving end requests data from the transmitting end by sending a short message and waiting for a period of time. If no valid data is received it will resend the request.

Alternatively the transmitting end just sends data and waits for an acknowledgement from the receiving end. If it gets no valid acknowledgement it assumes either the transmission or the acknowledgement were corrupted by a collision and repeats the transmission.

In both cases the waiting periods must be different on each TX/RX pair so that if there is a data collision at any time the next transmission will avoid it.