15. PLC Labs

15.1 Labs - Fundamental PLCs

• The fundamental laboratories are designed to cover basic understanding of the technology aspects, and some basic theory of practical control systems. Some of the laboratories will be conducted before the material has been covered in class. When this is the case, all efforts will be made to ensure that the level of knowledge is sufficient.

15.1.1 Lab 1: Introduction to Micrologix Controllers

Objective:

To learn the basic operation of low cost Allen-Bradley programmable logic controllers.

Pre-Lab: None.

Resources: Micrologix 1000 Hardware and RSLogix 500 Software manuals (www.ab.com)

Equipment:

Micrologix in travel cases

RSLogix 500 software

PC computer with windows/dos

Procedure:

1. Follow the Micrologix tutorial later in the notes.

Marking:

1. A pass grade will be assigned to students that complete the tutorial and print out the final program in the tutorial.

15.1.2 Lab 2: Electrical Wiring

Objective: To gain experience with electrical wiring requirements and then program an Allen Bradley Micrologix PLC to control equipment.

Pre-Lab: (NOTE: These, and all other Pre-labs will be checked before every lab. A mark of zero will be assigned when prelab materials have not been completed before the start of the laboratory)

1. Review the tutorial for the micrologix controller done the previous week. The manuals and PLCs will be left in a convenient location.

2. Examine the Electrical description below and complete the hardware design. This must be done in Autocad or some other sketching program. Note: It may help to look through the textbook.

3. Develop a simple flowchart for the process description below.

4. Develop ladder logic for the process below, and develop a set of test inputs to verify the operation. The ladder logic can be developed before the laboratory and brought in on disk. All ladder logic must be commented.

5. Select a process and develop a description of an interesting control function (use Boolean equations, flowcharts, or some other structured design technique). After this you may write your own individual ladder logic program for the PLC. The most creative programs will receive top marks. Develop a table of test values to verify operation.

Process Description:

There are four sensors on a large stamping press. One of the sensors (I/2) is on when a blank is present and ready for stamping. A second sensor is off when there are hands inside the press (I/3). A third sensor (I/4) is a start push-button. It is on momentarily when the press is to go into an active state (O/1). The fourth push-button (I/5) is a stop button, and all should stop when it is pushed.

There are also two outputs available. One output (a status light) is the press-on (O/0). It is active after the start button is pushed, this can be shut off if the stop button is pushed. The press will begin stamping cycles if the press-on output (O/1) is active. This will occur when the press-on output is active, and a part is present, and there are not hands inside.

Electrical Description:

This lab will involve wiring 115Vac from a wall socket. When doing this we will use loose electrical cords and connect them to the PLCs. Some special items must be noted.

1. DO NOT PLUG IN THE SYSTEM UNTIL all wires have been connected and checked.

2. Make sure the ground is connected to all devices.These are typically color coded as green, or have a ground symbol. Note: power should not flow through the ground, it is only for emergencies to draw current out of the cases of electrical equipment, and into the ground beneath the building. In other words the ground and common are not the same thing.

3. Normally the AC has 2 wires (for a single phase). For consumer applications we need to make sure the polarity is correct, so that the ‘hot’ (black) wire is switched off, making electrical shocks less likely. Note: in reality, even if these wires are backwards the power will still be delivered to the load.

4. After connecting the power to the devices, it is a good idea to plug them in and check operation before proceeding to connecting other devices.

5. Try not to daisychain power connections (like a string of christmas lights), but connect the power cord to a terminal strip, and then connect to each device to the terminal strip. (see the figure)

6. Do not leave loose, or exposed wires. These will only lead to short circuits, electric shocks, or other problems. Tighten the wires. If doing this for permanent jobs, the wire should also wrap around the screw. Note: leads with banana plugs or aligator clips are particularly prone to creating short circuits.

Inputs and outputs also require a few notes:

1. A PLC rarely has an internal power supply for inputs or outputs. You must always connect an external power supply for inputs or outputs. Note that the Micrologix does have a small 24Vdc power supply, but it is not connected to any of the inputs or outputs, and it will not drive a large load.

