See the Wiki for more information.
##Software Requirements (as at May 2015)
- Windows 10 (build 10122) or above
- Visual Studio 2015 (Community Edition (free), Professional or above)
##Getting Started For information on setting up your Raspberry Pi 2 running Windows 10 for IoT and your development environment see http://ms-iot.github.io/content/GetStarted.htm.
##Acknowledgements
- The Component library was inspired by the Raspberry# IO .NET/Mono IO Library for Raspberry Pi project
- The MQTT Client Library for .Net and WinRT
##Hardware
###Barebones
- Raspberry Pi 2. With no sensors or Explorer HAT Pro attached the Raspberry Pi can publish memory usage data enough to get you started and publishing data:)
###Ideal Hardware This lab is built around the Explorer HAT Pro as it has a four channel ADC, capacitive touch pads, four coloured LEDs, two H-bridge motor drivers, 5V input and output.
- Raspberry Pi 2
- Explorer Pro HAT
- Light Dependent Resistor
- Analogue Temperature Sensor
###Optional Extras 5. Adafruit Mini 8x8 LED Matrix 6. Breakout Board for Electret Microphone
Explorer Pro HAT Notes:
- Explorer HAT uses an output driver chip called the ULN2003A, which contains a set of transistor pairs called a Darlington Array. It transforms the small logic signal of the Pi into something capable of driving much bigger loads, such as motors, steppers, lights and more.
- The 4 outputs on Explorer HAT can sink 5V, but not source. This means you need to connect your load to one of the 5V pins, and then to the output. When you turn the output on it will connect your circuit to ground, allowing current to flow and your load to turn on. This is the opposite of using a bare Pi GPIO pin, where you might connect to the pin and then to ground; keep this in mind!
#What is The Internet of Things Maker Den?
The Internet of Things Maker Den is designed to be an accessible hands on experience with hardware prototyping and building a Universal Windows App that you will deploy to a Raspberry Pi 2 running Windows 10 for IoT..
The goal of the lab is to learn something about wiring circuits (with plenty of guidance), deploying code and streaming your sensor data to Microsoft Azure.
The Maker Den is implemented on top of the Internet of Things Solutions Framework.
#What is the Internet of Things Solution Framework?
The Internet of Things Solution Framework for Windows 10 on IoT is a general purpose extensible pluggable foundation to support sensors, actuators, data serialisation, communications, and command and control.
- Sensors
- Physical: Light, Temperature
- Virtual: Memory Usage, Diagnostics
- Sensor data serialised to a JSON schema
- Actuators
- Led, Relay, Generalised Output Pin
- Adafruit mini 8x8 LED Matrix on HT16K33 I2C Controller
- Low and high level pixel frame transformation primitives
- Alphanumeric character drawing and scrolling capability
- Converters
-
Drivers
- Ht16K33 16*8 LED Controller Driver driving Adafruit Mini 8x8 LED Matrix. See Adafruit project library.
-
Command and Control
- Control relays etc via the communications layer
- Communications
- Pluggable – currently implemented on MQTT (Mosquitto MQTT Server running on Azure)
- Supported and Tested
- Windows 10 for IoT on Raspberry Pi 2
- Supports Visual Studio 2015
The IoT Dashboard allows you to visualise the data streamed to Azure.
You can install the IoT Dashboard from here. Note, you will need to allow to run from unknown publisher.
##Creating your first applications
The only requirement is an Internet connected Raspberry Pi 2 running Windows 10 for IoT
This example will publish data to Azure and the IoT Dashboard
- From Visual Studio 2015 open the MakerDen.cs file in the MakerDen Project
- Modify the DevId in the StartNetwork Services method
- Ensure your Raspberry Pi is internet connected
- Ensure Visual Studio set to deploy to your "Remote Machine"
- Click Start to compile, deploy and run your application on the Raspberry Pi
- Open the IoT Dashboard and your data will appear as a guage
MakerDen.cs
using Glovebox.Adafruit.Mini8x8Matrix;
using Glovebox.IO.Components;
using Glovebox.IO.Components.Actuators;
using Glovebox.IO.Components.Sensors;
using Glovebox.IoT;
using System.Threading;
namespace MakerDen
{
public class MakerDen : IoTServices
{
public MakerDen() : base(false) { } // if Explorer Hat installed set : base(true)
public void Main()
{
// Replace "myPi2" with a unique 3 to 5 character identifier. Use your initials or something similar.
// This identifier will be visible on the IoT Dashboard
StartNetworkServices("myPi2", "YourNetworkId");
using (SensorMemory memory = new SensorMemory(5000, "mem01"))
{
memory.OnAfterMeasurement += OnAfterMeasurement;
Util.Delay(Timeout.Infinite);
}
} // End of Main()
}
}
###Blinky
Blinky is the "Hello, World!" of the Internet of Things World
This example assumes you have a Explorer Pro HAT
MakerDen.cs
using Glovebox.Adafruit.Mini8x8Matrix;
using Glovebox.IO.Components;
using Glovebox.IO.Components.Actuators;
using Glovebox.IO.Components.Sensors;
using Glovebox.IoT;
using System.Threading;
namespace MakerDen
{
public class MakerDen : IoTServices
{
public InitMakerDen() : base(true) { } // if Explorer Hat installed set : base(true)
public void Main()
{
using (Led red = ExplorerLedRed)
{
while (true)
{
red.On();
Util.Delay(1000);
red.Off();
Util.Delay(1000);
}
}
} // End of Main()
}
}
Or wire up your own LED. Follow this wiring diagram
MakerDen.cs
using Glovebox.Adafruit.Mini8x8Matrix;
using Glovebox.IO.Components;
using Glovebox.IO.Components.Actuators;
using Glovebox.IO.Components.Sensors;
using Glovebox.IoT;
using System.Threading;
namespace MakerDen
{
public class MakerDen : IoTServices
{
public InitMakerDen() : base(false) { } // if Explorer Hat installed set : base(true)
public void Main()
{
using (Led red = new Led(18, "led"))
{
while (true)
{
red.On();
Util.Delay(1000);
red.Off();
Util.Delay(1000);
}
}
} // End of Main()
}
}
###Light sensor activated light
MakerDen.cs
using Glovebox.Adafruit.Mini8x8Matrix;
using Glovebox.IO.Components;
using Glovebox.IO.Components.Actuators;
using Glovebox.IO.Components.Sensors;
using Glovebox.IoT;
using System.Threading;
namespace MakerDen
{
public class MakerDen : IoTServices
{
public InitMakerDen() : base(true) { } // if Explorer Hat installed set : base(true)
public void Main()
{
using (SensorLight light = new SensorLight(adc, Timeout.Infinite, "light01"))
using (Led redLed = ExplorerLedRed)
{
while (true)
{
if (light.Current < 70)
{
redLed.On();
}
else
{
redLed.Off();
}
Util.Delay(500);
}
}
} // End of Main()
}
}
###Ultimate
All singing dancing with Explorer Hat, Light and Temperature Sensors plus Adafruit Mini 8x8 LED Matrix that publishes data to Azure :)
MakerDen.cs
using Glovebox.Adafruit.Mini8x8Matrix;
using Glovebox.IO.Components;
using Glovebox.IO.Components.Actuators;
using Glovebox.IO.Components.Sensors;
using Glovebox.IoT;
using System.Threading;
namespace MakerDen
{
public class MakerDen : IoTServices
{
public InitMakerDen() : base(true) { } // if Explorer Hat installed set : base(true)
public void Main()
{
// Replace "myPi2" with a unique 3 to 5 character identifier. Use your initials or something similar.
// This identifier will be visible on the IoT Dashboard
StartNetworkServices("myPi2", "YourNetworkId");
using (Relay relay = new Relay(ExplorerPins.Output.One, "relay01"))
using (SensorTemp temp = new SensorTemp(adc, 4000, "temp01"))
using (SensorLight light = new SensorLight(adc, 1000, "light01"))
using (SensorMemory memory = new SensorMemory(5000, "mem01"))
using (AdaFruitMatrixRun matrixRun = new AdaFruitMatrixRun("matrix01"))
{
//Enable data publishing
temp.OnBeforeMeasurement += OnBeforeMeasure;
temp.OnAfterMeasurement += OnAfterMeasurement;
light.OnBeforeMeasurement += OnBeforeMeasure;
light.OnAfterMeasurement += OnAfterMeasurement;
memory.OnBeforeMeasurement += OnBeforeMeasure;
memory.OnAfterMeasurement += OnAfterMeasurement;
Util.Delay(Timeout.Infinite);
}
} //end of Main()
}
}
See Lab code snippets for more examples
##Explorer Hat Layouts ###Layout One
####Required components 2. Explorer HAT Pro 3. Light Dependent Resistor 4. Analogue Temperature Sensor
Layout | Image |
---|---|
Wiring | |
Components |
###Layout Two ####Required components
- Explorer HAT Pro
- Light Dependent Resistor
- Analogue Temperature Sensor
- Adafruit Mini 8x8 LED Matrix
Layout | Image |
---|---|
Wiring | |
Components |
###Layout Three ####Required components
- Explorer HAT Pro
- Light Dependent Resistor
- Analogue Temperature Sensor
- Adafruit Mini 8x8 LED Matrix
- Breakout Board for Electret Microphone
Layout | Image |
---|---|
Wiring | |
Components |