Development of photoelectric balanced car based on the linear CCD sensor

. The smart car is designed based on Freescale’s MC9S12XS128 and a linear CCD camera. The linear CCD collects the road information and sends it to MCU through the operational amplifier. The PID control algorithm, the proportional – integral – derivative control algorithm, is adopted synthetically to control the smart car. First, the smart car’s inclination and angular velocity are detect through the accelerometers and gyro sens ors, then the PD control algorithm, the proportional – derivative control algorithm, is employed to make the smart car have the ability of two-wheeled self-balancing. Second, the speed of wheel obtained by the encoder is fed back to the MCU by way of pulse signal, then the PI control algorithm, the proportional – integral control algorithm, is employed to make the speed of smart car reach the set point in the shortest possible time and stabilize at the set point. Finally, the PD control algorithm is used to reg ulate the smart car’s turning angle to make the smart car respond quickly while the smart car is passing the curve path. The smart car can realize the self-balancing control of two wheels and track automatically the black and while lines to march.


Introduction
Self balancing car is an unstable and non linear system. Conventional control techniques have been widely used in the self balancing car. However, these techniques require the complete mathematical model. The paper presents the photoelectric balanced car based on the linear CCD sensor without building the mathematical model of the system.

The design of hardware circuit and proof 2.1 Choice of tracking sensor module
From the Table 1, CCD has advantages in the amount of information, light adaptability, useful perspective, complexity of circuit design, difficulty of debugging and cost performance. Option 3 is selected, namely the CCD is selected.

Choice of main controller
Option 1: A STC89C51 MCU is adopted as the main controller. The advantages are that its cost performance is high and its low demand to the programmer. The disadvantages are that its function is weak in Multitasking or high speed project Option 2: A high-performance MCU such as MC9S12XS128 is adopted as the main controller.
The MC9S12XS128 MCU is an ultralow power 16-bit MCU with more ordinary I/O port, multichannel PWM module, multichannel A/D module, TIM module and serial communication module Comparing with STC89C51 MCU, MC9S12XS128 has obvious advantages in the operability and functions. Option2 is selected, namely the MC9S12XS128 is adopted as the main controller.

Choice of power supply
The design of power supply mainly involved in this is a regulated power supply. The leading indicator of regulated power supply is the stability of the output.
Power supply is a priority in the design of power supply can meet the requirements of voltage and current, the second is the efficiency. In this design in addition to the motor driver is larger, the current provided directly by the battery, other modules require all current is small, the general voltage chip can meet the requirements. The power of this design needs to include 3.3V, 5V, and 7.2V power distribution planning schemes as shown in

Choice of 3.3 V-voltage regulator systems
Option 1: The low dropout voltage regulator of LM1117 is selected to stable voltage.LM1117 is linear regulator chip, had the characteristics of low pressure differential, small ripple, whose peripheral as long as after several capacitance can meet the constant voltage output. Circuit is shown in Figure 2. Option 2: Choose a switching chip of LM2576. LM2576 type is switching power supply voltage chip, and has high efficiency. But the output ripple of LM2576 is larger than LM1117, and LM2576's demand of PCB writing is higher. What's more, circuit is complex, as shown in Figure 3. Because the power supply is to power a gyroscope and accelerometer, the stability of two sensor outputs has great effect on the upright controlling of the car. In order to ensure the stable output of sensor, so we choose the scheme, which is designed by LM1117-3.3V-voltage regulator chip.

