Роботы Ниже представлена
Блок фильтров для сабвуфера lm324 схема датчика движения с
Бп switching power supply sl-500 использованием Arduino.
Роботы В качестве датчика,
Управление датчика движения на симисторе мы будем
Electronic wall lamp model 15w использовать PIR-сенсор
Роботы (Passive Infrared
Блок фильтров для сабвуфера lm324 sensor), т.е.
Бп switching power supply sl-500 пассивный ИК датчик. PIR-сенсоры
Роботы основаны на методике измерения
Управление датчика движения на симисторе инфракрасного излучения от
Роботы обьектов.
Electronic wall lamp model 15w Итак, для создания ИК датчика Роботы движения Роботы нам понадобятся Блок фильтров для сабвуфера lm324 следующие компоненты:- контроллер
Бп switching power supply sl-500 Arduino;
-
Роботы макетная плата;
-
Управление датчика движения на симисторе 1 светодиод;
Electronic wall lamp model 15w - PIR
Роботы сенсор фирмы
Блок фильтров для сабвуфера lm324 Parallax;
- провода.
Бп switching power supply sl-500 Схема подключения датчика движения Роботы (PIR) к контроллеру Arduino Управление датчика движения на симисторе простейшая:
PIR-сенсор имеет 3
Electronic wall lamp model 15w вывода: плюс, минус и выход.
Роботы К
Роботы 7-му выводу
Блок фильтров для сабвуфера lm324 Arduino подключаем выход PIR-сенсора.
Бп switching power supply sl-500 Также, присоединим
Роботы светодиод к выводу
Управление датчика движения на симисторе 8 Arduino
Electronic wall lamp model 15w и GND.
Роботы Исходный код Блок фильтров для сабвуфера lm324 программы взят с Бп switching power supply sl-500 официального сайта arduino.cc:

