Escolar Documentos
Profissional Documentos
Cultura Documentos
CONTROLLED ROBOT
Project ID:3111
A Technical Project Report
submitted in partial fulfillment of
the requirement for the B.Tech.
under Biju Patnaik University of Technology, Rourkela.
Submitted By
GOURAB SAHOO
SANAM SINGH
OCTOBER - 2014
CERTIFICATE
This is to certify that the Project work entitled Android Bluetooth Controlled
Robot is a bonafide work being done by Gourab Sahoo and Sanam Singh
bearing Registration No1101314088, 1101314110 of ECE branch.
This Project report is submitted in partial fulfillment for the requirement of
the B.Tech. degree under Biju Patnaik University of Technology, Rourkela,
Odisha.
(Prof. RC das)
PRINCIPAL
ABSTRACT
A robot is usually an electro-mechanical machine that is guided by computer and electronic
programming. Many robots have been built for manufacturing purpose and can be found in
factories around the world. Designing of the latest inverted ROBOT which can be
controlling using an APP for android mobile. We are developing the remote buttons in the
android app by which we can control the robot motion with them. And in which we use
Bluetooth communication to interface controller and android. Controller can be interfaced to
the Bluetooth module though UART protocol. According to commands received from
android the robot motion can be controlled. The consistent output of a robotic system along
with quality and repeatability are unmatched. Pick and Place robots can be reprogrammable
and tooling can be interchanged to provide for multiple applications. The project is designed
to control a robotic vehicle using an android application. Bluetooth device is interfaced to
the control unit on the robot for sensing the signals transmitted by the android application.
This data is conveyed to the control unit which moves the robot as desired. An 8051 series
microcontroller is used in this project as control device.
Remote operation is achieved by any smart-phone/Tablet etc., with Android OS, upon a GUI
(Graphical User Interface) based touch screen operation. Transmitting end uses an android
application device remote through which commands are transmitted. At the receiver end,
these commands are used for controlling the robot in all directions such as forward,
backward and left or right etc. At the receiving end the movement is achieved by two motors
that are interfaced to the microcontroller. Serial communication data sent from the android
application is received by a Bluetooth receiver interfaced to the microcontroller. The
program on the microcontroller refers to the serial data to generate respective output based
on the input data to operate the motors through a motor driver IC. The motors are interfaced
to the control unit through motor driver IC
ACKNOWLEDGEMENT
We would like to express our immense sense of gratitude to our guide, Mr. Nihar Ranjan
Sahu, for his valuable instructions, guidance and support throughout our project..
We again owes our special thanks to Dr. Satya Ranjan Pattnaik, B-tech Project
Coordinator for giving us an opportunity to do this report.
And finally thanks to Prof. R.C. Das, Principal, APEX Institute of technology and
management for his continued drive for better quality in everything that happens at APEX.
This report is a dedicated contribution towards that greater goal.
(ECE201116067)
Mr.
SANAM SINGH
(ECE201110041)
ii
TABLE OF CONTENTS
ABSTRACT....................................................................................i
ACKNOWLEDGEMENT...................................................................ii
LIST OF TABLE.............................................................................iv
LIST OF FIGURES...........................................................................i
1. INTRODUCTION........................................................................1
2. PROJECT PLAN..........................................................................2
2.1 Block Diagram.......................................................................................... 2
2.2 Description............................................................................................... 2
3. CIRCUIT DESCRIPTION..............................................................5
4. AVR MICROCONTROLER.............................................................6
5. DEVICE OVERVIEW....................................................................7
5.1 Basic families........................................................................................... 7
5.2 Internal data memory.............................................................................. 8
5.3 Internal registers...................................................................................... 8
5.4 Instruction set.......................................................................................... 9
5.5 MCU speed............................................................................................... 9
5.6 Features................................................................................................. 10
5.7 Pin Configuration.................................................................................... 12
6. BLUETOOTH DRIVER...............................................................16
6.1 Bluetooth serial interface module..........................................................16
6.2 Bluetooth adapter.................................................................................. 16
7. MOTOR DRIVER......................................................................18
8. FUTURE WORK.......................................................................19
REFERENCES..............................................................................20
iii
LIST OF TABLE
Table5.1.Alternate Pin of Port A..13
Table5.2.Alternate Pin of Port B..14
Table5.3.Alternate Pin of Port C..14
Table5.4.Alternate Pin of Port D..15
iv
LIST OF FIGURES
Figure2. 1 Block Diagram.................................................................................................2
1. INTRODUCTION
Robot is a mechanical device that sometimes resembles a human and is capable of
performing a variety of often complex human tasks on command or by being programmed in
advance. Here at this robot I have used a Bluetooth module to control the robot via 2 BO
motors at 100RPM approx the robot is control by an android phone application
Microcontroller used is AVR with the Bluetooth module HC-05.The Bluetooth module used
is a HC-05 in smd package which works on a 3.3v and have a serial communication with
any device connected to it the communication speed can be configured on various speed via
AT Command.
The BT module is a SPP supported profile so it can be connected easily to any module or
phone. In this profile the data can be sent and receive to module. The BT module is
connected to the RX pin of microcontroller.
The L293D is a motor driver IC to operate the motors in any direction required dependent on
the logic applied to the logic pins.
2. PROJECT PLAN
2.1 Block Diagram
Android phone
AVR Microcontroller
Bluetooth Model
Arduino
Motor Driver
Motors
2.2 Description
Android phone:
It is type of phone which contains android operating system through which we can do the
Bluetooth operation and can operate the robot.
AVR Microcontroller:
It stands for Advanced Virtual RISC(Reduced instruction set computing). Microcontroller is
the heart of the Project. Where every- action is under the control of the Microcontroller. The
1
micro-controller used here is ATmega8535L.It is an 8-bit low power high performance AVR
micro-controller. It has 8K Bytes of Flash memory, 512 Bytes of SRAM and 512 Bytes of
EEPROM.
Bluetooth Model:
Here in this project we use the HC-05 Bluetooth Model. HC-05 embedded Bluetooth serial
communication module (can be short for module) has two work modes: order-response work
mode and automatic connection work mode. And there are three work roles (Master, Slave
and Loopback) at the automatic connection work mode. When the module is at the automatic
connection work mode, it will follow the default way set lastly to transmit the data
automatically. When the module is at the order-response work mode, user can send the AT
command to the module to set the control parameters and sent control order. The work mode
of module can be switched by controlling the module PIN (PIO11) input level.
Arduino:
Arduino is a single-board microcontroller, intended to make building interactive objects or
environments more accessible.[1] The hardware consists of an open-source hardware board
designed around an 8-bit Atmel AVR microcontroller, or a 32-bit Atmel ARM. Current
models feature a USB interface, 6 analog input pins, as well as 14 digital I/O pins that
accommodate various extension boards.
Introduced in 2005, the Arduino's designers sought to provide an inexpensive and easy way
for hobbyists, students, and professionals to create devices that interact with their
environment using sensors and actuators. Common examples for beginner hobbyists include
simple robots, thermostats and motion detectors. It comes with a simple integrated
development environment (IDE) that runs on regular personal computers and allows users to
write programs for Arduino using C or C++.
Motor driver:
It is an electronic circuit that enables a voltage to be applied across a load in either direction.
These circuits are often used in robotics and other applications to allow DC motors to run
forwards and backwards.
Most DC-to-AC converters (power inverters), most AC/AC converters, the DC-to-DC push
pull converter, most motor controllers, and many other kinds of power electronics use H
3. CIRCUIT DESCRIPTION
4. AVR MICROCONTROLER
The AVR architecture was conceived by two students at the Norwegian Institute of
Technology (NTH) Alf-Egil Bogen and Vegard Wollan.
The original AVR MCU was developed at a local ASIC house in Trondheim, Norway called
Nordic VLSI at the time, now Nordic Semiconductor, where Bogen and Wollan were
working as students. It was known as a RISC (Micro RISC) and was available as silicon
IP/building block from Nordic VLSI. When the technology was sold to Atmel from Nordic
VLSI, the internal architecture was further developed by Bogen and Wollan at Atmel
Norway, a subsidiary of Atmel. The designers worked closely with compiler writers at IAR
Systems to ensure that the instruction set provided for more efficient compilation of highlevel languages. Atmel says that the name AVR is not an acronym and does not stand for
anything in particular. The creators of the AVR give no definitive answer as to what the term
"AVR" stands for. However, it is commonly accepted that AVR stands for Alf (Egil Bogen)
and Vegard (Wollan)'s RISC processor. Note that the use of "AVR" in this article generally
refers to the 8-bit RISC line of Atmel AVR Microcontrollers.
Among the first of the AVR line was the AT90S8515, which in a 40-pin DIP package has the
same pinout as an 8051 microcontroller, including the external multiplexed address and data
bus. The polarity of the RESET line was opposite (8051's having an active-high RESET,
while the AVR has an active-low RESET), but other than that the pinout was identical.
The AVR 8-bit microcontroller architecture was introduced in 1997. By 2003, Atmel had
shipped 500 million AVR flash microcontrollers.
5. DEVICE OVERVIEW
The AVR is a modified Harvard architecture machine where program and data are stored in
separate physical memory systems that appear in different address spaces, but having the
ability to read data items from program memory using special instructions.
632-pin package
28100-pin package
cryptography support.
AVR family, such as LCD controller, USB controller, advanced PWM, CAN, etc.
6
SRAM for the AVR program code, unlike all other AVRs
32-bit AVRs
In 2006 Atmel released microcontrollers based on the 32-bit AVR32 architecture. They
include SIMD and DSP instructions, along with other audio and video processing features.
This 32-bit family of devices is intended to compete with the ARM based processors. The
instruction set is similar to other RISC cores, but it is not compatible with the original AVR
or any of the various ARM cores.
I/O registers has grown substantially to 4096 bytes (0000 160FFF16). As with previous
generations, however, the fast I/O manipulation instructions can only reach the first 64 I/O
register locations (the first 32 locations for bitwise instructions). Following the I/O registers,
the XMEGA series sets aside a 4096 byte range of the data address space which can be used
optionally for mapping the internal EEPROM to the data address space (1000161FFF16). The
actual SRAM is located after these ranges, starting at 2000.
Pointer registers X, Y, and Z have addressing capabilities that are different from
each other.
I/O ports 0 to 31 have different addressing capabilities than I/O ports 32 to 63.
CLR affects flags, while SER does not, even though they are complementary
instructions. CLR set all bits to zero and SER sets them to one. (Note that CLR is pseudo-op
for EOR R, R; and SER is short for LDI R,$FF. Math operations such as EOR modify flags
while moves/loads/stores/branches such as LDI do not.)
Accessing read-only data stored in the program memory (flash) requires special
LPM instructions; the flash bus is otherwise reserved for instruction memory.
two cycles. Branches in the latest "3-byte PC" parts such as ATmega2560 are one cycle
slower than on previous devices.
5.6 Features
1.
2.
5.
c.Programming of Flash, EEPROM, Fuses, and Lock Bits through the JTAG Interface
7.
Peripheral Features
One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture
8.
Mode
8 Single-ended Channels
10.
11.
Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, Standby
13.
14.
15.
Operating Voltages
16.
Speed Grades
17.
a.Active: 1.1 mA
b.
10
source Current if the internal pull-up resistors are activated. The Port pins are tri-stated when
a reset condition becomes active, even if the clock is not running. Apart from this all the
ports have their own alternate functions they will be explained later.
RESET: Reset input. A low level on this pin for longer than the minimum pulse length will
generate a reset, even if the clock is not running. The minimum pulse length is 1.5s. Shorter
pulses are not guaranteed to generate a reset.
XTAL1: Input to the inverting Oscillator amplifier and input to the internal clock operating
circuit.
XTAL2: Output from the inverting Oscillator amplifier.
AVCC: AVCC is the supply voltage pin for Port A and the A/D Converter. It should be
externally connected to VCC, even if the ADC is not used. If the ADC is used, it should be
connected to VCC through a low-pass filter.
AREF: AREF is the analog reference pin for the A/D Converter.
Port A Alternate functions: Port A acts as the input for the ADC.
Port Pin
Alternate Function
PA7
PA6
PA5
PA4
PA3
PA2
PA1
PA0
Port B Alternate functions: Port B pins have the alternate functions of SPI interface,
Analog comparator inputs, Timer/Counter external clock input.
12
Port Pin
Alternate Function
PB7
PB6
PB5
PB4
PB3
PB2
PB1
PB0
Port C Alternate Functions: Port C pins have the alternate functions of Timer oscillator &
two wire serial interface.
Port Pin
Alternate Function
PC7
PC6
PC1
PC0
Port D Alternate Functions: Port D pins have the alternate functions of external interrupts,
USART, Timer match outputs, capture inputs.
13
Port Pin
Alternate Function
PD7
PD6
PD5
PD4
PD3
PD2
PD1
PD0
6. BLUETOOTH DRIVER
HC serial Bluetooth products consist of Bluetooth serial interface module and Bluetooth
adapter, such as:
Civil level:
HC-04-M, M=master
HC-04-S, S=slaver
The default situation of HC-04 is slave mode. If you need master mode, please state it
clearly or place an order for HC-O4-M directly.The naming rule of HC-06 is same. When
HC-03 and HC-05 are out of factory, one part of parameters are set for activating the device.
The work mode is not set, since user can set the mode of HC-03, HC-05 as they want. The
main function of Bluetooth serial module is replacing the serial port line, such as:
There are two MCUs want to communicate with each other. One connects to
Bluetooth master device while the other one connects to slave device. Their connection can
be built once the pair is made. This Bluetooth connection is equivalently liked to a serial port
line connection including RXD, TXD signals. And they can use the Bluetooth serial module
to communicate with each other.
When MCU has Bluetooth salve module, it can communicate with Bluetooth
adapter of computers and smart phones. Then there is a virtual communicable serial port line
between MCU and computer or smart phone.
15
The Bluetooth devices in the market mostly are salve devices, such as Bluetooth
printer, Bluetooth GPS. So, we can use master module to make pair and communicate with
them. Bluetooth Serial modules operation doesnt need drive, and can communicate with
the other Bluetooth device which has the serial. But communication between two Bluetooth
modules requires at least two conditions:
The communication must be between master and slave.
The password must be correct.
7. MOTOR DRIVER
The L293 and L293D are quadruple high-current half-H drivers. The L293 is designed to
provide bidirectional drive currents of up to 1 A at voltages from 4.5 V to 36 V. The L293D
is designed to provide bidirectional drive currents of up to 600-mA at voltages from 4.5 V to
36 V. Both devices are designed to drive inductive loads such as relays, solenoids, dc and
bipolar stepping motors, as well as other high-current/high-voltage loads in positive-supply
applications.
All inputs are TTL compatible. Each output is a complete totem-pole drive circuit, with a
Darlington transistor sink and a pseudo- Darlington source. Drivers are enabled in pairs,
16
with drivers 1 and 2 enabled by 1,2EN and drivers 3 and 4 enabled by 3,4EN. When an
enable input is high, the associated drivers are enabled, and their outputs are active and in
phase with their inputs. When the enable input is low, those drivers are disabled, and their
outputs are off and in the high-impedance state. With the proper data inputs, each pair of
drivers forms a full-H (or bridge) reversible drive suitable for solenoid or motor
applications.
SOFTWARE
AVR studio:- In this project we are using the AVR studio in which programming is done
with the help of C language. AVR studio programming is used for digital input- output in C.
Each AVR digital I/O port is associated with input output register and it is known as DDRx,
PORTx registers where x represent the port A ,B, C.
Step1: The new project is been selected.
17
Step5: The above code is been compiled and burnt using sinaprog.
The DDRx register is used to configure the pins on the PORTx as input or output pins. Each
pin on the port is independent and thus the entire port does not have to be configured totally
19
as an output or input port.when we write 1 in the pin position in DDRx, then it means that
the pin is output pin and if 0 is written in the pin position then it means that the pin is input
pin.
The AVR C code below shows how to configure the pins on the port:
DDRA =0xFF; // Configure PortA as an Output port
DDRB =0x00; //Configure PortB as an Input port
DDRC=0xF0; //Configure first 4 pins on PortC as input pins and the others as output
A bit represents one of two possible states: 1 or 0 which means on/off, set/clear, high/low.
Several bits together represent numerical values in binary, where each bit is one binary digit.
An AVR microcontroller groups 8 bits together to form one byte with the
least Significant Bit (LSB) on the right. Each bit is numbered, starting from 0, at the LSB.
Consider the decimal number 15 for example. When it is represented in the binary format
then we get the value as 00001111.The four significant bits 0,1,2,3 are set.
0b0001111- /*binary*/
Example:
Write a program to be downloaded to the Atmega16 microcontroller which continuously
read the logic values on PortB and write them to PortC.
Solution:
The program below written in AVR Studio 4 accomplishes the task that was asked above.
Here several rules should be following:
1.
The header file <avr/io.h> must be included in order to use the name of the ports.
2.
The port must be configure before they are used. The first two lines in the main()
function of the program are for configuration.
3.
Once the ports are configured the we can write or read from them.
4.
The use of the While(1) loop allows for the continuous read and write operation.
#include<avr/io.h>
int main(){
DDRB =0x00;
#include<util/delay.h>
# include<avr/adc.h>
21
When program writing is complete, then we burn the microcontroller by using Sinaprog
Hex. Sinaprog is applicable when AVR studio software is used for coding of microcontroller.
Programming or burning a microcontroller means to transfer the program from the compiler
to the memory of the microcontroller. A compiler is a software which provides an
environment to write, test and debug a program for the microcontroller. The program for a
microcontroller is generally written in C or assembly language. Finally the compiler
generates a hex file which contains the machine language instruction understandable by a
microcontroller. It is the content of this hex file which is transferred to the memory of the
microcontroller. Once a program is transferred or written in the memory of the
microcontroller, it then works in accordance with the program.
22
Step3:- From the Hex File section browse the .hex file of the project you have Built.
Step4:- From Flash section click on Program button and wait for some time till it finishes
programming. When it displays the message Programming Flash OK your controller is
ready to work as per your program.
23
24
PROGRAM
#include<avr/io.h>
#include<util/delay.h>
#include<avr/usart.h>
void main()
{
DDRB=0b11111111;
usart_init();
PORTB=0b00000000;
while(1)
{
unsigned char x=usart_data_receive();
if((x=='A')||(x=='f'))
{
PORTB=0b00001010;
//forward
}
else if((x=='B')||(x=='b'))
{
PORTB=0b00000101;
//backward;
else if((x=='D')||(x=='r'))
{
PORTB=0b00000010;
//right
}
else if((x=='C')||(x=='l'))
25
{
PORTB=0b00001000;
//left
}
else if((x=='E')||(x=='s'))
{
PORTB=0b00001111;
//stop
}
else if(x=='G')
{
PORTB=0b00001001;
//360
else if(x=='F')
{
PORTB=0b00000110;
//-360
}
else
;}
}
26
CONCLUSION
We developed the remote buttons in the android app by which we can control the robot
motion with them. And in which we use Bluetooth communication to interface controller
and android. Controller can be interfaced to the Bluetooth module though UART protocol.
According to commands received from android the robot motion can be controlled. The
consistent output of a robotic system along with quality and repeatability are unmatched.
Pick and Place robots can be reprogrammable and tooling can be interchanged to provide for
multiple applications. The project is designed to control a robotic vehicle using an android
application. Bluetooth device is interfaced to the control unit on the robot for sensing the
signals transmitted by the android application. This data is conveyed to the control unit
which moves the robot as desired. An 8051 series microcontroller is used in this project as
control device.
27
REFERENCES
[1]
http://www.emtronizian.co.in/pdf/avrbasic.pdf
[2]
http://www.engr.sjsu.edu/bjfurman/courses/ME106/ME106pdf/intro-atmel.pdf
[3]
http://www.engr.sjsu.edu/~wdu/ME106Spring2010/LectureNotes/Si
mulatorTutorial.pdf
[4]
http://robotika.yweb.sk/skola/AVR/programing%20AVR%20by
%20BIBIN%20JOHN.pdf
[5]
http://engneeringgarage.yweb.ke/hgfjk/android/bluetooth%34robot%gousan
%21birth.pdf
28