In this tutorial, we will learn how to take sensor/sample readings from a Device and route the data from Blues Notehub to Fogwing platform. We shall use Arduino/Wiring running on a ESP32 wired up to Notecarrier-AF hardware. It gives flexibility to use different language, board, or Notecarrier as per the availability and convenience of the user.
Blues Notehub to Fogwing Connection Architecture:
The Notecard is a Cellular IoT device with an embeddable system on module (SoM). It can be used with any microcontroller that helps connect your edge solution to cloud applications. It does so through secure communications with the Blues Wireless Notehub. Notehub is a server-side service which is designed to connect to and synchronize Notefiles with Notecard devices. For the purpose of demonstration, the Blues wireless Feather starter kit has been used.
Pre-requisite before configure the settings:
Users are expected to have the below particulars ready before building this hardware.
Blues wireless Feather starter kit (select as per your region and application)
Micro USB to USB-A cable.
An internet connection that allows access to Notehub
Fogwing account (community subscription)
Airtel nano-SIM card (For India)
Blue wireless credit points required for Nodecarrier to make the connection work.
Step-by-step Instructions to create Notehub:
Below are the list of events to be followed.
Create and configure a NoteHub account
Create and configure a Fogwing account
Route from NoteHub to Fogwing
Connect your Notecard and Notecarrier
Configure the Arduino IDE
Install Notecard Arduino library
Visualize the data on the Fogwing platform
1. Create a NoteHub account
Let us throw detailed insights on the above list of events to understand it better.
a) Navigate your browser to Notehub.io, and you will be greeted with the sign-in screen.
b) Click the Sign-up button at the bottom of the display. Alternatively, if you already have a GitHub account and prefer to sign-up using GitHub instead, then you may click the Sign up with GitHub button.
c) Once you have created your account, you will be forwarded to the projects page. However, you will not be able to create your first project until you have successfully verified your email. A verification email will then be sent to the email ID you have given during the account creation process.
The link will return you to the project page of Notehub.io, and you will be ready to create your first project.
1.1 Create a New Project in Blues Notehub
Projects are core to the functionality of Notehub. They provide a way to organize group of products, distribute firmware, organize teams, and provide team access controls.
A Project is composed of one or more identifiers called ProductUIDs. Each Project is created with an initial ProductUID, enabling you to associate your Notecard(s) to your Project as soon as it is created.
i) Navigate to "io" domain, and click on the ‘Create Project’ button in the upper right corner.
ii) The ‘Create Project’ dialog will open.
iii) Provide a name for the project in the ‘Project Name’ input box.
iv) Provide a unique identifier for the default ‘ProductUID’. In order to help ensure your ProductUID is unique, every ProductUID is prepended with the reverse domain name notation of your account email.
v) For example, if you have signed up with [email protected], then your product would take the form of com.oceania.winston.smith :your_product_uid.
vi) Click the ‘Create Project’ button.
1.2 Create new Fleet
i) Select ‘Fleets’ from the left navigation bar.
ii) Click the ‘Add fleet’ option, in the upper right corner.
iii) Give the new fleet a name in the ‘Fleet name’ field.
iv) Click ‘Add fleet’.
2. Create a Fogwing IIoT Platform Account
a) Navigate your browser to fogwing.net and you will be greeted with the Sign-in screen.
b) Click the ‘Sign-up’ button at the top right corner of the display and fill the registration details as requested. This completes the registration process.
c) Once you submit the registration form you will receive a Registration Confirmation mail to your registered E-mail ID. Click on activation link and activate your account.
d) Now you can login to the platform using your credentials. Once you are logged in, you will land on Fogwing Get Started From the side bar, click on ‘Applications’, the Applications page will display. Click the ‘Add’ button, fill in all the fields and click on ‘Submit’ button.
e) The next step would be to create an edge device. Click on Edge Network -> Edge Devices. Edge Devices page will appear, click on ‘Add’ button and fill in all the required information about the Notecard by choosing the previously created application and click on ‘Submit’. You can check the ‘Auto Generate IoT Hub Access’. This will automatically create IoTHub access. In that case you can skip the below step 6.
Note: If you enable the Test Mode option, then your data will be deleted after 15 days.
f) Final step towards the configuration is IoTHub access. Navigate to Edge Network -> Edge Devices. IoTHub access page will appear. Click on ‘Add’ button select your application and provide the ‘Username’ and ‘Password’ for it. IoTHub access facilitates MQTT access for your Notecard/edge. After the successful creation of IoTHub access, you will receive an email to registered E-mail ID with Fogwing IoT Hub access details.
3. Connect your Notecard and Notecarrier
a) The Feather Starter Kit includes a Notecard-NBGL500, Notecarrier-AF, a pre-seated Adafruit HUZZAH32 ESP32 Feather, two u.FL cables for cellular and GPS (each connected on one side to the Notecarrier and other side free) an allen wrench for the Notecarrier screw-down post.
b) Place the Notecard into the M.2 slot on the Notecarrier. The wider portion of the edge connector slots is on the left. Once inserted, press it gently until the Notecard is inserted until the screw receptacle hole is completely visible.
c) Using the allen wrench, re-insert the screw into the mounting receptacle and tighten to secure the Notecard to the Notecarrier. Be sure not to overtighten the screw.
d) Secure the free end of the u.FL cable connected to the socket labelled MAIN on the Notecarrier to the MAIN socket on the Notecard.
e) Secure the free end of the u.FL cable connected to the socket labelled GPS on the Notecarrier to the GPS socket on the Notecard.
f) Insert the Airtel nano SIM card into the Notecarrier (tested in INDIA).
Please refer to the cellular service section of Blues wireless Notecard datasheet to validate whether Notecard SOM supports cellular service in your country or not.
Note: If Notecard SOM works for you, you can avoid an external SIM card. For more information, please contact Blues wireless support team.
Congratulations You’ve successfully connected your ESP32 and external SIM to your Notecard!
4. Write your Firmware in Blue Notecarrier.
4.1 Configure the Arduino IDE
a) For this portion of the guide, we’ll be using the Arduino IDE, so be sure to install version 1.8+ if you haven’t already. Once installed, we’ll need to add support for your ESP32 Board.
b) Start the Arduino IDE and open the ‘Preferences’ Copy the following path https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json into the "Additional Board Manager URLs" field. If there is already something in the box, then add a comma to separate the URLs. Click on ‘OK’.
c) Open the Boards Manager from the Tools -> Board: [board name] -> Boards Manager... Search for "esp32" and click the ‘Install’ button to add ESP32 board support to the Arduino IDE. Once the installation is complete, click the ‘Close’ button.
d) Next, plug your Arduino device back in, open the Arduino IDE and then select Adafruit ESP32 Feather from the Tools > Board menu, and select the appropriate Port for your device.
e) Click on Tools -> Manage Libraries...Search for "Blues" in the input box and click the ‘Install’ button next to the "Blues Wireless Notecard" result. Once the installation is complete, click the ‘Close’
4.2 Configure Notecard
Now you’ve configured your Arduino to communicate with the Notecard, let’s simulate some sample/sensor readings to NoteHub.
i) Navigate to fogwing-simulator-for-NoteHub public repository and download a ZIP archive using the "Clone" button.
ii) Unzip the downloaded file in your system and open the fw-notehub-sample-msg.ino sketch and update the ‘ProductUID’ with your ProductUID and data interval TIME_FREQ. Default is 60000mS(1min).
If you have a sensor, then you can replace the code snippet of sample data with your sensor snippet.
To get the ProductUID, log in to your NoteHub account and navigate to Projects-> Settings -> ProuductUIDs.
iii) Now connect the Adafruit ESP32 Feather to your system and upload the sketch into it.
iv) Once it is successfully complied and uploaded to the ESP32 Feather board then click on reset button on your board to restart the board.
Now it will start simulating the data to NoteHub. You can see the data on NoteHub.
5. Route data from Blues NoteHub to Fogwing
Notehub.io can support wide range of API endpoints by utilizing the Route feature. This guide provides instructions for leveraging the General HTTP/HTTPS Request/Response Route type to invoke the Fogwing IoTHub API.
a) Log in to Fogwing account and navigate to menu Administration -> Settings -> API Keys. Click on ‘Add Key’.
Once you click on ‘Add Key’ button Fogwing will generate API Access key for you.
b) Log in to Note Hub platform and navigate to ‘Routes’. Click on ‘Add Route’. Routes is displayed. Fill the below information and click on ‘Save’.
Route Name: (e.g. Fogwing IoTHub API)
Route Type: General HTTP/HTTPS Request/Response
HTTP Headers: Additional Headers
Fleets: Selected Fleets
Transform JSON: Body Only
Rate Limit: Unlimited
c) To verify whether the routing is happening or not, navigate to Events -> Click on latest record -> Details
d) Click on ‘Route log’. If data is successfully published to Fogwing platform, then you will see the successful response from the Fogwing IoTHub Unsuccessful if any error occurs.
6. Visualize the data on the Fogwing platform & Data Analytics
i) After completion of the above steps, if everything goes in line with the above-mentioned instructions, you will be able to see the data sent over Fogwing platform.
b) Data Analytics:
i) For detailed visualization of your data please log in to Fogwing Data Analytics, before that Navigate to ‘Edge Device’ and click on ‘Attribute’
ii) Click on ‘Add’.
iii) Enter all the information related to your device parameters one by one.
Note: Do not forgot to tick the Analytical? check box. If you have missed to tick on check box, then you will not see any data on Fogwing Data Analytics.
We are simulating three parameters, so it will look somethings like this.
iv) Now you are done with configurations, log into Fogwing Data Analytics using Fogwing registered E-mail ID and visualize different matrics of your data. You can configure the dashboards according to your preference. Below are some snaps.
c) Explore Dashboard in Fogwing Analytics Studio:
Customize the dashboard as per your requirements to see the detailed view of sensors data with different types of graphs and layout which shows different metrics of data.
d) Visualize Data Metrics in Fogwing Analytics Studio:
View all the parameters of your device together without navigating to any other tab. With the help of control panel, you can create your own screen like DCS, and SCADA system and you can display all important parameters that matters to you.
e) Query the data in Fogwing Analytics Studio
Analyze each data point in detail to understand the device behavior.