Design of magnetic encoder signal subdivision system based on single chip microcomputer

Publisher:幸福满溢Latest update time:2012-02-10 Source: 电子质量 Keywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Current status and significance of research on electronic subdivision of magnetic encoder output signals

Among digital sensors, magnetic encoders are a new type of electromagnetic sensitive element developed in recent years. Magnetic encoders have the advantages of being not easily affected by dust and condensation, simple and compact structure, fast response speed (up to 500~700kHz), and small size. At the same time, magnetic encoders can accurately arrange and combine multiple components to form new functional devices and multifunctional devices. Due to the above advantages of magnetic encoders, their application in the field of high-precision measurement and control has been increasing in recent years. As an important tool, magnetic encoders have become an indispensable component, and their market demand has increased at a rate of 20% to 30% per year. Under the requirements of high speed, high precision, miniaturization, and long life, in the fierce market competition, magnetic encoders have unique advantages with their outstanding characteristics and have become one of the keys to the development of high-tech products. In the research and production of magnetic encoders, improving the resolution and miniaturization of magnetic encoders has become the focus of research and development in various countries.

To improve the resolution of the encoder, the number of magnetic poles must be increased, which will increase the cost of the sensor and affect its application due to the increase in the size of the encoder. Therefore, it is necessary to perform secondary subdivision on the output signal of the magnetic encoder.

The solutions for encoder signal segmentation are mainly divided into two categories: hardware segmentation and software segmentation. Although hardware segmentation can obtain faster response speed and real-time output segmentation signal, it requires higher cost to achieve higher resolution. Although software segmentation has certain defects in real-time performance, it can obtain higher resolution at a lower cost and can flexibly set the resolution as needed.

This article will explore the algorithm for realizing magnetic encoder signal subdivision and the scheme for realizing real-time signal output using a low-cost single-chip microcomputer system. The design idea of ​​this system is to calculate the number of pulses to be output between two sampling points according to the mechanical angle between the two sampling points and the subdivision accuracy, and output them under the control of the system, so as to achieve the purpose of signal subdivision. Therefore, the signal subdivision scheme is actually composed of two parts: the calculation of the rotating mechanical angle and the output control of the subdivided pulses.

Rotation angle measurement scheme and hardware circuit implementation

The magnetic encoder disk used in the system can output two orthogonal sinusoidal signals. The encoder can output 8 continuous sine waves for each rotation. Since each rotation of the motor corresponds to a mechanical angle of 360 degrees, each sine wave corresponds to a mechanical angle of 45 degrees, and each sine wave corresponds to an electrical angle of 360 degrees. Therefore, a change of 90 degrees in the electrical angle of the sine wave corresponds to a change of 11.25 degrees in the mechanical angle of the magnetic encoder.

The encoder disk outputs two orthogonal sinusoidal signals. In a monotonic interval of the sinusoidal signal, the signal amplitude and the mechanical position of the encoder are one-to-one corresponding. Therefore, the amplitude of the measured signal can be converted into a corresponding angle signal, thereby realizing the subdivision of the magnetic encoding signal.

Construct an approximate trigonometric function. The waveform of the constructor is shown in Figure 1.


Figure 1 Constructor waveform

As can be seen from the waveform, the newly constructed function has an electrical angle of 90 degrees as a period (corresponding to a mechanical angle of 11.25 degrees). If two adjacent sampling points are within one period, the mechanical position of the encoder can be calculated according to the formula; if two adjacent sampling points are not within one period, just add N×11.25 to the calculation result of formula 1 (N is the number of periods between two sampling points). Using such a constructor can greatly simplify program design, thereby improving the real-time performance of the system.

Circuit diagram

The system circuit structure block diagram is shown in Figure 2. The two sinusoidal signals are encoded by the encoding circuit to generate a coded signal corresponding to the sine wave, and the CPU can count the integer cycles of the signal according to the coded signal.

The coded signal generated by the encoder controls the multiplexer to switch between the two input signals, so as to realize the function of exchanging the two input signals when = N × 90o (N = 1, 3, 5, ...). Under the control of the CPU, the sample-and-hold and A/D converter simultaneously sample the two sinusoidal signals at the same time, and perform A/D conversion on the signal held by the sample-and-hold. The converted data is transmitted to the CPU via 8255.


Figure 3 Signal subdivision hardware circuit diagram

Design of software part of segmentation scheme

The software flow chart of the electronic segmentation solution is shown in Figure 2.

The following two problems need to be solved in the output control of pulses: how to output subdivided pulses and how to control the output rate of subdivided pulses.
The speed change of the encoder disk is continuous and will not occur suddenly. Therefore, it can be approximately considered that the speed of the motor is constant in a very short period of time, and pulses can be output at equal time intervals during this period of time. Assuming that the speed response time of the motor is 100 milliseconds, it reaches a speed of 1000 rpm under constant acceleration, and the execution cycle of the program is 3000 microseconds. In one program cycle, the maximum angle error caused by uniform speed processing does not exceed 0.27 degrees, which will not cause erroneous output of pulses, and the accuracy requirements can be fully guaranteed. Outputting subdivided pulses at a constant rate in a very short time can greatly simplify program design and greatly improve the practical response performance of the system.

