Skip to main content

CODESYS Example: TemperatureMeasureWithRTD

Introduction

In this example, we will read the temperature using the RTD channel of the RevPi AIO and output the measured value to an analog output channel connected to a digital display.

Prerequisites

Hardware Requirements

  • RevPi Connect 4
  • RevPi AIO
  • Temperature Sensor (e.g., PT1000, 4 Wire)
  • Digital Display (e.g., ITP11 Process Indicator)

Software Requirements

  • CODESYS Development System installed on your PC

Preparation

Hardware Setup:

▷ Connect the Temperature Sensor (PT1000) to the RTD channel 1 of the RevPi AIO module.

▷ Connect RevPi Connect 4 and RevPi AIO using the PiBridge.

▷ Ensure the power supply is properly connected.

▷ Operate your RevPi either in headless mode or connect a monitor, mouse, and keyboard to it.

Tipp: For detailed instructions about how to set up your system, refer to the Getting Started guide.

Software Setup:

note: To ensure a compatible system with suitable software, please refer the following links:

Step 1: Create a New Project in CODESYS

▷ see how to create a project here and adapt with your Hardware.

▷ In this example we use the EN 61131-3 programming languages for PLC.

Step 2: Configure the RTD Channel and Output Channel

▷ ensure that the temperature sensor to RTD channel 1 on the RevPi AIO is connected.

▷ Configure RTD Channel 1 for PT1000 - 4 wire temperature measurements. ➜ Refer to the RevPi AIO documentation, section Configuring RTD Channels for Temperature Measurements, for detailed instructions.

▷ Connect the digital display (ITP11 Process Indicator) to analog output channel 1 on the RevPi AIO.

▷ Configure the analog output channel to use 4–20 mA current. ➜ Refer to the RevPi AIO documentation, section Configuring Output Channels for Temperature Measurements, for detailed instructions.

AIO Setting

Step 3: Write the Code for reading Temperature from RTD channel und wrie to the Output Channel

▷ Assign the variable name RTD_CH1 to the RTD Channel 1 with data type INT

▷ Assign the variable name iAIO_ch2 to the Output Channel 2 with data type INT

AIO Setting

▷ Double-click on PLC_PRG in the device tree. ➜ This will open the program window PLC_PRG where the Code for reading Temperature from RTD channel und write to the Output Channel of to the RevPI AIO module shall be written in ST.

AIO Setting

Step 6: Run the Application

Connect the RevPi in CODESYS

Run the Application

AIO Setting