Search on WeChat
Technical Training1. Connection of Siemens S7-1200 with Incremental Encoders
The digital input switch points of Siemens S7-1200 provide a fast counter function for the pulse signals of incremental encoders, with a single-phase signal reaching 200KHz, and a dual-phase signal (which can quadruple frequency and determine direction) reaching 80KHz. For the commonly used 2500PPR (pulses per revolution), the maximum speed can reach 1920RPM (revolutions per minute).
The signal from the incremental encoder is a PNP unidirectional open collector signal. It is recommended to choose an incremental encoder with a push-pull output type in the 10-30V range, such as the GI58N incremental encoder.
2. Connection of S7-1200 with Absolute Encoders
Absolute encoder signals are resistant to interference, and data will not be lost during power outages. PLCs do not need to constantly count for absolute encoders, saving CPU resources as there is no need to calculate interrupt times during CPU scanning. Especially now, as the market price of absolute encoders has significantly decreased, and due to increased data reliability, using absolute encoders can save debugging time and reduce after-sales service costs. The actual usage effect and cost performance are far superior to using incremental encoders. More and more users are inclined to use absolute encoders for PLC position positioning.
Due to the cost-effectiveness of the S7-1200, the preferred connection to absolute encoders is through a 4-20mA signal interface. The Siemens S7-1200 with SM1231 analog module can directly connect to 2 absolute encoders with 4-20mA output interfaces.
Absolute encoders can be classified into single-turn absolute and multi-turn absolute. A single-turn absolute encoder operates within 360 degrees or 0-180 degrees. For such encoders, 4mA corresponds to 0 degrees, and 360 degrees (or 180 degrees) corresponds to 20mA. The data in the PLC linearly corresponds to angle values, with each value corresponding to a unique angle value. This data does not rely on counting, is resistant to interference and power outages, and can be programmed directly. The recommended single-turn absolute encoder is the GMS412.LB (code 9400S), which allows setting the angle value and rotation direction corresponding to 20mA, for example, setting 20mA to correspond to 180 degrees, with the encoder operating within 0-180 degrees.
In PLC positioning control for length or height, it is often necessary for the encoder to rotate beyond 360 degrees, which requires selecting a multi-turn absolute encoder. The 4-20mA output of multi-turn absolute encoders has two types: one is a fixed range multi-turn absolute encoder, such as 16 turns, 64 turns, or 256 turns, where 20mA corresponds to the endpoint of 16 turns, 64 turns, or 256 turns. This type of encoder is relatively economical, and the recommended model is GEX60.LB;
The other type is an intelligent multi-turn absolute encoder, where 20mA can be set to any position between 1-4096 turns and can also set the zero point offset. The recommended model is GAX60.LB (code 9600). This encoder is widely used and has many successful applications in various fields such as lifting, water conservancy, military industry, petroleum, chemical, and various industrial machinery.
3. Connection of S7-1200 with Modbus RTU Signals
The Siemens S7-1200 can be configured with an RS485 communication interface, which can connect to the RS485 signals of absolute encoders, including single-turn and multi-turn. The RS485 signals of absolute encoders come in various forms, with the commonly used ones being simple RS485 broadcast mode (master mode actively broadcasts), free protocol with addresses sent by commands (slave passive mode), and Modbus RTU mode, etc. If only one absolute encoder is connected, it can use the encoder active mode, which has a simple protocol and reliable signals. However, if multiple encoders are to be connected(bus mode), Modbus RTU mode can be selected. However, this mode is not suitable for fast-moving control due to the polling nature, which results in slower data refresh from each encoder.
The recommended active mode RS485 encoders for single-turn absolute are models GES38.RDB, GES60.RDB, or GMS412.LB (code 9400S); for multi-turn absolute, the models are GEX60.LB (64 turns) or GAX60.LB (code 9600) (4096 turns).
The recommended passive command mode RS485 encoders (can connect 1-9 encoders with addresses) for single-turn absolute are models GMS412.LB (code 9400S); for multi-turn absolute, the models are GEX60.LB (64 turns) or GAX60.LB (code 9600) (4096 turns).
The recommended Modbus RTU mode encoders for single-turn absolute are models GMS412.RMB; for multi-turn absolute, the models are GAX60.RMB (4096 turns).
4. Connection of S7-1200 with Profibus-DP Signals
The Siemens S7-1200 can be configured with a Profibus-DP bus communication interface, which is the most commonly used output mode for European absolute encoders. Various European import brand encoders can be selected, including domestic brand absolute encoders. This interface is commonly used by Siemens, but the cost of such encoders is high, including the cost of configuring cable wiring, which is not suitable for the cost-effectiveness of the 1200, and will not be recommended here.
5. Practical Case Studies
Connecting Siemens S7-1200 with absolute encoder 4-20mA signal for simple positioning control;
Practical Application Introduction 1:
Height control of water conservancy gates for single and multiple machines. The lifting height of flood control, storage, water supply, and drainage gates across the country is achieved by winches (hoists) lifting and closing. Each gate station has 1-6 gate hoists, and the Siemens S7-1200 PLC connects to the 4-20mA interface of multi-turn absolute encoders, configured with HMI, which can effectively complete such simple positioning control.

