Design and production of intelligent car based on AVR microcontroller

Publisher:jiaohe1Latest update time:2011-11-22 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

O Introduction
Since the industrial revolution, with the development of electricity, mankind has entered a new stage of civilization. Robots have been widely used in industry, agriculture, service industry, military, machinery, transportation, aerospace and other fields. The continuous improvement of the level of intelligent robots has greatly improved labor efficiency and reduced labor intensity. Robots fight side by side with humans and play an important role in conquering nature and transforming nature.
The intelligent car is a comprehensive system integrating multiple disciplines such as theoretical mechanics, mechanical structure, digital circuit, analog circuit, sensor, single-chip microcomputer, control theory and algorithm. Its content covers multiple disciplines and fields such as machinery, electronics, automatic control principles, computers, and sensor technology.
The intelligent car based on ATmagel6L designed in this paper requires it to start from the starting line, and then automatically adjust the angle and speed by itself to make it automatically drive along a black guide line.

1 Hardware Design of Smart Car
The structure of the control system of this smart car is shown in Figure 1. The Atmegal6L microcontroller is the control module of the smart car. It is a high-performance, low-power 8-bit AVR microprocessor with advanced RISC structure, 16K bytes of in-system programmable Flash and 512 bytes of EEPROM. When working at 16 MHz, its performance is as high as 16 MIPS, and it has 32 programmable general I/0 ports and a JTAG interface for boundary scanning, which can basically meet the design requirements. The circuit voltage regulator module inputs 12 V voltage. After the voltage regulator circuit, two voltages of 9 V and 5 V can be obtained, of which 9 V voltage is used for the working voltage of the motor drive module, and 5 V voltage is used for the work of the microcontroller. Figure 2 shows the circuit diagram of the RPR220 photoelectric sensor module. The photoelectric sensor is composed of 10 RPR220 photoelectric pairs. RPR220 is an integrated reflective photodetector, whose transmitter is a gallium arsenide infrared light-emitting diode, and the receiver is a high-sensitivity silicon planar phototransistor. The INPUT and OUTPUT ports of L298N are used to provide a stable voltage to make the motor rotate.


1.1 Photoelectric sensor module
Figure 2 shows the circuit diagram of the photoelectric sensor module in this system. The line-finding path is generally a 3 cm black line engraved on a white plane. The car follows the black line. When the white line is detected, that is, the light emitted by the diode is reflected back by the white line, the triode in the photoelectric pair tube is turned on, and the input of port 6 of the comparator is low level. After passing through the comparator, the output of port 7 is high level. When the black line is detected, the light is absorbed, the light intensity is weakened, the triode in the photoelectric pair tube is not turned on, the input of port 6 of the comparator is high level, and the output of port 7 is low level. After the high and low levels (1 and 0) are fed back to the microcontroller through the PC port, they can be used to adjust the steering of the car head after processing by the microcontroller so that the black line is just in the middle of the 10 photoelectric probes, so that the car can move forward smoothly. A 0.1μF capacitor is connected in series at port 7 and then grounded. In this way, the square wave entering the microcontroller after filtering is very perfect. Connect this photoelectric tube to the code disk, and use the photoelectric tube to continuously scan the number of code disk grids. In this way, when the code disk rotates and the speed is low, the signal at terminal 6 can be changed into a square wave with a frequency corresponding to the speed. However, when the code disk is very fast, the signal at terminal 6 will become a sinusoidal signal with a frequency corresponding to the speed. The amplifier LM324 can be used as a comparator. After comparing the sinusoidal signal at terminal 6 with the reference voltage, a square wave with a frequency corresponding to the speed will be generated at terminal 7. After the microcontroller collects this signal, the various parameters of the DC motor can be calculated according to the formula, thereby accurately controlling the steering and displacement of the car.
1.2 Motor drive module
Figure 3 shows the circuit connection diagram of the L298N drive module. As a motor drive chip, L298N is a high-voltage and high-current full-bridge drive chip. It has a high frequency and can control two DC motors. It also has a control enable terminal. The working voltage can be input through pins 4 and 9, respectively, with 9 V and 5 V voltages. ENA and ENB pins are two enable ports, while INT and OUT are motor drive pins. By changing the logic level of the OUT terminal, the forward, reverse and stop states of the motor can be controlled. Table 1 lists the DC motor control logic. The six pins 5, 6, 7, 10, 11 and 12 of L298N can be directly connected to the PD port of the microcontroller, and the DC motor PWM speed regulation can be realized by programming the microcontroller.

[page]

