owlaf2173
Hi,  I'm new to using a Pi with a PLC CPU, but not new to PLCs.  I have a Pi 5, went through the installation steps on the openplc website.  I also install wiringpi from github.  I wired up the pi using the simple example on the openplc site to see a basic working version.  I have the program uploaded, the pi hardware selected, and the program running.  
 
Everything seems to install fine, but the output doesn't come on.  The inputs don't change.  I feel like I am missing a simple beginners step.
Reply 0 0
DJKalian
Hey @DJKalian could you post your PSM solution here so others can benefit? Indeed the Pi5 has a different GPIO structure. I couldn’t find any C library that works with it
Also, this forum posting may help us in the right direction. You probably understand most of it better than I do, but it seems that a library "lgpio" is working on Raspberry Pi 5
 
Reply 0 0
DJKalian
Thank you for your answer Kris,
 
as Thiago wrote, would be posible to get more detail instructions and code on how to make these changes in my RPI5 in order to get OpenPLC working?
 
I apologize if this seems like too much to ask but I would really like to work with OpenPLC in my RPI5.
 
Regards,
Gustavo, I hope you see the reply I made to Thiago containing the code examples, I did not want you to think I ignored your request and I did not want to duplicate a post. Please let me know if you have other questions.
 
Kris
Reply 0 0
Gustavo Ortiz
Thank you for your help Kris. I'll be trying this in my RPI5 and let you know if Im succesfull at it.
 
Regards,
Reply 1 0
Gustavo Ortiz
Hello,
 
To make RPI5 IO to work Im using the PSM as suggested. I wrote the code to handle the I/O but when I run "Start PLC" Im getting an error in the log:
 
"File "/home/tavortiz/OpenPLC_v3/webserver/core/psm/psm.py", line 3, in <module>
    from pymodbus.server.sync import ModbusTcpServer
ModuleNotFoundError: No module named 'pymodbus"
 
I verified the "pymodbus" library is installed.
 
Thank you for your help.
 
Regards,
 
Tavo
Reply 0 0
DJKalian
cd into your OpenPLC_v3 folder. if you "ls" you will see a text file called "requirements.txt"
type the commands, 
 
sudo apt-get install python3-pip
 
once this installs, type the command
 
sudo pip3 install -r ./requirements.txt --break-system-packages
 
this should install the versions of pymodbus and give access to the openplc server. when you start the PLC your pymodbus error should disappear
 
Kris
Reply 1 0
Gustavo Ortiz
cd into your OpenPLC_v3 folder. if you "ls" you will see a text file called "requirements.txt"
type the commands, 
 
sudo apt-get install python3-pip
 
once this installs, type the command
 
sudo pip3 install -r ./requirements.txt --break-system-packages
 
this should install the versions of pymodbus and give access to the openplc server. when you start the PLC your pymodbus error should disappear
 
Kris
It work!!!! Thank you for your help Kris! 
Reply 1 0
DJKalian
It work!!!! Thank you for your help Kris! 
I cannot take credit, I found bit and pieces of info here in the forums and in other places, I am only putting the pieces together. I am glad to help!
 
Kris
Reply 2 0
thiagoralves
That’s the beauty of an open source community
Reply 1 0
pc-cyberot
The easiest way to check is by uploading the Blink example and then check on the Monitoring page in the webserver if the output is being triggered. Then connect an LED to the pin and check if it blinks as well
 
Hey @DJKalian could you post your PSM solution here so others can benefit? Indeed the Pi5 has a different GPIO structure. I couldn’t find any C library that works with it
 
The easiest way to check is by uploading the Blink example and then check on the Monitoring page in the webserver if the output is being triggered. Then connect an LED to the pin and check if it blinks as well
Hello, I'm encountering an issue with monitoring the output in the monitoring tab of OpenPLC runtime. I'm using a basic blink program on a Raspberry Pi 4 Model B. It seems that two connections are necessary for the LED: one to GND (Pin 6) and the other to Pin 24 (8 PIO | %QX0.0). However, the LED is not blinking as expected. Interestingly, when I connect the GND to Pin 20 instead, the LED turns on but does not blink. Your assistance would be greatly appreciated.
Reply 0 0
thiagoralves
It seems that you're not wiring your LED properly. LEDs have polarity (only work in one direction) and require a resistor in series with the output pin to limit the current that flows through it.
 