2. The ground and common are terms that are badly confused. A true ground is an electrical connection to the ground beneath a building that will draw away current if there is an electrical fault. A common is a reference voltage for all parts of a circuit, typically 0V. When connecting devices such as sensors and actuators we want to connect them to a common. This problem is normally overlooked, but when we have systems with mixed power sources (eg. 115Vac, low voltage DC) we must separate these. DO NOT CONNECT the common to the ground. BE WARNED, many low voltage devices (such as power supplies, sensors, etc.) show the common as a ground.

3. Remember for relay outputs there is no common, the output is just a switch.

4. On the Micrologix PLC there is a small power supply that can be used to power a limited number of inputs or low power outputs. The figure below shows an example of three NO pushbuttons connected using this power supply. Normally a PLC will NOT have a power supply and you should recognize that this configuration is an exception.

The laboratory focus will be on building the system shown in the wiring diagram below. The wiring diagram loosely follows industrial wiring diagram standards. In the diagram the AC power is connected across the ‘L1’ and ‘N’ rails (vertical lines). The connections to the devices are indicated as shown on the devices. The inputs and outputs to be connected to the system include:

The inputs to the PLC will be

inductive proximity sensor ‘A’

photo proximity sensor ‘B’

NO start button

contact switch

The outputs are-

1 relay output to switch a 120Vac light ‘L’ (or an equivalent load)

1 pneumatic solenoid valve ‘V’

1 regular solenoid

12Vdc motor (small) ‘M’

 

The system is wired to include an estop that will cut the power to the outputs, but allow the plc and inputs to continue working.

The sourcing and sinking sensors to be used for the lab are shown with their conventional systems, as shown below.

Equipment:

PC with Micrologix programming software

PLC trainer boards

Wires, wire cutters and wire strippers

Screwdrivers

Pushbuttons NO and NC

PNP/NPN sensors

Procedure:

1. Build the system as shown, including the fuse and E-Stop. During the laboratory this might be modified to include an MCR to control the power.

2. As a group, enter and test a ladder logic program as developed in step 3. of the pre-lab. The program will be checked by monitoring on-line, and by completing the test table. The professor must check that the program is operational and assign a grade.

3. Individually enter and test your original ladder logic program from step 4. The test table must be completed to verify the operation. The instructor will check the results and assign a grade.

Marking:

50% Pre-lab (individual).

20% Procedure step 2 results (group).

30% Procedure step 3 results (individual).

 

Figure 15.1 Design Cover Page

 

Figure 15.2 Project Note Page

 

Figure 15.3 Project Diagramming Page

 

Figure 15.4 Project Diagramming and Notes Page

 

Figure 15.5 IO Planning Page

 

Figure 15.6 Internal Memory Locations Page

 

Figure 15.7 Ladder Logic Page

15.1.3 Lab 3: Simple Motor Control

Objective:

The PLC will be used to control a DC motor, and a simple encoder will be used to detect position.

Equipment:

PC with Micrologix programming software

PLC trainer boards

Wires

LEDS

Motors with gear head

Encoder disk

560 ohm resistor

1K resistor

1 uF capacitor

photo emitter/detector pair (H21A1)

Pre-Lab:

1. Develop a state diagram for a program to turn the motor shaft 3 times if button A is pushed, or 6 times if button B is pushed.

2. Develop ladder logic for the motor controller.

System Description:

The motor will be driven with 12V, switched by an output relay in the PLC. This will cause rotation at approximately 100rpm. A simple encoder will be made by using a clear disk with blacked-out areas. The disk will rotate with the shaft of the motor. An optical sensor will be used to detect the blacked-out areas. The result will be input pulses that go into the PLC. By counting the pulses we can tell how many times the shaft has rotated. The figure below shows the photodetector circuit.

 

The light beam will be broken with encoders that have the general pattern given below.

Procedure:

1. Connect the motor, PLC, and any required wiring.

2. Load and test the program for correctness.

Marking:

50% Prelab

50% Results in lab

