Auto Target Tracking Robot Design Based on Smartphone

Auto Target Tracking Robot Design Based on Smartphone

Shuen-De Wu1,* and Kei-Siang You1

1 Department of Mechatronic Engineering, National Taiwan Normal University, Taipei 10610, Taiwan

(Received 15 October 2015; Accepted 26 November 2015; Published on line 1 March 2016)
*Corresponding author:
DOI: 10.5875/ausmt.v6i1.1044

Abstract: This paper describes a robot tracking control design based on a smartphone using a commercial microprocessor. The system hardware consists of four major parts: an Android smartphone with an embedded camera, a Microchip microprocessor, a motor driver circuit and an Attacknid robot. First, an image of the surrounding environment is captured by the high definition camera embedded in the smartphone. The target is then recognized from the image using an algorithm developed in Android OS and OpenCV library. Third, motion control and laser activation strategies are achieved using the proposed algorithm implemented in Java. Fourth, the motion commands are delivered to the microchip processor through a USB interface. Finally, the processor produces a pulse width modulation (PWM) voltage to control the robot’s motion and activate the laser diode according commands sent from the smart phone. Experimental results demonstrate the feasibility of this proposed architecture.

Keywords: Robot, tracking control, smartphone, openCV, microchip


Smartphones have increased the ease with which people access information. Many of these devices run Android, an open source platform developed by Google [1]. Android software development kits (SDKs) allow developers to easily create new applications for use on the Android platform [2]-[3]. Most of Android smartphones are equipped with at least one camera, wireless communication interfaces (e.g., WiFi, Bluetooth, 3G/4G), a USB interface, a GPS receiver, an LCD/LED display, and various sensors. All of these devices can be accessed or controlled through the Android SDK and the obtained data can be used in applications. These features, combined with the relatively low cost of such phones has led the development of several smartphone-based robot controllers [4]-[9].

The present work describes a robot system designed with moving-target tracking ability which integrates an Android smartphone, a Microchip PIC24 microprocessor unit (MCU) [10], a high power laser pointer and a spider robot named Attacknid designed by COMBAT CREATURES [11]. Environment images are captured using the smartphone’s embedded camera. A moving target is then recognized in and extracted from the captured images using applications based on Android packages and the OpenCV library [12]. Robot movement strategies were designed based on the target’s location and size in the captured images. Control commands are sent to the MCU via USB interface. The MCU then generates pulse width modulation (PWM) voltages to control the motors to move the spider robot. To provide enough current to drive the motor, a motor driver circuit based on TA7257P was designed [13]. When the robot locks on the moving target, it activates a high power laser pointer to destroy the target. Figure 1 illustrates the proposed robot system. In this study, the moving target tracked by the robot is a balloon. A video was produced to depict the robot functions and is available on Youtube [14].

This remainder of paper is organized as follows: a brief introduction to our robot systems is given in section two; in section three we present the remodel procedures of the Attacknid robot; the tracking strategies are presented in section four; and section five provides concluding remarks.

System Structure

Robot Overview

Figure 2 depicts the robot’s architecture. The system's tracking procedures can be briefly described as follows:

  1. A camera embedded in the smartphone captures a high definition, real time picture of robot's environment. The color of selected target is then set using an application developed in the Android SDK.
  2. The target is recognized and extracted from the picture using an algorithm developed based on the Android OS and the OpenCV library. Robot movement strategies are then designed according to the location and size of the target in the images.
  3. Control commands are transmitted to the Microchip MCU via the USB interface. The MCU generates pulse width modulation (PWM) signals to control the motors according to the control commands.
  4. The PWM signals are fed into a TA7257P based motor driver circuit to drive the robot's motors.
  5. The robot locks onto the moving target and destroys it with a high power laser pointer.

The following subsections provide detailed descriptions of the relevant hardware and software.

Android Smartphone

New mechatronic systems increasingly involve interaction between smartphone and peripheral devices such as motors and sensors. The Linux-based, open source Android operating system allows programmers to develop software in Java using Android SDKs. The most popular SDKs are Android Studio powered by Google and Eclipse IDE powered by Eclipse Foundation. Using the function libraries provided in these SDKs, the developer can easily access Android smartphone functions such as image capture, video recording, multi-threading, GPS positioning and audio processing. Android smartphones can connect to other devices via various communication interfaces such as WiFi, Bluetooth, 3G/4G and USB. Furthermore, Android smartphone are relatively low cost. These characteristics make such devices a good candidate for the development of consumer-oriented robots.

