Automating Lights with PIR sensor and Arduino on Fedora
This is POC post about how you can start automating lights or a rooms , staircases and much more smartly and then normal switchboards do. The whole point of illuminating a room is to make sure the people who go in stay fine because , entering a dark room for many people is a task not for the chicken heart.
Lets first start with the requirements:
1. Arduino as basic as UNO should be fine
2. A bunch of wires
3. Couple of LED (in case you fry by ignoring the ground )
4. A PIR sensor
Let's jump right in:
1. First of all , you need an editor/IDE . For Arduino there is Arduino IDE , you can grab a free copy of the same from https://www.arduino.cc/
2. Once you grab the files , you can either extract it manually or just let the File manager on your Fedora handle the situation for you.
3.Once that you are done , you need to install the IDE.
Once the Arduino IDE is installed , just go ahead and check for two most important things under Tools in Arduino IDE
Ports : It should point to Arduino UNO (in my case)
Boards: This should give you a list of boards and your board should be selected.
The code that needs to uploaded is https://gist.github.com/sumantro93/67766cdb0e177567ff97f487b3809316
Connections
This is the important part , for me I have the light which I want to light up is at Pin 13.
The PIR will have 3 pins , (from the left)
1. The VCC pin goes to the 5V of the Arduino
2. The Output pin to Digital pin 3
3. The Ground PIN to the Ground Pin
Resultant connection will look like :
Lets first start with the requirements:
1. Arduino as basic as UNO should be fine
2. A bunch of wires
3. Couple of LED (in case you fry by ignoring the ground )
4. A PIR sensor
Let's jump right in:
1. First of all , you need an editor/IDE . For Arduino there is Arduino IDE , you can grab a free copy of the same from https://www.arduino.cc/
2. Once you grab the files , you can either extract it manually or just let the File manager on your Fedora handle the situation for you.
3.Once that you are done , you need to install the IDE.
Once the Arduino IDE is installed , just go ahead and check for two most important things under Tools in Arduino IDE
Ports : It should point to Arduino UNO (in my case)
Boards: This should give you a list of boards and your board should be selected.
The code that needs to uploaded is https://gist.github.com/sumantro93/67766cdb0e177567ff97f487b3809316
Connections
This is the important part , for me I have the light which I want to light up is at Pin 13.
The PIR will have 3 pins , (from the left)
1. The VCC pin goes to the 5V of the Arduino
2. The Output pin to Digital pin 3
3. The Ground PIN to the Ground Pin
Resultant connection will look like :
If you get everything right:
Hit upload on the Arduino IDE and the code will be uploaded. The result will be that the PIR sensor will be able to detect motion and turn the LED value to HIGH or LOW .
Thanks for sharing very helpful information. I found another Occupancy Sensor, site , they provide very helpful services.
ReplyDelete