Introduction: Mini Distance Security System
How does this Mini Distance Security System works?
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 person is too close (lower than 7cm) and the RGB LED will turn on red, followed by the buzzer sound and the laser emitter. And when the person step back a little bit, the RGB LED will turn green and the buzzer with laser emitter will be turn off.
Step 1: Gather Your Software
You will need to have Arduino Software (IDE) to deploy the Arduino code to the Arduino
which you can download at the link below:
https://www.arduino.cc/en/Main/Software
You will also need Microsoft Visual Studio 2015 Community Update 3 to work on the Universal Application
which you can download at the link below:
https://go.microsoft.com/fwlink/?LinkId=691129
The final thing which is most important one is Windows 10 IoT Core
You need to download Windows IOT Core Dashboard to download the Windows IoT OS and deploy the OS to the microSD card.
NOTE: Your OS must be at least Windows 10 version 1511.
Step 2: Gather Your Hardware
You will need:
- Raspberry Pi 3 Model B
- Raspberry Pi 7 inch touch screen LCD
- Arduino Uno
- Sharp 2Y0A21 ultrasonic sensor
- Arduino - active buzzer sensor
- Arduino - RGB LED
- Arduino - Laser diode module
- Breadboard
- microSD card
You may need a switch and 2 Ethernet cables to do the remote control from your laptop/computer.
You are required to connect one Ethernet cable from the Raspberry Pi to the switch and one Ethernet cable from your device to the switch.
Step 3: Assembly Your Raspberry Pi 7 Inch Touchscreen LCD
There is a video on YouTube about how to setup the LCD.
Step 4: Setup Your Final Devices
You can start to put the things together according to the diagram.
Step 5: Start to Write Your Arduino Code
Before do this, you have to connect the Arduino UNO physically to your laptop/computer to deploy the code from the Arduino IDE to the Arduino UNO.
Below is the sample code for Arduino:
Attachments
Step 6: Start on the Universal Application on Visual Studio
Step:
1. You will need to install "Universal Windows App Development Tool".
2. After finished the installation, start up the Visual Studio.
3. Create a new project -> Blank Universal Apps.
4. You will need to install the NuGet package for the RadialGauge. In this case, we recommend "
Microsoft.Uwp.Toolkit.UI.Controls" NuGet package.
5. Right click on the Project. Add reference: "Windows IoT Extensions for the UWP" for the deployment to the Raspberry Pi purposes.
6. Start design MainPage.xaml for the UI and the MainPage.xaml.cs for the code behind.
7. Remember to get the reading data from the Arduino to the Raspberry Pi. This code is done in the
MainPage.xaml.cs.
8. Finally, you can debug your project by remote machine in the Visual Studio.
Further information:
For the reference to create RadialGauge, you can refer to below link:
Step 7: The Sample UWP Code
I attached the Visual Studio - Universal Apps code for your reference.
Attachments
Step 8: Deploy Your Project
DEPLOY THE PROJECT !!
~Good Luck and Have fun~