Notifications
Clear all

PIR Motion Sensor  

Page 1 / 2

Sumanta
(@sumanta)
Trusted Member
Joined: 2 weeks ago
Posts: 57
Topic starter  

Hi everyone 😀 . Today I was working with the HC-SR501 PIR Motion sensor. I was facing a problem. When I set the jumper to H mode, i.e repeated trigger mode, I kept moving, but the LED turned off after a specific time interval. It should have remained on until I stopped moving. Sometimes, the LED turns on automatically, even when I am not moving. Please help me with this.🙏


Quote
frogandtoad
(@frogandtoad)
Honorable Member
Joined: 2 years ago
Posts: 671
 
Posted by: @sumanta

Hi everyone 😀 . Today I was working with the HC-SR501 PIR Motion sensor. I was facing a problem. When I set the jumper to H mode, i.e repeated trigger mode, I kept moving, but the LED turned off after a specific time interval. It should have remained on until I stopped moving. Sometimes, the LED turns on automatically, even when I am not moving. Please help me with this.🙏

Where did you get the code from, and can we see it?

Please note: - that without seeing your code, no one can help you, so always post the code you're having problems with, and address the specific areas of the code you're having problems with.


ReplyQuote
Sumanta
(@sumanta)
Trusted Member
Joined: 2 weeks ago
Posts: 57
Topic starter  

@frogandtoad I didn't use the sensor with an Arduino. I used it autonomously. I connected everything on the breadboard.


ReplyQuote
frogandtoad
(@frogandtoad)
Honorable Member
Joined: 2 years ago
Posts: 671
 

@sumanta

Posted by: @sumanta

@frogandtoad I didn't use the sensor with an Arduino. I used it autonomously. I connected everything on the breadboard.

This is a two way street - You ask questions, I(we) answer... I(we) ask questions... then you SHOULD answer 😉


ReplyQuote
Sumanta
(@sumanta)
Trusted Member
Joined: 2 weeks ago
Posts: 57
Topic starter  

@frogandtoad

Posted by: @frogandtoad

Where did you get the code from, and can we see it?

This was your question, right? I have answered it.

Posted by: @sumanta

@frogandtoad I didn't use the sensor with an Arduino.

I didn't use an Arduino at all.  Then how can I show you the code? All I can provide you is the circuit diagram:-

Screenshot 20210114 172722~2

 


ReplyQuote
DroneBot Workshop
(@dronebot-workshop)
Workshop Guru Admin
Joined: 2 years ago
Posts: 842
 

@sumanta

The issue is that you don't understand what the "H" mode is supposed to do, from the way you describe it the HC-SR501 (which I assume you are using, you didn't specify the part number) is working correctly.

You might want to look at the spec sheet to understand its operation. Pay particular note to the difference between the "H" and "I" mode.

  • In "H" mode the output is activated for a preset period of time and then is inactivated, regardless of if there is still a person in the vicinity.
  • In "I" mode, it is activated for and will stay activated while it still senses a person. It will then go off after a preset time when the person is no longer in the vicinity.

 

Sounds to me like you wanted to use the "I" mode for your application.  

And, at the risk of sounding self-promotional, I did an entire video and article about this sensor.  I include operation without a microcontroller or microcomputer.

@frogandtoad is correct, you need to provide all of the information (like a circuit diagram and part number) so that we can assist you. And it's also a good idea to do a little research on your own first, Google is your friend. We are all very happy to help, but we need the correct information first.

😎

Bill

 

"Never trust a computer you can’t throw out a window." — Steve Wozniak


frogandtoad and Sid liked
ReplyQuote
Sumanta
(@sumanta)
Trusted Member
Joined: 2 weeks ago
Posts: 57
Topic starter  

@dronebot-workshop Thank you for the spec sheet. 😀

To tell you the truth, I actually don't happen to know, which mode I'm working with. 🤔 If the jumper is placed on the pin labelled"H", then the sensor is working in the "H" mode, right? 

Or is it just the opposite? 🤔 


ReplyQuote
Sumanta
(@sumanta)
Trusted Member
Joined: 2 weeks ago
Posts: 57
Topic starter  
Posted by: @dronebot-workshop

which I assume you are using, you didn't specify the part number

I did sir. 🙂 

Posted by: @sumanta

Today I was working with the HC-SR501 PIR Motion sensor.


ReplyQuote
Sid
 Sid
(@sid)
Trusted Member
Joined: 3 months ago
Posts: 73
 
Posted by: @sumanta

