Design of intelligent robot based on AT89S52 embedded system

Publisher:chi32Latest update time:2012-11-14 Source: 21ic Keywords:AT89S52 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1 Introduction

In the post-PC era of the rapid development of information technology, computers, communications, and consumer electronics are integrated. Although computers and networks have fully penetrated into every corner of daily life, various new embedded access devices have become the current mainstream products. Any ordinary person may have dozens of electronic products with embedded technology, ranging from small digital products such as watches, mobile phones, mp3 players, PDAs, to large smart home appliances, network home appliances, and vehicle-mounted electronic devices. Embedded technology is indispensable. As an important research branch of embedded technology, robotics technology is currently in full swing at home and abroad. Various industrial robots and service robots have begun to be applied to people's production and life. The advantages of using robots have been widely recognized by people and are becoming a part of our daily work and life. This paper uses AT89S52 to design an embedded intelligent tracking robot. Under the control of sensors, motor drives and software, it can intelligently complete the task of detecting maze walking routes. Compared with traditional remote control toy cars, it has certain independence and intelligence, and is a prototype of future intelligent toy cars.

2 System Hardware Architecture and Working Principle

The hardware architecture of the embedded intelligent tracking robot is shown in Figure 1. With the single-chip microcomputer AT89S52 as the core, the periphery consists of a motor drive module, a motor power module, a mainboard power module, a communication module, an obstacle avoidance module, and an online programming module. The infrared photoelectric sensor is connected to the P0.5, P0.6, and P0.7 ports of the AT89S52 through the P8, P9, and P10 interfaces of the mainboard, where P0.5 = 0 means there is an obstacle in front; P0.6 = 0 means there is an obstacle on the left; P0.7 = 0 means there is an obstacle on the right. The left and right motors are connected to the mainboard motor drive module through the P5 interface of the mainboard.

After power-on, the sensor collects the signal from the maze baffle to control the lower five bits of port P0, realizing the forward/reverse rotation of the left and right motors, so that the robot can turn left, turn right, move forward in a straight line, etc., and complete the process of moving from the entrance to the exit in the maze.

3 System Interface Circuit Design

3.1 Microcontroller Module

AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller. It has an 8KB ISP Flash read-only program memory that can be repeatedly erased and written 1000 times. The device is manufactured using high-density, non-volatile storage technology and is compatible with the standard MCS-51 instruction system and 80C51 pin structure. The chip integrates a general-purpose 8-bit central processing unit and ISP Flash storage unit, which can provide cost-effective solutions for many embedded control application systems.

AT89S52 has 40 pins, 8KB Flash program memory, 256B RAM, 32 external bidirectional input/output ports, 5 interrupt priority levels, 2 levels of interrupt nesting, 2 16-bit programmable timers and counters, 2 full-duplex serial communication ports, watchdog (WDT) circuit, on-chip clock oscillator, etc.

A development board is used during the development process to facilitate program debugging and whole machine testing. After the system debugging is completed, the microcontroller is removed from the development board and installed in the microcontroller holder of the robot system board. Since the tasks that the robot in the design needs to complete are relatively simple, only the crystal oscillator and reset circuit are retained in the microcontroller system of the robot system board, and redundant circuits such as the JTAG programming port are cancelled.

3.2 Sensor Module

The working principle of the photoelectric sensor is that the infrared transmitting tube of the sensor emits infrared light, and the receiving tube counts according to the intensity of the reflected infrared light. Therefore, the surface of the detected component or object must have black and white parts to absorb and reflect infrared light, so that the receiving tube can be in the effective cutoff and saturation zone to achieve the purpose of counting. The detection and adjustment circuit of the sensor is shown in Figure 2. R3 in the figure is used to adjust the threshold voltage of the comparator. After observation by the oscilloscope, the output waveform is quite regular and can be directly used for query by the microcontroller. It has been verified that the voltage drop of the battery powering this circuit is small. The infrared photoelectric sensor is connected to the P0.5, P0.6 and P0.7 ports of AT89S52 through the P8, P9 and P10 interfaces of the motherboard. Among them, P0.5 = 0 means there is an obstacle in front; P0.6 = 0 means there is an obstacle on the left; P0.7 = 0 means there is an obstacle on the right.

3.3 DC motor drive circuit and power module

The DC motor is connected to the driver module of the motherboard through the P5 interface of the motherboard. This article uses L298 as the driver chip of the motor. The four pins 5, 7, 10, and 12 of L298 are connected to the microcontroller. By programming the microcontroller, the forward and reverse functions of the two sets of DC motors can be realized. Since the voltage of the microcontroller is about 4.8V, a VFM boost power chip is used to provide a voltage of about 5V for the microcontroller and peripheral circuits. [page]

4 Software Design Module

4.1 Software Development Environment and Search Algorithm

This paper uses Keil U Version2 as the system development environment, and uses a mixture of C language and assembly language in program design. In terms of software algorithms, considering that the time and space efficiency of the depth-first search algorithm is proportional to the complexity of the maze terrain, that is, the more complex the maze, the longer it takes to search for the exit. This paper adopts a maze path search strategy called the left-hand (or right-hand) rule, that is, in the maze, you can find the exit by searching along the left (or right) wall.

