Arduino pir sensor with adjustable range

Hi I have a pir sensor

I am trying to understand if I can control the range of the sensor I only want it to activate if it detects objects less than 50mm from the sensor so not movement of objects more than 50mm from the sensor will be ignored

If anyone had been able to active this and has any resource on what’s required to do so I would appreciate their advice

Adjusting the se sensitivity on the board does not seem to control the distance / range that the sensor detects objects

Thanks in advance

PIR sensors by default operate on a change in the infrared pattern detected. Movement is an important part of how the sensor works. To sense something less than 50mm from the sensor you could try a Distance Sensor. These sensors are active sensors, they send a signal and measure the bounce back response.

This one sends an IR signal and detects the bounce back from the object. It is very accurate from 10 to 30cm but it has a narrow field.

This one uses ultra sonics to bounce the signal of an object.

I have used both of these successfully. The ultra sonic one had a wider field than the IR one, both were very accurate. The IR one is not good below 6cm so not useful in your application. The ultra sonic worked accurately down to 1cm in my testing.

Cheers
Jim
(Core Electronics Customer(

Hi

Thanks for this info

What about the single lens ultra sonic ones like those used in vehicle bumpers instead of the ones that have 2 sensors such as the one you are suggesting

Claude Raiola

0414 228 948

Haven’t tested tested single lens ultra sonic ones, I don’t know how well they would behave. Probably they have a wider beam width.
The two I listed I have tested and used in projects. There are other infrared sensors that most likely would meet the 5cm distance you need.

All I can suggest is to buy some and try it out.

Cheers
Jim

Hi can u share with me the sketch used as mine is just returning 0 values

Regards

Claude Raiola

0414 228 948

I used the PIR to drive a transistor to turn a bright LED bank on and off. Part of my garage is rather dark, so when you walk near that area the LED turn on.
The PIR OUT is 0V when untriggered and 3.3V when triggered.
The following code turns the UNO LED (D13) on if the PIR is triggered.

regards
Jim

/*********************************************************
 * PIR Test
 * 
 * PIR connected to UNO D2.
 * Turns on the UNO LED D13 when triggered.
 * 
 */
#define PIR        2    // PIR Input
#define LED       13    // LED Output

//===========================================================================
void setup() {
  
  pinMode(PIR, INPUT_PULLUP);
  pinMode(LED, OUTPUT);

  digitalWrite(LED,0);    // Turn LED off at start

  delay(1000);
}
//===========================================================================
void loop() { 

  if (digitalRead(PIR)) {
    digitalWrite(LED,1);    // PIR is triggered, turn LED on
  } else {
    digitalWrite(LED,0);    // PIR is untriggered, turn LED off
  }
  delay(100);
}
//===========================================================================
//===========================================================================

Thanks for your reply and code

I was able to get it working by changing the i/o pins to different ones.

Not sure if you were the person I spoke with over phone re the push / pull solinoids

Trying to under stand what the push force is on them I need a push force of at least 16n but the push force indicated refers to initial force is that different to force it uses during push or just at the start.

The solinoid needs to be the smallest one possibly that meets the 16n requirement

I welcome your advise

Claude Raiola

0414 228 948

Hi Claude,

Unfortunately I have no experience when it comes to solenoids with respect to the force used.
The only solenoid I have used was water valve; apply 24VAC and it activated.
This was done through a relay controlled by a Raspberry Pi GPIO port.

Don’t think I can be much help.

Regards
Jim