Hey guys.
I'm developing a project that concerns the detection of Human presence inside a room.
For this I am using an Arduino with a SE-10 PIR Motion Sensor http://www.sparkfun.com/products/8630.
Although the easy way to put all the stuff working,the results obtained are not the expected.
For example this morning I made a test, where I put the PIR sensor inside a box, to not detect any kind of motion.
Unexpectedly the results were the following:
In 1275 iterations, it had detected motion for 140 times, what represents in the end an error % of 10%!!!
To let you know I am using an open collector scheme with a pullup resistor of 10kohms (http://bildr.org/2011/06/pir_arduino/), that sends the values to an arduino (supplies the sensor with 5V).
Because I am thinking to use both sensors in my master thesis project, this problem is really worrying.
have you accounted for the 1-2 seconds it takes the pir to "warm up" in your code? (like adding a delay in void setup?) also, in my experience with a PIR (mine is a different model, but perhaps this is still your problem), the pin is pulled low for several seconds, so if your code loops several times in a second, the int that is are counting the times the alarm was tripped could be going up more than you intend it to (perhaps the pir was only tripped once, but your code looped 140 times before the pir pin returned to high).
aha! i am a rather inexperienced coder, but think i have found a problem. if i am not mistaken the first line inside your loop "int pirVal1 = digitalRead(pirPin1);" should be "pirVal1 = digitalRead(pirPin1);" and you should add "int pirVal1 = 0;" to where you have defined the rest of your variables at the top. i'm not sure if this is causing your "big" problem, but I've done the same thing before, and it does mess everything up
please modify your post, select the code and press the # button (looks so much better).
I'm developing a project that concerns the detection of Human presence inside a room.
PIR sensors in the first place detect movement, not presence (although these two are tightly coupled.
Once visited a company who had PIR in meeting rooms and if we just sat on the tables it took 2 minutes before lights went out. (immediately people started waving
Hey Rob! Your totally right. I made the mistake using the word presence, but I know that this sensor just capt movement... Sorry for the mistake
About the code Teddy I'm not sure if the position of the definition of int variable ca affect the final result...
I will try on Monday to use your suggestion on my work
As far as motion sensor go, I have a couple parallax motion sensors, and I've beat myself up trying to find a way to make them accurate let alone precise. If you want to spend the money there are industrial grade motion sensors out there that are very reliable. The question is: Do you want to spend the money, and can you adapt them to arduino?
But you could also use a simple filter in your program like a mode/median filter similar to how people use them for ultra sonic detectors.
Average the readings.
Unhappily I don't have more money to spend on material, so I must work with the stuff I already bought
Concerning master thesis and arduinos just google it and you will find a lot of thesis that use arduino as microcontroller over the world. Of course this PIR sensor's don't have the best quality, but as far as sparkfun sell them I thought they had the minimum quality acceptable...
At this moment I'm thinking to use something like mode/median filter, the question is: will this filter erase also the true values, when somebody is moving? How the code will know wich values are true and false? Thanks for you help Tesla