Proceedings of 2012 4th International Conference on Machine Learning and Computing IPCSIT vol. 25 (2012) © (2012) IACSIT Press, Singapore Design of a Smart Car based on Wireless Image Acquisition Technology FAN Yuezhen +, ZHENG Fu, DING Feng and QIAN Hua School of Technology, Beijing Forestry University, Beijing 100083, China Abstract. Design of a smart car based on wireless image acquisition technology is introduced. The smart car is controlled by MCU MC9S12DG128. It receives control commands to carry a camera to different sites to capture images. There is a CMOS camera and a ZigBee RF module installed on the smart car. The CMOS camera can obtain static images. Then the acquired image data are stored in MC9S12DG128. And the image data are transferred to a remote monitor on PC through wireless ZigBee RF module based on IEEE 802.15.4/ZigBee protocol. Finally, the smart car can be used to capture and send images of special environments, such as toxic environment and narrow spaces, to a remote monitor center. Keywords: Smart car, CMOS camera, ZigBee, Image acquisition 1. Introduction In recent years, lots of disasters occurred on the earth. But in the rescuing sites, rescuers can’t get access to dangerous environments because of radiation, poisonous gas, or narrow spaces. The Fukushima Daiichi nuclear disaster led to global panic, which is nuclear meltdowns and releases of radioactive materials at the Fukushima I Nuclear Power Plant, following the Tohoku earthquake and tsunami on 11 March 2011. At that time, rescuers could not get close to the disaster site in fear of the nuclear radiation. To solve the problem, a smart car based on wireless image acquisition technology was constructed. It can be used to acquire and send images of special environments though wireless ZigBee network to a remote monitor center. 2. System Analysis The wireless image acquisition system is composed of several parts. The main controller is based on Freescale MC9S12DG128 [1], which is a 16-bit micro controller and has enough peripherals, such as PWM, UART and so on. A keyboard is connected as the I/O device. A PWM module output to the servo to control the direction of front-wheel. Another PWM module is outputted to the MC33886 driver to drive the DC motor at the rear-wheel. The photoelectric encoder installed in the rear-wheel is used to measure the velocity for a feedback control [2, 3]. There is a CMOS camera OV7620 controlled by OV529, capturing pictures. The wireless ZigBee module CC2530, connected to the UART interface of the MCU, is used to send image data to the remote monitor and receive commands from it. The interconnection among these modules is shown in Figure 1. + Corresponding author. Tel.: +86-010-62336221. E-mail address: fanyuezhen@163.com. 194 Fig. 1: The structure of the wireless image acquisition system 3. Hardware Design In order to complete the system’s function, hardware circuits for CMOS camera [4], ZigBee RF module and smart car was designed. 3.1. CMOS Camera The image sensor module for our platform is OmniVision OV7620 combined with embedded DSP OV529. The OV7620 image sensor is a low voltage CMOS sensor that provides the full functionality of a single-chip VGA camera and image processor, as shown in Figure 2. The OV7620 provides full-frame, subsampled or windowed 8-bit images in a wide range of formats, operating at up to 30 frames per second (fps), controlled through the Serial Camera Control Bus (SCCB) interface [5]. The OV529 Serial Bridge contains an Embedded JPEC CODEC and controller chip that can compress and transfer image data from the Camera Sensor to an external device [6]. The OV529 performs all imaging function like white balance, downsizing and compressed image to JPEG format. And the image sensor module connects with the processor through UART. U9 D[0..15] R17 10K AGCEN3 +5V SVDD 1 AVDD 8 14 44 DVDD 29 32 +3.3V 48 6 7 15 43 30 31 C62 0.1uF 5 C63 0.1uF 10 C64 0.1uF 11 13 RESET 2 FREX 4 SBB 12 R18 10K 9 47 27 R19 10K AGCEN/RAMINT SVDD AVDD AVDD AVDD DVDD DOVDD SGND AGND AGND AGND AGND DGND DOGND VREQ VRS VCCHG VTO RESET FREX SBB PWDN MID XCLK1 R20 OV7620 Y2 C65 1 Y0/CBAR Y1/PROG Y2/G2X Y3/RAW Y4/CS1 Y5/SHARP Y6/CS2 Y7/CS0 UV0/GAMDIS UV1/CC656 UV2/QVGA UV3/ECLKO UV4/SLAEN UV5/MIR UV6/BPCLR UV7/B8 PCLK/OUTX2 VSYNC/CSYS FODD/SRAM CHSYNC/BW HREF/VSRAM SIO-1 SIO-0 XCLK2 41 40 39 38 37 36 35 34 26 25 24 23 22 21 20 19 33 16 17 42 18 45 46 28 D0 D1 D2 D3 D4 D5 D6 D7 D8 D9 D10 D11 D12 D13 D14 D15 PCLK VSYNC SRAM CHSYNC HREF SCL SDA 1M 2 6.14MHz 33p C66 33p Fig. 2: The schematic of the CMOS camera 3.2. ZigBee Module A ZigBee transceiver, CC2530, was used as a RF module to communicate with the PC. Thus, the car model can transmit image data to the PC. And the PC also can send control commands to the car model. The 195 CC2530 is a true system-on-chip (SoC) solution for IEEE 802.15.4, Zigbee and RF4CE applications. It enables robust network nodes to be built with low costs. The schematic of CC2530 is shown in Figure 3. 1 744 DCOUPL RBIAS GND 728 2 32 2 L261 2 1 Ind 2N0 1 22 23 40 639 30 747 41 604 21 1 2 1 2 2 P4 R301 56K C401 1U 3 276 X1 736 1 4 32M 738 X2 1 32768 C221 27p 1 2 1 2 C231 27p 1 2 1 2 1 2 1 2 1 2 1 2 1 Header 2 C262 1p 33 CC2530 2 1 C253 000 C331 15p C321 15p P2 VDD Reset P1.2 P2.0 1 3 5 7 9 11 13 15 17 19 2 4 6 8 10 12 14 16 18 20 P0.5 Header 10X2 Fig. 3: The schematic of CC2530 3.3. Motor Driving Module The smart car is driven by a DC motor in the rear-wheel; its direction is controlled by a servo in the front-wheel [7]. To obtain a stable speed of the motor, feedback mechanism PID was used to eliminate environment interference such as non-stable battery voltage and uneven road friction. So an integrated photoelectric encoder was used to get the speed of the motor. The signal is connected to PT7 of the MCU. RS-380SH motor was used. It works at voltage 7.2V and no-load current 0.5A, whose specified rotating speed is 16200 r/min. MC33886 is a monolithic H-Bridge ideal for fractional horsepower DC-motor and bidirectional thrust solenoid control. Two chips of MC33886 are paralleled to drive the motor, which can provide greater driving force. And the MC33886s are controlled by a PWM from the MCU. Changing the duty cycle of the PWM, then the speed of the motor was adjusted [8]. The schematic of the driving circuit is shown in Figure 4. 196 SMA_SMD 5 4 3 2 XSOC32M_Q2 734 2 1 2 1 L251 Ind 000 21 2 1 21 2 C254 2p2 2 1 2 1 XSOC32M_Q1 1 2 1 2 18p C261 1p L252 Ind 2N0 2 1 2 1 P2_3 1 2 1 2 26 724 1 21 18p P2_4 1 2 1 2 25 725 1 C251 12 7321 1 1 RF_N 2 C252 1 RF_P 731 2 P0.4 P0.5 P0.6 P0.7 Reset P2_0 P2_1 P2_2 P1_0 P1_1 P1_2 P1_3 P1_4 P1_5 P1_6 P1_7 P0_0 P0_1 P0_2 P0_3 P0_4 P0_5 P0_6 P0_7 RESET_N C1 2U2 VDD 2 C311 100n P3 21 24 27 28 29 31 1 Header 10X2 36 35 34 11 9 8 7 6 5 38 37 19 18 17 16 15 14 13 12 20 C272 220p 1 P2.0 P2.1 P2.2 P1.0 P1.1 P1.2 P1.3 P1.4 P1.5 P1.6 P1.7 P0.0 P0.1 P0.2 P0.3 P2.1 P2.2 P1.4 P1.5 P1.6 P1.7 C271 100n 2 P1.3 P1.0 AVDD5/AVDD_SOC AVDD3 AVDD2 AVDD1 AVDD4 AVDD_GUARD 2 2 4 6 8 10 12 14 16 18 20 DVDD AVDD_DAEG DGND_USB USB_M USB_P DVDD_USB C241 100n 2 1 3 5 7 9 11 13 15 17 19 U1 C211 100n 1 2 1 2 10 39 1 2 3 4 1 2 1 2 C101 100n P1 P0.4 P0.1 P0.2 P0.3 P0.0 P1.1 P0.6 P0.7 1 2 1 2 1 2 1 2 1 2 1 2 C391 1U L1 1 2 Bead 102 C255 000 Fig. 4: The schematic of the motor driving circuits 4. Software Design To achieve the system, 3 types of specified software were developed. One on CC2530 was the ZigBee protocol stack to communicate between the smart car and the remote controller; one was the smart car control software based on MC9S12DG128; another one was the PC monitor developed with Microsoft MFC. A set of protocol of commands were specified so that the PC monitor and the smart car must obey with it to communicate with each other accurately. 4.1. CC2530 Software In a ZigBee network, there are 3 types of nodes; they are coordinator, router, and end device [9]. Each node can be configured as one of these above. So the node connected to the PC was configured as a coordinator; the one installed on the car was configured as an end device. When powered on, the coordinator set up a ZigBee network, and then the end device enters the established network. Since then, the PC monitor sent commands to the smart car to take pictures or move around; the smart car controlled the camera to take a picture and sent the image data to the PC monitor. As is specified [9], packet size of ZigBee is 127 Bytes; despite for necessary controlling bytes, the payload of each packet is less than 100 bytes. As a result, we separated the image data into 64 bytes per packet to transfer. The flowchart of the wireless communication procedure is shown in Figure 5. Start Abandon cmmand N Coordinator setting up ZigBee network Move command Take picture command End device entering network Set servo angle Send COMS camera command Set motor speed Store the data in memory Communication OK? Y Calculate the packet number Smart car waiting for command from monitor Send the image data Smart car receiving command Fig. 5: The flowchart of the wireless communication procedure 197 4.2. Smart Car Control The car receives the commands through the wireless ZigBee CC2530 module. According to different commands, the car moves can move back and forth, turns around, takes pictures and sends image data. First of all, the length of the servo rod was adjusted to an optimal value. Thus, the servo has the most extent of sensibility. The servo is controlled by PWM. And the servo's rotation is proportional to the pulse width. However, the relationship between the turning radius of the car models and steering angle of the servo is nonlinear [10]. The relationship between them was obtained through lots of experiments, and then the data was plotted in MATLAB, as shown in Figure 6. They were stored in the memory as a table. When the car is set to a specified turning radius, the MCU will search the table for the corresponding PWM duty cycle and outputted it. Traditional PID control strategy was adopted to control the speed of the motor [11]. Compared to openloop control, the PID feedback control can keep the motor maintaining a stable speed. The PID parameters were tuned through lots of experiments. Fig. 6: The relationship between turning radius and servo angle 4.3. PC Monitor Center A monitor program was developed with the Microsoft MFC, as shown in Figure 7(Image Captured in our Lab.). The upper right combo list and button were used to control the COM port; the middle two buttons were used to take and show pictures, acquired by the smart car; the bottom right 4 buttons were used to control the movement of the car. Then the bottom box showed the state of the program dynamically. Because the image is JPEG format, there is a decoder module in the program. Fig. 7: The MFC monitor program 198 5. Conclusions By designing the CMOS camera, wireless ZigBee module and smart car control module, a wireless image acquisition system was developed. In experiments, as the car moved around, it can acquire and send image of its surroundings to the PC monitor to display. 6. Acknowledgements This paper was supported by Chinese Universities Scientific Fund (BJFU-YX2010-8). 7. References [1] Zhuo Qing, Huang Kaisheng, and Shao Beibei, “Learn to make smart cars.” Press of Beijing University of Aeronautics and Astronautics,2007. [2] G. Yue-hua, "Design of Autonomous Tracing System in Intelligent Vehicle Based on Infrared Photoelectric Sensor," Semiconductor Optoelectronics, vol. 1, 2009. [3] X. W. Hao and H. F. Sun, "Tracking Control Algorithm Based on Photoelectric Sensors for Smart Car System," Iccsse 2009: Proceedings of 2009 4th International Conference on Computer Science & Education, pp. 587-591, 2009. [4] T. Schweers, "Smart hyper - a hybrid concept-car with high innovative potential," Vehicle Concepts for the 2nd Century of Automotive Technology, vol. 1653, pp. 243-254, 2001. [5] Z. H. Wang and Y. Y. Ye, "Image Recognition Technology and Optimized Control Algorithm of the Self-tracing Smart Car Based on CMOS Camera Sensor," Icems 2008: Proceedings of the 11th International Conference on Electrical Machines and Systems, Vols 1- 8, pp. 2096-2101, 2008. [6] X. Q. Wang, et al., "Route Identification and Direction Control of Smart Car Based on CMOS Image Sensor," 2008 Isecs International Colloquium on Computing, Communication, Control, and Management, Vol 2, Proceedings, pp. 176-179, 2008. [7] P. K. Chang, et al., "Integrated smart car navigation and voice control system design," Iecon 2006 - 32nd Annual Conference on Ieee Industrial Electronics, Vols 1-11, pp. 23-28, 2006. [8] M. F. Wang and Z. J. Jiang, "The Design and Comparison of DC Motor Drive Circuit in Smart Car Competition," 2009 Ieee International Conference on Intelligent Computing and Intelligent Systems, Proceedings, Vol 2, pp. 325-328, 2009. [9] ZigBee Alliance. ZigBee Specification.ZigBee Document 053474r07, Version1.1, September5th, 2005. [10] S. H. Ma and W. Li, "Non-linear PID Control Method with Feed-forward in Smart Car," Ccdc 2009: 21st Chinese Control and Decision Conference, Vols 1-6, Proceedings, pp. 462-465, 2009. [11] Z. L. Lu, et al., "Intelligent Control Research based on the Smart Car," 2nd IEEE International Conference on Advanced Computer Control (Icacc 2010), Vol. 2, pp. 292-297, 2010. 199