Роботы /*
* //////////////////////////////////////////////////
* Управление датчика движения на симисторе //making sense of Роботы the Electronic wall lamp model 15w Parallax PIR sensor's output
* Роботы //////////////////////////////////////////////////
Роботы *
* Блок фильтров для сабвуфера lm324 Switches a LED according Бп switching power supply sl-500 to the Роботы state of the Управление датчика движения на симисторе sensors output Electronic wall lamp model 15w pin.
* Роботы Determines the Блок фильтров для сабвуфера lm324 beginning and end Бп switching power supply sl-500 of continuous motion sequences.
Роботы *
* @author: Kristian Управление датчика движения на симисторе Gohlke / krigoo Роботы (_) Electronic wall lamp model 15w gmail (_) com / http://krx.Роботы at
Роботы * @date: Блок фильтров для сабвуфера lm324 3. September 2006
Бп switching power supply sl-500 *
* kr1 Роботы (cleft) 2006
* Управление датчика движения на симисторе released under Electronic wall lamp model 15w a creative Роботы commons "Attribution-NonCommercial-ShareAlike Блок фильтров для сабвуфера lm324 2.0" license
Бп switching power supply sl-500 * http://creativecommons.org/licenses/by-nc-sa/2.0/de/
Роботы *
*
* The Управление датчика движения на симисторе Parallax PIR Sensor Роботы is Electronic wall lamp model 15w an easy to use digital Роботы infrared Роботы motion sensor Блок фильтров для сабвуфера lm324 module.
* (http://www.parallax.Бп switching power supply sl-500 com/detail.asp?Роботы product_id=555-28027)
*
* Управление датчика движения на симисторе The sensor's Electronic wall lamp model 15w output pin Роботы goes to Блок фильтров для сабвуфера lm324 HIGH if motion Бп switching power supply sl-500 is present.
* However, Роботы even if motion is Управление датчика движения на симисторе present it goes Роботы to Electronic wall lamp model 15w LOW from time to time,
Роботы * Роботы which might Блок фильтров для сабвуфера lm324 give the impression no Бп switching power supply sl-500 motion is Роботы present.
* This Управление датчика движения на симисторе program deals Electronic wall lamp model 15w with this Роботы issue by Блок фильтров для сабвуфера lm324 ignoring LOW-phases shorter Бп switching power supply sl-500 than a given time,
Роботы * assuming continuous motion Управление датчика движения на симисторе is present during Роботы these Electronic wall lamp model 15w phases.
*
*/
/////////////////////////////
//VARS
Роботы //Время Роботы калибровки датчика Блок фильтров для сабвуфера lm324 (10-60 сек. по даташиту)
Бп switching power supply sl-500 int calibrationTime Роботы = 30;
//the Управление датчика движения на симисторе time when Electronic wall lamp model 15w the sensor Роботы outputs a Блок фильтров для сабвуфера lm324 low impulse
long Бп switching power supply sl-500 unsigned int lowIn;
//the Роботы amount of milliseconds the Управление датчика движения на симисторе sensor has to Роботы be Electronic wall lamp model 15w low
//before we assume all Роботы motion Роботы has stopped
Блок фильтров для сабвуфера lm324 long unsigned int pause Бп switching power supply sl-500 = 5000;
Роботы boolean lockLow = Управление датчика движения на симисторе true;
boolean Electronic wall lamp model 15w takeLowTime;
int Роботы pirPin = Блок фильтров для сабвуфера lm324 7; //вывод подключения Бп switching power supply sl-500 PIR сенсора
int ledPin Роботы = 8;
/////////////////////////////
//SETUP
Управление датчика движения на симисторе void setup(){
Serial.Роботы begin(9600);
Electronic wall lamp model 15w pinMode(pirPin, INPUT);
pinMode(ledPin, OUTPUT);
digitalWrite(pirPin, Роботы LOW);
Роботы //дадим датчику Блок фильтров для сабвуфера lm324 время на калибровку
Serial.Бп switching power supply sl-500 print("calibrating sensor Роботы ");
for(int i Управление датчика движения на симисторе = 0; Electronic wall lamp model 15w i < Роботы calibrationTime; i++){
Блок фильтров для сабвуфера lm324 Serial.print(".");
Бп switching power supply sl-500 delay(1000);
}
Serial.println(" Роботы done");
Serial.println("SENSOR ACTIVE");
Управление датчика движения на симисторе delay(50);
}
////////////////////////////
Роботы //LOOP
Electronic wall lamp model 15w void loop(){
if(digitalRead(pirPin) == HIGH){
Роботы digitalWrite(ledPin, Роботы HIGH); //the Блок фильтров для сабвуфера lm324 led visualizes the sensors Бп switching power supply sl-500 output pin Роботы state
if(lockLow){
//makes Управление датчика движения на симисторе sure we Electronic wall lamp model 15w wait for Роботы a transition Блок фильтров для сабвуфера lm324 to LOW before Бп switching power supply sl-500 any further output is Роботы made:
lockLow = false;
Управление датчика движения на симисторе Serial.println("---");
Serial.Роботы print("motion Electronic wall lamp model 15w detected at ");
Роботы Serial.print(millis()/1000);
Serial.Роботы println(" sec");
Блок фильтров для сабвуфера lm324 delay(50);
}
takeLowTime = Бп switching power supply sl-500 true;
}
Роботы if(digitalRead(pirPin) == LOW){
Управление датчика движения на симисторе digitalWrite(ledPin, LOW); Electronic wall lamp model 15w //the led Роботы visualizes the Блок фильтров для сабвуфера lm324 sensors output pin Бп switching power supply sl-500 state
if(takeLowTime){
lowIn = Роботы millis(); //save the time Управление датчика движения на симисторе of the transition Роботы from Electronic wall lamp model 15w high to LOW
takeLowTime = Роботы false; Роботы //make sure Блок фильтров для сабвуфера lm324 this is only done Бп switching power supply sl-500 at the Роботы start of a Управление датчика движения на симисторе LOW phase
Electronic wall lamp model 15w }
//if Роботы the sensor Блок фильтров для сабвуфера lm324 is low for Бп switching power supply sl-500 more than the given Роботы pause,
//we assume that Управление датчика движения на симисторе no more motion Роботы is Electronic wall lamp model 15w going to happen
if(!lockLow && Роботы millis() - Блок фильтров для сабвуфера lm324 lowIn > pause){
//makes Бп switching power supply sl-500 sure this Роботы block of code Управление датчика движения на симисторе is only Electronic wall lamp model 15w executed again Роботы after
//a Блок фильтров для сабвуфера lm324 new motion sequence Бп switching power supply sl-500 has been detected
lockLow Роботы = true;
Serial.print("motion Управление датчика движения на симисторе ended at "); Роботы //output
Electronic wall lamp model 15w Serial.print((millis() - pause)/1000);
Serial.Роботы println(" Роботы sec");
delay(50);
Блок фильтров для сабвуфера lm324 }
}
}
В
Бп switching power supply sl-500 скетче Arduino
Роботы видно, что датчик
Управление датчика движения на симисторе проводит с
Electronic wall lamp model 15w амодиагностику, а затем
Роботы переходит в
Блок фильтров для сабвуфера lm324 режим отслеживания движений.
Бп switching power supply sl-500 Когда движение обнаружено, то
Роботы загорается светодиод. По Serial
Управление датчика движения на симисторе Monitor вы можете
Роботы отслеживать
Electronic wall lamp model 15w сколько по времени длилось движение.
Роботы Данный
Роботы проект можно
Блок фильтров для сабвуфера lm324 использовать как основу для
Бп switching power supply sl-500 обнаружения д
Роботы вижения в охранных сигнализациях,
Управление датчика движения на симисторе для включения
Electronic wall lamp model 15w освещения, в
Роботы робототехнике и
Блок фильтров для сабвуфера lm324 т.п.
Источник:
Бп switching power supply sl-500 http://www.instructables.com/