I'm developing a new version of the OpenPLC Ladder Editor that can generate code for standard arduinos. Since the OpenPLC is based on arduino platform, it wasn't a big challenge. While I was testing the code on my arduino UNO, a new idea was born. Arduinos can now understand ladder code the same way OpenPLC does, but they don't have the layer of electrical protection that makes a PLC reliable. What if I create a shield for the arduino that can act like a protection layer for its inputs and outputs? I then grabed a blank paper and started to draw some diagrams... Hey, it's possible!
I decided to call my draft "OpenPLC Mini", since it will be a cheaper and simpler version of the traditional OpenPLC. And the best part of all of this is that you can try it NOW!
The beta version of the OpenPLC Ladder Editor 0.2a can be found on this link: https://drive.google.com/file/d/0BwyThwktWLAlQjRkMXVrVVRsLUk/edit?usp=sharing
You can use it on your regular arduino UNO or Mega. For now, the only limitation is that it doesn't implement the Ethernet functions that the OpenPLC has. So, no MODBUS or SCADA for you. But this is a work in progress version, and I'm planning to add this in the near future. You will, obviously, only need to attach an ethernet shield for it to work properly.
This version can compile code to standard OpenPLC, OpenPLC Mini and barebones arduinos.
The OpenPLC works with expansion cards, and I decided to keep the same level of compatibility between OpenPLC, Arduinos and OpenPLC Mini. So, both arduinos and OpenPLC Minis also have expansion cards, but they are virtual cards, since there is no bus to attach hardware on it.
To assign contacts to each expansion card you must follow OpenPLC naming convention. The software automatically adds X for inputs and Y for outputs. Then you just need to enter the board number and IO number. Each IO expansion card for the OpenPLC has 8 IOs with address from 0 to 7. So, to access the first input of the first card, your contact name should be X1_0 (it means that you are accessing input #0 from input card #1). To clarify, I will give you an example. Suppose that you have the following ladder diagram:
|---[ ]--------------------------( )---|
If you assign contact name X1_0 to contact and Y1_0 to coil, the OpenPLC will activate the first output of the first output card whenever it sees the first input of the first input card active.
The OpenPLC Mini (and also a barebones arduino) doesn't have expansion cards because it doesn't have a bus. So, there are virtual expansion cards attached to the processor pins for it to work properly. Below is the relation of the arduino pins and the virtual expansion cards:
1st input card
arduino digital pin 2 ====> X1_0
arduino digital pin 3 ====> X1_1
arduino digital pin 4 ====> X1_2
arduino digital pin 5 ====> X1_3
arduino digital pin 6 ====> X1_4
arduino digital pin 7 ====> X1_5
arduino digital pin 8 ====> X1_6
arduino digital pin 9 ====> X1_7
2nd input card
arduino digital pin 10 ====> X2_0
arduino digital pin 11 ====> X2_1
(yes, this second internal card only has 2 inputs)
1st output card
arduino digital pin 12 ====> Y1_0
arduino digital pin 13 ====> Y1_1
arduino analog pin A0 ====> Y1_2
arduino analog pin A1 ====> Y1_3
arduino analog pin A2 ====> Y1_4
arduino analog pin A3 ====> Y1_5
arduino analog pin A4 ====> Y1_6
arduino analog pin A5 ====> Y1_7
Just to remember, you don't have to add "Xs" and "Ys" in your contacts names, as the OpenPLC Ladder Editor automatically adds it for you.
Try it out in your arduinos and post a comment below if it worked for you.