Intrusion detection Java App on RaspberryPi with Microsoft Azure
This Sample Appliaction get the data of celsius, pressure and humidity data from BME 280 sensor on Raspberry Pi(Raspberry Pi 2 Model B). After receved it, the application push the data to Azure IoT Hub.I also configure the Stream Analytics and PowerBI on Azure separatelly.As a result, we can confirm the data on PowerBI dashboard.
And also, I put the PIR motion sensor, camera and LED on RasPi. So if something had moved in front of motion sensor, it detected and turn on the LED and automatically take the phone of front of the camera. After take the photo, it upload the image to Azure Storage Blob. After uploaded the image, it send the URL to Cognitive Services as Face API and Emotion API. After received the result of analysis data, it showes the result to standard output as follow.
How to run this Sample Application
- 1. Need to create Azure IoT-Hub, Azure Storage on Azure.
- 2. Need to get the access key for both above services.
- 3. You need to create and get the Subscription ID of Cognitive Services.
- 4. Get the source code from GitHub
- 5. After get both access keys and subscription IDs, Please Edit the property files?
- 6. Build the Application
- 7. Confirm the build binary
$ cd RaspberryPi-To-Azure-IoT-Hub/target/
- 8. Copy the file to Raspberry Pi by scp
$ scp RaspberryPi-To-Azure-IoT-Hub-1.0-SNAPSHOT.jar firstname.lastname@example.org:/home/pi/
- 9. SSH Login to the Raspberry Pi
$ ssh -l pi 192.168.1.100
- 10. Execute the Application on Raspberry Pi
$ sudo java -jar RaspberryPi-To-Azure-IoT-Hub-1.0-SNAPSHOT.jar
How to place the sensors on Raspberry Pi 2.
How to place the LED
|anode (+)||registor (Ω)|
There is no need to connect "5.0 VDC Power (pin2)" in this time.
How to place the BME 280
|BME 280||Raspberry Pi|
|VIN||5.0 VDC Power (pin2)|
|SCK||GPIO 9 SCL1(I2C:pin5)|
|SDI||GPIO 8 SDA1(I2C:pin3)|
How to place the PIR Motion Sensor
|PIR Motion Sensor||Raspberry Pi|
|+DC Voltage||5.0 VDC Power (pin2)|
Pleaase note :
For PIR motion sensor, you need to adjst the default sensor setting. 1. I changed the Retriggering setting from "Low" to "High" by change the jumper pin. Please refer to the Testing a PIR of https://learn.adafruit.com? 2. There is two yellow adjuster on the PIR Motion sensor. One is Sensitivity Adjust and the others is Time Delay Adjust. Please adjust by using yellow adjuster for your environment ?