Design of robot toy control system using magnetoresistive sensor and AT89C52 microcontroller

Publisher:电子创新者Latest update time:2023-06-05 Source: elecfans Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

The chip only completes the main operations related to communication, computing, etc. When there is no operation, it is maintained by the operating system uClinux running on it. The maintenance and control of all peripheral devices unrelated to the core calculation, control, communication and operation of the EZ328 are completed through an AT89C52. The underlying communication protocol with the EZ328 is the synchronous serial port protocol (SPI), which is implemented by software in the AT89C52 . The components included in C52 are mainly A/D converters, keyboard interfaces, and motor drive modules. The hardware structure circuit diagram is as shown in Figure 1:

Design of robot toy control system using magnetoresistive sensor and AT89C52 microcontroller

figure 1


1 Magnetoresistive sensor and its detailed acquisition process

1.1 Introduction to magnetoresistive sensor HMC1022

A sensor that uses changes in magnetoresistance in the magnetic circuit to convert measured changes into changes in AC voltage. Its mechanism is a four-arm Wheatstone bridge, which converts the magnetic field into a differential output voltage and can detect magnetic field signals as low as 85 microgauss. This low-cost sensor has a smaller footprint than similar traditional models. size and lower power consumption. The power supply is 3V-10V DC voltage. The HMC0122 used in this design adopts a 16-pin SOIC package and integrates two Wheatstone bridges to measure the magnetic field signals of the X-axis and Y-axis of the plane, so that the complete signal in the direction of the horizontal plane can be obtained.

What is special is that Honeywell's magnetoresistive sensor has a patented set/reset circuit.

Figure 2 and Figure 3 are the circuit design of the internal bridge and set/reset circuit of HMC1022 respectively.

Design of robot toy control system using magnetoresistive sensor and AT89C52 microcontroller

figure 2

Design of robot toy control system using magnetoresistive sensor and AT89C52 microcontroller

image 3


1.2 Working principle of magnetoresistive sensor

The phenomenon that the resistance of a substance changes in a magnetic field is called the magnetoresistive effect. For ferromagnetic metals such as iron, cobalt, nickel and their alloys, when the external magnetic field is parallel to the internal magnetization direction of the magnet, the resistance almost does not change with the external magnetic field; when the external magnetic field deviates from the internal magnetization direction of the metal, the resistance value of such metals will Reduced, this is the anisotropic magnetoresistive effect of ferromagnetic metals when a thin film is attached to a silicon wafer using standard semiconductor processes. When a current is applied along the length of the ferromagnetic alloy strip and a magnetic field is applied in the direction perpendicular to the current, the resistance of the alloy strip itself will change the most. At the same time, two aluminum current strips were designed on the silicon chip during production, one is the set/reset strip. When the sensor encounters strong magnetic field induction, magnetic domain saturation will occur. This bias magnetic field strip is used to arrange the magnetic domains. The reset (i.e. restore sensitivity) can also be used to set or reset the polarity of the output; the other is the bias magnetic field strip, which is used to generate a bias magnetic field to compensate for the environmental magnetic field. The output voltage of the HMC is the sensor when the magnetic field intensity is 0 Output. So when U0 is 0, Uout is proportional to the magnetic field strength B.


As shown in Figure 4, assume that the robot is on a horizontal plane, X is the direction of travel of the robot, Y is the direction vertical to X on the horizontal plane to the right, the direction of the ground north pole and the geomagnetic north pole are as shown in the figure. H is the geomagnetic field, Hx and Hy are the horizontal components of H in the X and Y directions respectively, β is the angle between the robot's traveling direction and the geomagnetic north direction, γ is the angle between the geomagnetic north pole and the geographical north direction, and K is the robot's traveling direction. The angle between it and the geographical north direction is the angle we ultimately require.

Design of robot toy control system using magnetoresistive sensor and AT89C52 microcontroller

1.3 Circuit design of magnetoresistive sensor signal acquisition module

The voltage signal output from HMC1022 is very weak. My test was 0 to 3mv. It needs to be amplified by an amplifier. The amplifier is AN622, and the amplification factor is selected to be 600 times. This amplifier can be added with a 2.5v bias voltage. , so the voltage output to the A/D is 2.5v+(0~3mv)*600. The voltage signals collected by the two channels are amplified and connected to ADC0832. ADC0832 is a two-channel 8-bit precision successive approximation analog-to-digital conversion chip. Input a MUX ADDRESS sequence through a serial I/O port DI to configure the A/D into differential mode and select which channel signal.

Using max662a as the constant voltage source of the RST/SET part, the working principle and process of the circuit are as follows:

1. Terminal 14 (P1.7) of 2051 outputs high level, and the SR circuit set function is strobe

2. Control ADC0832 through the corresponding terminals of 2051 P1 to complete an A/D conversion and record the voltage value Vset read this time.

3. P1.7 of 2051 outputs low level, and the SR circuit reset function is strobe

4. Control AD0832 through the corresponding terminals of 2051 P1 to complete an A/D conversion and record the voltage value Vrst read this time.

5. Find the output bias voltage V0 of 1022=(Vset+Vrst)/2.

6. Use 2051 to control AD0832 to complete the A/D conversion. Subtract V0 from the value Vrst read each time to get the voltage required for calculation Vread=Vrst-V0.

7. seek

8. K=β-γ, goto 6

The value obtained after 2051 processing is used with an I/O port to simulate PWM output with the cooperation of the clock, and is passed to the C52 microcontroller.


2 Conclusion

The entire circuit design is used as a loadable module for robot toys, and the effect is very good in actual use. The resolution of the direction is fully satisfied within 5 degrees, and the processing results are passed to the main control chip. It has been used in practice and achieved satisfactory results. From a cost-effective perspective, this circuit design is a relatively successful one.


Reference address:Design of robot toy control system using magnetoresistive sensor and AT89C52 microcontroller

Previous article:Application solution for realizing high-precision inertial measurement component system based on acceleration measurement sensor
Next article:Self-made password lock design based on microcontroller

Recommended ReadingLatest update time:2024-11-16 11:50

Wireless data transmission design between AT89C52 microcontroller and PC
In some special applications, microcontroller communication cannot use wired data transmission, but requires short-distance wireless data transmission. Short-distance wireless transmission has the advantages of strong anti-interference ability, high reliability, good security, few geographical restrictions, and flexib
[Microcontroller]
Wireless data transmission design between AT89C52 microcontroller and PC
51 single chip microcomputer (AT89C52) D/A conversion
#include reg52.h   #define uchar unsigned char   #define uint unsigned int   sbit cs=P3^0;   sbit wr=P3^1;   void delayms(uint x)   {       uint y,z;       for(y=x;y 0;y--)           for(z=110;z 0;z--);   }   void main()   {       flying temp;       cs=0;       wr=0;       while(1)           {           P2=temp;      
[Microcontroller]
51 single chip microcomputer (AT89C52) D/A conversion
LCD display AT89C52 single chip DS1302 real time clock program
#include'reg52.h' //Header file containing microcontroller registers #include'intrins.h' //Header file containing _nop_() sbit RS=P2^0; //LCD read/write selection bit sbit RW=P2^1; //LCD read/write selection bit sbit E=P2^2; //LCD enable terminal sbit BF=P0^7; //Busy signal sbit SCLK=P1^0; //1302 clock output sbit DAT
[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号