A Blazor app that acts as a go-between an IoT Device and Azure IoT Hub. Blazor receives telemetry from a device over Http which it then forwards to teh IoT Hub. Commands can be forwarded back to the device from the hub via the Blazor app. There is also a command line app that can get telemetry over a serial port and forward this to Blazor. This has been implemented for Arduino devices that have no WiFi/Ethernet. The take-homes are tha the devices don’t need to store hub credentials nor implement the Azure IoT Device SDK, and simple devices don’t need networking to be able to submit telemetry.

Background

This is a .NET 5 version update of djaus2/BlazorSensorApp. This forwarded Telemetry messages to an IoT Hub. The telemetry could be generated in the Blazor Client. Alternatively there were Arduino and .NET Core console app RPi apps that could forward simulated or real telemetry via Http Posts to the Blazor service for on-forwarding. This version continues with a port of the console app to .NET 5, still forwarding Telemetry to the service via Http Posts (for on-forwarding to the hub). The app has two modes of operation; for this it runs in Http mode. The Http Post option for Arduino has been dropped (to be added back later), but reimplemented using the USB serial connection to a desktop. With this the console app runs in the alternative mode where it communicates with the Arduino device serially to get telemetry and send commands. IoT Hub commands can be sent to the device whether he console app is running in Http Post mode, or in the Arduino serial mode.

The architecture of this solution
The Architecture of the Telemetry mechanism for this solution. There is also the Command Architecture, not shown here.

Other

There is a PnP oriented Azure IoTBridge app: Azure IoT Central Device Bridge. This project is a simpler implementation without PnP capabilities. This project is simply focused upon sending and monitoring Telemetry as well as implementing commands.

  • Azure IoT device SDKs
  • In another previous project, Azure IoT Hub Toolbox the Azure IoT Hub SDK Quickstarts sample apps were integrated into a single UWP app (with a UI). This new project implements similar functionality.
  • Much work has also been done to orchestrate Azure IoT Hub and related entities as a set of PowerShell scripts. That project is Azure IoT Hub PowerShell Scripts This is a menu driven set of scripts. It includes sample apps to deploy, Az Sphere etc.

Functionality

  • Blazor Server for forwarding telemetry to an Azure IoT Hub
    • Connection strings required
    • Currently in server appsettings.json
    • (Client has page for setting connection strings but currently not used.)
  • Wasm Client app for forwarding simulated telemetry via the server.
  • Can similarly on-forward real or simulated telemetry from RPi, Arduino etc
    • .Net console app for desktop and say, RPi, that forwards telemetry via Http Post to the Blazor service … simulated data at this stage.
    • Arduino app that forwards via a serial port to the Blazor service … simulated data at this stage
      • The original BlazorSensorApp solution had an Arduino Http Post version of the app. This will be re-added later.
  • Can monitor IoT messages sent from the service (view on Client)
    • Directly via a transmission log kept on the service.
    • Via a D2C monitoring of messages to the IoT Hub . (Integration of the Quickstarts ReadD2cMessages sample app).
      • Nb: Actually runs as a separate app that forwards to the service via Http
      • The D2C sample app remains as a .NET Core app (couldn’t be ported to .NET 5).
      • It forwards message information over Http to the service
  • Can send commands to the device (whether simulated or not)
    • Direct from the client.
    • Via the IoT Hub: Direct (with Blazor service) integration of the Quickstarts InvokeDeviceMethodApp sample app.
      • Service integrates invocation functionality from the Quickstarts SimulatedDeviceWithCommand sample app for monitoring commands submitted via the IoT Hub.
    • Service maintains a ConcurrentQueue of commands received directly or from the hub that is polled by the device.
    • (Simulated) device apps forward a list of commands at start that the Client uses to generate a menu of commands.

Solution Projects

  • BlazorIoTBridge
    • BlazorIoTBridge.Client
    • BlazorIoTBridge.Shared
      Included in Client, Server and Serial2lBlazor_app
    • BlazorIoTBridge.Server
      • SimulatedDeviceWithCommandOnlyBlaz_lib
      • InvokeDeviceMethod_lib
    </li>
  • SerialBlazor_app
  • ReadD2cMessagesBlaz_app
    • BlazorIoTBridge.SharedDNC
      Same as BlazorIoTBridge.Shared but .Netcore</font>
    </li> </ul> Key:
    .NET 5
    .NET Core 3.1 There is also an Arduino app that hooks to SerialBlazor serially as a device. ## 2Dos - Recreate Http Post Arduino app - Update image above - Add back in real sensor telemetry to devices. - Allow for multiple devices to simultaneously use same Blazor service. - Setting or registering device specific connection information via the client.

 TopicSubtopic
  Next: > Meltdown
<  Prev:   Grove Beginner Kit For Arduino
   
 This Category Links 
Category:IoT Index:IoT
  Next: > Google Home Windows Bridge
<  Prev:   Blazor-IoT