Multiple Sensor Data Using Arduino

Hi,
I am trying to interface dht11 sensor in arduino and trying to read it in serial monitor in node red. The "split node" is working fine, but after that the "Payload Object Sensor" function is not working. Please resolve this situation. The related codes are given below:

[{"id":"99ef7505.c281c8","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"61fee05.2f50b2","type":"serial in","z":"99ef7505.c281c8","name":"","serial":"a2dd7e6a.214a8","x":60,"y":180,"wires":[["ddf9c433.b32258"]]},{"id":"5c3851c1.3b432","type":"debug","z":"99ef7505.c281c8","name":"Frame from Sensors","active":true,"console":"false","complete":"true","x":510,"y":120,"wires":},{"id":"dd3f2d0e.54406","type":"file","z":"99ef7505.c281c8","name":"Sensor Data","filename":"D:\My Files\Sensor.txt","appendNewline":true,"createDir":true,"overwriteFile":"false","x":800,"y":160,"wires":[]},{"id":"190e0530.f9648b","type":"ui_gauge","z":"99ef7505.c281c8","name":"Temp DHT11","group":"2b53962a.e11c1a","order":1,"width":0,"height":0,"gtype":"gage","title":"Temp DHT11","label":"","format":"{{value}}°C","min":0,"max":"60","colors":["#008000","#ff8000","#ff0000"],"x":980,"y":220,"wires":},{"id":"ddf9c433.b32258","type":"function","z":"99ef7505.c281c8","name":"","func":"var newMsg = {payload: msg.payload.toString()};\nreturn newMsg;","outputs":1,"noerr":0,"x":180,"y":180,"wires":[["69577f5b.d860a"]]},{"id":"69577f5b.d860a","type":"split","z":"99ef7505.c281c8","name":"","splt":" ","spltType":"str","arraySplt":"1","arraySpltType":"len","stream":false,"addname":"","x":300,"y":180,"wires":[["6ec1d5b5.6fa74c","5c3851c1.3b432"]]},{"id":"6ec1d5b5.6fa74c","type":"function","z":"99ef7505.c281c8","name":"Payload Object Sensor","func":"var newMsg = {};\nvar Sensor = {\n NData: 0, \n Temp_DHT11: 0,\n Humid_DHT: 0,\n Time: new Date().toString()\n};\n\ncontext.data = context.data || {};\n\nswitch(msg.parts.index){\n case 0:\n context.data.NData = parseFloat(msg.payload);\n msg = null;\n break;\n case 1:\n context.data.Temp_DHT11 = parseFloat(msg.payload);\n msg = null;\n break;\n case 2:\n context.data.Humid_DHT = parseFloat(msg.payload);\n msg = null;\n break;\n default:\n msg = null;\n break;\n}\n\nAllData = context.data.NData &&\n context.data.Temp_DHT11 &&\n context.data.Humid_DHT;\n\nif(AllData){\n var time = Date();\n context.data.Time = time.toString();\n Sensor = context.data;\n newMsg = { payload: context.data,\n topic: 'Frame Sensor' };\n context.data = null;\n return newMsg;\n}\nelse\n return msg;\n\n\n","outputs":1,"noerr":0,"x":490,"y":240,"wires":[["6ea2f4d2.fa18dc","dd3f2d0e.54406","db161a91.1bf308"]]},{"id":"6ea2f4d2.fa18dc","type":"function","z":"99ef7505.c281c8","name":"Split Data","func":"var msgTemp_DHT11 = {payload: msg.payload.Temp_DHT11};\nvar msgHumid_DHT = {payload: msg.payload.Humid_DHT};\n\nreturn [msgTemp_DHT11, msgHumid_DHT ];","outputs":2,"noerr":0,"x":695.3627052307129,"y":336.9830274581909,"wires":[["190e0530.f9648b","2fbba10c.d9999e"],["dbcc3883.4d3b78","e6b489b1.c1b568"]]},{"id":"dbcc3883.4d3b78","type":"ui_gauge","z":"99ef7505.c281c8","name":"Humid DHT11","group":"539bb2f8.4cd23c","order":1,"width":0,"height":0,"gtype":"gage","title":"Humid DHT11","label":"","format":"{{value}}%","min":0,"max":"100","colors":["#ffff80","#ff8000","#008000"],"x":990,"y":300,"wires":},{"id":"2fbba10c.d9999e","type":"ui_chart","z":"99ef7505.c281c8","name":"Graph 5 min Temp DHT11 (°C)","group":"2b53962a.e11c1a","order":2,"width":0,"height":0,"label":"Graph 5 min Temp DHT11 (°C)","chartType":"line","legend":"false","xformat":"%H:%M:%S","interpolate":"basis","nodata":"","ymin":"10","ymax":"40","removeOlder":"5","removeOlderUnit":"60","outputs":2,"x":1040,"y":260,"wires":[,]},{"id":"e6b489b1.c1b568","type":"ui_chart","z":"99ef7505.c281c8","name":"Graph 5 min Humid DHT11 (%)","group":"be69083c.111928","order":2,"width":0,"height":0,"label":"Graph 5 min Humid DHT11 (%)","chartType":"line","legend":"false","xformat":"%H:%M:%S","interpolate":"basis","nodata":"","ymin":"0","ymax":"100","removeOlder":"5","removeOlderUnit":"60","outputs":2,"x":1040,"y":340,"wires":[,]},{"id":"db161a91.1bf308","type":"debug","z":"99ef7505.c281c8","name":"Frame from Sensors","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":830,"y":120,"wires":},{"id":"a2dd7e6a.214a8","type":"serial-port","z":"","serialport":"COM5","serialbaud":"9600","databits":"8","parity":"none","stopbits":"1","waitfor":"","newline":"0","bin":"bin","out":"time","addchar":"false","responsetimeout":""},{"id":"2b53962a.e11c1a","type":"ui_group","z":"","name":"Sensor DHT11","tab":"ba6c5c45.1e5fb","order":2,"disp":true,"width":"6"},{"id":"539bb2f8.4cd23c","type":"ui_group","z":"","name":"Pressure, Humidity","tab":"ba6c5c45.1e5fb","order":4,"disp":true,"width":"6"},{"id":"be69083c.111928","type":"ui_group","z":"","name":"DHT11: Humid (5 Min)","tab":"ba6c5c45.1e5fb","order":5,"disp":true,"width":"6"},{"id":"ba6c5c45.1e5fb","type":"ui_tab","z":"","name":"MONITORING","icon":"dashboard","order":1}]

#include <DHT.h>

/*

  • Codigo para Arduino Pro Micro el cual permite leer los sensores:
  • DS18B20, Read Temp: (Pin 8, Comunicacion 1-Wire),
  • DHT11, Read Temp y Humedad: (Ping 9, Comunicacion 1-Wire),
  • BMP180 Read Temp, Altitud, Presion: (Pin 2=SDA, 3=SLC, Comunicacion I2C).
  • El formato de la trama enviada por puerto Serial (USB): NData Data1 Data2 Data3 Data4 ... DataN
  • La trama es Procesada con Node Red para su visualizacion.
    */

#define PIN_SENSOR_DHT 2

DHT SensorDHT(PIN_SENSOR_DHT,DHT11);

void setup() {
Serial.begin(9600);
SensorDHT.begin();
}

void loop() {
//Read Temperature and Humidity from DHT11 Sensor
String Temp_DHT = (String)SensorDHT.readTemperature();
String Humid_DHT = (String)SensorDHT.readHumidity();

/*Read Temperature from DS18B20 Sensor
SensorDS.requestTemperatures();
String Temp_DS = (String)SensorDS.getTempCByIndex(0);

//Read Temperature from BMP180 Sensor
String Temp_BMP = (String)SensorBMP.readTemperature(); //Celcius
String Pressure_BMP = (String)SensorBMP.readPressure(); //Pascal
String Altitude_BMP = (String)SensorBMP.readAltitude(); //mts */
int NData = 2;
String str_Payload;

//Crea un string con el formato: NData Data1 Data2 Data3 ... DataN
str_Payload += NData;
str_Payload += " " + Temp_DHT;
str_Payload += " " + Humid_DHT;
/* str_Payload += " " + Temp_DS;
str_Payload += " " + Temp_BMP;
str_Payload += " " + Pressure_BMP;
str_Payload += " " + Altitude_BMP;*/
str_Payload += " ";

byte Payload[str_Payload.length()];
int LengthFrameAPI = 6 + sizeof(Payload);
int LengthPayload = sizeof(Payload);

Serial.print(str_Payload);

delay(1000);
}

Please see the post below for how to share flows here, the one you posted is not importable. However before doing that you say that it is just one function that is not working. Start by putting a debug node showing what is going into the function and check that is correct. Next you can insert node.warn() statements into your code to show the state of variables as it runs through. The warn text will be shown in the debug pane. If that does not help then post just the function here and show us what is going into it.

Here is the flow please help[{"id":"99ef7505.c281c8","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"61fee05.2f50b2","type":"serial in","z":"99ef7505.c281c8","name":"","serial":"a2dd7e6a.214a8","x":60,"y":180,"wires":[["ddf9c433.b32258"]]},{"id":"5c3851c1.3b432","type":"debug","z":"99ef7505.c281c8","name":"Frame from Sensors","active":true,"console":"false","complete":"true","x":510,"y":120,"wires":[]},{"id":"dd3f2d0e.54406","type":"file","z":"99ef7505.c281c8","name":"Sensor Data","filename":"D:\\My Files\\Sensor.txt","appendNewline":true,"createDir":true,"overwriteFile":"false","x":800,"y":160,"wires":[[]]},{"id":"190e0530.f9648b","type":"ui_gauge","z":"99ef7505.c281c8","name":"Temp DHT11","group":"2b53962a.e11c1a","order":1,"width":0,"height":0,"gtype":"gage","title":"Temp DHT11","label":"","format":"{{value}}°C","min":0,"max":"60","colors":["#008000","#ff8000","#ff0000"],"x":980,"y":220,"wires":[]},{"id":"ddf9c433.b32258","type":"function","z":"99ef7505.c281c8","name":"","func":"var newMsg = {payload: msg.payload.toString()};\nreturn newMsg;","outputs":1,"noerr":0,"x":180,"y":180,"wires":[["69577f5b.d860a"]]},{"id":"69577f5b.d860a","type":"split","z":"99ef7505.c281c8","name":"","splt":" ","spltType":"str","arraySplt":"1","arraySpltType":"len","stream":false,"addname":"","x":300,"y":180,"wires":[["6ec1d5b5.6fa74c","5c3851c1.3b432"]]},{"id":"6ec1d5b5.6fa74c","type":"function","z":"99ef7505.c281c8","name":"Payload Object Sensor","func":"var newMsg = {};\nvar Sensor = {\n NData: 0, \n Temp_DHT11: 0,\n Humid_DHT: 0,\n Time: new Date().toString()\n};\n\ncontext.data = context.data || {};\n\nswitch(msg.parts.index){\n case 0:\n context.data.NData = parseFloat(msg.payload);\n msg = null;\n break;\n case 1:\n context.data.Temp_DHT11 = parseFloat(msg.payload);\n msg = null;\n break;\n case 2:\n context.data.Humid_DHT = parseFloat(msg.payload);\n msg = null;\n break;\n default:\n msg = null;\n break;\n}\n\nAllData = context.data.NData &&\n context.data.Temp_DHT11 &&\n context.data.Humid_DHT;\n\nif(AllData){\n var time = Date();\n context.data.Time = time.toString();\n Sensor = context.data;\n newMsg = { payload: context.data,\n topic: 'Frame Sensor' };\n context.data = null;\n return newMsg;\n}\nelse\n return msg;\n\n\n","outputs":1,"noerr":0,"x":490,"y":240,"wires":[["6ea2f4d2.fa18dc","dd3f2d0e.54406","db161a91.1bf308"]]},{"id":"6ea2f4d2.fa18dc","type":"function","z":"99ef7505.c281c8","name":"Split Data","func":"var msgTemp_DHT11 = {payload: msg.payload.Temp_DHT11};\nvar msgHumid_DHT = {payload: msg.payload.Humid_DHT};\n\nreturn [msgTemp_DHT11, msgHumid_DHT ];","outputs":2,"noerr":0,"x":695.3627052307129,"y":336.9830274581909,"wires":[["190e0530.f9648b","2fbba10c.d9999e"],["dbcc3883.4d3b78","e6b489b1.c1b568"]]},{"id":"dbcc3883.4d3b78","type":"ui_gauge","z":"99ef7505.c281c8","name":"Humid DHT11","group":"539bb2f8.4cd23c","order":1,"width":0,"height":0,"gtype":"gage","title":"Humid DHT11","label":"","format":"{{value}}%","min":0,"max":"100","colors":["#ffff80","#ff8000","#008000"],"x":990,"y":300,"wires":[]},{"id":"2fbba10c.d9999e","type":"ui_chart","z":"99ef7505.c281c8","name":"Graph 5 min Temp DHT11 (°C)","group":"2b53962a.e11c1a","order":2,"width":0,"height":0,"label":"Graph 5 min Temp DHT11 (°C)","chartType":"line","legend":"false","xformat":"%H:%M:%S","interpolate":"basis","nodata":"","ymin":"10","ymax":"40","removeOlder":"5","removeOlderUnit":"60","outputs":2,"x":1040,"y":260,"wires":[[],[]]},{"id":"e6b489b1.c1b568","type":"ui_chart","z":"99ef7505.c281c8","name":"Graph 5 min Humid DHT11 (%)","group":"be69083c.111928","order":2,"width":0,"height":0,"label":"Graph 5 min Humid DHT11 (%)","chartType":"line","legend":"false","xformat":"%H:%M:%S","interpolate":"basis","nodata":"","ymin":"0","ymax":"100","removeOlder":"5","removeOlderUnit":"60","outputs":2,"x":1040,"y":340,"wires":[[],[]]},{"id":"db161a91.1bf308","type":"debug","z":"99ef7505.c281c8","name":"Frame from Sensors","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":830,"y":120,"wires":[]},{"id":"a2dd7e6a.214a8","type":"serial-port","z":"","serialport":"COM5","serialbaud":"9600","databits":"8","parity":"none","stopbits":"1","waitfor":"","newline":"0","bin":"bin","out":"time","addchar":"false","responsetimeout":""},{"id":"2b53962a.e11c1a","type":"ui_group","z":"","name":"Sensor DHT11","tab":"ba6c5c45.1e5fb","order":2,"disp":true,"width":"6"},{"id":"539bb2f8.4cd23c","type":"ui_group","z":"","name":"Pressure, Humidity","tab":"ba6c5c45.1e5fb","order":4,"disp":true,"width":"6"},{"id":"be69083c.111928","type":"ui_group","z":"","name":"DHT11: Humid (5 Min)","tab":"ba6c5c45.1e5fb","order":5,"disp":true,"width":"6"},{"id":"ba6c5c45.1e5fb","type":"ui_tab","z":"","name":"MONITORING","icon":"dashboard","order":1}]

[{"id":"99ef7505.c281c8","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"61fee05.2f50b2","type":"serial in","z":"99ef7505.c281c8","name":"","serial":"a2dd7e6a.214a8","x":60,"y":180,"wires":[["ddf9c433.b32258"]]},{"id":"5c3851c1.3b432","type":"debug","z":"99ef7505.c281c8","name":"Frame from Sensors","active":true,"console":"false","complete":"true","x":510,"y":120,"wires":[]},{"id":"dd3f2d0e.54406","type":"file","z":"99ef7505.c281c8","name":"Sensor Data","filename":"D:\\My Files\\Sensor.txt","appendNewline":true,"createDir":true,"overwriteFile":"false","x":800,"y":160,"wires":[[]]},{"id":"190e0530.f9648b","type":"ui_gauge","z":"99ef7505.c281c8","name":"Temp DHT11","group":"2b53962a.e11c1a","order":1,"width":0,"height":0,"gtype":"gage","title":"Temp DHT11","label":"","format":"{{value}}°C","min":0,"max":"60","colors":["#008000","#ff8000","#ff0000"],"x":980,"y":220,"wires":[]},{"id":"ddf9c433.b32258","type":"function","z":"99ef7505.c281c8","name":"","func":"var newMsg = {payload: msg.payload.toString()};\nreturn newMsg;","outputs":1,"noerr":0,"x":180,"y":180,"wires":[["69577f5b.d860a"]]},{"id":"69577f5b.d860a","type":"split","z":"99ef7505.c281c8","name":"","splt":" ","spltType":"str","arraySplt":"1","arraySpltType":"len","stream":false,"addname":"","x":300,"y":180,"wires":[["6ec1d5b5.6fa74c","5c3851c1.3b432"]]},{"id":"6ec1d5b5.6fa74c","type":"function","z":"99ef7505.c281c8","name":"Payload Object Sensor","func":"var newMsg = {};\nvar Sensor = {\n    NData: 0, \n    Temp_DHT11: 0,\n    Humid_DHT: 0,\n    Time: new Date().toString()\n};\n\ncontext.data = context.data || {};\n\nswitch(msg.parts.index){\n    case 0:\n        context.data.NData = parseFloat(msg.payload);\n        msg = null;\n        break;\n    case 1:\n        context.data.Temp_DHT11 = parseFloat(msg.payload);\n        msg = null;\n        break;\n    case 2:\n        context.data.Humid_DHT = parseFloat(msg.payload);\n        msg = null;\n        break;\n    default:\n        msg = null;\n        break;\n}\n\nAllData = context.data.NData &&\n          context.data.Temp_DHT11 &&\n          context.data.Humid_DHT;\n\nif(AllData){\n    var time = Date();\n    context.data.Time = time.toString();\n    Sensor = context.data;\n    newMsg = { payload: context.data,\n    topic: 'Frame Sensor' };\n    context.data = null;\n    return newMsg;\n}\nelse\n    return msg;\n\n\n","outputs":1,"noerr":0,"x":490,"y":240,"wires":[["6ea2f4d2.fa18dc","dd3f2d0e.54406","db161a91.1bf308"]]},{"id":"6ea2f4d2.fa18dc","type":"function","z":"99ef7505.c281c8","name":"Split Data","func":"var msgTemp_DHT11 = {payload: msg.payload.Temp_DHT11};\nvar msgHumid_DHT = {payload: msg.payload.Humid_DHT};\n\nreturn [msgTemp_DHT11, msgHumid_DHT ];","outputs":2,"noerr":0,"x":695.3627052307129,"y":336.9830274581909,"wires":[["190e0530.f9648b","2fbba10c.d9999e"],["dbcc3883.4d3b78","e6b489b1.c1b568"]]},{"id":"dbcc3883.4d3b78","type":"ui_gauge","z":"99ef7505.c281c8","name":"Humid DHT11","group":"539bb2f8.4cd23c","order":1,"width":0,"height":0,"gtype":"gage","title":"Humid DHT11","label":"","format":"{{value}}%","min":0,"max":"100","colors":["#ffff80","#ff8000","#008000"],"x":990,"y":300,"wires":[]},{"id":"2fbba10c.d9999e","type":"ui_chart","z":"99ef7505.c281c8","name":"Graph 5 min Temp DHT11 (°C)","group":"2b53962a.e11c1a","order":2,"width":0,"height":0,"label":"Graph 5 min Temp DHT11 (°C)","chartType":"line","legend":"false","xformat":"%H:%M:%S","interpolate":"basis","nodata":"","ymin":"10","ymax":"40","removeOlder":"5","removeOlderUnit":"60","outputs":2,"x":1040,"y":260,"wires":[[],[]]},{"id":"e6b489b1.c1b568","type":"ui_chart","z":"99ef7505.c281c8","name":"Graph 5 min Humid DHT11 (%)","group":"be69083c.111928","order":2,"width":0,"height":0,"label":"Graph 5 min Humid DHT11 (%)","chartType":"line","legend":"false","xformat":"%H:%M:%S","interpolate":"basis","nodata":"","ymin":"0","ymax":"100","removeOlder":"5","removeOlderUnit":"60","outputs":2,"x":1040,"y":340,"wires":[[],[]]},{"id":"db161a91.1bf308","type":"debug","z":"99ef7505.c281c8","name":"Frame from Sensors","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":830,"y":120,"wires":[]},{"id":"a2dd7e6a.214a8","type":"serial-port","z":"","serialport":"COM5","serialbaud":"9600","databits":"8","parity":"none","stopbits":"1","waitfor":"","newline":"0","bin":"bin","out":"time","addchar":"false","responsetimeout":""},{"id":"2b53962a.e11c1a","type":"ui_group","z":"","name":"Sensor DHT11","tab":"ba6c5c45.1e5fb","order":2,"disp":true,"width":"6"},{"id":"539bb2f8.4cd23c","type":"ui_group","z":"","name":"Pressure, Humidity","tab":"ba6c5c45.1e5fb","order":4,"disp":true,"width":"6"},{"id":"be69083c.111928","type":"ui_group","z":"","name":"DHT11: Humid (5 Min)","tab":"ba6c5c45.1e5fb","order":5,"disp":true,"width":"6"},{"id":"ba6c5c45.1e5fb","type":"ui_tab","z":"","name":"MONITORING","icon":"dashboard","order":1}]
[{"id":"99ef7505.c281c8","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"61fee05.2f50b2","type":"serial in","z":"99ef7505.c281c8","name":"","serial":"a2dd7e6a.214a8","x":60,"y":180,"wires":[["ddf9c433.b32258"]]},{"id":"5c3851c1.3b432","type":"debug","z":"99ef7505.c281c8","name":"Frame from Sensors","active":true,"console":"false","complete":"true","x":510,"y":120,"wires":[]},{"id":"dd3f2d0e.54406","type":"file","z":"99ef7505.c281c8","name":"Sensor Data","filename":"D:\\My Files\\Sensor.txt","appendNewline":true,"createDir":true,"overwriteFile":"false","x":800,"y":160,"wires":[[]]},{"id":"190e0530.f9648b","type":"ui_gauge","z":"99ef7505.c281c8","name":"Temp DHT11","group":"2b53962a.e11c1a","order":1,"width":0,"height":0,"gtype":"gage","title":"Temp DHT11","label":"","format":"{{value}}°C","min":0,"max":"60","colors":["#008000","#ff8000","#ff0000"],"x":980,"y":220,"wires":[]},{"id":"ddf9c433.b32258","type":"function","z":"99ef7505.c281c8","name":"","func":"var newMsg = {payload: msg.payload.toString()};\nreturn newMsg;","outputs":1,"noerr":0,"x":180,"y":180,"wires":[["69577f5b.d860a"]]},{"id":"69577f5b.d860a","type":"split","z":"99ef7505.c281c8","name":"","splt":" ","spltType":"str","arraySplt":"1","arraySpltType":"len","stream":false,"addname":"","x":300,"y":180,"wires":[["6ec1d5b5.6fa74c","5c3851c1.3b432"]]},{"id":"6ec1d5b5.6fa74c","type":"function","z":"99ef7505.c281c8","name":"Payload Object Sensor","func":"var newMsg = {};\nvar Sensor = {\n    NData: 0, \n    Temp_DHT11: 0,\n    Humid_DHT: 0,\n    Time: new Date().toString()\n};\n\ncontext.data = context.data || {};\n\nswitch(msg.parts.index){\n    case 0:\n        context.data.NData = parseFloat(msg.payload);\n        msg = null;\n        break;\n    case 1:\n        context.data.Temp_DHT11 = parseFloat(msg.payload);\n        msg = null;\n        break;\n    case 2:\n        context.data.Humid_DHT = parseFloat(msg.payload);\n        msg = null;\n        break;\n    default:\n        msg = null;\n        break;\n}\n\nAllData = context.data.NData &&\n          context.data.Temp_DHT11 &&\n          context.data.Humid_DHT;\n\nif(AllData){\n    var time = Date();\n    context.data.Time = time.toString();\n    Sensor = context.data;\n    newMsg = { payload: context.data,\n    topic: 'Frame Sensor' };\n    context.data = null;\n    return newMsg;\n}\nelse\n    return msg;\n\n\n","outputs":1,"noerr":0,"x":490,"y":240,"wires":[["6ea2f4d2.fa18dc","dd3f2d0e.54406","db161a91.1bf308"]]},{"id":"6ea2f4d2.fa18dc","type":"function","z":"99ef7505.c281c8","name":"Split Data","func":"var msgTemp_DHT11 = {payload: msg.payload.Temp_DHT11};\nvar msgHumid_DHT = {payload: msg.payload.Humid_DHT};\n\nreturn [msgTemp_DHT11, msgHumid_DHT ];","outputs":2,"noerr":0,"x":695.3627052307129,"y":336.9830274581909,"wires":[["190e0530.f9648b","2fbba10c.d9999e"],["dbcc3883.4d3b78","e6b489b1.c1b568"]]},{"id":"dbcc3883.4d3b78","type":"ui_gauge","z":"99ef7505.c281c8","name":"Humid DHT11","group":"539bb2f8.4cd23c","order":1,"width":0,"height":0,"gtype":"gage","title":"Humid DHT11","label":"","format":"{{value}}%","min":0,"max":"100","colors":["#ffff80","#ff8000","#008000"],"x":990,"y":300,"wires":[]},{"id":"2fbba10c.d9999e","type":"ui_chart","z":"99ef7505.c281c8","name":"Graph 5 min Temp DHT11 (°C)","group":"2b53962a.e11c1a","order":2,"width":0,"height":0,"label":"Graph 5 min Temp DHT11 (°C)","chartType":"line","legend":"false","xformat":"%H:%M:%S","interpolate":"basis","nodata":"","ymin":"10","ymax":"40","removeOlder":"5","removeOlderUnit":"60","outputs":2,"x":1040,"y":260,"wires":[[],[]]},{"id":"e6b489b1.c1b568","type":"ui_chart","z":"99ef7505.c281c8","name":"Graph 5 min Humid DHT11 (%)","group":"be69083c.111928","order":2,"width":0,"height":0,"label":"Graph 5 min Humid DHT11 (%)","chartType":"line","legend":"false","xformat":"%H:%M:%S","interpolate":"basis","nodata":"","ymin":"0","ymax":"100","removeOlder":"5","removeOlderUnit":"60","outputs":2,"x":1040,"y":340,"wires":[[],[]]},{"id":"db161a91.1bf308","type":"debug","z":"99ef7505.c281c8","name":"Frame from Sensors","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":830,"y":120,"wires":[]},{"id":"a2dd7e6a.214a8","type":"serial-port","z":"","serialport":"COM5","serialbaud":"9600","databits":"8","parity":"none","stopbits":"1","waitfor":"","newline":"0","bin":"bin","out":"time","addchar":"false","responsetimeout":""},{"id":"2b53962a.e11c1a","type":"ui_group","z":"","name":"Sensor DHT11","tab":"ba6c5c45.1e5fb","order":2,"disp":true,"width":"6"},{"id":"539bb2f8.4cd23c","type":"ui_group","z":"","name":"Pressure, Humidity","tab":"ba6c5c45.1e5fb","order":4,"disp":true,"width":"6"},{"id":"be69083c.111928","type":"ui_group","z":"","name":"DHT11: Humid (5 Min)","tab":"ba6c5c45.1e5fb","order":5,"disp":true,"width":"6"},{"id":"ba6c5c45.1e5fb","type":"ui_tab","z":"","name":"MONITORING","icon":"dashboard","order":1}]

A good way of debugging a function is to use node.warn something like this
node.warn("idx ="+msg.parts.index);

second you should read; https://nodered.org/docs/writing-functions#storing-data
and look at your function again

Hey @emetechnologies thanks for getting involved, but just posting a flow without any context as to why is confusing.
If you are trying to help @mani2411 can you explain how you have changed the flow?
Or,
If you are @mani2411, why have you posted the same flow 3 times?

this is due to some poor internet connection.

It is the same flow uploaded by the creator. There was an error submitting the flow so I re-send it on his behalf. Please find any solution for the functions as we are very new to node red and unable to solve this problem.

Did you see what I posted in the first reply? To repeat:
Start by putting a debug node showing what is going into the function and check that is correct. Next you can insert node.warn() statements into your code to show the state of variables as it runs through. The warn text will be shown in the debug pane. If that does not help then post just the function here and show us what is going into it.

You have not followed that advice.