This application implements mainly two things:
It is implemented on a raspberry Pi with a SoftPWM output. But it will work on every other PLC, which can read a temperature and output an analog value, as well.
So feel free to take and adapt the code to your needs. The following procedure describes just how it is done with a Raspberry Pi.
You can use Wharfie to get a pure Debian based Root Filesystem. The biggest advantages of using debian are:
But you can also start with a Raspbian image.
Download and install the CODESYS package from the CODESYS Store. After the installation, you can install the debian package via Tools > Update Raspberry Pi.
This package contains the SoftPWM driver, which can be used to emulate an analog output on the Pi.
It can be found on Forge.
This package contains an generic driver for SPI temperature sensors.
As I based my system on Raspberry Pi and "debian stretch", I had to manually set the frequency of the SPI bus. This is a known issue of the Raspberry Pi kernel, starting from stretch.
Use the download button at the top of the page to install the project.
Here are the schematics which I used. But this is no rocket science. You can use every other temperature sensor or amplifying circuit.