Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Find the programming and circuit diagram of speedometer with 3 144 hall element ~
Find the programming and circuit diagram of speedometer with 3 144 hall element ~
Product description:

Product name: ZH3 144

Product category: single output Hall switch integrated circuit

Product specifications: 4-20V

Product model: ZH3 144

Product description: * Wide power supply voltage range and large output current. * Fast switching speed and no instantaneous jitter. * wide working frequency (0~ 100KHz). * Long service life, small size and convenient installation. * can directly interface with logic circuit.

Application * DC brushless motor contactless switch * position control current sensor * automobile igniter safety alarm device * isolation detection speed detection

Hall sensor is a magnetic sensor, which is often used to collect switching signals, such as CS3020 and CS3040. This sensor is a three-terminal device, which looks like a triode and can work as long as it is connected to power supply and ground. The output is usually an open collector (OC) gate, which has a wide working voltage range and is very convenient to use. As shown in figure 1, it is the outline of CS3020, which will literally align itself. These three pins are Vcc, ground and output from left to right.

Figure 1 CS3020 outline drawing

When the Hall sensor is used to obtain pulse signals, its mechanical structure can also be relatively simple. As long as a magnetic steel is attached to the circumference of the rotating shaft and the Hall switch is close to the magnetic steel, there will be signal output. When the rotating shaft rotates, it will continuously generate pulse signal output. If a plurality of magnetic steel particles are stuck on the circumference, one rotation can be realized and multiple pulse outputs can be obtained. When sticking magnetic steel, it should be noted that the Hall sensor is sensitive to the direction of magnetic field. You can manually approach the sensor before pasting. If there is no signal output, you can try again in another direction. This kind of sensor is not afraid of dust and oil, and is widely used in industrial field.

2 Hardware circuit design

The method of speed measurement determines the hardware connection of speed measurement signal, and speed measurement is actually frequency measurement. So some principles of frequency measurement are also applicable to speed measurement.

Usually, counting method, pulse width measurement method and equal precision method can be used for testing. The so-called counting method is to count the number of input pulses within a given gating time; The pulse width measurement method is to control the counting gate by using the pulse width of the measured signal, and count a high-precision high-frequency counting signal. Because the gate and the measured signal cannot be synchronized, there is an error of 1 in both methods. The first method is suitable for high signal frequency, and the second method is used for low signal frequency. Equal precision criterion has good adaptability to high and low frequency signals.

Fig. 2 is a signal acquisition part of the speed measuring circuit. Capacitor C2 is connected in parallel at the input end of the power supply to filter out the power supply noise and make the Hall element work stably. HG stands for Hall element. Adopt CS3020. Capacitor C3 connected in parallel at the output end (pin 3) of Hall element filters the waveform peak, then connects the pull-up resistor R2 and then connects it to pin 3 of LM324. A voltage comparator is composed of LM324. The output voltage of Hall element is compared with the potentiometer RP 1, and the high and low level signals are obtained for single chip microcomputer to read. C4 is used for waveform shaping to ensure a good digital signal. LED is easy to observe, the comparator does not light when it outputs high level, and lights when it outputs low level. Micro-motor M can be used, and the speed of motor can be increased or decreased by potentiometer RP 1 voltage division. C 1 capacitor makes the speed of the motor not abrupt, because the capacitor can store charge.

The function of voltage comparator: to compare the magnitude of two voltages (the output voltage indicates the magnitude relationship between two input voltages);

When the terminal voltage of "+"input is higher than that of "-"input, the output of voltage comparator is high;

When the terminal voltage of "+"input is lower than that of "-"input, the output of the voltage comparator is low;

The comparator also has a shaping function. Using this characteristic, the single chip microcomputer can obtain a good and stable output signal without losing the signal, which improves the accuracy and stability of speed measurement.

Fig. 2 schematic diagram of speed measuring circuit

3 speed measurement program

Hall sensor is used to measure the rotating speed, and 1 magnet is installed on the shaft to be measured, that is, the rotating shaft generates 1 pulse every revolution, and the rotating speed (rpm) is required to be displayed on the digital tube.

The program compiled in C language is as follows:

//Hardware: old STC experimental version

//P3-5 interface speed pulse

