Update: Here are the latest versions of this library: PIR Sensor Library for Proteus V3.0 and PIR Sensor Library for Proteus V2.0.
Hello friends, hope you are doing well. Today, I will share a new PIR Sensor Library for Proteus. PIR Sensor module is not available in Proteus so we can't use it in our simulations. But today, I will share a new PIR Sensor Library for Proteus which can easily simulate PIR Sensor in Proteus software. We are quite happy that we are helping engineers by sharing these new Proteus Libraries.
We all know about PIR Sensor but if you don't know then first read Interfacing of PIR Sensor with Arduino.
As a quick review, a PIR sensor is used to detect motion in the environment and is commonly known as a motion sensor. It's quite helpful in security projects where you need to detect motion. For example in some bank vault where there's no possibility of motion, you can place this sensor and can check if there's any movement. It is also used in home automation i.e. if there's no movement in some room, turn off its appliances. So, in short, the PIR sensor has numerous uses and is used quite a lot in engineering projects.
First of all, I will show you today, How to download this PIR Sensor Library for Proteus and then we will also design a small simulation in Proteus in which I will interface this PIR Sensor with Arduino UNO. You can interface it with any microcontroller i.e. PIC Microcontroller or 8051 Microcontroller. But today, I will interface it with an Arduino microcontroller. As homework, you guys interface it with a PIC Microcontroller or 8051 Microcontroller and share it in comments, it may help others. So, let's get started with the PIR Sensor Library for Proteus:
#define pirPin 2 int calibrationTime = 30; long unsigned int lowIn; long unsigned int pause = 5000; boolean lockLow = true; boolean takeLowTime; int PIRValue = 0; void setup() { Serial.begin(9600); pinMode(pirPin, INPUT); } void loop() { PIRSensor(); } void PIRSensor() { if(digitalRead(pirPin) == HIGH) { if(lockLow) { PIRValue = 1; lockLow = false; Serial.println("Motion detected."); delay(50); } takeLowTime = true; } if(digitalRead(pirPin) == LOW) { if(takeLowTime){lowIn = millis();takeLowTime = false;} if(!lockLow && millis() - lowIn > pause) { PIRValue = 0; lockLow = true; Serial.println("Motion ended."); delay(50); } } }
That's all for today, hope you have enjoyed it and gonna use it in your projects. If you get into any trouble, ask in the comments and I will try to resolve them as soon as possible. Take care !!! :)
JLCPCB – Prototype 10 PCBs for $2 (For Any Color)
China’s Largest PCB Prototype Enterprise, 600,000+ Customers & 10,000+ Online Orders Daily
How to Get PCB Cash Coupon from JLCPCB: https://bit.ly/2GMCH9w