Hello to all.
I'm trying to use my Zilog PIR with my arduino 2009 board, but i'm finding a lot of problems.
This is the Zilog's datasheet:
http://www.electrokit.se/download/SEN-09587-PS0284.pdf
I did these hardware connections:
GND pin 1 <--> GND
VDD pin 2 <--> 3.3V
RXD/DLY pin 3 <--> Arduino TX 1
TXD/SNS pin 4 <--> Arduino RX 0
MD/RST pin 5 <--> Arduino pin 2
LG pin 6 <--> 3.3V
SLP/DBG pin 7 <--> Arduino pin 4
GND pin 8 <--> GND
and I've added a 10KOhm resistor between Zilog Pin4 and 3.3V as written in the datasheet.
But i'm not able to read any correct value from the sensor.
I tryed to use this code:
int calibrationTime = 30;
long unsigned int lowIn;
long unsigned int pause = 5000;
boolean lockLow = true;
boolean takeLowTime;int pirPin = 2;
int ledPin = 10;
long timeToRelease;
//SETUP
void setup(){
Serial.begin(9600);
pinMode(pirPin, INPUT);
pinMode(ledPin, OUTPUT);
digitalWrite(pirPin, LOW);Serial.print("calibrating sensor ");
for(int i = 0; i < calibrationTime; i++){
Serial.print(".");
delay(1000);
}
Serial.println(" done");
Serial.println("SENSOR ACTIVE");
delay(50);
timeToRelease = millis();
}////////////////////////////
//LOOPvoid loop(){
if(digitalRead(pirPin) == HIGH){
Serial.println("OK");
digitalWrite(ledPin, HIGH);
timeToRelease = millis() + 5000;
}
if(digitalRead(pirPin) == LOW){
Serial.println("NONE");
digitalWrite(ledPin, LOW);
delay(5000);
if(takeLowTime){
lowIn = millis();
takeLowTime = false; }
else {
if(millis() > timeToRelease) {
digitalWrite(ledPin, LOW);
}
}}
}
I can just read from the serial monitor that the pirPIN is always HIGH, but this is not possible.
Can you help me, please?
May be I did a mistake with the hardware connections.