⚙️

Siemens S7-1200 PLC and Encoders Overview

Apr 7, 2025

Using Siemens S7-1200 PLC with Incremental Encoders

Overview

  • Discussed how to use Siemens S7-1200 PLC to read sensors and incremental encoders.
  • Application contexts include packaging machines, conveyors, speed measurement, and distance measurement.

Types of Sensors

  • Regular Sensors: Detect physical parameters like position or speed. Example: a roller with 100 pulses per revolution.
  • Incremental Encoders: Provide higher resolution; e.g., 1,000 lines represent one revolution, yielding 1,000 counts per revolution.

Key Concepts

  • Count and Speed Measurement:
    • Use high-speed counters to read counts from channels (e.g., ID 1000).
    • Counts can be translated to Revolutions Per Second (RPS) or Revolutions Per Minute (RPM).
  • Incremental Encoder Basics:
    • Typically outputs two channels (A and B).
    • Direction of rotation can be determined by comparing A and B signals.
    • Can be set up for quadrature output, counting four times per pulse for increased resolution.

Configuration Steps in TIA Portal

  1. Controller Setup:

    • Using S7-1200, e.g., CPU 1211 with high-speed counter resources.
    • Up to 6 high-speed counters available, capable of handling up to 100 kHz.
  2. High-Speed Counter (HSC) Configuration:

    • Select the counter mode (e.g., counting mode).
    • Use A-B counting for directional sensing.
    • Set initial counter values and limit values.
  3. Event Configuration:

    • Reference value setting allows outputs to trigger based on counters reaching defined thresholds.
    • Hardware interrupts can be set to execute upon reaching certain counter values.
  4. Input Filtering:

    • Set the input filter time according to the encoder’s frequency capabilities.
    • Recommended to set below 0.8 microseconds for 100 kHz.

Programming Logic

  • Counter Reading:
    • Use program blocks to read and assign counter values to internal variables.
    • Example: Move count from channel ID 1000 to an internal memory variable.
  • Direction Control:
    • Use count up/down configurations through CPU properties, not through the program.
  • Count Initialization:
    • Use function blocks to set preset values for the counter, useful for retaining values across reboots.

Practical Application

  • Demonstrated setting up a basic system where:
    • An incremental encoder mounted on a motor shaft is read by the PLC.
    • The motor is run at known speeds to verify counter readings.

Conclusion

  • This application showcases the fundamental principles of using a Siemens S7-1200 PLC with incremental encoders.
  • Next video will cover translating counter readings to speed calculations for practical applications.