Android smartphones are undoubtedly the most popular gadgets these days. You will find various apps on the Internet that exploit inbuilt hardware in these mobile phones, such as Bluetooth and Wi-Fi, to control other devices. Presented here is a robot that can be controlled using an app running on an Android phone. The control commands are sent via Bluetooth and the robot has such features as:
1. It can be controlled from Android smartphones by touch or voice commands
2. The speed of the robot can also be controlled
3. The robot will sense and inform to the phone its distance from the nearest obstacle
4. It will also send information about the direction in which it is moving
Fig. 1 shows the author’s prototype of the robot and Fig. 2 shows the app running on an Android phone to control the robot.
Circuit and working
Fig. 3 shows circuit diagram of the Android phone-controlled robot. The circuit is built around an Arduino UNO board (BOARD1), ultrasonic transceiver module HC-SR04, Bluetooth module JY MCU BT, motor driver L293D (IC1), DC motors M1 and M2, and a few common components.
The circuit uses two 9V batteries—one to power the Arduino board and the other to power the motors, as shown in Fig. 3. Regulated 5V supply for rest of the circuit is provided by the Arduino board itself. LED on the board indicates presence of power supply.
Bluetooth module. Bluetooth module JY MCU BT used in the project can be connected to any device, via built-in UART interface, to communicate with other Bluetooth-enabled devices such as mobile phones, handheld computers and laptops. The module runs on a 3.6V to 6V supply. Fig. 4 shows a picture of the Bluetooth module.
Ultrasonic transceiver module. Ultrasonic transceiver module HC-SR04 uses sonar, like bats and dolphins, to determine distance to an object. It offers excellent non-contact range-detection of 2cm to 400cm with high accuracy and stable readings in an easy-to-use package. It comes complete with an ultrasonic transmitter and a receiver module. Fig. 5 shows the ultrasonic transceiver module.
To start the measurement of distance, pin 2 (TRIG) of the module should receive a high pulse for at least ten microseconds. The pulse will initiate the module to transmit eight cycles of ultrasonic burst at 40 kHz and wait for the reflected ultrasonic burst. When the sensor detects the reflected ultrasonic burst, it sets pin 3 (ECHO) to ‘high’state. Duration of the reflected pulse depends on the distance from the obstacle, which can be easily calculated as:
Distance (in centimetres) = T/58
where, T = Width of pulse at ECHO pin in microseconds
Arduino Uno board. Arduino is an open source electronics prototyping platform based on flexible, easy-to-use hardware and software. It is intended for artists, designers, hobbyists and anyone interested in creating interactive objects or environments.
Arduino Uno is a board based on ATmega328 microcontroller. It has 14 digital input/output pins, six analogue inputs, a USB connection for programming the on-board microcontroller, power jack, an ICSP header and a reset button. It is operated with a 16MHz crystal oscillator and contains everything needed to support the microcontroller.
The board is very easy to use as the user simply needs to connect it to a computer with a USB cable, or power it with an AC-to-DC adaptor or battery to get started. The microcontroller on the board is programmed using Arduino programming language using Arduino development environment.
Pins 8 and 9 of BOARD1 are connected to pins Tx and Rx of the Bluetooth module, respectively. Pins 10 and 11 are connected to trigger (TRIG) and echo (ECHO) pins of HC-SR04, respectively. Pins 2 through 7 of BOARD1 are the output pins, which are connected to IC1 for controlling the motors. Pins 2, 3 and 4 of BOARD1 are connected to IN3, EN2 and IN4 of IC1 to control motor M1, and pins 5, 6 and 7 are connected to IN1, EN1 and IN2 of IC1 to control motor M2. EN1 and EN2 are used to control the speeds of the motors.
The control commands for the robot are sent from the phone using the app shown in Fig. 2. You can send the commands either by touching on various options on the phone’s screen or through speech commands. Corresponding to control commands you select on the app, the related data is sent through Bluetooth of the phone. Data transmitted by the phone is received by Bluetooth module at the robot end. The received data is fed to pin 8 of BOARD1. The microcontroller on BOARD1 processes the received data and drives motors accordingly.
The robot also sends back the status. In the app you can see label ‘Robot Status,’ below which you can see the direction in which robot is moving. The robot continuously sends back information about the distance from the closest obstacle to the phone, and if it reaches too close to an obstacle the robot stops automatically.