JMiller
I am trying to run the code that is attached on a Raspberry Pi 4. The simulation seems to go fine, but when the program is uploaded nothing happens. The Monitoring page doesn't change states. Also on the Monitoring page, PB2 should be true as it is negated, yet it shows as false on the page.
Reply 0 0
thiagoralves
Did you load the Raspberry Pi driver on the Hardware tab as per instructions on the OpenPLC website?
Reply 0 0
JMiller
Yes, I did. Is there something I am missing on this page?
Reply 0 0
thiagoralves
Just checked your code and it seems fine, couldn't find anything wrong with it. Are you sure you're testing the right input pins? %IX0.3 and %IX0.4 are pins 11 and 13 on the Raspberry Pi GPIO header. Also, negating a contact won't make it show negated on the monitoring page. The monitoring page shows you the state of your variables. A negated contact doesn't change the state of the variable associated with it, just inverts the condition for it to be closed or open.
Open the monitoring page, make sure it is refreshing (works better on Chrome) and touch pins 11 and 13 with 3.3V. You will see that the two inputs will blink.
Reply 0 0
JMiller
I am 100% sure that the pins I am connected to are 11 and 13. When you say blink do mean the highlighted box or the Value. When hovering over one of the pins with my mouse, the pin becomes highlighted with a dark gray box and the box is what is blinking.
Reply 0 0
thiagoralves
You should see this when the variable is true:
true.png and this when the variable is false:false.pngJust upload this little oscillator project to your Pi and first check the monitoring page to see if out0 is changing like the picture above. If it is not, then probably there is something on your browser that is preventing the page refresh. If you can see out0 changing state every second on the monitoring page, then check your %QX0.0 output on the Pi. You should read 0V / 3.3V intermittently every second.
Reply 0 0
JMiller
The monitoring page Value is changing between True and False; however, the LED is not lighting up.
Reply 0 0
thiagoralves
So this means that there is something wrong with your Pi. My best bet is that there is some background library / task / Python script that is interfering with OpenPLC driver. Try installing OpenPLC on a fresh Raspbian install. This usually works best
Reply 0 0
JMiller
Okay, I will try that.
Reply 0 0
JMiller
I installed a fresh Raspbian OS, installed OpenPLC, and uploaded the oscillator .st file. On start up the LED will light up, but will do nothing when OpenPLC start running the program. Attached are photos of the GPIO pins and the circuit. The black wire is ground and the white wire is connected to %QX0.0
Reply 0 0
thiagoralves
Just now I noticed that you're using a Pi4. I've seen users reporting issues on the Pi4 due to WiringPi (a library that OpenPLC relies on to control the GPIO pins). Try to update your WiringPi according to instructions here: http://wiringpi.com/wiringpi-updated-to-2-52-for-the-raspberry-pi-4b/
You need to be at least on version 2.52 for it to work
Reply 1 0
JMiller
After updating wiringpi it is now working. Thank you!
Reply 0 0
Logopaede
Hello Thiago and JMiller,

I'm glad I found your thread, because I'm a novice with OpenPLC and got stuck with my Raspberry Pi 4B (Raspian Buster) before I read your answers. Thank you very much!

The monitoring, button and LED did not react, until I updated wiringpi 2.50 to 2.52:
$ gpio -v
gpio version: 2.50
Copyright (c) 2012-2018 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

Raspberry Pi Details:
Type: Unknown17, Revision: 02, Memory: 0MB, Maker: Sony
* Device tree is enabled.
*--> Raspberry Pi 4 Model B Rev 1.2
* This Raspberry Pi supports user-level GPIO access.

-->

gpio -v
gpio version: 2.52
Copyright (c) 2012-2018 Gordon Henderson
This is free software with ABSOLUTELY NO WARRANTY.
For details type: gpio -warranty

Raspberry Pi Details:
Type: Pi 4B, Revision: 02, Memory: 4096MB, Maker: Sony
* Device tree is enabled.
*--> Raspberry Pi 4 Model B Rev 1.2
* This Raspberry Pi supports user-level GPIO access.


A second caveat was the 'Hello World.zip' example. With the Raspberry Pi 4 the button function at %IX0.0 has to be negated. I saw it documented somewhere but in this context I attach the change again in Hello_World_Negated.zip.

Before interested, new Users (like me) give up to early, some small hints for Raspberry Pi on the getting-started page of OpenPLC would have been helpful.

Thank you
Reply 0 0
thiagoralves
The negated inputs are documented on the getting started for the Raspberry Pi: "Also, take note that the first two inputs (%IX0.0 and %IX0.1) have hardware pullups, which means that if you don’t connect anything to them, they will both read as TRUE. This is part of the design of the Raspberry Pi boards, and can’t be changed by the OpenPLC software. Therefore, the logic on these first two inputs must be reverse."

On the wiring pi update, I would expect users to start with a fresh updated image, especially if you're running on a newer hardware.
Reply 0 0
Logopaede
Yes, Thiago, you are right.
Just from the standpoint of a noob it is a bit confusing. A beginner with 'Hello World.zip' needs an uncomplicated feedback, that the OpenPLC runtime works at all. The first hurdle should not be too high to keep track. For those users a short example might be helpful, an additional sentence like "(edit button properties from Normal to Negated on Raspberry Pi)".

The Rasbian Buster on my Pi4 has not been a fresh install, indeed, but I updated it last weekend just before my OpenPLC installation and it just got wiringpi 2.50 from apt.

Sorry for my English, it often sounds too harsh because I lack the right words 🙂 I appreciate your project very much!

Thank you
Reply 0 0
Reply