Grove – PIR Motion Sensor 紅外線人體移動探測感測器 支援 arduino 與 Raspberry Pi

-23%

Grove – PIR Motion Sensor 紅外線人體移動探測感測器 支援 arduino 與 Raspberry Pi

NT$333 NT$257 未稅

這是一個極易使用的紅外線 PIR人體運動探測感測器。通過這個感測器,你可以使你的作品對運動,例如人類的運動作出互動。只要將其接到Grove – Base Shield上,並且下載程序,當有人走入它的探測範圍時,PIR運動探測傳感器就會在它的SIG腳上輸出一個HIGH信號。

尚有庫存

貨號: 101020020(A7-14) 分類: 標籤: , , , , , ,
  • 商品說明
  • 原廠資料
  • 技術文件
  • 評論 (0)

商品說明

這是一個極易使用的紅外線 PIR人體運動探測感測器。通過這個感測器,你可以使你的作品對運動,例如人類的運動作出互動。只要將其接到Grove – Base Shield上,並且下載程序,當有人走入它的探測範圍時,PIR運動探測傳感器就會在它的SIG腳上輸出一個HIGH信號。

檢測範圍和響應速度可通過2個電位焊接在其電路板來調節,所述響應速度是從0.3秒 – 25秒,和最大6米的檢測範圍。

產品規格

工作電壓: 5V
工作電流(VCC=3V): 100uA
工作電流(VCC=5V): 150uA
探測半徑:3m (支持0.1 – 6m)
延時:1-25S
工作波長:7-14um
探測角度:120°

應用理念

  • 運動感測器
  • 保全防護系統
  • 交換器
  • 工業自動化

應用示例

以下是一個簡單的運動探測的應用示例。當有人在它的探測半徑內走動,PIR運動探測傳感器就會在它的SIG腳上輸出一個HIGH信號,使LED會亮起。下面的程序,PIR Sensor是接在D2引腳。
PIR Motion test.jpg

Note: 如果想調節測量範圍和延時,需要將板子上面的兩個電阻R13和R14焊下來,再接兩個可調電阻在板子上預留的電位器的位置。具體需要參考V1.2 Eagle電路圖。PIR的工作模式分為可重複觸發以及不可重複觸發兩種,通過板子上的跳線帽可以調節。

Introduction

This is a simple to use PIR motion sensor with Grove compatible interface. This sensor allows you to sense motion, usually human movement in its range. Simply connect it to Grove – Base shield and program it, when anyone moves in its detecting range, the sensor will output HIGH on its SIG pin.

Specification

  • Operating Voltage: 5V
  • Operating Current(VCC = 3V): 100uA
  • Operating Current(VCC = 5V): 150uA
  • Measuring Range: 3m by default (support 0.1 – 6m)
  • Holding Time: 1 – 25s
  • Working Wave Length: 7 – 14um
  • Detecting Angle: 120 degree

Usage

With Arduino

The following sketch demonstrates a simple application of sensing motion. When someone moves in its detecting range, it will output High through its SIG pin and the LED will light. Otherwise, it will output LOW. Then you can use it to detect the motion of people.

PIR Motion test.jpg

 
/*******************************************************************************/
/*macro definitions of PIR motion sensor pin and LED pin*/
#define PIR_MOTION_SENSOR 2//Use pin 2 to receive the signal from the module 
#define LED	4//the Grove - LED is connected to D4 of Arduino

void setup()
{
	pinsInit();
}

void loop() 
{
	if(isPeopleDetected())//if it detects the moving people?
		turnOnLED();
	else
		turnOffLED();
}
void pinsInit()
{
	pinMode(PIR_MOTION_SENSOR, INPUT);
	pinMode(LED,OUTPUT);
}
void turnOnLED()
{
	digitalWrite(LED,HIGH);
}
void turnOffLED()
{
	digitalWrite(LED,LOW);
}
/***************************************************************/
/*Function: Detect whether anyone moves in it's detecting range*/
/*Return:-boolean, true is someone detected.*/
boolean isPeopleDetected()
{
	int sensorValue = digitalRead(PIR_MOTION_SENSOR);
	if(sensorValue == HIGH)//if the sensor value is HIGH?
	{
		return true;//yes,return true
	}
	else
	{
		return false;//no,return false
	}
}

