Simple intelligent robot designed based on AT89C51 microcontroller

Publisher:星光曲折Latest update time:2006-11-22 Source: 电子工程师Keywords:PWM Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
introduction

With the continuous development of microelectronics technology, microprocessor chips are becoming more and more integrated. Microcontrollers can integrate CPU, memory, timers/counters, parallel and serial interfaces, watchdogs, and pre-processors on one chip. A variety of circuits such as amplifiers, A/D converters, D/A converters, etc. make it easy to combine computer technology with measurement control technology to form an intelligent measurement control system. This technology has led to rapid development of robot technology. At present, people can design and manufacture simple intelligent robots with certain special functions.

1 Design ideas and overall plan

1.1 Design ideas of simple intelligent robot

This robot can walk along the guide line in any area, automatically avoid obstacles, and can walk along the light source when guided by the light source. At the same time, it can detect metal pieces buried underground, send out audible and visual indication information, and can store and display the number of detected breakpoints and the distance between each breakpoint and the starting line in real time. Finally, it can stop at a designated location and display the entire run. process time.

1.2 Overall design plan and block diagram

This design uses AT89C5l microcontroller as the detection and control core. An infrared photoelectric sensor is used to detect black lines and obstacles on the road, a metal sensor is used to detect metal iron pieces under the road, a photoelectric encoder is used to measure distance, a photoresistor is used to detect and determine the location of the garage, and PWM (Pulse Width Modulation) technology is used to dynamically control the motor. Direction of rotation and speed. Through software programming, precise control of robot travel, obstacle avoidance, and stopping, as well as storage and display of detection data are achieved. Through the optimized combination of circuits, all resources of the 51 microcontroller can be utilized to the maximum extent.

Port P0 is used for digital tube display, port P1 is used for PWM drive control of the motor, and ports P2 and P3 are used for data collection and interrupt control of the sensor. The advantage of this is that it fully utilizes the internal resources of the microcontroller and reduces the overall design cost. The overall scheme of the program is shown in Figure 1.

2 System hardware composition and design principle

The hardware part of this system consists of a single-chip microcomputer unit, a sensor unit, a power supply unit, an audible and visual alarm unit, a keyboard input unit, a motor control unit and a display unit, as shown in Figure 2.

2.1 Microcontroller unit

This system uses AT89C51 microcontroller as the central processor. Its main task is to scan the signal input from the keyboard to start the robot, and continuously read the data collected by the sensor while the robot is walking. After processing the obtained data, it generates PWM pulses with different duty cycles according to different situations to control the motor. At the same time, the relevant data is sent to the display unit for dynamic display, and an audible and visual alarm signal is generated. Among them, P0 is used for dynamic display of the digital tube, P1.0 to P1.5 control 2 motors, P1.6 and P1.7 are independent keyboard interfaces, P2 is connected to the sensor, and P3.2 is connected to the photoelectric code plate for mileage measurement. P3.7 is connected to the sound and light alarm unit, and P3.4, P3.5, and P3.6 are connected to the light-emitting diodes used to display the number of breakpoints.

2.2 Motor control unit

This robot uses a dual-motor, two-wheel-driven car as its base. The two motors independently control the wheels on the left and right sides. The turning function is realized by the difference in the speed of the motors on both sides. It can also turn in place for easy control. The traditional car is driven by a power motor and a steering motor, and the turning angle is difficult to control and is inconvenient to use.

The motor control circuit adopts an H-type drive circuit composed of high-power pairs of tubes BDl39 and BDl40. The microcontroller generates PWM pulses with different duty cycles to accurately adjust the motor speed. Since this circuit works in the saturated or cut-off state of the transistor, it avoids the tube consumption of the transistor when working in the linear amplification area and can maximize efficiency; the H-type circuit ensures that the motor speed and direction can be simply controlled; electronic switch The speed and stability can fully meet the needs. The entire drive circuit is a widely used motor drive technology. See Figure 3 for the circuit.

2.3 Sensor unit

