Anda di halaman 1dari 6

Project Arduino Robot Controlled by Bluetooth

Diego de Castro Fernandes

Attila Vitez

Dr. habil. Husi Gza

Villamosmrnki s Mechatronikai
Tanszk
Debreceni Egyetem, Mszaki Kar
Debrecen, Magyarorszg
diegocastro27f@gmail.com

Villamosmrnki s Mechatronikai
Tanszk
Debreceni Egyetem, Mszaki Kar
Debrecen, Magyarorszg
viteza@eng.unideb.hu

Villamosmrnki s Mechatronikai
Tanszk
Debreceni Egyetem, Mszaki Kar
Debrecen, Magyarorszg
husigeza@eng.unideb.hu

Absztrakt The intent of the project Arduino Robot controlled


by Bluetooth was develop the knowledge of robotic, of programation
and of comunication wireless ultilizing the Bluetooth to control the
robot through a Android App installed on a Cellphone or a Tablet.
Kulcsszavak Bluetooth, Programming, Robot programming

I.

INTRDUCTION

Arduino is a platform free hardware prototypes and single


board, designed with a Atmel AVR microcontroller with
support input / output built, a language standard programming,
which originates from Wiring, andis essentially C / C ++. This
project consists of a robot controlled primarily by an Arduino
and it will receive and reads your signal transmited by
bluetooth and make your move according to the signal. It was
used a Arduino Bluno and the robot was a six leg ant with
each leg controlled by two servo motors.
II. THE ARDUINO
Arduino, according to one of its creators ,Massimo Banzi, is
an open source physical computing platform based on a simple
input/output (I/O) board and a development environment that
implements the Processing language. It is a Open hardware
and software project, so both software and hardware are
extremely accessible and very flexible and they can easily be
customized and extended[1].
The community around it. The number of users which
collaborate and share through the arduino.cc main website is
huge. The arduino website contains a editable Wiki, called the
Playground[2], and a forum where people can ask for help on
their projects or discuss about anything related to Arduino and
electronics prototyping.
The Arduino microcontroller has become one of the most
popular prototyping platforms in the world, and is a prime
example of how hardware and software technologies
originally created for military, business, and scientific
applications can be repurposed to serve the needs of
individuals creating projects in the realms of new media art
and design[3].

Fig. 1. Bluno Board


III. BLUETOOTH
The Bluetooth technology was developed by a Swedish
company Ericsson and therefore, the term was named after a
local hero Harald Blatand II Bluetooth , who was historically
known for uniting various unorganized kingdoms. Bluetooth is
a technology that provides users freedom from wired
connections, enabling links between mobile computers,
mobile phones, portable handheld devices, and connectivity to
the Internet. This technology was initially developed for
mobile telecommunications but is now used in many other
forms of digital data communications as mentioned earlier[4].
Bluetooth is intended to be a standard that works at two levels,
it provides agreement at the physical level and Bluetooth is a
radio frequency standard and also provides agreement on
when bits are sent, how many will be sent at a time, a
redundancy check. [5] The Bluetooth devices transmits and
receives in a previously unused frequency band of ranging

from 2.00 GHz to 2.45GHz radio spectrum that is available


worldwide which has been set aside by international
agreement for the use of industrial, scientific and medical
devices (ISM). Bluetooth works on a "free band" which
means that there is no restrictions for travelers using Bluetooth
enabled equipment. For transmission of information between
Bluetooth enabled devices there is no necessary "line of
sight," which means that these devices do not work in the
same fashion that television remote controls work.

Wake Up

The Robot stand


Up.

Walk

The robot walk 3


steps forward.

Walk Right

The robot walk 3


steps forward
bending to the
Right.

Walk Left

The robot walk 3


steps forward
bending to the
Left.

Walk Back

The robot walk 3


steps back.

Spin

The robot Rotate


clockwisely.

The process of walking is made through the grouping of the


legs in 2 groups, as you can see on the diagram of the Fig. 3.
All the legs of the same group do the same movement at the
same time.

Fig. 2. Diagram of Bluetooth Communication