Compared with the depth-first search method, the space occupied by the left-hand (or right-hand) rule has nothing to do with the complexity of the maze. The choice of the robot's search path is only related to the current node, and there is no need to backtrack. At the same time, the manufacturing accuracy of the hardware is not high, and there is no need to accurately control the robot's moving distance and direction, which facilitates the drive design. To facilitate the implementation of the algorithm, this article sets the following constraints:

1. In the algorithm, no matter how complex the maze terrain is, it is composed of seven basic terrains: straight line, dead end, T-shaped, cross, corner and end point.

2. According to the number of forks, the fork is divided into a two-way fork and a three-way fork (generally there is no four-way fork), and the forks in front of the fork are called the first fork, the second fork, and the third fork from right to left (only for the cross type). There are three different forms of two-way forks. The first is that a fork appears on the right side of the route (the fork on the right is called the first fork, and the fork in front is called the second fork); the second is that a fork appears on the left side of the route (the fork in front is called the first fork, and the fork on the left is called the second fork); the third is a T-junction (the fork on the right is called the first fork, and the fork on the left is called the second fork). For these three situations, the corresponding program of the algorithm consists of the main program, the straight line subroutine, the left subroutine, the right subroutine, and the correction subroutine. The main program plays the role of guidance and decision-making, deciding what the robot should do and when. The other functions of the robot are realized by calling specific subroutines.

4.2 Algorithm Flowchart Description

The maze search algorithm used in this paper is shown in Figure 3. After the motor and sensor power are turned on, the microcontroller, under the control of the program, determines the forward and reverse rotation of the motor according to the value detected by the sensor. When P0.7=1, it means there is no obstacle on the left. According to the "right hand" traversal algorithm, the robot will call the right rotor program; when P0.7=0 and P0.5=0, the robot will call the left rotor program; otherwise, the robot moves in a straight line, repeatedly detecting and adjusting the robot's movements until the robot walks out of the maze.

5 Conclusion and innovation

This paper discusses the hardware architecture of the embedded intelligent tracking robot based on AT89S52, applies the left-hand (or right-hand) rule to the tracking robot's walking route search, and focuses on the circuit implementation technology of the photoelectric sensor module, DC motor drive module, power supply module, etc. based on AT89S52. After repeated tests, the robot can intelligently complete the tracking task from the entrance to the exit of the maze under the control of software without any external force. The innovation lies in the automatic perception of obstacles through photoelectric sensors, and the use of software to control the robot to turn left/right and walk in a straight line. It is an attempt to detect complex paths, especially suitable for path detection in environments that people cannot reach. The system has low cost, high reliability, and sensitive response. It also has certain reference value for the design and development of intelligent toys.

Keywords:AT89S52 Reference address:Design of intelligent robot based on AT89S52 embedded system

Previous article:Design of Battery Four Parameters Detection System Based on AT89C52 Control
Next article:Using the parallel port to realize the ISP function of AT89S series microcontroller

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

【C51 Self-study Notes】Overview and Preparation
Using atmel company: AT89S52 Use the burning tool: progisp Writing tool: Keil uVision Development board used: Sirius TLX-1C development board The subsequent codes have been packaged: https://download.csdn.net/download/f_zmmfs/10560847 (delete for infringement) structure:        It integrates an 8-bit CPU,
[Microcontroller]
【C51 Self-study Notes】Overview and Preparation
Design and implementation of a sine signal generator
  0 Introduction   Sine signal source plays a very important role in laboratory and electronic engineering design, but the traditional sine signal source is generally expensive according to actual needs, has poor performance at low frequency output and is not easy to adjust automatically, and has poor engineering pr
[Microcontroller]
Design and implementation of a sine signal generator
Design of blood flow velocity meter based on Doppler principle
Blood flow velocity refers to the flow speed of red blood cells in blood vessels. It is a very important physiological parameter that can reflect many body functions, such as heart function, blood circulation system function and human metabolism level. Therefore, the detection of human blood velocity has great physiol
[Microcontroller]
Design of blood flow velocity meter based on Doppler principle
Design of Voice Broadcast Recorder
   0 Introduction   With the development of digital electronic technology and the emergence of microcontrollers such as single-chip microcomputers, voice storage and automatic playback have become easy to achieve. At present, voice storage and automatic playback systems have been widely used in daily life. The voice
[Microcontroller]
Design of Voice Broadcast Recorder
AT89S52 pin function introduction
Power pin: (pin 40) positive power supply VCC; (pin 20) negative power supply GND. Reset pin: (9-pin) reset pin RST. Clock signal input and output pins: (19-pin) XTAL1; (18-pin) XTAL2; External ROM read select pin: (pin 29) PSEN (low level is valid). Address latch and ROM programming pulse input
[Microcontroller]
AT89S52 pin function introduction
Design of network switch system based on USB interface
    With the continuous deepening of e-government construction such as online declaration, online approval and even online office, the connection with the Internet has become closer. However, due to the international, open and free nature of the Internet, the internal network is also facing more serious security threat
[Microcontroller]
Design of network switch system based on USB interface
at89s52 Minimum System Diagram Microcontroller Minimum System Introduction and Design
  This article introduces a minimum system example based on AT89S52 microcontroller prototype design, including the microcontroller pin diagram, crystal oscillator circuit diagram and reset circuit diagram, etc. The minimum system diagram of the 51 microcontroller is constructed. We hope to provide a certain minimum s
[Microcontroller]
at89s52 Minimum System Diagram Microcontroller Minimum System Introduction and Design
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号