# include & ltSTC 12C54 10AD。 Definition of internal special register of H & gt// single chip microcomputer

# Define uchar unsigned characters

#define uint unsigned int // Macro definition of data type

Uchar code LK[ 10]={0xC0, 0xF9, 0xA4, 0xB0, 0x99, 0x92, 0x82, 0xF8, 0x80, 0x90}; //font code of digital tube 0~9

uchar LK 1[4]={0xfe,0xfd,0xfb,0xf 7 }; //bit selection code

Uint data z, counter; //Defines the unsigned integer global variable lk

//====================================================

Void init(void) // Defines an initialization sub-function named init.

{//init subfunctions are started and assigned respectively.

TMOD = 0x 5 1; //c gate/tm1m0cgate/tm1m0counter t 1 timer T0

// 0 1 0 1 0 0 0 1

th 1 = 0; //counter initial value

TL 1 = 0;

TH0 =-(50000/256); //Timer t0 has a timing of 50ms.

TL0 =-(50000% 256);

EA = 1; //IE = 0x 00; //EA-et 1 ES et 1 ex 1 et 0 EX0

ET0 = 1; // 1 0 0 0 0 0 1 0

tr 1 = 1;

TR0 = 1;

TF0 = 1;

}

//=============================================

Void delay(uint k)// delay program

{

Uint data I, j;

for(I = 0; I & ltk;; i++)

{

for(; j & lt 12 1; j++){; }

}

}

//================================================

Void//Digital tube display

{

p 1 = LK[z/ 1000]; P2 = lk 1[0]; Delay (10);

p 1 = LK[(z/ 100)% 10]; P2 = lk 1[ 1]; Delay (10);

p 1 = LK[(z % 100)/ 10]; P2 = lk 1[2]; Delay (10);

p 1 = LK[z % 10]; P2 = lk 1[3]; Delay (10);

}

//=========================================

Void main(void) // The main program is started.

{

uint temp 1,temp2

init(); //Call init initialization subroutine

for(; ; )

{

temp 1 = TL 1; temp 2 = th 1;

counter =(temp 2 & lt; & lt8)+temp 1; //Read the counter value and convert it to decimal.

//z = counter;

Display ();

}//End of an infinite loop statement

}//End of main program

//===================================================

// uint Chu Shi = 60;

Void timer 0(void) interrupt 1 use 1

{

TH0 =-(50000/256); //Timer t0 has a timing of 50ms.

TL0 =-(50000% 256);

//Chu Shi-;

//If (Chu Shi < = 0) {

Z = counter/0.5; //Reading speed

//}

TH0 = 0; //Clear the timer every 50 milliseconds.

TL 1 = 0;

}

Hall velocimetry

Speed measurement is a common problem in industrial and agricultural production, and it is of great significance to learn to design speed measuring instruments by using single chip microcomputer technology. To measure the speed, the first thing to be solved is the problem of sampling. When making a tachometer with analog technology, the method of tachogenerator is often used, that is, the rotating shaft of tachogenerator is connected with the measured shaft, and the voltage of tachogenerator reflects the speed. Speed can be measured by simple pulse counting method with single chip microcomputer. As long as the rotating shaft produces one or a fixed number of pulses every revolution, and the pulses are sent to the single chip microcomputer for counting, the information of the rotating speed can be obtained.

In the following, the common toy motor is taken as the speed measuring object, and the signal acquisition circuit is designed with CS3020, and the output of counting pulse is realized through the voltage comparator. The speed can be measured in the experimental box of single chip microcomputer, and the output can also be directly connected to a frequency meter or a pulse counter to get the number of pulses per unit time, and the motor speed can be obtained through conversion. This can use less hardware and no programming, but it is only the verification of Hall sensor speed measurement application.

1 acquisition of pulse signal

Hall sensor is a magnetic sensor, which is often used to collect switching signals, such as CS3020 and CS3040. This sensor is a three-terminal device, which looks like a triode and can work as long as it is connected to power supply and ground. The output is usually an open collector (OC) gate, which has a wide working voltage range and is very convenient to use. As shown in figure 1, it is the outline of CS3020, which will literally align itself. These three pins are Vcc, ground and output from left to right.