Try following this guide to get started with OpenPLC: https://autonomylogic.com/docs/3-2-creating-your-first-project-on-openplc-editor/
Reply 1 0
pc-cyberot
Hi,
 
Following is the ladder drawing,
 
[203128%2F8908743%2Fmceclip0]
 
Following is te wiring that I have done,
 
[203128%2F8908745%2Fmceclip0]
 
[203128%2F8908750%2Fmceclip0]
 
Its working fine on the monitoring tab of the runtime with a delayed red and green output.
[203128%2F8908751%2Fmceclip0]
 
Please let me know where I am missing?
 
I doubt the ladder drawing and the physical wiring do not match.
Reply 0 0
thiagoralves
QX0.2 is pin 16, not gpio 16
IMG_1807.jpeg
Reply 1 0
pc-cyberot
Hi,
 
I tried on a new Raspberry Pi 5.
 
Same topology as above, same results the physical LED do not blink but the runtime monitoring tab is working
 
[203128%2F8912819%2Fmceclip0]
 
Please let me know how I can trouble shoot.
 
Following is the physical connection:
  • From PIN 7 (GND) - connected to resistor - then big leg of the LED which is the positive side and the negetive side is connected to PIN 16 (%QX0.2).
  • Tried connecting the to PIN 3 (GND) - no success.
  • Please note I have only connected PIN 7 and 16 and no other connection for the power source.
 
Runtime logs:
OpenPLC Runtime starting...
Interactive Server: Listening on port 43628
Skipping configuration of Slave Devices (mbconfig.cfg file not found)
Warning: Persistent Storage file not found
Issued start_modbus() command to start on port: 502
Server: Listening on port 502
Server: waiting for new client...
Issued start_dnp3() command to start on port: 20000
DNP3 ID manager: Starting thread (0)
DNP3 ID DNP3_Server: Listening on: 0.0.0.0:20000
Issued start_enip() command to start on port: 44818
Server: Listening on port 44818
Server: waiting for new client...
Issued stop_pstorage() command
 
GPIO Read all
 
[203128%2F8912821%2Fmceclip0]
 
GPIO and runtime status:
 
[203128%2F8912828%2Fmceclip0]
 
Please let me know what I am missing.
 
Thanks
Reply 0 0
thiagoralves
Raspberry pi 5 does not work with OpenPLC. The hardware driver must be rewritten to work with the new GPIO interface.
Reply 1 0
pc-cyberot
 
Hi,
 
Thanks for your quick response. I am really struggling with my first program.
 
I tried again on Raspberry Pi 4 B.
 
*I can see all GPIO is MODE "IN" - Is this normal ?
 
Following are the outputs:
 
Compiling Program
Generating C files...
POUS.c
POUS.h
LOCATED_VARIABLES.h
VARIABLES.csv
Config0.c
Config0.h
Res0.c
Moving Files...
Compiling for Raspberry Pi
Generating object files...
Generating glueVars...
varName: __QX0_2 varType: BOOL
Compiling main program...
Compilation finished successfully!
 
Runtime logs:
OpenPLC Runtime starting...
Interactive Server: Listening on port 43628
Skipping configuration of Slave Devices (mbconfig.cfg file not found)
Warning: Persistent Storage file not found
Issued start_modbus() command to start on port: 502
Server: Listening on port 502
Server: waiting for new client...
Issued start_dnp3() command to start on port: 20000
DNP3 ID manager: Starting thread (0)
DNP3 ID DNP3_Server: Listening on: 0.0.0.0:20000
Issued start_enip() command to start on port: 44818
Server: Listening on port 44818
Server: waiting for new client...
Issued stop_pstorage() command
 
 
Monioring Works Fine
[203128%2F8913211%2Fmceclip0]
 
 
 
Following are the outputs from the Raspberry PI 4 B:
 
[203128%2F8913218%2Fmceclip0]
Reply 0 0
Reply