Note: The detecting distance and holding time can be adjusted by adding two extra potentiometers on board. For the details please refer to the V1.2 Eagle below. The module can also be set as retriggerable or un- retriggerable by changing the jumper hat.

With TI LaunchPad

Is Anybody here (PIR Motion Sensor)

The following sketch demonstrates a simple application of sensing motion. When someone moves in its detecting range, the output of the application will be high through its SIG0 pin and the LED will turn on. Otherwise, the output will be LOW. Note that the PIR motion sensor is very sensitive to motion!

PIR.jpg

/*
  Grove-PIR-Motion-Sensor
 The following sketch demonstrates a simple application of sensing motion.
 When someone moves in its detecting range, it will output High through its 
 SIG pin and the LED will light. Otherwise, it will output LOW. Then you can 
 use it to detect the motion of people. 
 
 The circuit:
 * sig pin of the Grove-PIR-Motion-Sensor to pin39 (J14 plug on Grove Base BoosterPack)
 * one side pin (either one) to ground
 * the other side pin to +VCC
 * LED anode (long leg) attached to RED_LED
 * LED cathode (short leg) attached to ground
 
 * Note: Position the trig jumper on N_Retrig to ensure  
 
 This example code is in the public domain.
 
http://www.seeedstudio.com/wiki/index.php?title=Twig_-_PIR_Motion_Sensor
 
*/

/* Macro Define */
#define PIR_MOTION_SENSOR        39            /* sig pin of the PIR sensor */
#define LED                      RED_LED      /* led */

#define ON                       HIGH                    /* led on */
#define OFF                      LOW                     /* led off */
#define _handle_led(x)           digitalWrite(LED, x)    /* handle led */ 

/* the setup() method runs once, when the sketch starts */
void setup() {
    
    pinMode(PIR_MOTION_SENSOR, INPUT);   /* declare the sig pin as an INPUT */
    pinMode(RED_LED, OUTPUT);            /* declare the red_led pin as an OUTPUT */
    _handle_led(OFF);
}

/* the loop() method runs over and over again */
void loop() {
   
    if(isPeopleDetected()) {
        _handle_led(ON);           /* if we detect a people, turn on the led */
    } else {
        _handle_led(OFF);          /* found nobody, turn off the light */
    }
  
}

/* judge if there is a people around */
boolean isPeopleDetected() {
    int sensor_val = digitalRead(PIR_MOTION_SENSOR);        /* read sig pin */
    if(HIGH == sensor_val) {
        return true;                                        /* people detected */
    } else {
        return false;                                       /* people un-detected */
    }
}

With Raspberry Pi

1.You should have got a raspberry pi and a grovepi or grovepi+.
2.You should have completed configuring the development enviroment, otherwise follow here.
3.Connection

  • Plug the sensor to grovepi socket D8 by using a grove cable.

4.Navigate to the demos’ directory:

   cd yourpath/GrovePi/Software/Python/
  • To see the code
   nano grove_pir_motion_sensor.py   # "Ctrl+x" to exit #
import time
import grovepi

# Connect the Grove PIR Motion Sensor to digital port D8
# SIG,NC,VCC,GND
pir_sensor = 8

grovepi.pinMode(pir_sensor,"INPUT")

while True:
    try:
        # Sense motion, usually human, within the target range
        if grovepi.digitalRead(pir_sensor):
            print 'Motion Detected'
        else:
            print '-'

        # if your hold time is less than this, you might not see as many detections
        time.sleep(.2)

    except IOError:
        print "Error"

5.Run the demo.

   sudo python grove_pir_motion_sensor.py

 

Download File Not available

商品評論

目前沒有評論。


只有註冊並且購買過商品的顧客才能撰寫評論