SOFT PLC

SOFT PLC

Raspberry Pi PLC. Orange Pi PLC. Windows PLC. Computer PLC. Windows PLC.

Click here for Soft PLC site.

Soft PLC can run on any operating system. You can turn computers, Raspberry Pi, or similar devices into PLCs. You can use GPIOs as digital inputs, digital outputs, PWM, serial ports, and SPI. You can also use USB serial ports, serial port-equipped barcode readers, and similar devices. You can use Fulmatic PLC IO modules together with a remote IO CPU. You can run it for 60 minutes without purchasing a license. The license fee is $25 USD per device.

Soft PLC runs on all operating systems. The platform where Soft PLC will run must have Microsoft .Net Core 8.0.4 Runtime. This version may change with future updates. You can see which .Net Core version the current version of Soft PLC is compatible with under the “Download” heading here.

Soft PLC Installation

The installation of the Soft PLC is explained in more detail on the help pages of Fulmatic SOFT. You can download Fulmatic SOFT from here.

To access the Soft PLC files, save the files to your computer by clicking the ‘Save Soft PLC files’ button in the top right corner of the Fulmatic Soft’s PLC window.

Installation of Soft PLC on Windows

  • Microsoft .Net Core 8.0.4 must be installed for the Soft PLC to work. You can download .Net Core Runtime 8.0.4 from here.
  • You can start the Soft PLC on your computer with the SoftPLC.exe file in the folder where you saved the Soft PLC files.
  • The first time you run it, Windows will ask for permission for this program to open a TCP port on the network. You should respond with Yes.
  • To use the serial ports on your computer with the Soft PLC, you need to define the serial ports in the Config.txt file in the Project folder.

Serial Port:Name=COM0;BaudRate=115200;Parity=None;StopBits=1;DataBits=8;FlowControl=None; Serial Port:Name=COM1;BaudRate=115200;Parity=None;StopBits=1;DataBits=8;FlowControl=None;

The following procedures are for Raspberry Pi PLC and similar devices.

Installation of Soft PLC on Raspberry Pi/Orange Pi and Similar Platforms

  • Open the terminal on Raspberry Pi and create a folder named SoftPLC under /home/raspberrypi. Note that the /home/raspberrypi directory may vary depending on your device and username.
    mkdir SoftPL
  • Transfer the saved Soft PLC files to your device using a USB flash drive or FTP (Filezilla). For more information on transferring files via FTP, visit here.
  • In Filezilla, select the Soft PLC files saved on your computer and upload them to the SoftPLC folder you created on the Raspberry Pi.
  • The copying of the Soft PLC files is completed with this step.
  • When Dotnet is installed, to run the Soft PLC, enter the following line in your terminal:
    sudo dotnet /home/raspberrypi/SoftPLC/SoftPLC.dll

Installation of Dotnet on Raspberry Pi/Orange Pi and Similar Platforms

  • For Raspberry Pi, you can download .Net Core Runtime 8.0.4 from here. If there is version compatibility issue, you may encounter error messages on the terminal screen.
  • Transfer the downloaded file to Raspberry Pi using a USB flash drive or file transfer programs like FileZilla. For information on file transfer via FTP, visit here.
  • Once you’ve downloaded the file, move it to the /home/raspberrypi/Downloads directory.
  • Next, open the terminal on Raspberry Pi and create a folder named ‘dotnet‘ under /home/raspberrypi.
    mkdir dotnet
  • Navigate to the Downloads folder and extract the downloaded file into the ‘dotnet’ folder.
  • The filename here is dotnet-runtime-8.0.4-linux-arm.tar.gz, which is the name of the downloaded file. You should adjust accordingly based on the file you downloaded.
    tar -xvf dotnet-runtime-8.0.4-linux-arm.tar.gz -C /home/raspberrypi/dotnet/
  • After extracting the tar file, we will set up the PATH for dotnet. Execute the following command for this:
    sudo nano /home/raspberrypi/.bashrc
  • Add the following lines to the bottom of the file.
    export DOTNET_ROOT=/home/raspberrypi/dotnet/
    export PATH=$PATH/home/raspberrypi/dotnet/
  • Once you have finished editing, press Ctrl + X to save the file. Then, press Y and Enter to confirm the save.
  • To apply the changes without restarting, run the following command:
    source ~/.bashrc
  • To save the dotnet path as a default secure path, run the following command:
    sudo visudo
  • Paste the following line in the file under the existing “Default secure path” line as shown in the image.
    Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/raspberrypi/dotnet"
  • When you’re done editing, save and close the file.
  • After these procedures, Dotnet installation is completed.

The WiringPi library must be installed for the GPIOs to be used.

  • WiringPi is a GPIO library developed for Raspberry Pi and similar platforms.
  • This library allows you to control the GPIO pins of the Raspberry Pi easily and effectively.
  • WiringPi is also used for GPIO usage in Soft PLC. Therefore, for Soft PLC to run on Raspberry Pi, WiringPi needs to be installed on your device.
  • To install WiringPi, execute the following commands in the terminal.(applicable for Raspberry Pi; it may vary for other platforms)
    sudo apt install git
    sudo git clone https://github.com/WiringPi/WiringPi.git
    cd WiringPi
    sudo ./build
  • For more information about WiringPi, you can visit here.