Choice of 5 V-voltage regulator systems
Option 1: Choose LM7805-linear regulator chip.LM7805 just need a few peripheral devices to constitute a stable voltage stabilizing belt. Its' device has protection circuit of over-current, overheat and the compensating pipe in the design, but the difference between the input and output is big what LM7805 needs. The input needs voltage which is greater than 7.5V to have a more stable output. Circuit is shown in Figure 4. Option 2: Choose LM2940-linear regulator chip. LM2940 is the power supply of low dropout linear regulator. Its' characteristic is that the difference between input and output is low, and the input voltage is from 7V to 26V. Inside the chip has static current to reduce the circuit, at the same time with current limit, limiting of heat, meter and insert, and other functions. LM2940's distribution of pin with upright packaging is as the same as LM7805's distribution of pin, and the peripheral circuit can also be the same. Circuit is shown in Figure 4.
Option 3: Choose TPS7350-linear regulator chip. TPS7350 is the low dropout linear regulator chip with micro power consumption, it has characteristics of high precision of output voltage, low output noise and low pressure differential, and the input voltage can below 5.33V, but it costs higher than the first two schemes. The circuit diagram is shown in Figure 5. Considering the battery voltage is 7.2V, LM7805 is difficult to meet the requirements, it has very good reflecting in the process of testing. When the battery voltage falls to around 7.4 V, the battery internal resistance will be larger, voltage's output is unstable, especially in the intelligent vehicle, the effect is not ideal. TPS7350 has the very good effect, stable output, but considering the factor of cost, last 5 v regulated power system are adopted LM2940 voltage regulator, achieving the desired effect.

Choice of 7.2V-power supply system
The voltage of 7.2V is the battery voltage, in principle, the bigger voltage the motor supplies, can the speed of output rotational be faster, the stronger the motivation will be, therefore, battery provides directly power to drive motor.

Choice of motor driver
Option 1: The integrated chip such as MC33886 is selected. The advantages are that its technology is mature. It has a good performance on the motor control. It has perfect over-current, under-voltage, over-temperature protection, and other functions. But we must parallel slices MC33886 in order to decrease the larger internal resistance.
Option 2: The integrated chip such as BTS7960 is selected to set up the full bridge converter. The advantages are that its internal resistance is far less than MC33886, so it can produce less heat when Motor current is larger.
Option 3: The full bridge driver is set up through the MOS tube. The advantages are that the price is cheap, the structure is simple and it is easy to control. However, the output current of the transistor are smaller, so the drive capability is limited. Because it is discrete component, its stability can't be guaranteed and its volume is larger. As a result, option 3 is selected, namely the MOS tube is selected.

Choice of the acceleration and the gyroscope module
Option 1: Direct read is that sensor outputs analog signal directly and then apply MCU's analog-to-digital conversion module to read.
Option 2: Indirect reading requires indirect access to get each direction of the acceleration information through sequential control and the MCU processing.
As a result, option 1 is selected, namely the direct read is selected. Because direct analog output chip has the advantages is that information can be read easily and code can be controlled well. At the same time, programmers will meet great difficulties in code design.

Choice of velocity measurement module
Option 1: The photoelectric encoder is selected to measure the speed. It has low cost and convenient installation. Because of the manufacturing process, its precision is not high and it is unable to obtain high precision speed signals, and the signals are greatly influenced by the environment.
Option 2: The optical-electricity encoder is selected to measure the speed. Although it has high cost, its precision is higher than the photoelectric encoder. Therefore, option 2 is selected, namely the opticalelectricity encoder is selected to measure speed.

Software design
The software design of system is shown in Figure 6.

Experimental data and analysis
To verify the results of self-balancing control, the upright test, the speed test, the direction test and the comprehensive test are carried out.

Upright test
From the Table 2, the befitting P parameter is in the vicinity of 7.0. Therefore, P parameter is set as 7.3. There is a slight oscillation phenomenon, when parameter P=7.3. The oscillation phenomenon means that the car swings back and forth. The slight oscillation phenomenon can be inhibited when the D parameter is adjusted.

Speed Test
Captions should be typed in 9-point Times. They should be centred above the tables and flush left beneath the figures.

Direction Test
Please refer to Table 6.

Conclusions
Through the above test, the photoelectric balanced car based on the linear CCD sensor has the following functions. It can reach two-wheeled self-balancing, march at a given speed, and turn on a bend smoothly. Marching at a given speed takes advantage of the negative feedback mechanism. The left and right motor speed is changed when the linear CCD sensor detects the deviation from the track in order to turn on a bend smoothly. So the photoelectric balanced car can realize the self-balancing control of two wheels and track automatically the black and while lines to march.

Future works
It is difficult to provide a farther forward for the linear CCD sensor because the linear CCD sensor is extremely sensitive to external environment, but the farther forward is important to a Freescale smart car. As for the laser sensor, the biggest characteristic is to provide a further perspective, and it has strong ability to adapt to the environment.