Skip to content

Deploy cloud functions and UI for PIC-IoT board on your own Google Cloud Project

License

Notifications You must be signed in to change notification settings

heberth2788/microchip-pic-iot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 

Repository files navigation

Microchip logo GCP Logo Leverege logo

PIC-IoT Quick Start

A rapid deployment tool for getting your PIC-IoT data on the cloud. Powered by Leverege.
Talk to an Expert »

(Links will open in this window. Shift+click, command+click, or middle mouse click to open in new window or tab.)

Table of Contents

  1. Set up your GCP and Firebase Projects
  2. Run the Quickstart Script
  3. Add your devices public key to your IoT Core Registry
  4. Update your PIC-IoT device firmware

This repository contains resources for quickly connecting your PIC-IoT device to your own Google Project and deploying a live UI to Firebase.

Following this guide, you will clone this repo into your Google Cloud project, and run a script that:

  • enables Cloud Functions, Cloud IoT Core, and Pub/Sub,
  • creates a pic-iot Pub/Sub topic,
  • creates an IoT registry (default name: PIC-IOT, configurable in the script),
  • adds your device's UID to the registry,
  • builds and deploys a Cloud Function to route Pub/Sub messages to your Firebase project, and
  • builds and deploys a UI to firebase.

After running the quick script, you'll need to add your device's secure pubkey to the device's entry in your IoT core registry and update the firmware on your device using MPLAB Code Configurator.

Set up your GCP and Firebase Projects

The quickstart requires that you have a Firebase project connected to a GCP project with billing enabled.

GCP Project

  1. Create (or select an existing) GCP project.

    GO TO THE MANAGE RESOURCES PAGE

  2. Enable billing for the project.

    LEARN HOW TO ENABLE BILLING

Firebase Project

  1. Launch the Firebase Console.

    GO TO FIREBASE CONSOLE

  2. Select 'Add project'.

  3. In the Project Name field, select the GCP project you created or selected above.

  4. Click 'Add Firebase'.

Run the Quickstart Script

  1. Open Cloud Shell from your project.

  2. In the shell, run

git clone https://github.com/Leverege/microchip-pic-iot.git && cd microchip-pic-iot/setup && bash setup.sh

to clone this repo, enter the newly created directory, and run the quickstart script.

  1. You will need to provide firebase authentication. To do this, copy the authentication URL provided in the shell console, and paste it into a new browser window. Then, log in on that page, authorize the app, and copy the security key. Paste the security key into the shell at the prompt and hit return.

  2. At the prompt, enter your PIC-IoT device's UID. Your device's UID is the last portion of the url you see after launching CLICK-ME.HTM from the device.

  3. If you would like to customize your IOT Core registry name, you may do so at the IoT core registry name prompt.

    IoT core registry names must start with a letter, use only letters, numbers, hyphens, and the following characters:

     + . % _ ~
    
  4. The setup script will run for several minutes. The setup script will:

    • Enable Cloud Functions, IoT Core, and Pub Sub in your GCP project
    • Create an IoT Core registry called PIC-IOT and register your device
    • Install, build, and deploy Cloud Functions and the UI

Add your device public key to your IoT Core Registry

  1. Make sure your device is connected to your computer via USB.

  2. Open your IoT Core registry management page, and select the PIC-IOT registry.

    OPEN IOT CORE REGISTRY MANAGEMENT

  3. Click on your device's UID in the list.

    Because registry entries must begin with a letter your device UID will be prefixed with a 'd'. To search for your device by uid, you must enter 'd<your_device_id>' in the search box.

  4. Click the Add public key button.

  5. Select 'Upload' under the input method, and ES256 (not ES256_X509) as the public key format. Then click the Browse button.

  6. In the upload window, navigate to the CURIOSITY drive, then select PUBKEY.TXT and click add to upload it.

Update your PIC-IoT device firmware

  1. Follow the PIC-IoT documentation for updating your PIC board's firmware with your new GCP project information using MPLAB Code Configurator.

View your live data!

And that's it! If you've edited your device with the MPLAB, you should see live data flowing to your new Firebase app at <your-project-id>.firebaseapp.com/device/<your-device-uid>.

Building a solution at scale?

Want to build something bigger? We can help you scale your projects into solutions. Talk to an IoT expert.

Whether you're a Fortune 500 company or startup, transforming your current business or creating entirely new businesses, it takes a team with deep experience across verticals and use cases to turn your IoT prototype into an IoT product.

About

Deploy cloud functions and UI for PIC-IoT board on your own Google Cloud Project

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 70.1%
  • CSS 24.6%
  • Shell 4.5%
  • HTML 0.8%