Daniel Porrey
Published © GPL3+

Sensor Telemetry 2.0.1

Drive temperature data to Microsoft Azure IoT Hub and monitor the data remotely from a Windows Universal application. Digitally Remastered!

IntermediateFull instructions provided4 hours13,003

Things used in this project

Hardware components

Adafruit MCP9808 High Accuracy I2C Temperature Sensor Breakout Board
×1
Raspberry Pi 3 Model B
Raspberry Pi 3 Model B
×1
Tactile Button Switch
×1
Large Breadboard
×1
Cobbler Breakout Kit
Optional
×1
10K Ω Resistor
×2
Resistor 220 ohm
Resistor 220 ohm
×4
Red LED
×1
Blue LED
×1
Green LED
×1
Yellow LED
×1
Jumper wires (generic)
Jumper wires (generic)
Male-to-Male if using cobbler, Male-to-Female if you are making connections directly to the Raspberry Pi.
×1

Software apps and online services

Microsoft Azure
Microsoft Azure
Windows 10 IoT Core
Microsoft Windows 10 IoT Core
Visual Studio 2015
Microsoft Visual Studio 2015

Story

Read more

Schematics

Fritzing

Connections made directly to the Raspberry Pi.

Breadboard

Connections made directly to the Raspberry Pi.

Schematic

Connections made directly to the Raspberry Pi.

Fritzing

Connections made using Vilros Cobbler.

Breadboard

Connections made using Vilros Cobbler.

Code

SQL

SQL
Use this script to create the SensorReadings table in your SQL Server database.
USE [SensorTelemetry];
GO

CREATE TABLE [dbo].[SensorReadings]
    (
      [Id] [NVARCHAR](128) NOT NULL ,
      [TimestampUtc] [DATETIME] NOT NULL ,
      [Source] [INT] NOT NULL ,
      [Temperature] [REAL] NOT NULL ,
      [IsCritical] [INT] NOT NULL ,
      [IsAboveUpperThreshold] [INT] NOT NULL ,
      [IsBelowLowerThreshold] [INT] NOT NULL ,
      [Version] [TIMESTAMP] NULL ,
      [CreatedAt] [DATETIMEOFFSET](7) NULL ,
      [UpdatedAt] [DATETIMEOFFSET](7) NULL ,
      [Deleted] [BIT] NULL ,
      CONSTRAINT [PK_dbo.SensorReadings] PRIMARY KEY NONCLUSTERED ( [Id] ASC )
        WITH ( PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF,
               IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,
               ALLOW_PAGE_LOCKS = ON )
    );
GO

ALTER TABLE dbo.SensorReadings ADD CONSTRAINT [DF_SensorReadings_Id] DEFAULT (NEWID()) FOR [Id];
GO

ALTER TABLE dbo.SensorReadings ADD CONSTRAINT [DF_SensorReadings_CreatedAt] DEFAULT (SYSUTCDATETIME()) FOR [CreatedAt];
GO

ALTER TABLE dbo.SensorReadings ADD CONSTRAINT [DF_SensorReadings_UpdatedAt] DEFAULT (SYSUTCDATETIME()) FOR [UpdatedAt];
GO

ALTER TABLE dbo.SensorReadings ADD CONSTRAINT [DF_SensorReadings_Deleted] DEFAULT ((0)) FOR [Deleted];
GO

Visual Studio 2015 C# Source Code

Credits

Daniel Porrey

Daniel Porrey

50 projects • 318 followers
I am a developer and creator. As an Amazon Associate I earn from qualifying purchases.

Comments