The entire robot uses a total of 9 sensors, which are distributed in different parts of the entire robot and play different roles in cooperation with each other, as shown in Figure 4.

The description of each sensor in Figure 4 is as follows:

Sensor 1 is a metal detection sensor placed directly in front of the robot and facing downward, for detecting metal.

Sensor 2 is a forward-facing ultrasonic sensor placed directly in front of the robot for detecting obstacles. The ultrasonic wave comes from the 40 kHz square wave signal generated by the 555, which is sent out through the ultrasonic transmitter. The transmitting head continuously sends out signals. When encountering an obstacle, the signal will be reflected back, so that the receiving head will receive the signal and send the signal to the microcontroller for corresponding judgment and processing.

Sensor 3 is an infrared photoelectric sensor placed directly in front of the robot and facing downward to detect the stop line. The infrared transmitting tube emits a signal, which is reflected by different reflective media, and a corresponding judgment is made based on whether the infrared receiving tube receives the signal.

Sensors 4 and 5 are infrared photoelectric sensors placed under the robot base and are used to detect guide lines on the ground. The principle is the same as sensor 3.

Sensors 6 and 7 are placed directly in front of the robot and are used to find the light source. When there is a light source in front of the robot, the size of the photoresistor will change. The changes of the two sensors will be compared and processed and sent to the microcontroller. The microcontroller will generate a corresponding adjustment signal to make the robot walk in the direction of the light intensity.

Sensor 8 is an ultrasonic sensor placed on both sides of the rear of the robot facing outward. It is used for turning when the robot encounters an obstacle and determines whether the robot has completely bypassed the obstacle. The principle is the same as sensor 2.

The sensor 9 is placed on the photoelectric code disk directly behind the robot for mileage calculation. With the help of the mouse principle, a plastic wheel with a diameter of 2.6 cm is used to make a homemade photoelectric code disk. After polishing, the circumference is 8 cm, and then Punch 8 holes at equal distances on the small wheel, as shown in Figure 5. The minimum distance measurement accuracy can reach 1 cm, which is enough to meet the requirements. Photoelectric sensors are installed on both sides and installed at the rear of the car to synchronize them with the driving of the car. According to the actual situation, the distance between the self-made holes cannot be exactly equal, but after specific measurement of the photoelectric code disk, it can ensure that 50 pulses are generated when traveling 50 cm, so it is used as the reference unit for calculating distance. In the straight area, the distance between the center line of the iron piece and the starting line can be calculated from the number of pulses generated by the circuit.

In addition, in order to clearly and intuitively observe the working status of each sensor, a working indicator light is specially designed for each sensor in the circuit to display the working status of each sensor in real time.

2.4 Keyboard input unit

The keyboard input unit adopts an independent keyboard and consists of 2 keys, one of which is the start key and the other is the display switching key. When the robot completes its walking process, press this key to display the entire walking process. time.

2.5 Display unit

The display unit consists of two 7-segment digital tubes. In order to reduce the power consumption of the entire system, it uses microcontroller software decoding, dynamic display, and real-time display of the distance from each breakpoint to the starting point and the entire running process. time.

2.6 The sound and light alarm unit

uses 555 as the oscillation source, and uses the microcontroller to trigger the oscillation source to drive the electromagnetic sounder as the sound indicator and a light-emitting diode as the light indicating device to form the sound and light alarm unit.

2.7 Power supply unit

This system uses 2 sets of power supplies to supply power to the motor and control circuit separately. The system control circuit uses the output power supply (5V) stabilized by 7805, and the motor uses 4 AA batteries to power the system.

3 System software design

The supporting software program of this system adopts a module structure and is written in C language. It mainly consists of initialization program, deviation adjustment program, deviation light source adjustment program, sound and light indication subroutine, reading sensor status, display program, timer 0 interrupt service program, timer 1 interrupt service program, external interrupt 0 service program , parking processing and other modules. The main flow of the system is shown in Figure 6.

4 Conclusion