15.1.4 Lab 4: Introduction to PLC-5 Controllers

Objective:

To learn the basic and intermediate functions of the Allen Bradley PLC-5 Controllers.

Pre-Lab: (due at the start of lab period)

None.

Equipment:

PLC-5 processors, cards, racks and cables

RSLogix and RSLinx software and computers

Power supplies

Wire and screwdrivers

Voltmeters

Procedure:

1. Follow the PLC-5 tutorial later in the notes.

Marking:

All/Nothing based on completion of the tutorial.

15.1.5 Lab 5- Sequential Logic Control

Objective:

Develop a PLC program that will control a miniature set of traffic lights. These lights will go through a normal sequence, but will have pedestrian cross walk buttons that will activate a cross walk signal when pressed. When done the student should understand the design and implementation of time dependent control circuits.

Pre-Lab: (due at the start of lab period)

1. Draw a state transition diagram for the traffic lights given the process description below.

2. Write the ladder logic model for the state transition diagrams.

3. Develop an exhaustive test table that will test all of the possible transition states for the traffic lights.

4. Develop a creative description of a process for the PLC that is time dependent. Create the state transition/petri net/etc model for the problem. Then create the ladder logic to support the design. Note: the boards for these labs also contain relays, switches, buzzers, lights, a motor, optical sensors, etc. A test method must be developed for the results.

Process Description:

We want to develop a controller for a set of traffic lights that is at the cross of Main St. and a less used Cross Rd. The lights under two possible sequences as shown below. In the normal sequence the green for cross is shorter with no cross walk light. If a cross walk button is pushed while the Main light is green or yellow the Cross green light will be on longer with a walk sign.

Equipment:

PC with PLC programming software

PLC-5 processors, cards, racks and cables

4 red LEDs

2 yellow LEDs

4 green LEDs

10@ 1K resistors

Wires

Procedure:

1. The instructor will describe how to connect the PLC, power supply, buttons, etc at the beginning of the laboratory period. As a group you will connect the circuits. Components used will include push buttons and red/yellow/green LEDs for lights.

2. As a group, enter and test the ladder logic for pre-lab 2 and conduct tests in pre-lab 3. The instructor must check the performance.

3. Individually wire, enter and test the pre-lab step 4. The results must be demonstrated to the professor. Marks will be deducted for excessive debugging time. (1% per minute past 30 minutes up to 100%)

Marking:

50% Pre-lab (individual).

30% Procedure step 1 (group).

20% Procedure step 2 (individual).

15.1.6 Lab 6a: Analog Input/Output

Objective:

To explore analog inputs and outputs on PLCs and mathematical calculations.

Pre-Lab: (due at the start of lab period)

1. Write simple programs to read and output analog voltages from the PLC.

2. Develop the ladder logic to read an analog voltage, perform a calculation, and output the result as an analog voltage. The equation is,

Process Description:

Analog inputs and outputs are done with multipurpose cards in the PLC rack. To control these cards there is some overhead required to set voltage ranges, scales, values, etc. We do this by putting values in the PLCs integer memory, and then the contents are moved to the analog I/O card where values are read or set.

To write voltages to the PLC we set up a block of memory, the function shows this starting at N9:0, and it is 13 words long. The contents are described in the analog card manual. The block transfer function also needs a control block of memory, this is BT10:1

To read voltages we use a similar method. In the example below the input value will be read when the analog input is on. When done the result will be stored in N7:10+4 = N7:14. The value will range from -4095 for -10V to 4095 for 10V.

Equipment:

PLC-5 processors with analog input/output cards

Computers with RS-Logix programming software

Voltmeters

Power Supplies

Procedure:

0. Note: Some of the Analog IO cards are current, not voltage based. If you have one of these cards ask the instructor for additional directions.

1. Test the simple programs to input and output voltages from the PLC. (Note: The block transfer devices should be closest to the CPU AND use the PLC is single slot addressing mode.)

2. Implement prelab step #2 and test with a multimeter and voltage supply. Use a number of values to confirm.

Marking:

40% prelab

60% working programs in the lab

