0% found this document useful (0 votes)
26 views

Da6 3

1) The document describes an IoT task to collect sensor data from an Android device, concatenate the values, and save them to a CSV file. 2) The data is received as an XML string from the phone via UDP and accelerometer values are extracted using a custom function. The values are then converted to angles. 3) The values are concatenated using a function node and saved to a CSV file. Functions are used to extract data from the XML string, convert accelerometer values to angles, and concatenate the values into CSV format.

Uploaded by

Goutham Krishna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views

Da6 3

1) The document describes an IoT task to collect sensor data from an Android device, concatenate the values, and save them to a CSV file. 2) The data is received as an XML string from the phone via UDP and accelerometer values are extracted using a custom function. The values are then converted to angles. 3) The values are concatenated using a function node and saved to a CSV file. Functions are used to extract data from the XML string, convert accelerometer values to angles, and concatenate the values into CSV format.

Uploaded by

Goutham Krishna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Name: Soham Korgaonkar

Reg No: 18BEI0038

IOT Task 6
Task: Create a function node that collects multiple string inputs and perform
string operation. (Inputs may be from inject node. Operation can be
concatenation)
Aim: To get sensor data from an android device, concatenate the values and
save them to csv.

Procedure:
1. Get the data from phone using UDP Block in Node-Red
The data will be received as an XML String, as given below
<?xml version='1.0' encoding='UTF-8' standalone='yes'
?><NodeId>1</NodeId><Accelerometer><Accelerometer1>-
0.5187225341796875</Accelerometer1><Accelerometer2>0.656402587890
625</Accelerometer2><Accelerometer3>9.570663452148438</Accelerome
ter3></Accelerometer><TimeStamp>1603001641648</TimeStamp>

2. The accelerometer values are than extracted using a custom function:


3. The accelerometer values are than converted to angles using a function
block.

The same is done for the y and z values


4. These values are displayed on the dashboard

5. The values received are than concatenated using function node and
saved in a CSV file.

Explanation of 3 Functions used


1. XML to String
The function uses IndexOf function to get the index of “<Accelerometer1>” as
the value after this is the acceleration value.
This index is added to 16 and the resulting index is sent to substr function
which creates a substring
Then the resulting value is stored in variable msg.xValue
The same is done with y and z and they are stored as msg.yValue and
msg.zValue respectively

2. Convert to Angles
𝑎𝑐𝑐𝑒𝑙
The node implements the following function ((𝑠𝑖𝑛−1 ( )) × 180)/𝜋
9.8

This function converts the acceleration values to angles in degree.

3. Convert to CSV

This node concatenates the values received and converts them to CSV
format which is then stored in a Data_Values.csv file.
Complete Flow Diagram

Results:
1. Dashboard Output
2. CSV File Screenshot

The symbols at the end are a result of bad encoding of degree symbol.

Working Video:
https://drive.google.com/file/d/1cNVBxeS9A4L0VAZmAgcbZ_jSj-
2XN1qe/view?usp=sharing

Conclusion:
The values sent by the phone were successfully received, displayed on
dashboard and saved as a csv file.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy