Hi,
I am currently working with a PIR and Arduino. Does anyone knows if i can adjust the delay time to less than 1 sec. The thing is, i only need that the state remains high when the sensor detects motion, not to stay high after.
Is there a solution for that or another sensor ?
I also need to put ir into a plastic container (transparent) and the pir works good with that.
Leave the sensitivity pot in the center position (as it was).
Turn the time pot fully anti-clockwise for the shortest "on" time.
That is the shortest time you will get.
I doubt it will be less than 2-3seconds, and it could re-trigger during that time.
Manage additional timing with the Arduino.
Post your code.
Leo..
I am controlling two leds with android and arduino, 2 different circuits, it works but the problem is when the pir stays high.
When i turn off one led (1st circuit) the other led turns on (2nd circuit) then the first led turns on again but in my code if number 1 is received and if pir is high the led turns off and send number 2, and because the pir remains high from to the begginig, automatically turns the led off (you can say that the led never went on)
May be with a better code? or another sensor?
its a little messy the code but here it is:
char val;
int led = 8;
int sensor = 7;
int calibrationTime = 5;
void setup() {
for(int i = 0; i < calibrationTime; i++){
Serial.print(".");
delay(1000);
}
Serial.println(" done");
Serial.println("SENSOR ACTIVE");
delay(50);
Hi,
Does anyone knows if that kind of sensor works if i put it into a plastic container (transparent) like the pir does?
I want yo detect motion but the pir remains high when motion detected.
How do you know the PIR remains high?
How long does it remain high?
Are you high?
Can you try to include useful information like what items you have and what you are trying to accomplish?
Not sure what you're trying to do.
Wrote some code (untested) that should make the PIR sensor work.
Tell us what function you expect from the serial link.
See if the sensor is active, control the indicator LED?
Leo..
const byte pirPin = 7;
const byte pirLED = 13; // buildin LED
const byte pirLED2 = 8; // optional second LED ??
byte calibrationTime = 5;
boolean pirState = 0, oldpirState = 0;
void setup() {
Serial.begin(9600); // start serial monitor
pinMode(pirLED, OUTPUT);
pinMode(pirLED2, OUTPUT);
Serial.print("Calibrating");
for (int i = 0; i < calibrationTime; i++) {
Serial.print(".");
delay(1000);
}
Serial.println(" done");
Serial.println("SENSOR ACTIVE");
}
void loop() {
pirState = digitalRead(pirPin); // read the pin every loop
if (pirState != oldpirState) { // if it has changed (not the same as before)
if (pirState) { // if PIR is active
digitalWrite(pirLED, HIGH); // turn onboard LED on
Serial.println("Movement detected");
// more "on" code here, e.g. send alarm to BT/Android
}
else { // if PIR is not active
digitalWrite(pirLED, LOW); // turn onboard LED off
Serial.println("PIR inactive");
// more "off" code here
}
oldpirState = pirState; // update oldpirState
}
}
Plastics that are transparent to visible light are not necessarily transparent to IR. Some plastics that are opaque to visible are transparent to IR. Then there are plastics that may be transparent to only certain wavelengths of IR.
So:
identify the plastic of your container (most likely HDPE or PP, could be PET, PS, PC or PMMA as well).
figure out the wavelength of your IR sensor.
find out whether the plastic used is transparent to that IR wavelength.
I am controlling 2 circuits (just for now, will be more) of Arduino, pir, Bluetooth and LED (each circuit). I am controlling them with my Android Phone.
So what i AM trying to do is simple, turn one LED on, i turn it off with my Hand (pir detects motion) and the other LED (2nd circuit) turns on and i want to turn it off as quickly as i can to turn on the first circuit and on and on.
The PIR remains high because a send a number 2 when its high and when a i turn off a led, number 2 is received several times during like 3 sec, and that is the issue, because that does not allow me to turn back on the same circuit.
hdfbalv:
So what i AM trying to do is simple, turn one LED on, i turn it off with my Hand (pir detects motion) and the other LED (2nd circuit) turns on and i want to turn it off as quickly as i can to turn on the first circuit and on and on.
The PIR remains high because a send a number 2 when its high and when a i turn off a led, number 2 is received several times during like 3 sec, and that is the issue, because that does not allow me to turn back on the same circuit.
Let me be the first to say: "huh?"
Iow: no clue what you're trying to say, let alone trying to accomplish.