The encoder can be installed on the winch drum shaft or the gearbox shaft. Pre-calculate the number of rotations required for the encoder and set the encoder output of 20mA to be greater than that number, for example, 16 turns. This way, every change of 1mA in the encoder output linearly corresponds to one rotation of the drum, allowing for the calculation of height changes of the gate to control the opening and closing height of the water gate. The encoder model used is the aforementioned recommended GAX60.LB (code 9600), with project application locations in various water gates in Northeast Harbin, Jiangsu Changzhou, and other areas.
Practical Application Introduction 2:
Hydraulic dual-cylinder synchronous control. Larger water gate doors require two hydraulic cylinders on the left and right for power lifting, maintaining synchronous positions to ensure smooth lifting and lowering of the gate. A certain water gate in Guangdong originally used a gate opening gauge only for display, but due to the low reliability of the original display instrument, it could not complete the synchronous correction and lifting control of the hydraulic cylinders. The user hoped to use a small economical PLC with HMI to replace the original display-only instrument to improve control reliability and programmability. The PLC selected was Siemens S7-1200, and the encoder selected was the absolute multi-turn encoder with a 4-20mA signal interface, GAX60.LB (code 9600) with 2 units, installed with mechanical devices corresponding to the heights of the left and right hydraulic cylinders. The corresponding setting for the hydraulic cylinder height of 6 meters corresponds to 20mA, and the two 4-20mA signals connect to the analog interface of S7-1200. The PLC compares the two sets of data and controls the electromagnetic valves of the hydraulic system of the left and right cylinders based on the height difference, adjusting the flow rate of the hydraulic oil to control the lifting or lowering speed and position difference of the cylinders, maintaining synchronous correction of the lifting control. The Siemens S7-1200 paired with two absolute encoders with 4-20mA interfaces effectively completed such synchronous correction and lifting control.
6. How to Connect Encoders to PLC and Program
Required Hardware:
1. PLC: Siemens S7-1200-CPU1214C/DC/DC/DC, V4.1.
2. Encoder: E6B2-CWZ5B, PNP, incremental type, 1000P/R, as shown below:

3. Wiring between Encoder and PLC; as shown below:

Brown: DC24V+
Blue: COM
Black: A, connect to I0.0
White: B, connect to I0.1
Orange: Z, connect to I0.3
Among them, the connection points A and B can be defined by oneself, not necessarily I0.0 and I0.1, while Z cannot be changed.
4. Configure High-Speed Counter; as shown below:



Here, select HSC1, enable high-speed counter, counting, A/B counting, increment counting. Use the default address ID1000 as the counter address, but other addresses can also be chosen, occupying four bytes.
5. Pay Attention to the Filter Issue of the IO Channels Used; as shown below:

Older version CPUs do not require consideration for filtering when using high-speed counters, but the V4.1 version CPU does not have filtering, so attention must be paid to the filtering and pulse frequency of the encoder. If not suitable, it will be filtered out.
6. Monitor Test Results; as shown below:

No programming is required to read it. Only when some special functions are needed is programming necessary, which will not be introduced here.
7. Filtering Time and Maximum Detectable Frequency; as shown below:

Disclaimer:This article is reproduced from the internet, and the copyright belongs to the original author. If there are any copyright issues, please contact us in time for deletion. Thank you!HISTORY/Previous Recommendations
Complete question bank for the 2022 Electrician Junior Exam (including answers)
Three essential tools for electrical workers, easily opened with WeChat!
【Collection】 The “Path” of a ten-year veteran electrician, the secret to earning over ten thousand a month!
Five major electrical drawing software (CAD, Eplan, CADe_simu…), which one do you pick?
Latest electrical CAD drawing software, with a super detailed installation tutorial!
Latest electrical drawing software EPLAN, with a super detailed installation tutorial!
Common problems for beginners using S7-200 SMART programming software (with download link)
Super comprehensive electrical calculation EXCEL spreadsheet, automatically generated! No need to ask for electrical calculations!
Bluetooth headsets, introductory books for electricians/PLC freely given away? Come and claim your electrical gifts!
Basic skills of PLC programming: Ladder diagrams and control circuits (with 1164 practical cases of Mitsubishi PLC)
If you still can’t understand electrical diagrams? Basics of electrical diagram reading, simulation software available, quickly get started with theory and practice!
12 free electrician video courses, 10GB software/e-book materials, and 30 days of free live electrician courses are being given away!
Don’t forget to like + view!
Click “Read the Original” to learn PLC/electrician courses for free.