plcLib (Arduino): Getting Started with Ladder Logic

The PLC design method often starts with an electrical circuit, or block diagram, which is then redrawn as a ladder diagram, and then converted into an Arduino sketch before being compiled and downloaded in the normal way. The figure below illustrates the process

The name 'ladder diagram' comes from the superficial resemblance to a physical ladder, with vertical power rails at each side, and horizontal circuit branches called rungs connected between the rails. More complex ladder diagrams have a series of rungs, each of which represents a separate circuit.

Ladder diagrams are an adaptation of an earlier technology called relay logic, in which switches and relays are used to control industrial circuits. A simple relay logic circuit is shown below.

Notice the positive power rail at the left, and negative at the right. Switches SW1 and SW2 are push-to-make and push-to-break types, causing their associated lamps to be lit when the switches are pressed or released, respectively. Switch SW3 is connected to relay coil RL1 and the changeover relay contacts are then linked to lamps BL3 and BL4. The relay contacts are arranged so that only one lamp is lit at any time.

Any program which make use of the plcLib software library must be entered as a standard Arduino text-based sketch, which PLC programmers may refer to as instruction list programming. With practice, the process of converting a ladder diagram into an Arduino sketch becomes relatively straightforward. A number of alternatives to the ladder logic design approach are available, including function block programming, sequential function charts and structured text, each of which is discussed separately.

These five programming methods (ladder diagram, instruction list, function block, sequential function chart and structured text) are defined by the Part 3 of the IEC 61131 standard (IEC 61131-3, also known in the UK as BS EN 61131-3), which deals with programming languages for programmable controllers.

Related Topics

top