Kevin Hilscher
Published © GPL3+

Azure IoT Swimming Pool

Control and monitor a swimming pool using Azure IoT Hub, Streaming Analytics, Azure SQL, API App, Raspberry Pi, Windows IoT Core, Arduino.

AdvancedFull instructions provided16 hours20,148
Azure IoT Swimming Pool

Things used in this project

Hardware components

DS18B20 Waterproof Digital Temperature Sensor
(Red wire connects to 3-5V, Blue/Black connects to ground and Yellow/White is data)
×2
IoT Power Relay
×1
Resistor 4.75k ohm
Resistor 4.75k ohm
1/4W, 5%
×2
Raspberry Pi 2 Model B
Raspberry Pi 2 Model B
×1
Arduino UNO
Arduino UNO
Arduino Uno R3
×1

Software apps and online services

Microsoft Azure
Microsoft Azure
Windows 10 IoT Core
Microsoft Windows 10 IoT Core
Arduino IDE
Arduino IDE
Visual Studio 2015
Microsoft Visual Studio 2015
Azure IoT Hub Device Explorer
Fritzing
Power BI

Story

Read more

Schematics

Raspberry Pi to Arduino over I2C connecting 2 DS18B20 Sensors

Raspberry Pi to Arduino over I2C connecting 2 DS18B20 Sensors

IoT Pool Architecture

Overall architectural diagram

Raspberry Pi to IoT Power Relay

Code

JSON Message Payload Format for Device to Cloud (D2C) Messages

JSON
Note: "IsPoolPowerOn" - 0 indicates power off; 1 indicates power on
{
	"PoolName" : "IoTPool",
	"PoolWaterTempC" : 30,
	"OutsideAirTempC" : 27,
	"IsPoolPowerOn" : false,  
	"SampleDateTime" : "2016-07-05T23:35:58.0882185Z"
}

SQL Database "Pools" Table Schema

SQL
CREATE TABLE [dbo].[Pools] (
    [Id]              INT            IDENTITY (1, 1) NOT NULL,
    [PoolName]        NVARCHAR (MAX) NULL,
    [PoolWaterTempC]  FLOAT (53)     NOT NULL,
    [OutsideAirTempC] FLOAT (53)     NOT NULL,
    [IsPoolPowerOn]   INT  NOT NULL,
    [SampleDateTime]  DATETIME       NOT NULL,
    CONSTRAINT [PK_dbo.Pools] PRIMARY KEY CLUSTERED ([Id] ASC)
);

IoT Pool Git Hub Repo

All source code

Credits

Kevin Hilscher

Kevin Hilscher

1 project • 7 followers
Azure Cloud Solution Architect at Microsoft
Thanks to Mike Mackes and Miles Burton.

Comments