To tell you the truth, I actually don't happen to know, which mode I'm working with. 🤔 If the jumper is placed on the pin labelled"H", then the sensor is working in the "H" mode, right? 

Have a look at this image - it depicts how the Jumper should be placed for that H. Then compare this with the setting on your Sensor and you should have cleared your doubts 🙂

Using PIR Sensor

Now if you are based in India, the most common scenario is that you are using this product manufactured by "Kuongshun" of China Mainland. Most of those who sell the Kits in India import stuff from China owing to the cost factor. An Elegoo kit is at least 10 times expensive than what these kits from China are priced at - be it sellers on Amazon.in or other organizations/sellers.

Life is exploring and learning


ReplyQuote
Sumanta
(@sumanta)
Trusted Member
Joined: 2 weeks ago
Posts: 57
Topic starter  

@sid Okay..... So the jumper must be placed on the 'I' pin to set the sensor to the 'H' mode. Just the opposite of what I thought. 😯 

I was pondering on the image shown by you. I was about to delete my message. I had almost grasped the concept.

Still, thanks for the reply. 😀 


ReplyQuote
Sumanta
(@sumanta)
Trusted Member
Joined: 2 weeks ago
Posts: 57
Topic starter  

@dronebot-workshop Yes sir. This time I tried out the same circuit with the correct jumper setting. The jumper was placed on the 'H' pin, i.e., the sensor was working with the 'I' or 'L' mode, which I wanted. But the same problem occurred. I gave the sensor 5 minutes to adjust to its surroundings. Then, I made continuous movements near the sensor. But the LED turned on for 3-4 seconds and turned off, but I was still in motion. I got the similar observation in the other mode(it's supposed to behave in such a way in that mode, though). I'm beginning to think, that the sensor responds a bit late to the motion.

Please help 🙏


ReplyQuote
frogandtoad
(@frogandtoad)
Honorable Member
Joined: 2 years ago
Posts: 671
 

@sumanta

Posted by: @sumanta

@frogandtoad

Posted by: @frogandtoad

Where did you get the code from, and can we see it?

This was your question, right? I have answered it.

Posted by: @sumanta

@frogandtoad I didn't use the sensor with an Arduino.

I didn't use an Arduino at all.  Then how can I show you the code? All I can provide you is the circuit diagram:-

Screenshot 20210114 172722~2

 

Yes, but my point was that you didn't provide this information from the start, so you misled me and other readers, which cause more questions to be asked before we can get to the core of problem.  So it's always good to provide as much information as possible up front, and address the specific parts of the code, if you're having an issue with programming as well.

Cheers.


ReplyQuote
frogandtoad
(@frogandtoad)
Honorable Member
Joined: 2 years ago
Posts: 671
 

@sumanta

Posted by: @sumanta

@dronebot-workshop Yes sir. This time I tried out the same circuit with the correct jumper setting. The jumper was placed on the 'H' pin, i.e., the sensor was working with the 'I' or 'L' mode, which I wanted. But the same problem occurred. I gave the sensor 5 minutes to adjust to its surroundings. Then, I made continuous movements near the sensor. But the LED turned on for 3-4 seconds and turned off, but I was still in motion. I got the similar observation in the other mode(it's supposed to behave in such a way in that mode, though). I'm beginning to think, that the sensor responds a bit late to the motion.

Please help 🙏

I believe you originally had the jumper in the correct position for "H" mode, if that is what you wanted.  However, as Bill stated, you're not fully understanding how it works, and that is why it's so important to read the datasheet for your device.

Take particular note of blocking time, reset times, direction, etc...

Cheers.


ReplyQuote
frogandtoad
(@frogandtoad)
Honorable Member
Joined: 2 years ago
Posts: 671
 

@sid

Posted by: @sid

Have a look at this image - it depicts how the Jumper should be placed for that H.

Actually, I will dispute that image, as it looks to have come from some website, and judging by the few datasheets I have seen, the jumper setting shown is incorrect... always trust the datasheet over any websites.

Cheers.


ReplyQuote
Sumanta
(@sumanta)
Trusted Member
Joined: 2 weeks ago
Posts: 57
Topic starter  

@frogandtoad

Thanks. 🙂 Can you tell me which mode is appropriate for my project? Because in different sites, the definition of the modes is different. That's why I am confused. I want the LED to be lit, until motion continues. Mr. Bill says that I need the "I" mode. For setting the sensor to this mode, what should be the setting of the jumper? It should be placed on which 2 pins? The upper 2 or the lower 2?

Thanks in advance 😀 


ReplyQuote
Page 1 / 2