Introduction: Bluetooth Controlled Motion Sensor Alarm
PIR Sensor is connected to the arduino. When a motion is being detected, an alarm sound and flashing LED will start to act. The times of the motion detections are saved, and can be viewed later on a small LCD screen. The data (motion detections) is sent via bluetooth and can be viewed on a smartphone by a designated app for android.
Step 1: Materials Required
Materials Required for the project are as follows:
1 (image-1)-Arduino Uno/Duemilanove arduino arduino Uno
2 (image-2)-LCD shield from df robots or any other but similar to the image LCD Shield
3 (image-3)-HC-05 Bluetooth Module Bluetooth Module
4 (image-4)-PIR Motion Sensor PIR Sensor
5 (image-5)- 6 pin push button
6 (image-6)- Breadboard Breadboard
7 (image-7)-Jumper Wires Male to Male and Female to Male Jumper Wires
8 (image-8)-Light Emitting Diode (LED)
9 (image-9)-Water Pump (additional advancements for the project) Water Pump
11-A container to act as a suitcase for the project
12 (image10)- Small Piezo Buzzer
The project wil cost under Rs.1200 or $20
Step 2: Testing the LCD Shield
Just attach the LCD Shield to the arduino as shown in the image i.e. the pins of the LCD in parallel with the pins of the arduino.
Now upload the code.
Step 3: Testing the PIR Sensor
Pyroelectric ("Passive") InfraRed sensors:'''What is a PIR sensor?'''PIR sensors allow you to sense motion, almost always used to detect whether a human has moved in or out of the sensors range. They are small, inexpensive, low-power, easy to use and don't wear out. For that reason they are commonly found in appliances and gadgets used in homes or businesses. They are often referred to as PIR, "Passive Infrared", "Pyroelectric", or "IR motion" sensors.PIRs are basically made of a pyroelectric sensor (which you can see above as the round metal can with a rectangular crystal in the center), which can detect levels of infrared radiation. Everything emits some low level radiation, and the hotter something is, the more radiation is emitted. The sensor in a motion detector is actually split in two halves. The reason for that is that we are looking to detect motion (change) not average IR levels. The two halves are wired up so that they cancel each other out. If one half sees more or less IR radiation than the other, the output will swing high or low.Along with the pyroelectic sensor is a bunch of supporting circuitry, resistors and capacitors. It seems that most small hobbyist sensors use the BISS0001 ("Micro Power PIR Motion Detector IC"), undoubtedly a very inexpensive chip. This chip takes the output of the sensor and does some minor processing on it to emit a digital output pulse from the analog sensor.For many basic projects or products that need to detect when a person has left or entered the area, or has approached, PIR sensors are great. They are low power and low cost, pretty rugged, have a wide lens range, and are easy to interface with. Note that PIRs won't tell you how many people are around or how close they are to the sensor, the lens is often fixed to a certain sweep and distance (although it can be hacked somewhere) and they are also sometimes set off by house pets.
PIR sensors are rather generic and for the most part vary only in price and sensitivity. Most of the real magic happens with the optics. This is a pretty good idea for manufacturing: the PIR sensor and circuitry is fixed and costs a few dollars. The lens costs only a few cents and can change the breadth, range, sensing pattern, very easily.In the diagram above, the lens is just a piece of plastic, but that means that the detection area is just two rectangles. Usually we'd like to have a detection area that is much larger. To do that, we use a simple lens such as those found in a camera: they condenses a large area (such as a landscape) into a small one (on film or a CCD sensor). For reasons that will be apparent soon, we would like to make the PIR lenses small and thin and moldable from cheap plastic, even though it may add distortion. For this reason the sensors are actually Fresnel lenses (see image below).OK, so now we have a much larger range. However, remember that we actually have two sensors, and more importantly we dont want two really big sensing-area rectangles, but rather a scattering of multiple small areas. So what we do is split up the lens into multiple section, each section of which is a fresnel lens.The different faceting and sub-lenses create a range of detection areas, interleaved with each other. That's why the lens centers in the facets above are 'inconsistent' - every other one points to a different half of the PIR sensing element.
Reading the PIR Sensor
Upload the code which is mentioned below:
Step 4: Making the Connections
Internal input: By batteries (6 batteries, 1.5V each) or 9V battery to the power input of the arduino card.
External input: By an external transformer (9V, 1A) to the 2.1mm input or via USB cable to the mini USB input of the arduino card.
Arduino (Top: left to right):
GND - LED/s (GND), Speaker (GND).
Digital 13 - LED/s (Vcc).
Digital 12 - Pushbutton (right leg).
Digital 11 - Speaker (Vcc).
Digital 10, 9, 8, 7, 6, 5, 4 - LCD Keypad Shield (D10, D9, D8, D7, D6, D5, D4).
Digital 2 - PIR Sensor (OUT). Digital 1 (TX) - Bluetooth module (RXD).
Digital 0 (RX) - Bluetooth module (TXD).
Arduino (Bottom: left to right):
Reset - LCD Keypad Shield (RST).
5V - Bluetooth module (Vcc), PIR Sensor (Vcc), LCD Keypad Shield (5V), Pushbutton (with a 10k resistor between the 5v and the middle leg of the pushbutton).
Gnd - Bluetooth module (GND), PIR Sensor (GND), LCD Keypad Shield (GND), Pushbutton (left leg).
Gnd - 9V connector (-). Vin - 9V connector (with a switch between the Vin and the +).
NOTE-YOU SHOULD GENERALLY POWER THE ARDUINO WITH THE INBUILT POWER PIN THAT IS WITH THE USB CABLE OR CHARGER FOR BETTER RESULTS AND ESPECIALLY IN THIS PROJECT.
Step 5: Making the LED Face
CONNECT THE LEDs AS SHOWN IN THE IMAGE ABOVE.
Step 6: Making the Connections With the Water Pump
To run the water pump just attach the pipes in the inlet and outlet extensions withing the motor and attach the inlet pipe with a source containing the water.
The water pump is an advancement to the project so that whenever the PIR Sensor detects the motion or an intruder the water pump would start taking in water and project it with a turbulent force or flow on the intruder.
NOTE-YOU SHOULD ATTACH A NOZZLE WITH A SMALL CROSS-SECTION SO THAT THE WATER COMES OUT OF THE PUMP WITH A TURBULENT FORCE.
Step 7: Uploading the Code
Download the arduino software from the link given below and run the software:
1.Download the .ino file which is present in this page (this your final arduino code).
2.Downlaod the zip files namely StopWatchClass and LiquidCrystalDisplay .
3. Extract those files in the libraries folder of the arduino software location (shown in the picture).
4.For more information on these libraries, check out the following links:
5.Choose the board: Tools -> Board -> Arduino Uno.
6.For other boards, see more information regarding the serial1 connection (to avoid compatibility issues): http://arduino.cc/en/reference/serial
Verify The code and upload to the arduino.
Step 8: Receiving the Message on Your Android Smart Phone
Download the arduino bluetooth control app by broxcode from the link below:
Steps to connect to the android smartphone:
1. Turn on your project.
2.Turn on your phone's Bluetooth.
3. Open the app and click the terminal window.
4.Connect to HC-05 and if it asks for the connection password then type 1234 or 0000.
5 Open the terminal in the app.
6.Congratulations you have made the project.
Step 9: Tidy Up the Things
Now pack your project in a container to make it look good.
If you want to program it for arduino mega then change all the serial to serial1 in the code.