By definition, Bluetooth is a global standard for wireless
connectivity. Based on a low-cost, short-range radio link,
Bluetooth cuts the cords that used to tie up digital devices.
When two Bluetooth equipped devices come within 10 meters
range of each other, they can establish a connection together.
And because Bluetooth utilizes a radio-based link, it doesn't
require a line-of-sight connection in order to communicate.
Your laptop could send information to a printer in the next
room, or your microwave could send a message to your
mobile phone telling you that your meal is ready (Nokia).
IV. OPERATION
With the Arduino Robot turned on and Connected with the
bluetooth controller, that can be a cellphone or tablet
application or even a computer if this have a Bluetooth
Module, Its just necessary send the code relate with the act
that you wish that the robot perform according with the
following guide.

Fig. 3. Schematic of the groups of legs of the Robot

TABLE I
LIST OF CODES

Code

Action

Description

Sleep

The Robot lay


down.

V. ROBOT STRUCTURE

VI. PROGRAM
First Part: Declaration of the variables and the Motors.

Fig. 4. The robot used in the Project

The robot is composed of six legs, three in each side of it, and
each leg is controlled by two servo motors. One of the motors
of each leg control the movement of up and down of it, and
the other motor control the front and back movement, and both
working together turn available the walking. Everything is
controlled by a Arduino Bluno and the legs are powered by a
rechargeable battery that there is inside the robot. Inside the
program the legs were enumerated following the diagram of
the Fig. 5.

Fig, 5 Diagram of the Number of each Leg

#include <Servo.h> // Call the Library


Servo motor1a; // Declaration of the Motors
Servo motor1b;
Servo motor2a;
Servo motor2b;
Servo motor3a;
Servo motor3b;
Servo motor4a;
Servo motor4b;
Servo motor5a;
Servo motor5b;
Servo motor6a;
Servo motor6b;
int rate = 500; // Time in ms between the steps
int inc = 20; // Rate of Inclination for Left or Right
int inc2 = 5; // Rate of Rotation
Second Part: Idication of the pin of each motor and open of
the Serial port.
void setup(){
motor1a.attach(2); // Indicate of the Pin of each Motor
motor1b.attach(3);
motor2a.attach(4);
motor2b.attach(5);
motor3a.attach(6);
motor3b.attach(7);
motor4a.attach(8);
motor4b.attach(9);
motor5a.attach(10);
motor5b.attach(11);
motor6a.attach(12);
motor6b.attach(13);
Serial.begin(115200); // Open Serial Port
motor1a.write(105); // Set the Robot on Awake mode
motor2a.write(125);
motor3a.write(115);
motor4a.write(130);
motor5a.write(65);
motor6a.write(125);
motor1b.write(120);
motor2b.write(115);
motor3b.write(120);
motor4b.write(125);
motor5b.write(105);
motor6b.write(80);
}

Third Part: Selection of the behave using the codes received.

void loop (){


if(Serial.available()>0){ // Checks if the input to the
serial port
char sinal = Serial.read(); //Save the input sinal
if (sinal=='1'){
WakeUp() // Do the activity wakeup
}
else if (sinal=='2'){
Sleep() // Do the activity sleep
}
else if(sinal=='3')
{
walk(); // Do the activity walk
}
else if(sinal=='4')
{
right(); // Do the activity right
}
else if(sinal=='5')
{
left(); // Do the activity left
}
else if(sinal=='6')
{
walkback(); // Do the activity walkback
}
else if(sinal=='7')
{
spin(); // Do the activity spin
}
}}
Fourth Part: The activities work basically on the same way,
here is exemplified the walk and the left activity.
Walk:
void walk() // Begin of the Walk Activity
{
motor1a.write(105); //Set all the legs to wake
position
motor2a.write(125);
motor3a.write(115);
motor4a.write(130);
motor5a.write(65);
motor6a.write(125);
motor1b.write(120);
motor2b.write(115);
motor3b.write(120);
motor4b.write(125);
motor5b.write(105);
motor6b.write(80);
int i=0; // Put Zero on the step counter

while (i<3){ // Set that the activity should happen 3


times, therefore the robot will give 3 steps
delay(rate); // Here begin a Cycle
motor1a.write(105);
motor4a.write(130);
motor5a.write(65);
delay(rate);
motor2a.write(160);
motor3a.write(80);
motor6a.write(170);
delay(rate);
motor1b.write(120);
motor4b.write(125);
motor5b.write(105);
delay(rate);
motor2b.write(155);
motor3b.write(80);
motor6b.write(120);
delay(rate);
motor2a.write(125);
motor3a.write(115);
motor6a.write(125);
delay(rate);
motor1a.write(80);
motor4a.write(170);
motor5a.write(30);
delay(rate);
motor2b.write(115);
motor3b.write(120);
motor6b.write(80);
delay(rate);
motor1b.write(80);
motor4b.write(165);
motor5b.write(80);
i++; // Here ends the Cycle and add 1 unit to the
value of the counter
}
motor1a.write(105); // In the End of the activity set
all the legs to wake mode.
motor2a.write(125);
motor3a.write(115);
motor4a.write(130);
motor5a.write(65);
motor6a.write(125);
motor1b.write(120);
motor2b.write(115);
motor3b.write(120);
motor4b.write(125);
motor5b.write(105);
motor6b.write(80);
}

