Tabovl
Hello. I hope that I chose the right category for my question.
My friends have a small non-profit railroad museum. They asked me to help with the repair and the launch of railway signaling equipment. Basically, I need to think of the simulation part of the railway station. It is approximately 200 logical inputs / outputs (with the possibility of further expansion in the future). So far I have in the theoretical stage and wondering which way to go. Traditional PLC would be appropriate but it is entirely beyond the financial capacity. After the big internet search, I found a project openPLC and came to me as a suitable option. Can I get a free older PC, install Linux and deploy openPLC. But how do the required number of inputs / outputs? There are some cheap solution? Best make at home or buy cheaply. I do not need a great response speed. Little experience with programming PLC got from my work and my hobby is electronics, in that I do not see the problem.
Thank you for answers and excuse my broken English.
thiagoralves
The Arduino Mega has a large number of inputs and outputs. You could use about 4 of them to have around 200 I/O. However, each Arduino Mega needs to be connected to a host for the OpenPLC to work. You can have each arduino connected to 4 regular computers over the USB port or you could buy 4 cheap raspberry pi zeros and connect them to the arduinos as well.

Another option would be to use the ESP8266. They are wifi-enabled so you can have your I/Os working without wires! However, these little devices have only 10 I/O each. You would have to buy a lot of them and have them all connected to the same wireless network for it to work.
Reply 0 0
Tabovl
I do not know if I understand this correctly.
Can I connect multiple Arduino Mega one OpenPLC install in my PC? Or any Arduino Maga needs its own installation OpenPLC?  It would suit have many Arduino Mega connected to one OpenPLC. From the description on the Web me this is not very clear.

Logic functions that need not complicated, but it uses a lot of inputs and outputs. It's all about converting the historic relay logic to the PLC environment. That's a lot of relays and relays time functions. Almost no other functions are not needed.
I confess that I have not yet installed and tested OpenPLC.
Reply 0 0
thiagoralves
If you go with the Arduino, you will have to have one PC (or RaspberryPi) for each Arduino. You can't connect many arduinos to the same PC running OpenPLC. That's why people are finding interesting to use the pair Arduino + RaspberryPi because it is still cheap (around $30 to buy both) and works great.

If you decide to use ESP8266, you can use as many as you want with only one PC running OpenPLC. They are WiFi devices and all of them will connect to your WiFi network and communicate with your host PC running OpenPLC.

Now, about your large number of I/Os. If you're converting old relay logic to PLC logic, probably you will end up with way less required I/O for your system. Relay logic has lots of I/Os because each relay must be connected to something else to create the logic. If you're using a PLC, these connections happen internally when you write your ladder program. Therefore, you only need the I/O that actually connects to the endpoint actuator or sensor. The intermediary relay connections is not needed anymore.
Reply 0 0
Tabovl
We are trying to deploy the original panel and simulate the actual train station. The panel controls the railway switches, signals and other equipment. Back to go counter position information of the train, the state of railway switches and the like. Unfortunately I have no photo, I showed here.
Perhaps one we found on the internet photo of a similar device:
http://pralinka.venku.cz/dfcd-most/fanta/o3a.jpg
Our panel is much more complex and older. Approximately around 1955)
The paradox is that most modelers model railways has physical switches tracks and trains and not the console that simulates. We have a real desk but simulate the tracks and switches and trains ... :-)

The panel is a terminal to which the room was full of relay logic and other circuits. Colleagues had just repaired and checked by the preserved documentation and replace missing documentation.

To operate the panel estimate the need for about 200 I / O but it is the first estimate. We hope that the variance estimation will be the order of + -10 I / O (but rather less about actually starting to look like)

Which way do we go then I'll have to consult with my friends, for whom this invent, they'll finance the whole project.
The realization is still a long time. As I wrote earlier, we are still in the preparatory phase of the project.

I regret that not more Arduino to connect to a PC or Raspberry. This would greatly increase the possibilities of application and project OpenPLC for further use. ESP board has little pins for a larger project.

Thank you for your valuable advice.
Reply 0 0
skv
Hi Tabovl,

as I understand you want to control all your 200 I/O from a single PLC program. I'd recommend you to make Arduino/STM32Discovery based Modbus I/O module with RS485 interface. In this case Arduino can work standalone and doesn't require constant connection to PC or Raspberry.
Then you connect all you Arduino boards over RS485 to PC. PC is running OpenPLC with Modbus client over RS485 and sends commands to all your distributed Arduino boards.
Reply 0 0
Tabovl
Yes, you understood well.
Is there a manual or tutorial how to run the Modbus and RS485?
Especially in combination with the Arduino, it sounds like what I need.
I guess about what's going on but my experience with this is no.

Thank you very much for your advice.

Tabovl
Reply 0 0
thiagoralves
You could write yourself a Modbus slave "scketch" for the Arduino, or get one ready on the internet (I bet there might be at least one), and then use OpenPLC Modbus Master driver as you've been using with your other devices, but to communicate with the Arduino slave instead. The Modbus Master won't know it is an Arduino. It will communicate with it as if it was a standard Modbus device.
Reply 0 0
Dammerel
Hi all greeting from australia
Im looking at a similar project, lots of IO
my understanding is i could use a RPi (as PLC) and Arduino Mega (as IO)
my question is how to link the two, I guess via UBS port on both ?
Andrew
Reply 0 0
Tabovl
Dammerel ->
If I understand correctly, two or more Arduino (IO) and one Raspberry or PC (PLC "CPU") can not currently be connected.
It is a real pity. I think this is not a big modification of the source code of the OpenPLC project and the resolution of individual IO boards for example by some control bit. But I'm not such an experienced programmer to try it.

Skv, thiagoralves ->
Modbus and RS485 I want to try. But now I do not have much time to devote this project.
Reply 0 0
thiagoralves
Tabovl wrote:
Modbus and RS485 I want to try. But now I do not have much time to devote this project.

The advantage of using the Modbus driver is that you can connect multiple Arduinos to the same host, as opposed to the traditional Arduino USB driver.

Dammerel wrote:
my question is how to link the two, I guess via UBS port on both ?

Just follow the instructions in the website for the arduino platform (www.openplcproject.com). Basically you will need to upload a firmware to your arduino board and install OpenPLC on your RaspberryPi. At the end of the installation process, choose the Arduino driver and you will be good. Then just connect your Arduino board to one of the USB ports of the Rpi board and you will be good to go. No extra setup is necessary.
Reply 0 0
Dammerel
Thanks for the answer, this is a project I will try
with the driver, do i select option 8 or 6 ?
Andrew
8)    Arduino+RaspberryPi8) Arduino+RaspberryPi
Capture.JPG
Reply 0 0
thiagoralves
The ideal driver is the RaspberryPi+Arduino one. However, right now it doesn't really matter. Both options should work with your Arduino board. I'll combine the two options on the next release of OpenPLC.

If you experience any problems with your setup, try building the project again and selecting the RaspberryPi+Arduino option, and let me know what was the problem.
Reply 0 0
Reply