Zilog PIR and arduino 2009, how to

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();
}

////////////////////////////
//LOOP

void 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.

Thanks for your reply.

I'd like to use is in hardware interface mode, but as you said, i'm doing some mistakes with the ports.

Can you give me some advices in order to fix it?

I thought that I had to use just the Zilog PIN5 in order to read HIGH and LOW levels with Arduino, but I was wrong because I have to configure all other pins before to use it.

In my opinion, this sensor is a little bit more complicated to use than the other ones like parallax models which have few pins.

I just like to use it to detect some humans movements, I don't have to do more complicated stuff for now..

thanks again, Richard, for your help.

I've already connected the Zilog's Pin5 to Arduino Pin2. But i'm not using any resistor, may be it is for this that I'm having this problem.

Do you think i can use a 100Ohm resistor? because at this moment I just have a 100 Ohm resistor and 1K Ohm one.

then, I'm reading always on page 55 thast I don't have to connect the PIN7and may be i can avoid to connect pin3 and pin4. It is correct? Because, on page 9-10 there is written that if there are 0V on pin3 and pin4, zilog will use highest sensitivity and the shorter delete time.

Can you tell me if i'm doing well, now?

Thanks a lot.

I connected the zilog pin5 with Arduino Pin4 and with a 1K ohm resistor on 3,3V.

I'm using this simple code in order to just read the pin5 values but i always get the HIGH value, so i'm sure it is not still working properly.

The led is always turned on, too.

I've tryed to do some photos in order to explain better my connections. Unfortunately, these photos are not very clear, i'm sorry.

Just a question: but, i think it's normale to get always an HIGH value on arduino PIN4, because it is directly connected to the 3,3V with the 1K resistor.

I'm pretty sure i'm adding the 1K resistor in the wrong way on the breadboard..

I've read with a test the voltage value between the Zilog pin5 and ground and it is always at 3,3V.

There is something wrong.. :(

that's fine! it works!

I had to connect pin6 at least to 1VDC in order to activate the signal on Zilog PIN5.

:)

I just got one of these so this thread was quite timely!

I hope it will help you! :)

Ive got one working as well. Recently DigitalJohnson posted a topic about a library he created for the Zilog ePir. http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1283389900/9

Its for the mega but theres plenty to look at for pointers.

Gordon

unfortunately, i've already seen that library, but it doesn't compile on duemilanove boards.

It wont compile directly without modification. But you can use parts of the code in your own sketches by looking at how he has implemented a lot of the functions.

Gordon