Intelligent robots are increasingly used in today's society. From ordinary toy robots to industrial control robots, from robots that can cook to robots that can conduct space exploration, it is foreseeable that the application of intelligent robots will be more extensive in the future. Everyone is familiar with ordinary wireless remote control cars, and everyone thinks Nintendo's video game WII is amazing. The familiar ones are not fun, and the amazing ones are unaffordable. This may be a common problem encountered by many people. This design starts from a new perspective of thinking and makes a smart car that can be played in daily life to share with readers who share the same hobby.
Overall system design
The principle of the smart car system is to install a three-dimensional coordinate sensor on the car. The car will have intelligent perception function and will move along with the target object. The system mainly has three components: one is the three-dimensional coordinate light sensor (ETOMS-ET21X111), which is used to collect the moving coordinates of the target object. The sensor is very simple to use; the second is the MCU (EMC-EM78P156), which reads the sensor data to control the motor rotation. EM78P156 is a common MCU on the market, which is easy to use and cheap; the third is the motor. The motor can be an ordinary DC motor, which uses PWM control. The overall framework of the system is shown in Figure 1.
Figure 1 System overall framework
The overall function of this design can be simply summarized as: allowing the car to follow people (or objects). Separately, the following three small functions need to be realized: the sensor can correctly read X,
The Y and Z coordinate values are the first condition. The MCU can correctly judge the size changes of the X and Z coordinate values, which is the key. Some people may wonder why the Y coordinate change is not judged? That is because the car cannot jump up and down (up and down are the Y axis). The MCU controls the motor direction and the motor PWM time according to the size changes of the coordinate values, which is the result.
Hardware system design
1 Sensor peripheral circuit design
ETOMS-ET21X111 is a high-performance light sensor with X, Y, and Z coordinate data output functions. It has the following features: high-speed data output, up to 75 frames of coordinate data per second; low voltage operation, voltage range 2.7 ~ 3.5V; standard RS232 serial data output format to output coordinate values; use external crystal oscillator, range 0.5 ~ 12MHz, usually 3.58MHz; with controllable exposure interface EO4 ~ EO7.
The four interfaces EO4 to EO7 are used for exposure control. They can be controlled by software or hardware. You can choose the appropriate one according to your needs. This design uses hardware to set all four interfaces to high level.
The detailed interface circuit around the sensor is shown in Figure 2. From Figure 2, we can see that EO4~EO7 are high. This is the exposure setting that is pulled high by hardware. It can also be set in software. When the IC is working normally, the coordinate data is output by the RS232 port. Note that the 4 LEDs in Figure 2 are infrared LEDs. The IC operating voltage is 3.3V, and the system is powered by 5V. The IC uses a 3.58MHz external crystal oscillator, and it can work normally after power-on automatic reset.
Figure 2 Sensor interface circuit [page]
2 MCU interface circuit design
The detailed design of the MCU peripheral control circuit is shown in Figure 3. In Figure 3, L and L+ control the left motor PWM, and R and R+ control the right motor PWM. RS232 receives the sensor coordinate data input. The IC works at 3.3V voltage and automatically resets after power-on. The system clock uses a 4MHz external crystal oscillator.
Figure 3 MCU interface circuit
3 Left motor control circuit
The left motor control circuit is shown in Figure 4. The right motor control circuit is the same as the left one. In the figure, Q3 and Q4 use PNP tubes, and L and L+ cannot be LOW at the same time to avoid short circuit.
Figure 4 Left motor control circuit [page]
Software system design
After the system is powered on, it is first initialized, the registers of EMC78P156 are set, the interrupt flag register is enabled, and the interrupt is waited. Figure 5 is the main program flow chart.
Figure 5 Main program flow chart
When an interrupt occurs, the interrupt handling subroutine is entered. First, the interrupt flag must be turned off and the scene must be protected. Then the XYZ coordinate values are read and analyzed, which can be divided into the following situations.
(1) Determine the change in the X-axis. If the X value is greater than 14 and less than or equal to 17, the motor does not rotate left or right. Then determine the change in the Z-axis coordinate value. If the Z value is also greater than 14 and less than or equal to 17, the motor does not rotate forward or backward.
(2) If the X-axis coordinate value is greater than 17, determine the Z-axis coordinate. If the Z value is greater than 17, reverse the right motor and then turn the left and right motors backward. If the Z value is less than 14, rotate the left motor forward and then turn the left and right motors forward. Otherwise, the motors do not rotate.
(3) If the X-axis coordinate value is less than 14, determine the Z-axis coordinate. If the Z value is greater than 17, reverse the left motor, and then the left and right motors rotate backward; if the Z value is less than 14, rotate the right motor forward, and then the left and right motors rotate forward; otherwise, the motors do not rotate. The flow of the interrupt handling subroutine is shown in Figure 6.
Figure 6 Interrupt handling subroutine flow[page]
Design Tips
1 Sensor design tips
ET21X111 has the best spectral response to infrared rays, but natural light contains a large amount of infrared rays, so strong natural light will affect the sensor data, causing a large deviation between the output coordinates and the actual coordinates. The solution is to add a filter, but this can only have an attenuation effect. The specific application depends on the situation.
2 Motor Control Circuit Design Techniques
When designing a circuit to control the forward and reverse rotation of a motor, please note that: when the MCU is powered on, the state of the I/O is uncertain, so at the beginning of the program, the two I/Os of Q3 and Q4 must be set to HI (Q3 and Q4 are PNP tubes, if they are NPN tubes, the I/O is set to LOW) to prevent both I/Os from being LOW when powered on, causing Q3 and Q4 to be turned on and form a short circuit. In addition, it should be noted that only one of Q3 and Q4 can be turned on at the same time.
3 MCU Design Tips
When the brushless DC motor starts or rotates, it will generate large power burrs, which is very detrimental to the operation of the MCU, so this LC π-type filter circuit is added, as shown in Figure 7.
Figure 7 Filter circuit
4 Programming skills
When the smart car is running, it needs to read the coordinate data from the sensor while controlling the PWM output of the motor. The sensor will output coordinate data every 12ms, so the best way is to use interrupts to read the sensor data and perform PWM output when there is no data output.
Previous article:Photoelectric Roll Angle Measuring Instrument Based on FPGA/MCU
Next article:Design of a power supply for automobile solenoid valve quality test
Recommended ReadingLatest update time:2024-11-16 21:29
- Popular Resources
- Popular amplifiers
- Wireless Sensor Network Technology and Applications (Edited by Mou Si, Yin Hong, and Su Xing)
- Modern Electronic Technology Training Course (Edited by Yao Youfeng)
- Modern arc welding power supply and its control
- Small AC Servo Motor Control Circuit Design (by Masaru Ishijima; translated by Xue Liang and Zhu Jianjun, by Masaru Ishijima, Xue Liang, and Zhu Jianjun)
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Seizing the Opportunities in the Chinese Application Market: NI's Challenges and Answers
- Tektronix Launches Breakthrough Power Measurement Tools to Accelerate Innovation as Global Electrification Accelerates
- Not all oscilloscopes are created equal: Why ADCs and low noise floor matter
- Enable TekHSI high-speed interface function to accelerate the remote transmission of waveform data
- How to measure the quality of soft start thyristor
- How to use a multimeter to judge whether a soft starter is good or bad
- What are the advantages and disadvantages of non-contact temperature sensors?
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Exploring the source of the MSP430F5529 default clock frequency (1.05MHz)
- [Lazy self-care fish tank control system] Handling auth errors in ON Semiconductor IDE environment
- Practical Tips | Priority Inversion Problems in RTOS Applications
- Useful information | Four major development skills for microcontrollers!
- ESP32 test using 128G TF card
- 【TI mmWave Radar Review】+Configuration File Test (I)
- ST MEMS Creative Competition Post 5 - Finite State Machine Learning (FSM)
- AC/DC voltage and current signal ADC acquisition
- EEWORLD University Hall----Microelectronic Devices and IC Design (Huazhong University of Science and Technology)
- Looking for QFN32/LQFP128 package PCB parts library