.NET Internet of Things

A presentation at .NET Conf in November 2021 in by Melissa Houghton

Slide 1

Slide 1

Slide 2

Slide 2

.NET Internet of Things Melissa Houghton melissahoughton.dev melissahoughton melissahoughton meliss_houghton

Slide 3

Slide 3

About Me Lead Software Engineer Developer Technologies melissahoughton.dev melissahoughton melissahoughton meliss_houghton

Slide 4

Slide 4

What is IoT? @meliss_houghton

Slide 5

Slide 5

How can you use .NET for IoT @meliss_houghton

Slide 6

Slide 6

Libraries System.Device.Gpio Hardware Platform Device Bindings Core APIs .NET IoT Libraries • Analog Converters • Digital Logic • Display Controller • • • ADC CAN GPIO • • • Tooling • I/O Expanders • Sensors • LED Drivers • Memory • Motor Drivers • Real Time Clocks Futures • I2C PWM SPI System.Device.* Windows 10 IoT / Linux • • X86 X64 • • ARM32 ARM64 • • BeagleBone Black Custom Hardware Maker Boards • • Raspberry Pi HummingBoard @meliss_houghton • CLI • Docker • Templates • Testing

Slide 7

Slide 7

System.Device.Gpio Protocols Including: • General-purpose I/O (GPIO) • Inter-Integrated Circuit (I2C) • Serial Peripheral Interface (SPI) • Pulse Width Modulation (PWM) • Serial port @meliss_houghton

Slide 8

Slide 8

Iot.Device.Bindings https://github.com/dotnet/iot/tree/main/src/devices @meliss_houghton

Slide 9

Slide 9

@meliss_houghton

Slide 10

Slide 10

Tools @meliss_houghton

Slide 11

Slide 11

Deployment @meliss_houghton

Slide 12

Slide 12

Framework-dependent

Install .NET on the device curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin —channel Current # Publish the app with Deployment mode = Framework-dependent and Target runtime = Portable dotnet publish # Copy the files from the computer to the device scp -r /publish-location/* pi@raspberrypi:/home/pi/deployment-location/ # Run the app on the device dotnet HelloWorld.dll

Self-contained

Publish the app with Deployment mode = Self-contained and Target runtime = linux-arm dotnet publish -r linux-arm # Copy the files from the computer to the device scp -r /publish-location/* pi@raspberrypi:/home/pi/deployment-location/ # Run the app on the device chmod +x HelloWorld

./HelloWorld @meliss_houghton

Slide 13

Slide 13

Debugging @meliss_houghton

Slide 14

Slide 14

@meliss_houghton

Slide 15

Slide 15

.NET nanoFramework @meliss_houghton

Slide 16

Slide 16

@meliss_houghton

Slide 17

Slide 17

.NET IoT nanoFramework Powerful boards Low-level microcontrollers All .NET core libraries Specific .NET libraries Iot.Device.Bindings and System.Device.Gpio Specific packages per sensor Manual deployment setup Remote debugging experience Manual remote debugging Deploy the code via SSH connection Built-in deployment Deploy via wired connection @meliss_houghton

Slide 18

Slide 18

Meadow @meliss_houghton

Slide 19

Slide 19

Why use Meadow • Enterprise IoT • Full .NET on embeddable microcontrollers • Plug and Play IoT Library • Focused on Security • Cloud agnostic @meliss_houghton

Slide 20

Slide 20

using Meadow; Program.cs using Meadow; using Meadow.Devices; using System.Threading; using Meadow.Foundation.Leds; namespace HelloMeadow namespace HelloMeadow { { MeadowApp.cs class Program public class MeadowApp : App<F7Micro, MeadowApp> { { static IApp app; public MeadowApp() public static void Main(string[] args) { { var pwmLed = new PwmLed( // instantiate & run new meadow app Device, Device.Pins.D13, TypicalForwardVoltage.Blue); app = new MeadowApp(); // pulse the LED Thread.Sleep(Timeout.Infinite); pwmLed.StartPulse(); } } } } } } @meliss_houghton

Slide 21

Slide 21

Azure IoT SDK for .NET https://github.com/Azure/azure-iot-sdk-csharp @meliss_houghton

Slide 22

Slide 22

Azure IoT Hub // Create device client // And connect to IoT Hub using MQTT protocol DeviceClient deviceClient = DeviceClient.Create( iotHubHostName, deviceAuthentication, TransportType.Mqtt); … // Send the telemetry message. await deviceClient.SendEventAsync(message); @meliss_houghton

Slide 23

Slide 23

Time Series Insights @meliss_houghton

Slide 24

Slide 24

Digital Twins

Slide 25

Slide 25

@meliss_houghton

Slide 26

Slide 26

AI/ML for IoT with .NET @meliss_houghton

Slide 27

Slide 27

ML.NET @meliss_houghton

Slide 28

Slide 28

Azure Cognitive Services @meliss_houghton

Slide 29

Slide 29

Azure Video Analyser @meliss_houghton

Slide 30

Slide 30

How to get started @meliss_houghton

Slide 31

Slide 31

@meliss_houghton

Slide 32

Slide 32

Thanks for joining! https://bit.ly/dotnetconf-iot melissahoughton.dev melissahoughton meliss_houghton melissahoughton