How does this mini security project work?
Firstly, the Sharp 2Y0A21 sensor will detect the distance between the sensor and the object (in our case, human) and the data (distance and ADC) will be shown on the touch screen in radial gauge form. As the distance goes up, the ADC will go down and vice versa as if they are in a push-pull relationship.
Secondly, if the distance between the sensor and the user is too close, the buzzer will buzz and the red LED will be lighted up. This will usually scare the user (e.g. burglar) away.
Lastly, we included the NFC so that the house owner can tap using a card to open the door, stop the buzzer and the led light will turn green.
Step 1: Coding Platforms You Need + Background Info You Need
You will need to have Arduino Software (IDE) which you can download here ---> https://www.arduino.cc/en/Main/Software
You will also need Microsoft Visual Studio 2015 Community Update 3. You can download here --->
You need to know all about breadboards
Step 2: Gather the Things That You Need.
You will need:
- 7” Raspberry Pi Touch Screen (optional)
- Jumper Wires: Male to male for arduino to sensor. Male to female for raspberry pi to arduino.
- Raspberry Pi 3 Model B (optional)
- Arduino Uno
Sharp 2Y0A21 sensor (To measure Distance and ADC)
The raspberry pi and touchscreen is only used to display our app using Universal Windows Platform in Visual Studio. The app as I have said earlier consist of 2 radial gauge. 1st radial gauge is to display the distance and 2nd radial gauge is to display the ADC value.
Step 3: ALL the Codes You Need
I have attached the files the arduino codes + visual studio codes. There are many ways to codes and feel free to edit them as it is not perfect. I assume that you know how to upload the arduino codes to arduino and deploy the app in VS.
Step 4: Connecting Sharp 2Y0A21 Sensor to Arduino Uno + Code
There are green, black, and yellow wires on the sensor. Of which, the red is the power, the black is for the ground and yellow is to analog.
The red wire will be connected to 5v.
The black to the ground (gnd).
The yellow to the A0.
Step 5: Adding Buzzer
The connection is pretty easy. Just look at the fritzing above. However do note that we are using a lot sensors for this project thus, please make good use of the breadboard as there a limited number of pins.
Step 6: RBG LED Light
Connecting this is pretty easy too. The only tricky part again is to get around making good use of the breadboard.
Step 7: Adding NFC
Adding NFC is simple too. Again please make good use of the breadboard to make it possible to connect all the sensors to the arduino.
Step 8: Connecting Arduino to Raspberry Pi
Connecting Arduino to Raspberry Pi. I have attached everything you need to know in the image above. No worries
Step 9: Connect Raspberry Pi to Touchscreen
Above is a demo on how to attach your raspberry to led touchscreen if you have not done so
Step 10: Copy Codes to Arduino
All the codes are written here to get the 4 sensors: LED light, sharp sensor, NFC, buzzer to be responsive and follow the project mission. Again, it is working 100% but they are many ways to put it and it is not limited to just using one code.
Step 11: Copy Codes to Your UWP
This is to display the radial gauge.
Please install Microsoft.Uwp.Toolkit.UI.Controls NuGet package:
If you want to edit further you radial gauge, please visit https://xamlbrewer.wordpress.com/2016/10/05/a-lap-...
for further information.
Step 12: DEPLOY
DEPLOY AND HAVE FUN.
All should be working well.