Using Arduino like a PLC

I have built a machine using pneumatic's for control and I am switching it manually to control it. I would like to use Arduino to fully automate it, having a start switch then controlling the rest using limit switch's It has seven different movements from start to home. Would appreciate some guidance on what code I would need to do this. This is all new to me.

Regards Paul

Are you controlling the pneumatics with electrical switches? If no you will need something like that to allow the Arduino to control it.

What output do you need, and what inputs will you supply.

" 7 different movements " are those sequence steps? are those single acting motions or double acting (like a cylinder is extended when the valve is powered and retracted when the valve is off, or does it require 2 signals , one to extend, and 1 to retract?)

You have 5 analog inputs which can also function as digital inputs. you have 14 digital input/output pins of which 2 are used for serial, leaving 12 pins.

Automating a machine sometimes means you have to add complexity for safety reasons. I was involved with a machine for use in a commercial pottery. Had several pneumatic operated transfers. Original design have single acting valves. Cylinders moved when the E-Stop was pushed and moved back when the power was restored. Was very unsafe. If there was a problem it would only get worse because of the undesired motion. Had to replace all the valves with double acting and make the program more complex to protect product and workers. BUT - the machine could be stopped at any point and restarted with no undesired or unnecesary movements.

With automation you MUST plan for any and all emergency conditions and what can possibly happen when you pull power, and apply power. You would hate to have someone get into the machine and E-Stop it, only to then have the machine move and trap them further.

You may need to look into a 1280-1284 or 2560 based board for more I/O, but you have a very nice platform to learn with the Arduino.

Classic Ladder is open source software to emulate PLC controllers which should do everything you need. I use it as a component in LinuxCNC where it works very well but it will also run on microcontrollers like the Arduino.

Thanks for the input, I manufacture a lot of small timber products all of which need spraying then need turning for respraying I have 12 800mm x 800mm wire framed racks on a rather large turn table the machine at one point slides in with a rack already up side down picks up rack with product clamping at the same time retracts to home position (as so it can clear turntable) then turns both racks via a rotary air cylinder. Then slides in again to unclamp drop rack back into position then unit slides back into home position ready for cycle start.

I build most of my machines from parts salvaged from machines at the local scrap yard so I have a number of 5 port electrically operated air valves I can use. I have built three cnc routers so far but this is all very new to me appreciate any help.

Goodoil, do you have experience with Ladder Logic and that's why you are talking about PLC's here?

If not, you can figure this out with coding with Arduino.. I strongly suggest "Stepwise Refinement", where you write short test sketches (programs) to run each different valve or function on an off. You can even start with the BLINK example. Then start combining functions together.

There is some information about power switching with Arduino, including relays etc. here:

If you are using electrically controlled valves you can operate them with relays or "Solid State Relays". Either way, having "Optical Isolation" between Arduino and the actual power switching is a good idea.

PLC's and Opto22 computer control etc. all normally DO have optically isolated inputs and outputs.

Let us know how it's going...

Thanks for the link Terry looks like a good place to start.

Regards Paul