Using powerful built-in software, it’s easy to add more functionality to the multifunction, mixed signal I/O on groov RIO, including using RTD temperature probes with minimal code.
The groov RIO MM1, MM2, and even the groov EPIC GRV-MM1001-10 modules are extremely flexible, with an incredible number of software configurable options. Even with all that potential, you can do more when you combine this I/O with software tools like PAC Control, CODESYS, Node-RED, and custom Linux programs.
A great way to see this is with RTD sensors.
Unlike ICTD temperature probes, which are read in as analog input points, RTD sensors are based on resistance and require different calculations to get the current temperature. By wiring the RTD as a two-wire thermistor into a 0–400k Ohm analog input, you can read in a value that can be scaled to degrees.
To briefly look at the math behind the exact formula for resistance-to-degrees scaling, it’s all based on the temperature coefficient of resistance (TCR). Feel free to skip over this part if you just want to know how to use it!
The coefficient is critical to getting an accurate measurement, so it is calculated based on the resistance readings of the RTD at 0 °C (R0) and 100 °C (R100).
For example, a PT100 RTD has a resistance of 100 Ω at 0 °C, and 139.1 Ω at 100 °C. Given that, we can use the formula to find the coefficient we need.
Given the coefficient and a current resistance reading into a groov RIO, here's the calculation to get temperature in degrees celsius (which can then easily be converted to degrees Fahrenheit or even kelvin, using the code `temp_C = ((input / 100) - 1) / 0.00391`):
If you didn’t follow all of that, don’t worry! It’s very easy to apply this formula in your own application. With PAC Control, it’s as simple as entering it into an OptoScript block. CODESYS easily handles it with structured text, and Node-RED can do the calculation in a function node. When it comes to custom Linux programs set up with secure shell access, you have a lot of options—one of which is to use Python and OptoMMP to read the input and put the result in the scratchpad.
Which of those options you use, or if you find another approach, is all going to depend on your application, whether you have EPICs, EPICs and RIOs, or just RIOs. No matter what, it’s easy to use RTDs with the software configurable I/O on multifunction, mixed signal inputs.
For some sample code and more details about the implementation of this code, head over to our OptoForum post on the topic at https://forums.opto22.com/t/obtaining-rtd-temperature-readings-using-groov-rio/5059.
And as always, happy coding!