Left:

void left() // Begin Left Activity


{
motor1a.write(105); // Set all the legs to WakeUp
mode but inclined to the left
motor2a.write(125);
motor3a.write(115);
motor4a.write(130);
motor5a.write(65);
motor6a.write(125);
motor1b.write(120-inc);
motor2b.write(115-inc);
motor3b.write(120-inc);
motor4b.write(125-inc);
motor5b.write(105-inc);
motor6b.write(80-inc);
int i=0; // Put Zero on the step counter
while (i<3){ // Set that the activity should happen 3
times, therefore the robot will give 3 steps
delay(rate); //Here Begin the Cycle.
motor1a.write(105);
motor4a.write(130);
motor5a.write(65);
delay(rate);
motor2a.write(160);
motor3a.write(80);
motor6a.write(170);
delay(rate);
motor1b.write(120-inc);
motor4b.write(125-inc);
motor5b.write(105-inc);
delay(rate);
motor2b.write(155-inc);
motor3b.write(80-inc);
motor6b.write(120-inc);
delay(rate);
motor2a.write(125);
motor3a.write(115);
motor6a.write(125);
delay(rate);
motor1a.write(80);
motor4a.write(170);
motor5a.write(30);
delay(rate);
motor2b.write(115-inc);
motor3b.write(120-inc);
motor6b.write(80-inc);
delay(rate);
motor1b.write(80-inc);
motor4b.write(165-inc);
motor5b.write(80-inc);
i++; // Here ends the Cycle and add 1 unit to the
value of the counter
}
motor1a.write(105); // In the End of the activity set

all the legs to wake mode


motor2a.write(125);
motor3a.write(115);
motor4a.write(130);
motor5a.write(65);
motor6a.write(125);
motor1b.write(120);
motor2b.write(115);
motor3b.write(120);
motor4b.write(125);
motor5b.write(105);
motor6b.write(80);
}
VII. CONCLUSION
As a result you have what is in accordance with the project
intent that is a program that allow a Robot that works with a
Arduino receive and reads your signal transmited by bluetooth
and make your move according to the signal.. The
comunication wireless ultilizing the Bluetooth to control the
robot can be made through a Android App installed on a
Cellphone or a Tablet. When the Code is uploaded in the
robot, a six leg ant with each leg controlled by two servo
motors, It will perform activity related to the code sent.
VIII.

REFERENCES

[1]

M. Banzi, "Getting Started with Arduino", OReilly books,October


2008, First Edition

[2]

Arduino Team, Arduino, http://www.arduino.cc/ (accessed May 20,


2016).

[3]

K. Leung, "A History of the Arduino Microcontroller"


http://www.kenleung.ca/_portfolioassets/PDF/HistoryOfArduino_KenLe
ung.pdf, 2010

[4]

Rachel Nuwer, "Why is Bluetooth Called Bluetooth?",


http://www.smithsonianmag.com/smart-news/why-is-bluetooth-calledbluetooth-hint-vikings-16270647/?no-ist (accessed May 20, 2016).

[5]

Curt
Franklin,
"How
Bluetooth
Works",
http://www.mindpride.net/root/Extras/how-stuffworks/how_bluetooth_works.htm(accessed May 30, 2016)