How to Measure Motor Speed Using a High Speed Counter with a Quadrature Encoder
This tutorial will cover the configurations using the built-in High Speed Counter for the Maple PLC’s and determining motor speed using a Quadrature Encoder in the control software (MapleLogic).
Software Required
Hardware Required
- Maple Modular PLC’S – Any Maple Modular PLC can be used.
- Maple Micro PLC’S – Any Maple Micro PLC can be used.
- Two-Phase Quadrature Encoder
- 12-24 VDC Motor
- PWM Brush Motor Speed Controller
- 24 VDC Power Supply (4010-0011)
Wiring and Circuit Design
High Speed Counter Configuration
- In this sample, select a Linear Counter to count in one direction.
- We are using a 2 Phase Quadrature Encoder, so select “2 Phase, 4 Multiplication” as the Input Pulse Type.
- Unit Time is the amount of pulses the encoder will output in one revolution so type “1000”
- Pulse per 1 Cycle will be pulses per one rotation which will be “1000” in this case.
- Set the RPM to “1”. If you are trying to read pulses per second, type “0” for PPS.
Ladder Diagram
- The first rung in your ladder diagram will have an “ALWAYS_ON” bit to turn ON the RPM Flag. This MUST be turned ON to use RPM in your HSC configuration. The instruction is [SET D116.5] because we are starting at D100 in the HSC Configuration window.
See the help file screenshot below. - In the Help File in MapleLogic navigate to the Built In High Speed Counter section.
- Under “Parameters”, scroll down to the control bits.
- Scroll to “16”, then “Bit 5” for the RPM Status Flag.
- The application instruction for your ladder logic will be [SET D116.5] because the starting address is D100. Add 16 to equal 116. And Bit 5 makes it D116.5
- On the 2nd rung, we’re using a compare instruction to turn ON an alarm, if the speed of the motor is greater than or equal to a certain amount, Y10 (Alarm) will turn ON. In this case is 1800 RPM.
High Speed Counter Online
Go Online and Download to the PLC.
- Check off “Enable Count” to initiate the High Speed Counter. This MUST be checked.
- “F10” is ON and turns ON [SET D116.5] to enable the “ON : RPM” bit.
- To Monitor the High Speed Counter while Online, click “Monitor”.
- The “Enable Count” Flag and “ON : RPM” Flag will turn ON after pressing “Monitor”.
Live Simulation of High Speed Counter and Motor
- In the live camera view above, you can see that X00 and X01 are ON for Phase A and B wires on the encoder.
- The speed of the motor is below 1800 RPM, so the alarm (Y10) is OFF.
- In the image above, the speed of the motor exceeded 1800 RPM, therefore the alarm (Y10) is ON.
- In the live camera feed, Y10 is ON (red LED light).
- In the image above, the speed of the motor is back below 1800 RPM, therefore the alarm (Y10) is OFF again.
- In the above image, the 2 Phase Quadrature encoder has the ability to count in two directions, forward or reverse.
- When the motor is in reverse, a negative number is represented in the RPM value and in the ladder diagram logic.
- The “Down Count” status flag also turns ON.
High Speed Counter I/O Module
IO-SHSC02 High Speed Counter Module
- If you need to add more than 2 High Speed Counter Channels, you can connect the IO-SHSC02 as an expansion module.
- This can ONLY be used to connect to the Maple Modular PLC’s.
- Each HSC Module has 2 Channels, just like the built-in HSC for the Maple Modular and Micro PLC’s. It also has all the same features as the built-in HSC.
- You WILL need to use a Terminal Block to connect the IO-SHSC02. There are connection and wiring examples in the High Speed Counter Module User Manual below.
Sample Project
The project shown above was designed for the specific hardware mentioned at the beginning of the tutorial and is intended to provide you guidance when programming your unit. If you are using models other than the ones specified in this sample project, similar steps can be duplicated within your own project.
Download MapleLogic Sample Project
Resources & Documentation
Maple PLC/MapleLogic Resources
- MapleLogic User Manual
- Maple Modular User Manual
- Maple Micro User Manual
- High Speed Counter Module User Manual
More
Tutorials
Sample Projects
See our Support Center for a complete list of Quick Start and Installation Guides