In this study, we use a Sony Xperia Android smartphone to capture environment images, locate a target within the environment and formulate movement strategies. These functions can be processed in real time due to the powerful CPU embedded in the smartphone. Detailed information on the smartphone is presented in Table 1.

Microchip MCU

The movement of a Combat Creatures Attacknid robot is controlled by three DC motors. Such motors are usually controlled by a PWM signal, which cannot be produced by a smartphone. Therefore, an MCU with 6 PWM output pins is needed. In addition, this MCU should be easily integrated with the Android OS. The Microchip PIC24F Accessory Development Start Kit [15] for Android was used for this task. As shown in Fig. 3, this kit is a standalone board used for evaluating and developing electronic accessories for Android smartphones and tablets. Applications for the Microchip PIC24F MCU are developed based on the MPLab X IDE [16].

PWM is a technique used to encode an analogue signal as a pulsing signal. It is usually used to control the power supplied to DC motors. Two PWM signals are needed to control a motor’s speed and rotation direction (CW/CCW). As previously mentioned, an Attacknid robot has three DC motors, thus, six PWM outputs are needed. Figure 4 presents the pin assignments of the PIC24F MCU.

In the PIC24F, the PWM signal is controlled by internal registers and comparators. The frequency and duty cycle of a PWM signal is controlled by the internal timer of the PIC24F MCU. Figure 5 shows the flow of the controller’s register, comparator and internal timer. Figure 6 illustrates the frequency controlling method with the timer.

The robot movement strategy is devised using Android applications. The movement strategy is bundled into a command packet and sent to the MCU via USB communication protocols. Thereafter, the MCU decodes the command and generates the corresponding PWM signals to control the robot’s movement. The software and firmware used to achieve communication between the Android applications and the Microchip MCU was developed using the Microchip Accessory Framework for Android [17]

Motor Driver Circuit

The current of the PWM signal output pin for the PIC24F MCU is too small to drive the robot’s DC motors, thus necessitating the use of a motor driver circuit. A motor driver is a small current amplifier used to convert a low-current control signal into a higher-current signal that can drive a motor. In this study, the motor driver is implemented based on Toshiba’s TA7257P [17]. The TA7257P IC is a full bridge driver rotation controller for DC motors, providing four operation modes including forward rotation, reverse rotation, stop and brake. Servo control is applicable because the operation supply voltage terminal and motor driving supply voltage terminal are independent. Figure 7 shows the connection of the PIC24F MCU and the TA7257P motor driver IC. The TA7257P IC has two input pins to receive PWM control signals and two output pins to control the DC motor. Therefore, three TA7257P components are needed for the robot system’s motor driver circuits.

The start and operating currents for the robot’s DC motors were determined experimentally (see Table 2)

Attacknid Robot

Combat Creature’s Attacknid robot is a low-cost consumer robot that has an impressively long battery life. The robot features six legs and two DC motors to control its movement on the ground. Another DC motor is used to drive its “weapons” devices. Movement is controlled by a 2.4GHz remote controller. Figure 8 shows the robot’s outward appearance [19].

Re-modeling of the Attacknid Robot


The Attacknid robot is controlled using a 2.4GHz remote control. This study designs an autonomous target tracking robot based on computer vision. This required the disassembly and re-modeling of the Attacknid robot. Roughly speaking, the Attacknid consists of the following modules:

  1. A horizontal and vertical movement mechanism;
  2. weapon devices;
  3. a PCB board for the 2.4GHz remote control and motor controllers/drivers;
  4. AA size battery holders.

This study is primarily interested in the Attacknid’s movement. In the Attacknid, the two DC motors rotate on two separate gearboxes. The horizontally-opposed motor and gearbox handles forward/backward movement while the vertically-opposed motor provides direction through its own gearbox running around an annulus or ring gear that forms part of the head shell. The movement mechanism is simple and useful for our robot system. Other modules including weapons devices, a PCB board and battery holders were removed from the Attacknid robot.

Achieving our design goal requires adding electronic devices and mechanical modules into the robot. These include:

  1. a smartphone;
  2. a smartphone holder;
  3. a Microchip PIC24F Accessory Development Start Kit;
  4. a motor driver circuit;
  5. a 9V battery socket;
  6. a high power laser pointer.

