1 Introduction
Intelligent mobile robots integrate research achievements from multiple disciplines such as mechanics, electronics , computer science, automatic control, and artificial intelligence, holding a prominent position in the current field of robotics research. The control system is the core component of a robot. Currently, the microcontrollers used in the underlying control systems of robots are mainly of two types: 8/16-bit microcontrollers and digital signal processors (DSPs). However, 8/16-bit microcontrollers have low data processing capabilities, large hardware circuits, and weak system stability. DSPs were originally designed for digital signal processing. In comparison, embedded microprocessors (ARMs) have almost the same internal resources and processing speed, but their control performance is superior to DSPs. Moreover, many ARM devices support the TCP/IP protocol, which is beneficial for future network control of robots. Considering the above factors, this paper proposes an intelligent wheeled mobile robot control system based on ARM and complex programmable logic devices (CPLDs) to realize the underlying control of the mobile robot.
2. System Composition and Working Principle
The mechanical navigation structure of the wheeled mobile robot designed in this system adopts a four-wheel differential steering mechanical mechanism. The two front wheels are follower wheels, which play a supporting role, while the two rear wheels are drive wheels, driven by two synchronous motors. The rotation speed of the two drive wheels is controlled separately, which allows the robot to move in different directions and speeds, making it flexible and controllable.
The mobile robot uses a PC as its host computer and a camera to analyze its own position and the external environment, creating an environmental map and planning its path. The host computer sends motion control commands to the robot's underlying control system, providing the theoretical speed values for the left and right drive motors. The robot control system, based on ARM and CPLD, communicates with the host computer via a wireless transceiver module. It controls the motor operation and the transmission and reception of the ultrasonic sensor array according to the host computer's commands; and makes obstacle avoidance decisions based on obstacle information.
3 Control System Hardware Design
3.1 Main Control Module Design
The core controller of this intelligent wheeled mobile robot control system uses the Samsung S3C44B0X, a 32-bit microprocessor based on the ARM7TDMI core (suitable for real-time environments). It features high-speed computing power, an A/D converter, abundant I/O ports, and interrupts, facilitating motor control, sensor information processing, external communication, and complex control algorithms. The system uses a CPLD as a coprocessor, providing programmable pulse generation circuits, photoelectric encoder input circuits, and ultrasonic sensor input circuits. Here, the Altera MAXⅡ series EPM1270 device is selected. This system design fully utilizes the high-speed logic processing capabilities of the CPLD, allowing the main controller (ARM) to only set control parameters. This reduces the burden on the main controller, improves the system's real-time performance, and also reduces peripheral hardware circuitry, enhancing the stability and reconfigurability of the control system.
The ARM and CPLD are connected via a parallel bus, which includes the ARM device's address, data, control, and multiplexed programmable I/O buses. The ARM controls the CPLD by accessing specific addresses and I/O ports, while the CPLD sends interrupt requests to the ARM through programmable I/O ports.
3.2 Design of Motor Control and Drive Module
The two drive wheels of the wheeled mobile robot are controlled by two separate drive motors, enabling the robot to move in different directions and at different speeds. The performance requirements for wheeled mobile robots necessitate high motor torque and low pulsation. The drive motors exhibit good performance at high, medium, and low speeds and have a simple control method; therefore, square-wave driven AC permanent magnet synchronous motors are selected. These motors operate with electronic commutation based on rotor position feedback information, and the motor speed is proportional to the frequency of the drive signal. They combine the advantages of AC motors (simple structure, reliable operation, and easy maintenance) with the advantages of DC motors (good dynamic characteristics and excellent speed regulation performance).
The system uses a CPLD and external drive devices to form the control circuit. It employs square wave drive and positioning control (power-on state control) to control two permanent magnet synchronous motors, achieving adjustable and precise speed and position control in a compact structure. Since the control principles for both motors are the same, only one is described here.
The motor control circuit in the CPLD consists of a frequency divider circuit, a speed control circuit, and a phase sequence distribution circuit. The frequency divider circuit is constructed using a frequency divider; the speed control circuit utilizes the arithmetic operation module `lpm_counter` from the LPM macrocell library of MAX+PLUSⅡ to construct a presettable 5-bit down counter. Based on the desired speed, a preset number is set. The counter decrements the `clk` pulse signal output from the frequency divider circuit until it reaches zero, outputting a borrow pulse. The preset number is then loaded again for further decrementing. This borrow pulse `cout` is used as the output pulse of the speed control circuit. The frequency range of the `cout` borrow pulse is `fclk/1` to `fclk/31`, thus introducing a speed control factor (preset number) with a step size of 1. The speed of the motor can be adjusted by continuously adjusting the frequency of the pulse signal from 1 to 31 times by changing the speed regulation factor. The phase sequence distribution circuit uses the cout borrow pulse as input and uses two D flip-flops and gate circuits to output four square wave pulses with a 90° phase difference as control signals for the two-phase synchronous motor. The stop signal controls the start and stop of the motor. The dir signal controls the direction of the motor. When rotating forward, the phase voltage uCD leads uAB by 90°. When rotating in reverse, uAB leads uCD by 90°. The frequency of each phase signal is 1/4 of the cout pulse frequency.
Simulation results verified the correctness of the design logic.
The external driver uses the L298 dual H-bridge high-voltage, high-current power integrated circuit. It outputs the 4-phase square wave signal generated by the pulse transformer circuit to the inputs IN1-IN4 of the L298 via a 74LS245 bus transceiver, controlling the switching on and off of the H-bridge to cause the motor to rotate forward, reverse, or stop. To prevent damage to the L298 from feedback voltage during motor start-up and shutdown, eight diodes are added between the L298 output and the motor for power-off freewheeling protection.
To improve motor control performance and achieve more precise and stable motion control of the robot, motor speed information is needed as a feedback loop for motor control. This system uses incremental photoelectric encoders for speed detection. Two photoelectric encoders are coaxially connected to two motors respectively. A CPLD, in conjunction with an ARM device, implements variable pulse number/pulse period speed measurement, i.e., variable M/T speed measurement, sampling the motor speed periodically. The difference between the sampled speed and the speed set by the host computer is transmitted to the PID controller, thus achieving closed-loop control of the motor speed.
3.3 Ultrasonic Sensing Module
Obstacle avoidance is a fundamental function of intelligent mobile robots, and the primary task of obstacle avoidance is to determine the location of obstacles. Path planning implemented by a PC based on the robot's vision system is easily affected by factors such as the intensity of light in the field of view and the background color. To address this issue, the robot uses ultrasonic sensors for ranging in its microcontroller control system to detect and locate obstacles.
The ultrasonic ranging method employs time-of-flight ranging, which calculates the distance between the robot and the obstacle using the time *t* from the emission of the ultrasonic wave by the generator to the reception of the reflected wave by the receiver after encountering an obstacle, and the speed of sound in air *v* (*v = 331.4(1+T/273)¹/² m/s; T is the temperature in Celsius). The module uses three pairs of ultrasonic transducers, positioned at the robot's front, left front, and right front. The ARM sends a control signal to start an internal timer. This control signal, after power amplification, serves as the start signal for the ultrasonic sensor drive circuit. The high-frequency oscillation signal returned by the ultrasonic sensor upon encountering an obstacle is amplified and transmitted through the receiving circuit to trigger an external interrupt on the ARM. The interrupt routine retrieves the timer count and calculates the distance.
4. Control System Software Design
4.1 Embedded Operating System
The intelligent wheeled mobile robot is a typical real-time multi-tasking system. Traditional single-task sequential execution mechanisms cannot meet the real-time requirements of this system design, and their reliability is low for complex systems. Therefore, the real-time operating system μC/OS-II was chosen. μC/OS-II is an open-source, portable, firmware-enabled, and customizable embedded operating system with features such as small code size, the ability to utilize a real-time kernel, multiple tasks, deterministic execution time, and stable and reliable operation. μC/OS-II was ported to the S3C44B0X, and the operating system was customized to save storage space.
A multi-tasking system based on a real-time kernel can be divided into a system layer and an application layer. The system layer consists of the kernel and driver libraries; the application layer includes all the code used to achieve the robot's task objectives. In the application layer programming of this system software, the robot's tasks are decomposed into multiple user tasks such as communication, information acquisition, and motor control. The embedded operating system μC/OS-II manages and schedules the task modules, coordinating the operation of various robot tasks to ensure the system's real-time performance and reliability.
4.2 Motion Control Algorithm
To ensure the stability and accuracy of the mobile robot's movement, and to enable the system to respond quickly and with small overshoot when controlling the robot's forward, backward, turning, and braking actions, the system employs an integral separation PID control algorithm during motor control.
5 Conclusion
This paper proposes an intelligent wheeled mobile robot control system based on ARM and CPLD. This scheme fully utilizes the internal resources of ARM and CPLD, combining the advantages of ARM microcontrollers (small size, high processing speed) with the high-speed logic processing capabilities, flexible scalability, and reconfigurability of CPLDs. Software and hardware debugging and operational experiments demonstrate that the system offers flexible control, good real-time performance, and high reliability, meeting the control requirements of intelligent wheeled mobile robots. This intelligent wheeled mobile robot control system can be used in various mobile robot control systems, exhibiting broad applicability, high cost-effectiveness, and strong practical value.