Not your usual PIR sensor – playing with ZDots

I made an order a while ago from DigiKey. I got some basic electronics prototyping stuff as well as a few sensors and LEDs t play around with. One of the more interesting things I picked up was a Ziglog ZDots PIR sensor (click to view datasheet).

Zdot computer board arduino

Now this is not the usual PIR sensor that everybody in the arduino community usualy uses, that would be the parallax sensor from SparkFun.
This sensor, from what I saw, has a couple of distinct advantages over the SparkFun sensor:

  1. It is less expensive than the SparkFun sensor ($2-3 woohhoooo!)
  2. It operates in dual modes, hardware (digital) or serial mode – in which it accepts all kinds of advanced commands
  3. I like to be different – the sparkfun sensor has been done before…

The real deal maker above was #2 for me – I am really noobish to all of this electronics stuff (my background is CS), so I thought a sensor that works simply (hardware mode), and more advanced (serial mode) would provide for a good learning experience.  Plus, this item was called a “board computer” which caught my eye – it is a whole system with advanced functionality and few parts built into a tiny board.

Anyhow, I was actually really scared of frying my new toy, so I waited for quite a while before deciding I was brave enough to have a go at wiring it up.  I read thru the technical specs quite a bit (above link) and ultimately found an example circuit for the sensor on p58 or so of the manual.  After this I was still hesitant because I don’t even have a multimeter (there is a reasonably nice digital one coming in the mail), and all I have done thusfar electronic-wise has been playing with an LED and ambient light sensor with the Arduino.

Tonight my curiosity finally got the best of me and I decided I would wire it up.  I am pretty much sure that I got the electronic part correct the first time, however a stupid bug in my code prevented me from seeing results.  It was just a lame “= vs ==” noob error, ah well.

Anyhow, I did get it working.  It is pretty darn simple too, as you can see by my code:

[cpp]
#define LED 6
#define MS 0 //motion sensor output line

int state = 1;

void setup(){
  Serial.begin(9600);
  pinMode(LED, OUTPUT);
  pinMode(MS, INPUT);

}

void loop(){

 state = digitalRead(MS);

 if(state == 0){
   Serial.println("Motion Detected!");
   digitalWrite(LED, HIGH);
   delay(5000);
 }else{
   Serial.println("All is quiet...  Too quiet...");
   digitalWrite(LED, LOW);
 }

}

[/cpp]

Here is another view of the sensor and my wiring (look! I made it neat!)
zdots pir sensor

Tags: , , ,

No comments yet.

Leave a Reply