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.
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:
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.
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 for an example of how to join messages into one object.
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.
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?
That should be fine.
Make sure you consider what happens if there an error of some sort reading one or more of the devices.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.