The robot has gone through many experiments on the runway that was set and achieved the expected results, but its level of intelligence is far from enough. With the continuous research and deepening of artificial intelligence and neural network technology, the development prospects of intelligent robots will become increasingly broad.

Keywords:PWM Reference address:Simple intelligent robot designed based on AT89C51 microcontroller

Previous article:MCS-51 microcontroller and CPLD/FPGA interface logic design
Next article:Simple intelligent robot designed based on AT89C51 microcontroller

Recommended ReadingLatest update time:2024-11-16 20:30

Key points of designing AVR microcontroller timing counter based on PWM function
1. Key points of timer/counter PWM design  According to the characteristics of PWM (Pulse Width Modulation (PWM: (Pulse Width Modulation) is a very effective mode that uses the digital output of the microprocessor to control the analog circuit)), the following points should be noted when using the ATmega128 timer/co
[Microcontroller]
[Self-study 51 MCU] 10 -- PWM introduction, 51 MCU RAM area division
1. PWM Introduction PWM (Pulse Width Modulation), also known as pulse width modulation in Chinese, can use digital signals to achieve the effect of an analog signal. Pulse width modulation is to change the pulse width to achieve different effects. See Figure 10-1 for three groups of pulse signals. It is a waveform w
[Microcontroller]
[Self-study 51 MCU] 10 -- PWM introduction, 51 MCU RAM area division
STM8S uses timer 1 to output PWM from CH4 through official LIB
I was confused when reading the Chinese datasheet of STM8S. It took me two nights to debug this function. Post the following code for your reference: TIM1_DeInit(); TIM1_TimeBaseInit(16, TIM1_COUNTERMODE_UP, 999, 0x00); //250 TIM1_OC4Init(TIM1_OCMODE_PWM1, TIM1_OUTPUTSTATE_ENABLE, 499, TIM1_OCPOLARITY_LOW, TIM1_OC
[Microcontroller]
Introduction of SST MCU using PCA function to generate PWM pulse
1. Program Description: SST microcontroller has 5-channel PCA module. PCA function provides stronger timing than ordinary microcontrollers, and less CPU intervention, which can reduce software overhead and improve accuracy. PCA pulse width modulation (PWM) mode can generate an 8-bit PWM, which is generated by comparin
[Microcontroller]
The important role of power factor corrector (PFC) in power supply applications
Traditional off-line switch-mode power converters produce non-sinusoidal input currents with high harmonic content. This can stress power lines, circuit breakers, and power utilities. In addition, harmonics can affect other electronic devices connected to the same power line. Active power factor correctors (PFCs) that
[Power Management]
The important role of power factor corrector (PFC) in power supply applications
89C52 PWM Output Program
#include reg52.h //Keil header file name #include "use.h" #include "Ver.h" //extern void LedOut(unsigned char *pLed); #define Pmax 55000 //55000 //42666(18.4320) #define Ki 2.2 //i=2 //---------------------------- sbit PwinPin=P3^5; //---------------------------- typedef union  { unsigned int Pwm; //pwm的数据 unsigned c
[Microcontroller]
AVR MCU 4-channel adjustable PWM
#include   #include avr/interrupt.h int main(void) {     DDRA=0XFF;  DDRB=0XFF;  PORTA=0XFF;  PORTB=0X00;  TIMSK=0X00;  TCNT0=0;  OCR0=25;  TCCR0=0B01101001;  //Timer 1, output 7.81220kHz square waveTCNT1H     =0x00; //Counter     clearTCNT1L=0x00;        TCCR1A=0xa9; //8-bit fast PWM, 8-division;
[Microcontroller]
STC MCU IO configuration and PWM
I/O Port Layout            All I/O ports of the STC2C5201AD series microcontrollers can be configured by software to one of four working types, as shown in the following table. The four types are: quasi-bidirectional port/weak pull-up (standard 8051 output mode), strong push-pull output/strong pull-up, input only (hig
[Microcontroller]
STC MCU IO configuration and PWM
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号