Design of digital speed measurement system based on 51 single chip microcomputer

Publisher:达文西happyLatest update time:2014-02-28 Source: 21IC Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The pulse generator based on Hall element designed in this scheme requires low cost, simple structure and good performance. There is a relatively harsh electromagnetic environment in the electrical control system, so the product itself is required to have strong anti-interference ability. The system is mainly composed of AT89S52 single-chip processing system, motor, sensor detection unit, signal processing unit and display system.

1 Overall design

The measurement of rotation speed is actually the measurement of the frequency of the periodic pulse signal caused by the rotation of the rotor. The Hall element speed measurement method uses the Hall switch element to measure the rotation speed.

The Hall switch element contains a voltage regulator circuit, a Hall potential generator, an amplifier, a Schmitt trigger and an output circuit. The output level is compatible with the TTL level. A disk is installed on the motor shaft, and several pairs of small magnets are installed on the disk. The more small magnets, the higher the resolution. The Hall switch is fixed near the small magnets. When the motor rotates, every time a small magnet passes the Hall switch, the Hall switch outputs a pulse. The number of pulses per unit time can be calculated to determine the speed of the rotating body. The system block diagram is shown in Figure 1.

 

 

2 System Hardware Circuit Design

The system includes Hall sensor, isolation and shaping circuit, main CPU, display circuit, alarm circuit and power supply. The measurement process is that the Hall sensor for measuring the rotation speed is coaxially connected to the motor shaft. Each time the shaft rotates one circle, a certain number of pulses are generated, which are output by the Hall device circuit, isolated and shaped, and sent to the single-chip microcomputer for processing. After receiving the signal, the single-chip microcomputer processes the value data and displays it on the LCD display.

Once the speed exceeds the limit, the CPU will sound an alarm through the buzzer.

2.1 Sensor Selection

The first step to measure the motor speed is to express the motor speed as a pulse signal that can be recognized by the microcontroller, so as to count the pulses. The use of Hall devices to detect pulse signals has the advantages of strong structure, small size, light weight, long life, and easy installation. When the motor rotates, it drives the sensor to move and generate a pulse signal of the corresponding frequency. After signal processing, it is output to a counter or other pulse counting device to measure the speed.

2.2 Microprocessor Selection

In order to reduce the size and power consumption, the commonly used and economical AT89S52 microcontroller is used: AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K in-system programmable memory. Its minimum system includes the AT89S52 microcontroller interface circuit, crystal oscillator circuit, and reset circuit. See Figure 2.

 

 

2.3 Counters and Timers

The advantage of using the on-chip counter is that it reduces the cost of the single-chip microcomputer system. Each pulse will generate a T1 count. After the 100ms interrupt generated by T0 is completed, the number of T1 interrupt overflows is the number of pulses that need to be counted. The counting part of the system uses the on-chip counter. The timer part can be generated by the on-chip always signal.

2.4 Signal Processing Circuit

The Hall sensor is used to measure the rotation speed. The detected signal is a pulse, so there is no need for analog-to-digital conversion. After the signal passes through the sensor, the noise is filtered out and it can be directly connected to the microcontroller for counting processing. Since it is a digital pulse signal, two reverse operations are used during filtering to achieve the purpose of isolation and shaping. The hardware connection is shown in Figure 3. Among them, 74LS14 is a six-bit inverter.

 

 

2.5 System Design Block Diagram

During actual measurement, the Hall sensor should be fixed on the bottom plate of the DC tachometer motor. A magnetic steel block is fixed on the shaft of the motor opposite to the Hall probe. The Hall sensor sends a pulse signal every time the motor rotates one circle, as shown in Figure 4.

 

 

3. Detection system software design

There are 4 basic steps to measure the motor speed: 1 is the control method; 2 is to determine the counting method; 3 is the signal input method; 4 is to read the count value. The measurement process is that the Hall sensor for measuring the speed is coaxially connected to the motor shaft. Every time the shaft rotates one circle, a certain number of pulses are generated, which are output by the Hall device circuit. After passing through the isolation shaping circuit, it becomes the counting pulse of the revolution counter. By controlling the counting time, the count value of the counter can correspond to the speed value of the shaft. The main CPU processes the value data and displays it on the LCD display. 3.1 Main program flowchart

First, initialize and set the initial value of each timer, and then determine whether to start the system for measurement. After starting the system, when the Hall sensor detects the arrival of the pulse, start the external interrupt, interrupt once for each pulse, and record the number of pulses. At the same time, start the T0 timer, interrupt once every 1 second, read the recorded number of pulses, that is, the motor speed. Sampling three times in a row, take the average value and record it as a speed value. Then judge the value. If the value is higher than 5000r/s, alarm and return to the initialization stage, otherwise, normal speed LCD display will be performed. As shown in Figure 5.

 

 

3.2 Interrupt Service Routine

In the interrupt service program stage, firstly, the interrupt is disabled. Then, the value of the pulse count is read. Then, T0 is initialized and the interrupt is disabled. Finally, the interrupt is returned.

 

 

3.2.1 External counting interrupt

3.2.2 Timer interrupt flow chart

 

 

4 Conclusion

This paper introduces a design scheme of motor speed measurement system based on single chip microcomputer, which overcomes the shortcomings of traditional measurement methods and can realize accurate measurement of motor speed in different sections. The speed measurement system has the advantages of fast measurement speed and high measurement accuracy. After signal conditioning, the output signal of the Hall sensor is counted by the single chip microcomputer to realize speed measurement, which makes full use of the internal resources of the single chip microcomputer and has a high cost performance. Facts have proved that this system can be applied in general speed detection and control.

Reference address:Design of digital speed measurement system based on 51 single chip microcomputer

Previous article:Design and implementation of online update mechanism based on CAN bus
Next article:Design and implementation of a general purpose digital frequency divider based on FPGA

Latest Power Management Articles
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号