Reference no: EM132962354
Internet of Things
IoT Device
2.1 Description of supplied Node-RED flow
(a) The supplied Node-RED flow in Appendix A of the Technology Specification document contains a Node-RED function node with the code shown below. Please explain all aspects of the function code, from receiving a message until returning.
// Array of simulated temperatures
var temp1 = [15, 17, 18.5, 20, 21.5, 23, 24, 22.2, 19, 1];
// Array of simulated relative humidities
var humidity1 = [50, 55, 61, 68, 65, 60, 80, 70, 62, 53];
var counter1 = context.get('counter1') || 0;
counter1 = counter1 + 1;
if (counter1 > 9)
counter1 = 0;
context.set('counter1', counter1);
msg = {
payload:
{
d: {
"temperature": temp1[counter1],
"humidity": humidity1[counter1]
}
}
};
return msg;
(a) Provide a screenshot of the entire deployed IoT Device flow on PC (or Mac). This screenshot should show all elements of the flow and should also show that that the Watson IoT node and MQTT node are connected.
(b) Provide the complete exported flow code for the IoT Device.
2.2 Watson IoT Service.
(a) Describe the creation of the Watson IoT Service device entry, including the creation of the device-type.
(b) Show the credentials that are returned for the creation of device: ‘CW2Dev1'. Explain why (on first creating these) you should store these credentials securely. Please provide a text version of these credentials - not a screenshot.
(c) After sending several data entries to the Watson IoT Service, provide a screenshot of the CW2 Board, showing all three Cards.
2.3 Execution of the IoT Device Application
(a) Take a screenshot of the IoT Device Node-RED Debug panel output for the case where the temperature value is > 23 and the panel shows a copy of the object sent. Please expand the object on the panel so that all fields can be seen. The date-time of the Debug output should also be visible.
(b) Take a screenshot of the IoT Device Node-RED Debug panel for the data received by the MQTT input (from IBM Cloud) in response to this ‘high-temperature' situation in part (a) directly above. Please expand the object on the panel so that all fields can be seen. The date-time of the Debug output should also be visible.
IBM Cloud Node-RED Application
(a) Provide a screenshot of the Dashboard chart showing a history of at least 10 pairs of values for temperature and humidity.
(b) Provide a screenshot of a Debug output that shows a copy of the incoming message received from the IoT Device, that triggers your flow to send to your Slack channel. Please expand the object on the panel so that all fields can be seen. The date-time of the Debug output should also be visible.
(c) Provide a screenshot of a Debug output that shows a copy of a message sent to your Slack channel. Please expand the object on the panel so that all fields can be seen. The date-time of the Debug output should also be visible.
(d) Provide a screenshot from your Slack channel, showing the message received via the message sent in part (c) above.
(e) Provide a screenshot of a Debug output that shows a copy of the incoming message received from the IoT Device, that triggers your flow to write to the Cloudant database. Please expand the object on the panel so that all fields can be seen. The date-time of the Debug output should also be visible.
(f) Provide a screenshot (from the Cloudant database service) of the contents of the specific document inserted into the database in response to the example data in part (e) above.
(c) Provide a screenshot of the entire deployed Node-RED IBM Cloud flow. This screenshot should show all elements of the flow and should show that the IBM IoT node and MQTT node are connected.
(g) Provide the complete exported flow code for the IBM Cloud Node-RED application.
Internet of Things Coursework 2
1 IoT Device Demonstrator
You are required to create an end-to-end IoT technology demonstrator application. It should utilise two application sections:
• An IoT device using Node-RED. The device should be on a Node-RED PC installation (or Mac if that is your preferred platform).
• A Node-RED application on IBM Cloud.
The specification for each of these is given below.
A separate document contains a template for the report that you should deliver for assessment: ‘Internet of Things CW2 RESIT Session 2020-21 Submission Document.docx'. The report is based upon implementing the Technology Demonstrator system.
1.1 IoT device using Node-RED
You are required to create a Node-RED flow for the device. The flow should be capable of sending and receiving data according to the following specification. It will be sending data to your IBM Cloud application and also receiving data from this application.
1.1.1 Sending Data
The flow should use as a starting point the Node-RED importable code in Appendix A IoT Device Starter Code. This includes a function that provides two data items each time that the inject button is clicked; the data represents temperature and humidity.
The flow should send the data to the IBM Cloud application by utilising the IBM Watson IoT service, using a Watson IoT Out node. You should create a new Watson IoT Service device for this, with device-type named ‘CW2' and device named ‘CW2Dev1'.
Any data sent should also be shown on your Node-RED Debug Panel for your IoT Device.
1.1.2 Receiving Data
The flow should receive messages sent by the IBM Cloud application using the MQTT service, using any suitable public MQTT broker.
Received messages are to be displayed using a Node-RED Debug node.
1.2 Watson IoT Service
Create a Board named CW2 within your Watson IoT Service that contains:
• A Card with a bar-chart that shows temperature data being received from the IoT Device CW2Dev1.
• A Card with a bar-chart that shows humidity data being received from the IoT Device CW2Dev1.
• A Card with the following Usage entry: Device types (see Figure 1, below).
• A Card with the following Usage entry: Data Transferred.
Test the board by sending data to the Watson IoT Service from the IoT device.
1.3 IBM Cloud Application
You are required to create a Node-RED flow for the Cloud application. The details follow below.
1.3.1 Receiving Data
Data should be received from your Watson IoT Service device ‘CW2Dev1'with an IBM IoT node. Note that you will need to create an API key inside the Watson IoT service, to be used with the IBM IoT node.
The data is to be processed as follows:
(a) A chart should be created using the Node-RED Dashboard nodes, on the Node-RED /ui interface. The chart should be correctly labelled and show both data items (temperature and humidity) that are received from the IoT device. Refer to the chart-node help information inside the Node-RED editor for the relevant details of displaying two items on the chart.
(b) If the received temperature value is > 23 (high-temperature) then a message should be sent to the IoT device, using a public MQTT broker; you should use a unique topic for this, because the broker is public.
The message should be in the following format, where <ACTUAL_VALUE> is the newly received temperature value:
"Warning, high temperature. Temperature = <ACTUAL_VALUE> degrees C'.
(c) If the received humidity value is >70 (high-humidity) then a message should be sent to a ‘Slack' messaging channel. The Slack workspace should have been created by you.
The message should be in the following format, where <ACTUAL_VALUE> is the newly received humidity value and <DEVICE_NAME> is the Watson IoT device name taken directly from the received IoT message:
"Warning, device <DEVICE_NAME> humidity = <ACTUAL_VALUE>'.
(d) If the received temperature value is < 3 (low-temperature) then a document should be stored in a Cloudant database named CWTemperature. The document should contain 1. A readable date-time value, 2. The device name (taken directly from the received IoT message) and 3. The temperature value. The stored data fields should use suitable labels.
Attachment:- Internet of Things.rar