The functionality of the smartphone, Microchip MCU and motor driver circuit are covered in section 2. The voltage level for the power supply of the motor driver IC, TA7257P, is 9V. Therefore, the original AA batteries are replaced with two 9V batteries. We removed the original weapon devices and mounted a smartphone phone holder. Figures 9 and 10 show the robot equipped with the new modules. The high power laser pointer is weapon used by the robot to destroy the target. After mounting the smartphone to the robot, we found it was too heavy for the motor, thus restricting vertical target tracking. Therefore, we added a metal counterweight on the rear to allow the motor to operate normally (see Fig. 11). Adding a metal counterweight to adjust the gravity center will significantly increase the robot’s weight. We will overcome the drawback in future designs. The re-modeled Attacknid robot is shown in Fig. 1.

Implementation of Tracking Strategies

In this study, the robot's autonomous target tracking ability was achieved using computer vision. Figure 12 shows the target tracking strategy flow, where x and y are the horizontal and vertical axes of the image captured by the smartphone. The distance determination was based on the change of target size in the captured image. Three degrees of freedom are detected and tracked simultaneously. The movement strategies can be determined according to the pictures captured by the smartphone camera before and after movements.

The user can select the target in the environment from the captured image through an Android application which also calibrates and activates the high power laser pointer. Figure 13 shows the user interface. The tracking strategies presented in Fig. 12 were implemented in Java using the Android SDK and OpenCV library. A target searching algorithm for the robot was also designed to track the target as it moves out of the camera’s field of view.


In this study, we re-modeled an Attacknid robot to enable it to autonomously track moving targets using an Android smartphone. Experiments verify the targeting performance, suggesting new directions for potential robot development based on Android smartphones.


This work was supported by the National Science Council, R.O.C., under Grants NSC 104-2221-E-003 -003.


  1. Android, "Android Developers Website,"
  2. Eclipse, "Eclipse Integrat00(IDE) Website,"
  3. Android Studio Overview, "Android Studio Website,"
  4. S. W. Moon, Y. J. Kim, H. J. Myeong, C. S. Kim, N. J. Cha, and D.H. Kim, "Implementation of smartphone environment remote control and monitoring system for Android operating system-based robot platform," URAI, 2011 8th International Conference on IEEE, pp. 211-214., Nov. 2011.
    doi: 10.1109/URAI.2011.6145963
  5. N. Oros and J. Krichmar, "Smartphone Based Robotics: Powerful, Flexible and Inexpensive Robots for Hobbyists, Educators, Students and Researchers," IEEE Robotics & Automation Magazine, 2013.
  6. X. Lu, W. Liu, H. Wang, and Q. Sun, "Robot control design based on smartphone," CCDC, 2013 25th Chinese. IEEE pp. 2820-2823, May.2013.
    doi: 10.1109/CCDC.2013.6561425
  7. K. Ono and H. Ogawa, "Personal Robot Using Android Smartphone," Procedia Technology, vol.18, pp.37-41, 2014.
    doi: 10.1016/j.protcy.2014.11.009
  8. M. K. Pathak, J. Khan, A. Koul, R. Kalane, and R. Varshney "Robot Control Design Using Android Smartphone," Journal of Business Management & Economics, 3(2), pp.31-33 ,2015.
    doi: 10.15520/jbme.2015.vol3.iss2.19.pp31-33
  9. D. Lorenčík, P. Sinčák, M. Marek, and J. Tušan, "Smartphone Robots," Robotics and Intelligent Systems, Emergent Trends, Springer International Publishing, pp. 137-143, 2015.
    doi: 10.1007/978-3-319-10783-7_15
  10. Microchip PIC24 MCU, 16-bit PIC24 MCUs, Microchip Technology Inc,
  11. Official Website of the attacknids,
  12. OpenCV, "OpenCV Official Site - OpenCV for Android,"
  13. TOSHIBA TA7257P datasheet, Toshiba, Aug. 2001.
  14. Video for Experimental Demo, Dec. 2014.
  15. PIC24F Accessory Development Starter Kit for Android,
  16. MPLAB X IDE,
  17. Microchip's Accessory Framework for Android(tm)
  18. Toshiba TA7257P


  • There are currently no refbacks.

Copyright © 2011-2018 AUSMT ISSN: 2223-9766