1. 3 Single-chip microcomputer control module
The Atmegal6L single-chip microcomputer of Atmel Company can be used to control the car. The single-chip microcomputer has 32 powerful programmable I/O interfaces and 4 PWM channels, and has eight 10-bit ADCs, which can control the car in real time. The eight ports PC0~PC7 of the single-chip microcomputer can be connected to the eight photoelectric probes of the photoelectric sensor module. Assume that the actual logical value detected by the probe is P, the assumed value is N, and the movement states of the wheels are forward-move, right-move, leftmove, hard-right-move, and hard-left-move. By comparing the actual value P with the assumed value N (0b0011-1100), the control module parameter table of the Atmegal6L single-chip microcomputer listed in Table 2 can be obtained, where x is an irrelevant item. During design, PD2~PD3 of Atmegal6L can be connected to two photoelectric pairs with code discs to accurately measure the steering and displacement of the wheel; PD5 and PD4 can be connected to the enable terminals ENA and ENB of the motor drive module respectively. PD1, PD0, PD6 and PD7 are connected to IN1, IN2, IN3 and IN4 of the motor drive module respectively. IN1 and IN2 ports are generally used for PWM input to use PWM speed regulation method, that is, the microcontroller outputs a series of square waves with fixed frequency, and drives the motor through the power amplifier, and then changes the duty cycle of the output square wave through microcontroller programming, so that the average voltage applied to the motor can be changed, thereby changing the speed of the motor.

2 Software design of smart car
The system software flow chart based on AVR microcontroller and C language programming is shown in Figure 4.

3 Conclusion
This paper focuses on the discussion of the principles of photoelectric sensors, single-chip microcomputer control and voltage regulators, as well as the mutual communication and coordination between these modules. This system uses cheap infrared tubes and a powerful ATmagel6L single-chip microcomputer as the main controller. At the same time, the debugging software is written in C language using the L298N driver chip, thus completing the design of an intelligent car that can track intelligently, avoid obstacles automatically, has modular structure, and has strong anti-interference ability. Through the debugging of the car, the system can enable the car to successfully and smoothly drive on any given black line, and the tracking effect is very good, the operation is very stable, and the speed is also very fast, and there will be no centrifugal phenomenon at the corners due to the high speed.
Intelligent cars have been widely used in military, civil, scientific research, and aerospace exploration fields. Its development is closely related to automatic control, single-chip microcomputer development, optimization of control algorithms, and microcomputer storage processing speed, and it is worth further research and exploration.

Reference address:Design and production of intelligent car based on AVR microcontroller

Previous article:Radio Telemetry System Based on AVR Microcontroller
Next article:Design of a Presettable Programmable Broadband DC Power Amplifier Circuit Based on ATmegal28

Recommended ReadingLatest update time:2024-11-16 23:48

Research on Direct Current Control Strategy of Single-phase PWM Rectifier
  1. Introduction   With the development of power electronics technology, power electronic devices are being used more and more widely, resulting in a large number of nonlinear loads pouring into the power grid, causing increasingly serious harmonic pollution to the voltage and current of the power system. However, PW
[Power Management]
Research on Direct Current Control Strategy of Single-phase PWM Rectifier
PWM - Control the brightness of LED with buttons
I wrote a blog post about PWM a year ago, the link is as follows: http://hi.baidu.com/do_sermon/item/ff523b0a8b9d3d173b53ee74 An oscilloscope is used in this paper to display waveforms with different duty cycles. In fact, LED can also be used to show the changes in PWM parameters through brightness. The actual
[Microcontroller]
PWM - Control the brightness of LED with buttons
MCU PWM frequency and cycle are adjustable
//------------------------------------------------------------------------------------ //Program function introduction: This program generates 15HZ~~~50KHZ square wave, and realizes independent modulation of frequency and pulse width. //Change the frequency without changing the pulse width, and change the pulse width
[Microcontroller]
PWM control LED light gradually turns on and off (C51)
/***********************************************************************/ /* ME300B MCU Development System Demonstration Program - PWM Control LED Light Gradually Brightens and Dims */ /* LED Display */                                     /*******************************************************************/ //PWM cont
[Microcontroller]
Buck Converter Using Low-Side PWM IC
The most common switching power supply structure is the buck converter, which can efficiently convert high voltage to low voltage. Figure 1 shows a typical buck converter, where the N-channel MOSFET Q1 requires a floating gate drive signal. The floating gate drive is part of the PWM (pulse width modulation) controll
[Power Management]
Buck Converter Using Low-Side PWM IC
Freescale PWM module
PWME works in 8-bit mode and enables or disables the corresponding channel PWMPOL sets the polarity of the corresponding channel PWMCAE sets the alignment of the corresponding channel PWMPER sets the period of the corresponding channel PWMDTY sets the duty cycle of the corresponding channel PWMCTL sets the correspondi
[Microcontroller]
Multi-channel PWM pulse width modulation output of 51 single chip microcomputer (STC89C52)
Software mode output PWM PWM is used to control the output intensity, such as the brightness of the light, the speed of the wheel, etc. The STC89/90 series does not have hardware PWM and needs to be simulated using code Using pure loop to implement PWM Non-interrupt implementation (SDCC environment compilation) #i
[Microcontroller]
ZVT-PWM inverter circuit
ZVT-PWM inverter circuit Figure ZVT-PWM inverter circuit
[Power Management]
ZVT-PWM inverter circuit
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号