Since the number of subdivided pulses can only be determined after the next sampling is completed, the output of the pulse will inevitably lag behind one program cycle in time. If the program execution cycle is set to 3 milliseconds, and the encoder rotates 1000 times per minute and outputs 1000 subdivided pulses per rotation, the output signal will have a maximum lag of 50 pulses, which is equivalent to a mechanical angle error of 18 degrees. If the speed of the encoder increases, the error will become larger. At the same time, since the execution cycle of the program is not a fixed value, the signal lag generated by it will also be a variable value. If the pulse is output after the next sampling is completed, the subdivision error will be relatively large and cannot be controlled. Therefore, the subdivision pulse cannot be performed until the calculation of the number of pulses to be output is completed.

In order to solve the above two problems, the output of pulses can be controlled by timing interruption. First, the time interval of the output pulses is calculated according to the number of pulses to be output, and this time interval is used as the timing time constant to control the output of the subdivided pulses. In this way, on the one hand, the pulse output and the output pulse calculation can be synchronized; on the other hand, the pulse output rate can be controlled by the timer, so that the subdivided pulses can be output in real time to the greatest extent.

In order to further simplify the program design, the program execution cycle can be set to a fixed value, and the timing program can be used to monitor the execution of the program to ensure that the execution cycle of each program is the set value. In this way, a query table can be established to directly determine the corresponding timing time constant according to the number of subdivided pulses to be output. In this way, the complex floating-point operation program is simplified to a simple table lookup program, which shortens the program execution cycle and ensures the real-time performance of the subdivided pulse output.


Figure 3 Electronic subdivision software flow chart

in conclusion:

The above design ideas have been applied in the design of encoder signal subdivision system, and successfully achieved 1000 subdivisions of the encoder output sine wave signal. It has been proved in practice that a high resolution can be obtained based on a low-resolution encoder by using a low-cost single-chip microcomputer system.

References:
1. Gu Yunbiao et al. Research on position subdivision method to improve the resolution of photoelectric encoder.
2. Electromagnetic Components and Special Devices, Journal of Chinese Inertial Technology, Vol. 4, No. 2, 1996
3. Zheng Yuankai et al. High-resolution magnetic encoder. Sensor Technology, No. 5, 1996
4. Li Huaiqiong et al. A digital subdivision technology of moiré fringe implemented by software. Metrology Technology
5. Liu Wenwen. High-precision grating signal subdivision algorithm. Journal of Applied Sciences, Vol. 17, No. 1, 1999

Keywords:MCU Reference address:Design of magnetic encoder signal subdivision system based on single chip microcomputer

Previous article:Development of Single Chip Microcomputer Control System for Beverage Filling Machine
Next article:Single-chip microcomputer C8051F020 and its application in cabinet-type electric energy meter

Recommended ReadingLatest update time:2024-11-17 01:52

Design of Single Chip Microcomputer Development System Based on KEIL 51
1. Introduction In recent years, with the continuous upgrading of KEIL 51, the high-version KEIL 51 compiler, especially Keil μVision2 (C51 integrated compilation environment based on Windows), has been welcomed by many microcontroller enthusiasts for its superior performance and ease of use. KEIL 51 provides u
[Microcontroller]
Design of Single Chip Microcomputer Development System Based on KEIL 51
Simple digital filtering algorithm for single chip microcomputer
1) Limiting filter algorithm During this operation, two adjacent samples are subtracted to find their increment, and then the absolute value of the increment is compared with the maximum difference A allowed between the two samples. The size of A depends on the specific situation of the object being measured. If it is
[Microcontroller]
Different initialization between C8051F and 80C51 series microcontrollers
The C8051F series microcontroller is a high-speed microcontroller produced by Cygnal. It is compatible with the 80C51 series microcontroller instruction set, but has many more resources than the latter, which greatly facilitates the development of embedded systems. This article introduces the differences in structure b
[Microcontroller]
Different initialization between C8051F and 80C51 series microcontrollers
Design of automatic line patrol wheel robot control system based on 51 single chip microcomputer
Wheeled mobile robot is an important part of the robot research field. It integrates mechanics, electronics, detection technology and intelligent control. Among various mobile mechanisms, wheeled mobile mechanism is the most common. The reason why wheeled mobile mechanism is widely used is mainly because it is easy
[Microcontroller]
Design of automatic line patrol wheel robot control system based on 51 single chip microcomputer
GP2Y0E02B distance measurement module 89c52 microcontroller serial port program
iic interface, GPIO1 needs 3.3V to 5v module. The program has been debugged and can be used. The serial port outputs crystal 11.0592 and the baud rate is 9600. SCL=P0^6; iic interface needs 3.3V to 5v module SDA=P0^7; iic interface needs 3.3V to 5v module GPIO1=P0^5; //Module enable #include reg52.h #include intrins
[Microcontroller]
How to Design a Solar Cell Controller Using an AVR Microcontroller
With the deepening of energy crisis and environmental pollution, the research and utilization of solar energy has received widespread attention. Solar energy is an inexhaustible renewable energy source for human beings. It is also a clean energy source that does not produce any environmental pollution. In the effectiv
[Microcontroller]
How to Design a Solar Cell Controller Using an AVR Microcontroller
PIC microcontroller interrupt service routine
There is a special definition method for interrupt service routines: void interrupt ISR(void); the function name "ISR" can be changed to any legal combination of letters or numbers, but its input parameter and return parameter types must be "void", that is, there are no input parameters and return parameters, and ther
[Microcontroller]
An efficient and fast algorithm for calculating square roots using a single chip microcomputer
When we use 8-bit MCU programming and use the square root algorithm, if we call the built-in subroutine, the generated code is too much and the efficiency is low. Because the software's built-in algorithm uses floating-point type for calculation, in reality we often only need to return integer data. Using the followin
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号