# RTD Data Collection Optimisation and Handling

**URL:** https://discourse.nodered.org/t/rtd-data-collection-optimisation-and-handling/66048
**Category:** General
**Created:** [5 August 2022 03:50 UTC](https://discourse.nodered.org/t/rtd-data-collection-optimisation-and-handling/66048 "2022-08-05T03:50:24Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![JeromePlAUD](https://avatars.discourse-cdn.com/v4/letter/j/b487fb/32.png) [@JeromePlAUD](https://discourse.nodered.org/u/JeromePlAUD)
#### Post date: [5 August 2022 03:50 UTC](https://discourse.nodered.org/t/rtd-data-collection-optimisation-and-handling/66048/1 "2022-08-05T03:50:24Z")

</div>

Hi - I am very new to node red and the Raspberry Pi but trying to create a data logger. I am using an 8-Channel RTD data acquisition board with 8 x PT100's attached. I have set out a flow which seems to work for a single channel, but when I add in another channel and save to a .csv file it doesn't seem to like to have two columns and prints them out on separate lines.

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/8/0/80e5f04db74bbed0977483e2b27631cdf96c5520.png)

I'm hoping to get the format - "Timestamp" , "RTD1" , "RTD2"

I believe this is due to the messages being generated separately and not in a single input, what would be the best way to fix this, as I eventually want to have 8 columns for each sensor.

This is my setup so far:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/d/b/db2fcb96b3be4c1208d48d215d248a63761c2521.png)

Any help to optimize this for 8 channels would be appreciated - My plan is to just have 8 rtd inputs and merge them into a single function, but not sure if this is the correct way.

My sample time is 0.1s and plan to have a toggle switch to start/stop the flow.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [5 August 2022 07:43 UTC](https://discourse.nodered.org/t/rtd-data-collection-optimisation-and-handling/66048/2 "2022-08-05T07:43:40Z")

</div>

Welcome to the forum @JeromePlAUD

The reason this is happening is that the Data function receives two messages one after the other from the two RTD nodes. One option is to use a Join node to combine the two values into one message.

See [this article in the cookbook](https://cookbook.nodered.org/basic/join-streams) for an example of how to join messages into one object.

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [5 August 2022 07:49 UTC](https://discourse.nodered.org/t/rtd-data-collection-optimisation-and-handling/66048/3 "2022-08-05T07:49:32Z")

</div>

An alternative which may be easier in this simple situation is to put the two RTD nodes in series rather than in parallel. After the first one use a Change node to move the value into a message property such as `msg.rtd1` then feed the change node to the second rtd node. That node should not destroy `msg.rtd1` so after that you will have both values available to format as you require and pass on.

---

<div class="post-metadata">

### Author: ![JeromePlAUD](https://avatars.discourse-cdn.com/v4/letter/j/b487fb/32.png) [@JeromePlAUD](https://discourse.nodered.org/u/JeromePlAUD)
#### Post date: [9 August 2022 05:33 UTC](https://discourse.nodered.org/t/rtd-data-collection-optimisation-and-handling/66048/4 "2022-08-09T05:33:05Z")

</div>

Thank you so much Colin, that worked a treat (Used the move section under the change function)! Do you see any issues if I were to replicate this 8 or 16 times? As eventually I plan to have 16 RTD's connected, so I would just have all 16 in series and then going into a csv file, not sure if that would still be possible or may use too many resources?

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [9 August 2022 06:37 UTC](https://discourse.nodered.org/t/rtd-data-collection-optimisation-and-handling/66048/5 "2022-08-09T06:37:00Z")

</div>

That should be fine.

Make sure you consider what happens if there an error of some sort reading one or more of the devices.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [23 August 2022 06:37 UTC](https://discourse.nodered.org/t/rtd-data-collection-optimisation-and-handling/66048/6 "2022-08-23T06:37:54Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
