plcLib - PLC Software for the Arduino

Our plcLib software allows you to develop 'PLC-style' control-oriented software applications for the Arduino and compatibles.

A wide range of example sketches will also become available once you have installed the library. In fact the above program – which is probably the simplest that does something useful – will be available from the pull down menu by selecting File > Examples > plcLib > InputOutput > BareMinimum.

Software Development Methods

In the most familiar design method, an electrical circuit containing elements such as switches and lamps is first represented in graphical form as a ladder diagram – which must then be transformed into a text-based Arduino program (or sketch), before being compiled and downloaded in the normal way. You can also describe a system as a block diagram (function block diagram), or a sequence based system (sequential function chart), all of which can be mixed with native C/C++ code (structured text), so you are free to use the design approach which best suits the problem.

The software is supplied as an installable Arduino library, which is included in the normal way at the start of your program. A number of text-based PLC-style commands then become available for use in your programs.

Unlike a modern commercial PLC, the software does not currently support graphical program entry, simulation, or run-time monitoring. Programs must be entered using the standard Arduino IDE. Diagrams provided in the User Guide are intended to illustrate the design process, and are linked to example sketches provided with the library.

Software features supported by the current plcLib version include inputs (digital / analogue), outputs (digital / PWM / servo), Boolean logic operators, latches, timers, and repeating waveforms. Further details are available from the User Guide (see below), including download and installation instructions.

Supported Hardware

The plcLib library may be used with a variety of hardware, including prototype boards, I/O shields and even Arduino compatible PLCs.

See the Simple Wireless Control for the Arduino topic for more details of the above application.

The Arduino Motor shield is supported as standard, allowing speed and direction control of up to two DC motors.

Modular construction and experimentation systems such as Grove allow a wide range of input and output devices to be connected, without the need for prototype board wiring or soldering.

Version 1.2 of the software is supplied with a wide range of sample configurations for commonly available hardware, including Controllino and Industrial Shields Arduino compatible PLCs. Details of supported hardware is given in the Defining Custom IO Allocations section.

Custom I/O configurations may also be developed for other hardware, not supported as standard. This process is illustrated using the Velleman I/O shield as a case study.

plcLib User Guide (Arduino – Version 1.2)

Related Topics