FABLAB
फॅबस्वीच
उद्देश :- विजेची बचत करणे.
साहित्य :- मोशन सेन्सर(PIR),आर्डीनो युनो बोर्ड,अॅडॅप्टर,७८०५ रेग्युलेटर,जम्पर वायर्स,रिले ड्रायव्हिंग सर्किट ,इ....
साधने :- (सिरीयल पोट पिन),प्रोग्यामिंगसाठी ,ग्लूगन,स्ट्रीपर,इन्सुलेशन टेप,सोल्डरिंग गन,सोल्डरिंग मेटल,कटर..
स्टेप :-
पहिल्यांदा PIR सेन्सोर आर्डीनो बोर्ड ला जोडले .
नंतर आर्डीनो बोर्ड ला रिले ड्रायवर जोडला व त्याच बरोबर ७८०५ जोडून घेतला.
नंतर आर्डीनो बोर्ड मध्ये मोतीओन सेन्सोर चा प्रोग्राम टाकला.
लेझर कटर मशीन च्या सहाय्याने एक बॉक्स तयार करून घेतला. त्या बॉक्स मध्ये सर्व जोडून घेतले व
तो बॉक्स नंतर ड्रीम हाउस मध्ये नेऊन जोडला .
जेव्हा ड्रीम हाउस मध्ये हालचाल होते तेव्हा लाईट चालू होते
आकृती :-
प्रोग्राम:-
//SETUP void setup(){ Serial.begin(9600); pinMode(pirPin, INPUT); pinMode(ledPin, OUTPUT); digitalWrite(pirPin, LOW); //give the sensor some time to calibrate Serial.print("calibrating sensor "); for(int i = 0; i < calibrationTime; i++){ Serial.print("."); delay(1000); } Serial.println(" done"); Serial.println("SENSOR ACTIVE"); delay(50); } //////////////////////////// //LOOP void loop(){ if(digitalRead(pirPin) == HIGH){ digitalWrite(ledPin, HIGH); //the led visualizes the sensors output pin state if(lockLow){ //makes sure we wait for a transition to LOW before any further output is made: lockLow = false; Serial.println("---"); Serial.print("motion detected at "); Serial.print(millis()/1000); Serial.println(" sec"); delay(50); } takeLowTime = true; } if(digitalRead(pirPin) == LOW){ digitalWrite(ledPin, LOW); //the led visualizes the sensors output pin state if(takeLowTime){ lowIn = millis(); //save the time of the transition from high to LOW takeLowTime = false; //make sure this is only done at the start of a LOW phase } //if the sensor is low for more than the given pause, //we assume that no more motion is going to happen if(!lockLow && millis() - lowIn > pause){ //makes sure this block of code is only executed again after //a new motion sequence has been detected lockLow = true; Serial.print("motion ended at "); //output Serial.print((millis() - pause)/1000); Serial.println(" sec"); delay(50); } } }
No comments:
Post a Comment