15.1.7 Lab 6b: PID Control

Objective:

To explore PID control.

Pre-Lab: (due at the start of lab period)

1. Write simple programs to read and output analog voltages from the PLC and perform PID control of a motor speed.

Process Description:

The basic equation for a PID controller is shown below. This function will try to compensate for error in a controlled system (the difference between desired and actual output values).

The figure below shows a basic PID controller in block diagram form.

The PID calculation is effectively a calculation in the PLC. One basic method of PID control is i) read voltage, ii) do PID calculation, iii) set output voltage. (Note: it is also common to get a self contained PID card for the PLC that deals with all inputs and outputs). The ladder logic below shows a PID control function.

Equipment:

PLC-5 processors with analog input/output cards

Computers with RS-Logix programming software

Voltmeters

Power Supplies

Motors and drives

Procedure:

1. Connect the PLC to a motor driver (Ultra 100, Ultra 5000 or series 160 VFD).

2. Test the PID control program. Note: there is a bug in the Allen Bradley software that prevents you from using the setup screen to set parameters: you may change the values directly in memory.

Marking:

40% prelab

60% working programs in the lab

15.1.8 Lab 7: Communications

Objective:

To explore the connection of a PLC to other PLCs using the data highway network, and to communicate with computers using RS-232 serial communications.

Pre-Lab: (due at the start of lab period)

