Hello to all, I have a project in developement which is as follows,

I have a bank of LEDs in a field. they are arduino UNO controlled. I need to send a wireless signal to the arduino. the signal will be triggered by a PIR motion detector. this sensor will be 30 to 40 meters away (approx.) from the arduino. this signal will stop a timer in the arduino as soon as the sensor detects motion.
I have used a PIR sensor connected to a NANO board which relayed the signal trough a 433 MHz radio transmitter. The receiver was attached to the UNO next to the banks of lights.
I prototyped this arrangement in my garage and used a switch to verify the program. everything worked fine. I then substituted the switch for the PIR sensor arrangement but started to get false triggers. The radio reciever appears to be stopping the timer in the program even though the transmitter was not powered up!!! Any advice on the best possible way to send this signal would get me out of this predicament. Thanks in advance

Code? Schematic? Hard to troubleshoot what you can't see.

Please read the How To Use This Forum post. It has somebody posting guidelines that will help you get the best help. Please use code tags when you post the code.

Sorry about the delay with this . My power supply went misisng. Anyway, this code works fine with a button/ switch. When I change out the switch for the 433MHz receiver the "elapsed time " is displayed on the monitor without the transmitter powered up . I have read about these cheap transmitter / receivers generating lots of noise. I’m new to this so I don’t know if this is the right way to send a signal to my ARDUINO UNO. As mentioned , I just need a signal to my ARDUINO from 30 to 40 meters , without a wired connection.

#include <VirtualWire.h>

const byte LED_1 = 2;
const byte LED_2 = 3;
const byte LED_3 = 4;
const byte BUTTON = 11;
const byte SENSOR_2 = A5;
const byte buzzer = A2;
const byte LED_RED = A1;
unsigned long start, finished, elapsed;
boolean   timeTrigger = 0;
void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600); //Set baud rate.

  vw_set_ptt_inverted(true); // On a communication line means that each
  // party is either transmitting or receiving ( like a walkie talkie)
  vw_set_rx_pin(A5); // set receiver pin
  vw_setup(2000);  // Bits per sec
  vw_rx_start();       // Start Phase Locked Loop (listening to the receiver)

  // Open serial monitor to read random numbers.

  pinMode (LED_1, OUTPUT);
  pinMode (LED_2, OUTPUT);
  pinMode (LED_3, OUTPUT);
  pinMode (BUTTON, INPUT);

  pinMode (SENSOR_2, INPUT);

  pinMode (buzzer, OUTPUT);
  pinMode (LED_RED, OUTPUT);
void loop() {

  uint8_t buf[VW_MAX_MESSAGE_LEN]; // 80 bytes is messgage length
  uint8_t buflen = VW_MAX_MESSAGE_LEN;
  if (vw_get_message(buf, &buflen)) { // if message received
    if (buf[0] == 'X') { // and if the first letter in message array is X
       digitalWrite(LED_RED , HIGH);
 boolean lastButtonState = 0;
 boolean buttonState_1 =digitalRead(BUTTON);   
 boolean buttonState_2 =  digitalRead(SENSOR_2);

      if (buttonState_1 != lastButtonState) {
        if ( buttonState_1 == HIGH) {
          timeTrigger = 1;
          start = millis();

      lastButtonState = buttonState_1;
      if ( buttonState_1  == HIGH   ) {
        tone(buzzer, 500); 
       if (buttonState_1==1){
    digitalWrite(LED_1, HIGH);
    digitalWrite(LED_2, HIGH);
    digitalWrite(LED_3, HIGH);


    digitalWrite(LED_1, LOW);
    digitalWrite(LED_2, LOW);
    digitalWrite(LED_3, LOW);

  if (buttonState_2 == 1 && timeTrigger == 1) {
    digitalWrite(LED_RED, LOW);
    finished = millis();
    timeTrigger = 0;
    elapsed = finished - start;
    Serial.println(" milliseconds elapsed");
  } }

It looks like you're trying to read VirtualWire data "messages" from pin A5 as well as just looking for the on/off status with digitalRead(). You should not attempt to do both. Which one do you actually want?

Thanks MorganS, I just want a signal in to the arduino from a PIR sensor. I thought I could use Radio message to accomplish this. I would prefer to read the on/off status and use the result as an input. is this doable?

In order to use VirtualWire, you need to have two Arduinos, one controlling the transmitter and one reading the receiver.

Get the simple example that comes with the VirtualWire library to work properly before adding in the PIR and the lights.

yes I have looked at the example with the virtual wire and yes , I am using 2 arduinos. A (NANO) for the transmitter and PIR sensor . The other arduino( UNO) to process the signal from the transmitter via a receiver and to update the program. My problem is that the program works perfectly using a switch as a means to stop the millis() and update the serial monitor with the elapsed time but when I replace the switch on pin A5 with a data signal from the receiver pin the millis () updates the serial monitor with elapsed time even though i'm not transmitting a signal. I have disconnected the transmitter to see if that's the issue but the receiver still triggers the millis().

I also have a RED LED in the program which comes on when the signal is being transmitted (PIR WORKING) and received. when the signal is not present the RED LED turns off. ( as per program).

but the millis still updates without the signal?????????? This is my delima. Hence my loss of faith in the cheap 433MHz transmitter and receiver set up and this is why I would like to try some other means of sending a signal to my ARDUINO UNO. So if anybody has used some other way to get a signal to an arduino from 30 to 40 meters without a wired cable I would love to know and try. It's either that or my program is not written correctly for a radio signal?

Have you, or have you not tried the suggestion in reply #5? You only said you "looked at the example".

Hello again to all the people who have given me great advice regarding this issue. I have re-written this program and have a better understanding of where my issues lay. even though I had the simple example in
the Virtual library working, my understanding of it took a while. If the cheap 433MHz radio combo. had a soul and an address I would offer my apppoligies!!! I have the Radio combo working to my satisfaction. It was a simple fix in th end.

 void loop() {
 boolean value_1 = 0;
   uint8_t buf[VW_MAX_MESSAGE_LEN]; // 80 bytes is messgage length
  uint8_t buflen = VW_MAX_MESSAGE_LEN;
if (vw_get_message(buf, &buflen)) { // if message received
    if (buf[0] == 'X') { // and if the first letter in message array is X
      value_1 = 1;

I needed a variable ( value _1) controlled by the 'if' statement as above. this in turn is used further down the code to enable the code to work properly.

 if (  timeTrigger == 1&& value_1 ==1) {  
    digitalWrite(LED_RED, LOW);
    finished = millis();
    timeTrigger = 0;
    value_1 =0;
    elapsed = finished - start;
    Serial.print(" milliseconds elapsed = ");

A basic fix I'm sure ,but it took a while for me to figure. Anyway , thanks again to the responders who pointed me in the correct direction. I would still like to know if there are other options regarding a different method of sending a signal this distance, wirelessly.

everyday is a day for school!!