1. Windows 10 IoT Core
.NET User Group Paderborn, 18. Oktober 2016
2. Über die Vortragenden
Jens Siebert
Diplom-Informatiker
Software-Architekt bei dSPACE
Twitter: @jens_siebert
Mark Lechtermann
Informatiker
Software-Architekt bei dSPACE
Twitter: @MarkLechtermann
3. Windows 10 – „One Windows“
Bild: Microsoft (https://winblogs.azureedge.net/win/2015/01/Windows-10_Product-Family.jpg)
4. Windows für eingebettete Systeme
Windows CE 1.0
(1996)
Windows CE 1.01
(1997)
Windows CE 2.0
(1997)
Windows CE 2.10
(1998)
Windows CE 2.11
(1998)
Windows CE 3.0
(2000)
Windows CE 4.0
(2001)
Windows CE 4.1
(2002)
Windows CE 4.2
(2003)
Windows CE 5.0
(2004)
Windows CE 6.0
(2006)
Windows CE 6R2
(2007)
Windows CE 6R3
(2009)
Windows Embedded 7
(2011)
Windows Embedded 8
(2013)
Windows 10 IoT Core
(2015)
Windows 10 IoT Pro
(2015)
5. Raspberry Pi
1.2GHz Quad-Core ARMv8 (Broadcom BCM2837)
1 GB RAM
Broadcom Video Core IV GPU
4x USB 2.0
802.11 b/g/n WiFi
10/100/1000 Mbit Ethernet
Bluetooth 4.1/LE
HDMI
Camera Interface (CSI)
Display Interface (DSI)
40 GPIO Pins
Bild: Microsoft (https://https://az835927.vo.msecnd.net/sites/iot/Resources/images/devices/RPi3_0.png)
7. Windows 10 IoT Core Setup
Raspberry Pi (2 oder 3)
SD-Card (16GB)
PC mit
Windows 10
SD-Card Reader
Windows 10 IoT Dashboard
Bild: Microsoft (https://az835927.vo.msecnd.net/sites/iot/Resources/images/IoTDashboard/IoTDashboard_SetupPage.PNG)
8. Windows Device Portal
Zugriff auf Windows 10 IoT Gerät über Web-Oberfläche
URL: http://<devicename>:8080
User: Administrator
Passwort: Aus Windows 10 IoT Dashboard
Bild: Microsoft (https://az835927.vo.msecnd.net/sites/iot/Resources/images/deviceportal/deviceportal.png)
9. Universal Windows Platform
Bild: Microsoft (https://i-msdn.sec.s-msft.com/de-de/windows/uwp/get-started/images/universalapps-overview.png)
10. Was wird benötigt?
Raspberry Pi 2 oder 3 mit Windows 10 IoT Core (Anniversary Update)
PC mit Windows 10 (Anniversary Update)
Visual Studio 2015 Update 3 (Community reicht aus)
Windows 10 SDK und Tools (für Anniversary Update)
Für Elektronik-Basteleien:
Breadboard
Elektronik-Komponenten (Widerstände, LEDs, etc.)
Sensoren (Temperatur, Luftdruck, Luftfeuchtigkeit, GPS, etc.)
Ein gewisses Elektronik-Grundwissen ist von Vorteil!
12. GPIO-Pins nutzen
using Windows.Devices.Gpio;
[…]
// Hole Referenz auf GPIO Controller Objekt
var gpio = GpioController.GetDefault();
// Prüfe ob GPIO Controller vorhanden ist
if (gpio != null)
{
// Verbindung zum GPIO-Pin Nr. 5 öffnen
var pin = gpio.OpenPin(5);
// GPIO-Pin als Ausgabe-Pin konfigurieren
pin.SetDriveMode(GpioPinDriveMode.Output);
// GPIO Pin auf Wert «High» setzen
pin.Write(GpioPinValue.High);
}
14. I2C-Bus nutzen
using Windows.Devices.I2c;
[…]
// Hole Referenz auf I2C Controller Objekt
var controller = await I2cController.GetDefaultAsync();
// Prüfe ob I2C Controller vorhanden ist
if (controller != null)
{
// Verbindung zum Sensor mit der Adresse 0x77 herstellen
var connectionSettings = new I2cConnectionSettings(0x77);
device = controller.GetDevice(connectionSettings);
// Wert aus Sensor-Register mit Adresse 0xAA auslesen
var registerData = new byte[2];
device.WriteRead(new byte[] { 0xAA }, registerData);
}
15. Demo: Temperatur-/Luftdruck-Sensor
Adafruit BMP180 Barometric Pressure/Temperature/Altitude Sensor
Vin: 3 to 5V (DC)
Logic: 3 to 5V compliant
Pressure sensing range: 300-1100 hPa
Up to 0.03hPa / 0.25m resolution
-40 to +85°C operational range
+-2°C temperature accuracy
This board/chip uses I2C 7-bit address 0x77.
Bild: Adafruit (https://cdn-shop.adafruit.com/970x728/1603-03.jpg)
16. UART nutzen
using Windows.Devices.SerialCommunication;
[…]
// Hole Referenz auf UART Objekt
var aqs = SerialDevice.GetDeviceSelector();
var dis = await DeviceInformation.FindAllAsync(aqs);
device = await SerialDevice.FromIdAsync(dis[0].Id);
// Prüfe ob UART Objekt vorhanden ist
if (device != null)
{
// UART Baud-Rate setzen
device.BaudRate = 9600;
// Wert über InputStream auslesen
var dataReader = new DataReader(device.InputStream);
var bytesRead = await dataReader.LoadAsync(1024);
var data = dataReader.ReadString(bytesRead);
}
17. UART nutzen
Wichtig: Nutzung der UART-Schnittstelle über Capabilities im Application
Manifest freischalten!
Package.appxmanifest:
<Capabilities>
<Capability Name="internetClient" />
<DeviceCapability Name="serialcommunication">
<Device Id="any">
<Function Type="name:serialPort" />
</Device>
</DeviceCapability>
</Capabilities>
18. Demo: GPS-Sensor
Adafruit Ultimate GPS Breakout (based on MTK3339)
-165 dBm sensitivity, 10 Hz updates, 66 channels
5V friendly design and only 20mA current draw
Breadboard friendly
RTC battery
Output: NMEA 0183, 9600 baud default
Fix status LED
Internal patch antenna
u.FL connector for external active antenna
Bild: Adafruit (https://cdn-shop.adafruit.com/970x728/746-08.jpg)
19. „Internet of Things“
Bild: siliconANGLE (http://siliconangle.com/files/2016/02/network-782707_1280-1080x675.png)
20. Azure IoT Hub
Bild: Microsoft (https://acom.azurecomcdn.net/80C57D/cdn/mediahandler/docarticles/dpsmedia-prod/azure.microsoft.com/en-us/documentation/articles/iot-hub-what-is-iot-
hub/20161003010117/hubarchitecture.png)
27. Nachrichten an IoT Hub senden
using Microsoft.Azure.Devices.Client;
[…]
var deviceClient =
DeviceClient.CreateFromConnectionString(azureIotHubConnectionString);
[…]
var message = new Message(Encoding.UTF8.GetBytes(data));
await deviceClient.SendEventAsync(message);
30. Nachrichten vom IoT Hub empfangen
using Microsoft.ServiceBus.Messaging;
[…]
var eventHubClient = EventHubClient.CreateFromConnectionString(
connectionString,
"messages/events"
);
[…]
var eventData = await eventHubReceiver.ReceiveAsync();
var data = Encoding.UTF8.GetString(eventData.GetBytes());