Skip to content

IoT project for a Raspberry Pi running Windows 10 IoT Core connected to a tilt sensor and three LEDs. This application sends notifications to an Azure IoT Hub after a specified number of tilts, which is then routed through a Stream Analytics job to an Event Hub which triggers a Logic App to send an email notification.

Notifications You must be signed in to change notification settings

kottofy/TiltSensor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tilt Sensor Project

IoT Raspberry Pi project built on Microsoft IoT Core platform in Visual Studio Community 2015 using a tilt sensor and LEDs. One LED lights up based on if the tilt sensor senses tilt (on if yes, off if no). Another LED lights up periodically to signify a check if there is tilting or not. If at those checks the tilt sensor is tilting, then that will be recorded as a tilt. After a certain number of tilts, the third LED will light up to signal a notification is being sent to Azure Event Hub.

Hardware

  • Raspberry Pi 2 Model B v1.1
  • Tilt Sensor (ex. Keyes KY-020)

Technologies

  • Windows 10 IoT Core
  • Windows UWP App on Pi
  • Windows UWP IoT Extension
  • Azure IoT Hub
  • Azure Stream Analytics Job
  • Azure Event Hub
  • Azure Logic App
  • Office 365

Azure Setup

Architecture

  1. Create the IoT Hub

  2. Create Service Bus Queue

  3. Create a Stream Analytics Job with input from the IoT Hub and output to the queue with the query

    SELECT
        *
    INTO
        [tiltsensoroutput]
    FROM
        [tiltsensorinput]
    WHERE
        IotHub.ConnectionDeviceId LIKE 'TiltSensor'
  4. Create a Logic App to trigger on new message in the queue and send to email, SMS with twilio, or to do whatever you'd like!

    logic app

Steps to Run This Project

  1. Download all of the files in the repository
  2. Open the solution in Visual Studio
  3. Update the local_settings.cs file with your device connection string and save it
  4. Change the run mode in Visual Studio to Remote Machine
  5. Update the IP Address of the Remote Connection
    • (Option A). If the Remote Connection window appeared after step 4, update the IP address with your IoT device IP address
    • (Option B) Otherwise, double click on Properties in the Solution Explorer and update the Debug section with your IoT device's IP address
  6. Nuget packages may need to be restored and project may need to be built or rebuilt and few times.
  7. Run the project on the Remote Machine

Loading This Project as Startup on Device

  1. Follow the instructions here to begin a PowerShell connection to the device (have patience here)
  2. Use the commands here to set the startup project
    • For this project, you will need to find the name of the project after it has been deployed to the device by using IotStartup list headless
    • Then, use the command IotStartup startup headless [Task1] and paste in the name of the project for [Task1]

About

IoT project for a Raspberry Pi running Windows 10 IoT Core connected to a tilt sensor and three LEDs. This application sends notifications to an Azure IoT Hub after a specified number of tilts, which is then routed through a Stream Analytics job to an Event Hub which triggers a Logic App to send an email notification.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages