Skip to content

djaus2/GPSMapIoTHub

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

82 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GPSMap

A Blazor Server app to monitor an Azure IoT Hub and map the GPS coordinatess sent to it as telemetry.
Uses Telerik Map Component.


Updates

  • Scrolling map < > Up and Down works, Recentres if location is more than 200m off centre.
  • 6X Replay option ( Default telemetry period is 1 / 10 sec, so 6x is 1 min of telemetry / 10s )
  • WorkInProgress branch has been merged back into Master
  • Much improved NMEA GPGGA sentence filter.
  • Can record and playback history
  • Can jumper GP12/13 for selecting between two wifis and whether or not to use Serial. Can also select Blutooth, GP11
    • GP13 _High = Deskyop WiFi , alt Mobile Wifi
      • Have dev WiFi and my phone wifi for when mobile
    • GP12 _High = Serial enabled
    • GP11 _High = BT enabled but Serial takes precedence
      • If Serial/BT enabled, it blocks if no Serial/BT connected.

Device Image
A typical GPS Device, suitable for Arduino use

About

This project is a coming together of the 7th Arduino Sketch (Azure_IoT_Hub_GPS) on GitHub at djaus2/RPI Pico W GPS and Bluetooth and the Telerik Map Demo. It started out as an endeavour to map that Sketch's IoT Hub telemetry in Azure IOT Central but this was deemed a simpler approach. This app maps the current location of the GPS device.

App Image
The App showing the location of the GPS device

Azure Sketch

As per the seventh Sketch in djaus2/RPI Pico W GPS and Bluetooth but modified specifically for this app.

  • Json is single level.
    • eg. {"lat":-37.7468138,"lon":144.8956847,"alt":64.6}
  • Includes Cloud to Device Messages that are interpreted as Telemetry config (case sensitive) commands:
    • Reset
      • Restarts the telemetry timing
      • At first is 1s but doubles each send until it reaches 60s.
    • Start
      • Restarts telemetry without any change to the period.
    • Stop
      • Stops telemetry without any chnage to the period.
    • Set-Period
      • Set the telemetry peroiod
      • The command is Set separated using a highen to:
        • The period, a numerical parameter in milliseconds
      • eg. Set-30000 sets the period between sends to 30 seconds (approx).

Have added abilty to send commands from GPSMap app to the device.

Getting Started

Setup the above Sketch in an Arduino Pico W. See djaus2/RPI Pico W GPS and Bluetooth .

You will need a Telerik license, whether a full license or a 30 day trial. Follow the steps as below3 at First Steps with Server-Side UI for Blazor

  • Step 1: Download Telerik UI for Blazor
  • Step 2: Add the Telerik NuGet Feed to Visual Studio
  • Step 3: Install the Telerik UI for Blazor Components The other steps have been implemented in the project.

Azure IoT Hub and Device

  • As used with Sketch 7.
  • Having created them need Hub name.

Now open this project and add your connection details in appsettings.json:

  • "HubName": The IoT Hub Name
  • "HubConnectionString": The IoT Hub connection string
    • On the left-side pane of your IoT hub, select Shared access policies
    • From the list of policies, select the service policy.
    • Copy the Primary connection string.
  • "DeviceId": The target device's Id
  • "EventHubConnectionString": The Endpoint
    • Go to the IoT Hub in Azure Portal
    • Select Built-in endpoints
    • Scroll down to Event Hub compatible endpoint
    • Select the Endpoint

OR

If you have Azure Cli installed.

  • Create an azcli prompt and login
  • Run az iot hub connection-string show -n <IoT Hub name> --policy-name service --key-type primary
  • Run az iot hub connection-string show -n <IoT Hub name> --default-eventhub

Operational Modes:

  • Live: Scan through historical telemetry then map wrt live telemetry
  • Historical: Scan though al previous telemetry (typically a day) then replay in timely manner.
    • Can set start and end date/time

Footnote

If running the Blazor app in development mode, the app can be opened in a phone browser locally using ngrok as per the blog post:
Blazor Server Development: Viewing in a phone.