1. Write two programs to run on separate PLCs. When a button is pushed on one PLC (node #1), it should send data to another PLC to turn on an output. The message should be passed using the DH+ network. Write a second program that uses DH+ to run on a PLC so that when a button is pushed it requests data to set an output.

2. Write a program to send a message out the RS-232 port on the PLC (to a connected PC running a terminal program) when an input is active.

Process Description:

As with the previous use of analog input and output cards, we need to set up blocks of memory that contain communication information. These blocks indicate what is to be sent and where.

The Data Highway Plus, DH+, network uses a single path to connect numerous devices. To use this the block of memory below must be used to set up the information to be sent or received.

When PLCs communicate, one PLC must write contents of its memory to a second, or one PLC must request contents of memory from a second. The program below shows the basic steps involved in communication.

 

Serial communications can be done using an RS-232 interface. This is the most common interface available (most personal computers have 2). On the PLC-5 CPU there is one RS-232 interface that we have been using for programming, we can also use this for normal communication. (Note: it is very common to purchase a separate card that provides a serial port. This keeps the port on the CPU available for programming.)

Equipment:

PLC-5s

RS-232 Communication cables

Data Highway cables

Screw drivers

2 Computers

Procedure:

1. Join your team with another team to test the DH+ program. Wire the PLC DH+ on each CPU together. Pick one as node 1 and the other as node 2 and set the switches on the back of the CPU cards. Test the prelab programs.

2. (single teams) Have two computers available. One will be used for programming the PLC, and the other will be used as an ASCII terminal. Enter and download the program to the PLC as normal. Disconnect the serial cable, and connect it to the other PC. Run ‘hyperterm’ and test the program.

Marking:

50% prelab (individual)

50% working programs (group)

15.1.9 Lab 8: Pneumatics

Objective: To implement a system using pneumatics

Pre-Lab:

1. Develop ladder logic to implement the process. (Hint: Use a state diagram for each cylinder.)

2. Develop all wiring and pneumatic diagrams.

Process Description:

Write a ladder logic program that has the following capabilities.

1. The unit will control a pneumatic system with two valves. One valve will control a spring loaded cylinder while the other will control a two way valve.

2. The system will have sensors on the cylinders to detect the ends of travel. Ladder logic will detect jam conditions when a cylinder should advance/retract but does not do so within 2 seconds.

3. A user can enter commands and get status reports using hyperterm over the serial port. The commands will be as listed below,

A: advance the spring loaded cylinder

B: retract the spring loaded cylinder

C: report the position of the spring loaded cylinder (F=forward, R=retracted, M=moving, J=jammed)

D: advance the two way cylinder

E: retract the two way cylinder

F: report the position of the two way cylinder (F=forward, R=retracted, M=moving, J=jammed)

Procedure:

1. Build and test the control system.

15.1.10 Lab 9: DVT Vision Systems

Objective: To use a vision system as a PLC sensor

Pre-Lab:

1. Examine the DVT training CD. In particular review ......

2. Follow the DVT tutorial that follows with the CD to prepare yourself to use the units in the lab.

3. Develop a ladder logic program using an SFC to perform the task described below.

4. Develop a wiring diagram (as in lab 5) for the system. This should be done on a computer.

Process Description:

A process will be designed to.....

Procedure:

1. Set up the DVT camera using the DVT software to perform the required inspection.

2. Connect the camera to the PLC so that it may detect pass and fail conditions.

3. Enter and test the ladder logic in the PLC.

15.2 Advanced PLC Laboratories

• Labs 10a, 10b, 11a, 11b: These four labs are complimentary, and each week there will be four groups that will rotate through all four labs.

• Group Size: 3 students, 4 rotating stations

• These laboratories will be used to pull together 4 individual control systems into a complete manufacturing control system. Although each group will solve a different control problem, each laboratory will end with all stations in a fully functioning control system.

• These four labs will all use an Allen-Bradley PLC-5 to control the stations.

• The descriptions below will be used to develop a design and ladder logic before arriving at the laboratory. All laboratories are to be done on design sheets like those found in the course notes, or equivalent.

• The basic schedule for the first lab is shown below for the first and second weeks.

 

 

• NOTE: In this lab three of the stations use the hole detect to start an operation. Even when the operation is done the hole in the keytag will remain. You must write your program so that after the press has retracted the process will not start immediately. Only after the hole is gone will the program start looking for a new hole. You might want to add another state that waits until the hole is gone.

15.2.1 Lab 10a: Shear Press

Objective:

A PLC will be used for control of a hydraulic cylinder that will shear off keytags.

Pre-Lab:

1. Examine the other components in the lab and determine what is required for proper operation of the shear.

2. Design the controls for the press.

3. Develop the ladder logic required for operation

Process Description:

The shear press will detect when the material is in place for shearing when a hole is detected by an optical sensor mounted. When sensed it will set a bit true in memory (B3:0/0) that will cause the material feeder to stop. A pneumatic cylinder will be actuated to clamp the strip. At this point shearing will begin by advancing the hydraulic cylinder until a hydraulic cylinder advanced limit switch is actuated. At this point the advance solenoid will be turned off, and the return cylinder solenoid will be actuated. This will continue until the retracted limit switch is actuated. At this point both the hydraulic solenoids are turned off. Finally the pneumatic solenoid is released, and the material feeder is allowed to continue.

PLC Outputs:

An AC Output card to output 120Vac.

shear retract solenoid
shear advance solenoid
pneumatic solenoid to clamp material

PLC Inputs:

An AC Input card to accept 120Vac.

hydraulic cylinder retracted limit switch
hydraulic cylinder advanced limit switch
control power on
auto mode selected
hydraulic power on

Procedure:

1. Make the electrical connections between the PLC and the shear station.

2. Enter the Ladder logic, and test the module by itself.

3. Integrate the components with the other parts of the system and produce parts.

15.2.2 Lab 10b: Feeder Positioning

Objective: a PLC will be used to position a material transport system driven by a stepper motor.

Pre-Lab:

1. Examine the other components in the labs and determine what is required for proper operation of the feeder.

2. Design the controls for the material feeder.

3. Develop the ladder logic required for operation

Process Description:

The feeder uses a stepper motor to advance the material strip. The feeder will continue to advance the material until one of the other machines orders the feeding to stop by setting flags true in memory locations (B3:0/00, B3:0/01, B3:0/02). The stepper motor is driven by specifying direction (we will always go forwards), and each time an output is pulsed it will step forward one pulse. It will take a large number of pulses to move the material one inch. Immediate outputs may make it possible to generate pulses faster that the ladder logic scan rate.

PLC Outputs:

A TTL (transistor) Output card to output 5Vdc.

each pulse moves the stepper motor one step
forward/reverse direction selector

PLC Inputs:

An AC Input card to accept 120Vac.

control power on (master power for the station)
automatic mode on (must be on for PLC control)

Procedure:

1. Make the electrical connections between the PLC and the feeder station.

2. Enter the Ladder logic, and test the module by itself.

3. Integrate the components with the other parts of the system and produce parts.

15.2.3 Lab 11a: Stamping Press Control

Objective: a PLC will be used to control an stamping press.

Pre-Lab:

1. Examine the other components in the lab and determine what is required for proper operation of the press.

2. Design the controls for the press.

2. Develop the ladder logic required for operation

Process Description:

The stamping press will detect when the material is in place for stamping (embossing) when a hole is detected by an optical sensor mounted. When sensed it will set a bit true in memory (B3:0/01) that will cause the material feeder to stop. A pneumatic cylinder will be actuated to clamp the strip. At this point stamping will begin by advancing the hydraulic cylinder until a hydraulic cylinder advanced limit switch is actuated. At this point the advance solenoid will be turned off, a two (or more) delay (0.5s) is required to allow the embossing to occur. After this the return cylinder solenoid will be actuated. This will continue until the retracted limit switch is actuated. At this point both the hydraulic solenoids are turned off. The pneumatic solenoid is released, and the material feeder is allowed to continue.

PLC Inputs:

An AC Input card to accept 120Vac.

hydraulic cylinder retracted limit switch
hydraulic cylinder advanced limit switch
control power on (master power for the station)
auto mode selected (must be on for plc operation)
hydraulic power on

PLC Outputs:

An AC Output card to output 120Vac.

press retract solenoid
press advance solenoid
pneumatic solenoid to clamp material

Procedure:

1. Make the electrical connections between the PLC and the press station.

2. Enter the Ladder logic, and test the module by itself.

3. Integrate the components with the other parts of the system and produce parts.

15.2.4 Lab 11b: Variable Feed Drill

Objective: a PLC will be used to control a variable feed drill

Pre-Lab:

1. Examine the other components in the lab and determine what is required for proper operation of the drill.

2. Design the controls for the drill.

3. Develop the ladder logic required for operation

Process Description:

The drill press will detect when the material is in place for drilling when a hole is detected by an optical sensor mounted. When sensed it will set a bit true in memory (B3:0/02) that will cause the material feeder to stop. A pneumatic cylinder will be actuated to clamp the strip. At this point drilling will begin. There are three modes for controlling the drill described below (We will use mode ii). When the drill is done the pneumatic solenoid is released and the material feeder allowed to continue.

i) Velocity Control: the drill may also be controlled using analog output card for feed velocity, and using digital inputs to measure position. The limit switches are used as in mode i). For drilling the analog output card should produce a voltage about +2V, -10V is used for retracting, and 0V for no motion. The ladder logic below will make the analog output card drive the drill to advance when a bit is set, and retract when a second bit is set, otherwise the drill will be idle.

ii) Position Control: the drill may also be controlled by specifying a target position. The limit switches used in i) should be used to check for errors.

PLC Inputs:

A DC Input card to accept 12Vdc.

hole detected sensor

An AC Input card to accept 120Vac.

drill retracted limit switch
drill advanced limit switch
control power on (master power for the station)
auto mode selected (must be on for plc operation)

PLC Outputs:

An AC Output card to output 12Vdc.

pneumatic solenoid to clamp material
drill motor start relay

An Analog Output card will be placed in slot 3 to output -10 to +10Vdc and control drill velocity.

drill velocity voltage

Procedure:

1. Make the electrical connections between the PLC and the drill station.

2. Set up the I/O modules. You will need to make sure the analog output card is also set up. When setting it up use the ‘autoset’ values option. This will pick memory locations for the card to use: take note of these. (You will need to do this again when all of the programs are combined.) The use the ‘insert ladder rungs’ program to put the functions you need in the ladder diagram.

3. Enter the rest of the ladder logic, and test the module by itself.

4. Integrate the components with the other parts of the system and produce parts.