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 #

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

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

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

▷ Ensure the power supply is properly connected.

▷ Connect your RevPi either to your network or set it up in desktop mode.

For detailed instructions about how to set up your system, see Getting Started.

Software #

✓ CODESYS Development System installed on your PC

To ensure a compatible system with suitable software, see Software Compatibility.

Step 1: Creating a New Project in CODESYS #

▷ Open CODESYS on your PC.

▷ Create a new standard project.

▷ Select CODESYS Control for Linux ARM or ARM64 depending of your image version

▷ Choose one of the EN 61131-3 programming languages for PLC.

Step 2: Configuring 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.

▷ 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.

AIO Setting

Step 3: Writing the Code #

▷ 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

▷ Open PLC_PRG in the device tree.

❯ This opens 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 shall be written in ST.

AIO Setting

Step 4: Running the Application #

▷ xref:…​/tutorial/codesys-blinkinglight.adoc#_step_5_connect_the_revpi_in_codesys[Connecting the RevPi in CODESYS]

AIO Setting