The Rotary Encoder
Total Page:16
File Type:pdf, Size:1020Kb
The rotary encoder Rotation of the rotary encoder may be counted by the positive rotation direction and a reverse direction pulse frequency output during rotation potentiometer not count this rotation count is not limited. With buttons on the rotary encoder can be reset to the initial state, that starts counting from 0 .
How it works: incremental encoder is a rotary displacement signal is converted to a series of digital pulses rotary sensor. These pulses are used to control the angular displacement . In Eltra angular displacement encoder conversion using a photoelectric scanning principle . Reading system to rotate the radial indexing plate ( disc) by alternating transparent and opaque windows windows constitute the basis, while the vertical irradiation by an infrared light source , the light of the projected image encoder to a receiver surface . The receiver is covered with a diffraction grating , which has the same code disk window width . The receiver 's job is to feel the change produced by the optical disk is rotated , and then converts the light into a corresponding change in electrical changes . So that a low level signal again rises to a higher level , and generates no interference of square pulses , which must be processed by electronic circuits . Reading systems typically employ differential mode, but as soon the two waveforms for different signal phase by 180 ° compared in order to improve the quality and stability of the output signal. The difference between the two readings are then formed on the basis of the signal , thereby eliminating the interference.
Incremental encoder
Clockwise Counterclockwis movement e movement A B A B 1 1 1 1 0 1 1 0 0 0 0 0 1 0 0 1 Incremental encoders give two-phase square wave, the phase difference are 90 °, usually called the A and B channels. Wherein the rotational speed of a channel-related information is given, while the two-channel signal by comparing sequence information obtained in the rotation direction. There is a special signal called the Z or zero channel, which gives the absolute encoder zero, this signal is a square wave coincide with the center line of the channel A square wave.
Incremental encoder accuracy depends on the mechanical and electrical two factors, these factors are: the grating indexing errors, disc eccentricity, bearing eccentric, electronic reading device errors and inaccuracies introduced by the optical parts. The encoder determines the degree of accuracy of the measurement unit, the encoder determines the accuracy of electrical pulses generated by the encoder of the stars. The following electrical degrees with a 360 ° rotation of the mechanical axis to represent, and the axis of rotation must be a complete cycle. To know how much the mechanical equivalent of a 360-degree electrical angle, you can use the following formula: Electrical machinery 360 = 360 ° / n ° pulses / revolution
Figure : A, B commutation signals The encoder indexing error is the maximum deviation angle of two units of electrical pulse to said continuous . Error exists in any encoder, which is caused by the aforementioned factors . The maximum error Eltra encoder is ± 25 electrical degrees ( under any conditions have been declared ) , the equivalent rating offset ± 7%, as for the maximum deviation of the phase difference 90 ° ( electrical ) of the two channels is ± 35 electrical ratings equivalent degree offset ± 10%. UVW incremental encoder signals In addition to the conventional encoder , there are some integration with other electrical output signal together with incremental encoder . Integrated with UVW incremental encoder signals that instance , it is usually applied to the AC servo motor feedback . These signals usually appear in pole AC servo motors , UVW by simulating the magnetic signal is generally a function of the original design. In the encoder Eltra these signals UVW generated using an optical method , and in the form of three square wave offset each other 120 °. In order to facilitate the motor starts , the starter motor is controlled by the right signal needs. The UVW poles can be repeated many times in the pulse mechanical axis of rotation , since they are directly dependent on the number of magnetic poles is connected to the motor , and for 6 or more signals UVW pole motor. ******************************************************************************************* ARDUINO Test code: const int interruptA = 0; const int interruptB = 1; int CLK = 2; // PIN2 int DAT = 3; // PIN3 int BUTTON = 4; // PIN4 int LED1 = 5; // PIN5 int LED2 = 6; // PIN6 int COUNT = 0; void setup() { attachInterrupt(interruptA, RoteStateChanged, FALLING); // attachInterrupt(interruptB, buttonState, FALLING); pinMode(CLK, INPUT); digitalWrite(2, HIGH); // Pull High Restance pinMode(DAT, INPUT); digitalWrite(3, HIGH); // Pull High Restance pinMode(BUTTON, INPUT); digitalWrite(4, HIGH); // Pull High Restance pinMode(LED1, OUTPUT); pinMode(LED2, OUTPUT); Serial.begin(9600); } void loop() { if (!(digitalRead(BUTTON))) { COUNT = 0; Serial.println("STOP COUNT = 0"); digitalWrite(LED1, LOW); digitalWrite(LED2, LOW); delay (2000); } Serial.println(COUNT); }
//------void RoteStateChanged() //When CLK FALLING READ DAT { if (digitalRead(DAT)) // When DAT = HIGH IS FORWARD { COUNT++; digitalWrite(LED1, HIGH); digitalWrite(LED2, LOW); delay(20); } else // When DAT = LOW IS BackRote { COUNT--; digitalWrite(LED2, HIGH); digitalWrite(LED1, LOW); delay(20); } }