For the use of GPIO and serial ports, definitions must be made in the Config.txt file within the Project folder.

  • GPIO and serial port usage can be configured.
  • Do not create lines for features that will not be used. For example, if there are no DI (Digital Inputs), do not add that line.
  • Write the definitions for Hardware PWM, Software PWM, and serial ports one after another, as many as there are.
  • Remember to adjust the GPIO physical pin numbers according to your own hardware.
  • Example Config.txt file:
    Shutdown Detect:29U;
    Digital Inputs:33D;35U;36;37U;
    Digital Outputs:38;40;
    Hardware PWM:Pin=12;Clock=100000;Range=100;
    Software PWM:Pin=16;Range=100;
    Serial Port:Name=/dev/ttyS1;BaudRate=115200;Parity=None;StopBits=1;DataBits=8;FlowControl=None;EnablePin=32;
    Serial Port:Name=/dev/ttyS2;BaudRate=115200;Parity=None;StopBits=1;DataBits=8;FlowControl=None;EnablePin=7;

  • Shutdown Detect
  • The pin used for your shutdown detection circuit. Below is an example of a shutdown detection circuit (SD Detect). You can also check here for more information.
  • Soft PLC has 256 kB of memory. Only the used portion of the memory is saved to disk. This reduces the size of the capacitor needed for the shutdown detection circuit.
  • When the program is closed with Ctrl + C, the required time for shutdown will be displayed on the terminal screen. For example, ‘PLC_Code.bin saving time: 70 ms.’ This duration depends on the hardware speed and the size of the written PLC code.
  • If the required shutdown time is insufficient, additional capacitors should be added. We recommend starting with 3300 µF.”
    Shutdown Detect:29U;

  • Digital Inputs
  • The pin numbers to be used as digital inputs should be written sequentially.
  • ‘U’ is used for Pull Up, ‘D’ for Pull Down, or it can be left blank.
  • ‘U’ and ‘D’ may not work on some systems. Configure them manually from the operating system or add external pull-up/down resistors.
  • The first pin number represents the first bit of the digital input starting address in Soft PLC.
  • Each subsequent pin number represents the following pins starting from the initial address.
  • The pins in the example file:
    Digital Inputs:33D;35U;36;37U;
    33D - I 0.0
    35U - I 0.1

  • Digital Outputs
  • The pin numbers to be used as digital outputs should be written sequentially.
  • Unlike digital inputs, they cannot be specified with ‘U’ or ‘D’.
  • The first pin number represents the first bit of the digital output starting address in Soft PLC.
  • Each subsequent pin number represents the following pins starting from the initial address.
  • The pins in the example file:
    Digital Outputs:38;40;
    38 - Q 0.0
    40 - Q 0.1

  • PWM
  • Clock and period constants are written statically within the Config.txt file.
  • In Fulmatic SOFT, the analog output address corresponds to the output value of the first PWM. This value should be between 0 and the set period.
  • The PWM range is written as a maximum of 1024.
  • If you write the analog output address as 100, then QW 100 will be the first PWM of type UINT16. Subsequent PWMs follow as QW 102, QW 104, and so forth.
  • Hardware PWMs are addressed first, followed by Software PWMs.
  • Decimal numbers are never used anywhere.

  • Hardware PWM
  • The pin numbers for hardware PWM can vary for each device. Here’s an example usage:
    Hardware PWM:Pin=12;Clock=100000;Range=100;
    Pin=Hardware PWM pin number 12 (GPIO18-PWM0)
    Clock=PWM frequency.
    Range=PWM ragnge(between 0 and 1024)

  • Software PWM
  • You can generate a PWM signal on an unused GPIO pin using Software PWM.
    Software PWM:Pin=12;Range=100;
    Pin=Software PWM pin number
    Range= PWM range
    Frequency formula: Frequency Hz. = 1.000.000 / (PWM Range x 100us)
    When Range is 100: frekans Frequency Hz. = 1.000.000 / (100 x 100us) = 100 Hz

  • Seri port
  • If you are communicating over a serial port using a USB converter or an RS232 chip, you do not need to specify the EnablePin parameter. This parameter is only necessary when using an RS485 integrated circuit.
    Serial Port:Name=/dev/ttyS1;BaudRate=115200;Parity=None;StopBits=1;DataBits=8;FlowControl=None;EnablePin=32;
    Serial Port:Name=/dev/ttyS2;BaudRate=115200;Parity=None;StopBits=1;DataBits=8;FlowControl=None;EnablePin=7;
    Name=Specify the name according to your hardware setup..
    BaudRate=Set the baud rate (communication speed) that your device supports. This value can vary depending on your device model and operating system.
    Parity=Specify the parity type. Options include None, Even, Odd, Mark, or Space.
    StopBits=Specify the number of stop bits. Options are 0, 1, or 2.
    DataBits=Specify the number of data bits. Options are 7, 8, or 9. For Modbus, it must be set to 8.
    FlowControl=Specify the flow control method. Options include None, RequestToSend, RequestToSendXOnXOff, or XOnXOff.
    EnablePin=If you are using RS485 communication facilitated by an RS485 integrated circuit and need to specify an EnablePin.

Leave a Reply