Dec50122 Embedded Robotics-Pw6
Dec50122 Embedded Robotics-Pw6
Dec50122 Embedded Robotics-Pw6
(1)
(2)
(3)
(4)
(5)
2 OBJECTIVE
b. Configure the Arduino IDE to communicate with WIFI, Bluetooth and Radio
Frequency.
3 THEORY
Android controlled robot make use of an Android mobile phone for robotic control with
the help of Bluetooth technology. For this the android mobile user has to install an
application on her/his mobile. Then the user needs to turn on the Bluetooth in the
mobile. The wireless communication techniques used to control the robot is Bluetooth
technology. User can use various commands like move forward, reverse, stop move
left, and move right. These commands are sent from the Android mobile to the
Bluetooth receiver. Android based robot has a Bluetooth receiver unit which receives
the commands and give it to the microcontroller circuit to control the motors. The
microcontroller then transmits the signal to the motor driver IC’s to operate the
motors.
.
4 EQUIPMENT / TOOLS
5 PROCEDURE
b) Connect the board to the PC using the USB cable and open the Arduino IDE
program and then write the following code
int motor2Pin2 = 9;
int state;
int flag=0; //makes sure that the serial only prints once the state
int stateStop=0;
void setup() {
// sets the pins as outputs:
pinMode(motor1Pin1, OUTPUT);
pinMode(motor1Pin2, OUTPUT);
pinMode(motor2Pin1, OUTPUT);
pinMode(motor2Pin2, OUTPUT);
Serial.begin(9600);
void loop() {
state = Serial.read();
flag=0;
if (state == '1') {
digitalWrite(motor1Pin1, HIGH);
digitalWrite(motor1Pin2, LOW);
digitalWrite(motor2Pin1, LOW);
digitalWrite(motor2Pin2, HIGH);
if(flag == 0){
Serial.println("Go Forward!");
flag=1;
digitalWrite(motor1Pin2, LOW);
digitalWrite(motor2Pin1, LOW);
digitalWrite(motor2Pin2, LOW);
if(flag == 0){
Serial.println("Turn LEFT");
flag=1;
delay(1500);
state=3;
stateStop=1;
digitalWrite(motor1Pin1, LOW);
digitalWrite(motor1Pin2, LOW);
digitalWrite(motor2Pin1, LOW);
digitalWrite(motor2Pin2, LOW);
if(flag == 0){
Serial.println("STOP!");
flag=1;
stateStop=0;
digitalWrite(motor1Pin1, LOW);
digitalWrite(motor1Pin2, LOW);
digitalWrite(motor2Pin1, LOW);
digitalWrite(motor2Pin2, HIGH);
if(flag == 0){
Serial.println("Turn RIGHT");
flag=1;
delay(1500);
state=3;
stateStop=1;
digitalWrite(motor1Pin1, LOW);
digitalWrite(motor1Pin2, HIGH);
digitalWrite(motor2Pin1, HIGH);
digitalWrite(motor2Pin2, LOW);
if(flag == 0){
Serial.println("Reverse!");
flag=1;
//Serial.println(state);
c) Click in the Verify button to make sure there are no compile time errors in the
code. Then, Click on the Upload button on the IDE to upload the code . Please
make sure to disconnect the Bluetooth module before you upload the code.
d) Download apps Arduino Bluetooth Controller.
e) Reconnect Bluetooth Module, then pairing the module with Arduino Bluetooth
Controller
f) Then, setting the controller regarding the program
g) Observe and discuss the result.
6 RESULT
7 DISCUSSION
Explain detail the operation of your Android Bluetooth Robot and state the limitation of
bluetooth communication.
8 CONCLUSION
By using your own words, make a conclusion to summarize the results obtained
from this practical activity. You may also specify any technical solutions to the
unexpected problems or errors which occurred during the process.