This is the sample Java application of Raspberry Pi (with BME 280). It send the sensor data of Celsius, Pressure and Humidity to Azure IoT Hub.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.gitignore Modify the image photo. Jan 25, 2017

Intrusion detection Java App on RaspberryPi with Microsoft Azure

Confirmation of this demo

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.

Power BI 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. Azure Storage Explorer 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.

Show Result

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/
$ ls
  • 8. Copy the file to Raspberry Pi by scp
$ scp RaspberryPi-To-Azure-IoT-Hub-1.0-SNAPSHOT.jar  pi@
  • 9. SSH Login to the Raspberry Pi
$ ssh -l pi
  • 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

Connect LED

LED Raspberry Pi
anode (+) registor (Ω)
cathode (-) Grand
registor GPIO 1(pin12)

There is no need to connect "5.0 VDC Power (pin2)" in this time.

How to place the BME 280

Connect BME 280

BME 280 Raspberry Pi
VIN 5.0 VDC Power (pin2)
GND Ground(pin6)
SCK GPIO 9 SCL1(I2C:pin5)
SDO Ground(pin6)
SDI GPIO 8 SDA1(I2C:pin3)

How to place the PIR Motion Sensor

Connect PIR Motion Sensor

PIR Motion Sensor Raspberry Pi
+DC Voltage 5.0 VDC Power (pin2)
Output GPIO 4(pin16)
GND Ground(pin6)

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 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 ?

Placed all sensors

Connect Sensor to RasPi