0% found this document useful (0 votes)
72 views

A Project Report On PC - Controlled - Robot

This document describes a project report on a PC controlled robot. The project involved designing and building an autonomous robot controlled by a PC using an AVR microcontroller, DC motors, wheels, and C programming. The microcontroller code was written in AVR studio using C programming and USART for serial communication between the PC and microcontroller to control the robot's movement based on commands from the PC. Hardware components like the DC motor, motor driver IC, and AVR microcontroller are discussed along with programming the microcontroller in AVR studio.

Uploaded by

Utkarsh Mittal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
72 views

A Project Report On PC - Controlled - Robot

This document describes a project report on a PC controlled robot. The project involved designing and building an autonomous robot controlled by a PC using an AVR microcontroller, DC motors, wheels, and C programming. The microcontroller code was written in AVR studio using C programming and USART for serial communication between the PC and microcontroller to control the robot's movement based on commands from the PC. Hardware components like the DC motor, motor driver IC, and AVR microcontroller are discussed along with programming the microcontroller in AVR studio.

Uploaded by

Utkarsh Mittal
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 45

Project report on PC Controlled Robot

Under the guidance of


Er. Priyanshu Tripathi Er. Uma Shanker
(Project Guide) (Project Incharge)

Uvsofts Technologies Pvt. Ltd.

Submitted for fulfillment of the requirements for the
award of the certificate of Summer Internship Program-
2014

By :-
Nikhil Sharma (as Asst. Research Engineer Trainee),
Department of Geophysics,
Banaras Hindu University, Varanasi-22100

Acknowledgement
It is high privilege for me to express my deep sense of gratitude
to all those members of Uvsofts Technologies Pvt. Ltd, who
helped me in the completion of the project, especially my guide
Er. Priyanshu tripathi, who was always there at the hour of
need for completion of my project work.A special thanks to all
co-interns at Uvsofts Technologies Pvt. Ltd whose
competitiveness brought best out of me.I would also like to
take this opportunity to thank my dear parents and family
whose support gave me a lot of strength and will power to
make this project possible.
Special and sincere thanks to all Professors of Department of
Geophysics, Banaras Hindu University, Varanasi who allowed
and inspired me to take part in this Internship.

Nikhil Sharma,
M.Sc. (Tech.)
Geophysics (1
st
year)



Certificate of completion



This is to certify that the project and the project report entitled PC
controlled robot is done my Mr. Nikhil Sharma under my guidance. He
has fulfilled the entire requirement for this project. I really appreciate
his hard work and efforts.



Er. Priyanshu Tripathi Er. Uma Shanker
(Project Guide) (Project Incharge)

Uvsofts Technologies Pvt. Ltd,
New Delhi

Table of contents:
1. Abstract
2. Introduction
3. Hardware implementation
3.1 dc motor
3.2 working of motor
3.3 L293D motor driver IC
3.4 Working of L293D
4. Microcontroller
4.1 AVR-ATmega Microcontroller
4.2 Features and Memory segments
4.3 Pin diagram
4.4 PIN description
5. Creation of Program Using AVR studio
5.1 Introduction
5.2 Steps for creating AVR program
5.3 Program code for Microcontroller
5.4 Output of AVR Studio Code.
6. USART
6.1 Introduction
6.2 Serial communication

6.3 Bit and Baud Rate
6.4 RS 232 Communication
6.5 Uses in AVR Microcontroller
6.6 USART Baud Rate Register
6.7 Code for USART Program
7. Other Projects
8. Conclusion
9. Bibliography


Abstract

This project is about designing and building an autonomous robot
controlled by a PC. Project requires the use of an AVR Microcontroller,
dc motors , wheels, as basic hardware. The code is written in C
programming language. The project requires to be written in AVR
studio in C programming language ( also USARTs code for transmission
and reception). USART is used in the Project for serial communication.

The basic objective of the project is to move a robot controlled by a PC.
This can be used for unmanned missions for geoexploration where
manned missions are not possible or risky. Use of robot for data
acquisition also brings forth advantages like accuracy, repetitive nature
of robot, long duration working without fatigue as well as the direct
data transmission by plotting a transmitter on it.


HARDWARE IMPLEMENTATION

DC MOTOR and its working :













DC MOTOR
A DC motor is a mechanically commutated electric motor powered from direct
current
These are the motors which convert DC signals into rotational motion.
In robotics applications they are preferred over AC motors as the motor and the
complete circuit require same kind of supply i.e. DC supply.

L293D DRIVING IC


L293D is a dual bridge IC and is used for driving two
motors. Each motor is connected to one H-Bridge.
The L298 Motor Driver has 4 inputs to control the motion
of the motors and two enable inputs which are used for
switching the motors on and off.
A double H-Bridge, since motion of two motors can be
simultaneously controlled on each half.




PINS OF L293D IC






DC MOTOR WITH L293D IC











AVR
ATMEGA 8
MICRO-CONTROLLER


INTRODUCTION :
ATmega8 is a 8-bit microcontroller based on the AVR
RISC architecture.
By executing powerful instructions in a single clock
cycle, the ATmega8 achieves throughput
approaching 1 MIPS per MHz.
In order to maximize performance and parallelism,
the AVR uses a Harvard architecture- which
separates memories and buses for program and
data.
Instruction in program memory are executed with
single level pipelining.
This concept enables instructions to be executed in
every clock cycle.
Single clock cycle, the ATmega8 achieves throughput
approaching 1 MIPS per MHz.





FEATURES
High-performance 8 bit Microcontroller
Up to 16 MIPS Throughput at 16 MHz
32 x 8 General Purpose Working Registers
Six ADC channels in PDIP package
Internal Calibrated Oscillator



TYPES OF PACKAGES
28-pin PDIP (Plastic Dual In-line Package)
32-pin TQFP (Thin Quad film Package)






MEMORY SEGMENTS
8K Bytes of Flash program memory
512 Bytes EEPROM (Electrically Erasable Programmable Read Only
Memory)
1K Byte Internal RAM (Random Access Memory)





PIN OUT

PIN DESCRIPTION:
VCC:- Digital supply voltage
GND :- Ground
Port B is an 8-bit bi-directional I/O port with internal pull-
up resistors.
Port C is an 8-bit bi-directional I/O port with internal pull-
up resistors. In additional ADC.
Port D is an 8-bit bi-directional I/O port with internal pull-
up resistors
AVCC:- The supply voltage pin for the A/D Converter
RESET:- A low level on this pin for longer than the
minimum pulse length will generate a reset, even if the
clock is not running
AREF:- The analog reference pin for the A/D Converter.




Three ports i.e PortB, PortC, PortD
Three registers associated with every port

DDRx Data Direction Register
PINx Port input
PORTx- Port output
*Note x is subscript and could be either of B, C, D


CREATION OF PROGRAM USING AVR
STUDIO

STEP 1 : Open AVR studio 4 IDE. You should see the
program banner below.




STEP 2 : When the IDE opens, youll see the
programming and simulator environment as well as a
dialog box requesting information : Are you starting a
new project or opening a saved project ?





STEP 3 : Click on the New Project button.
STEP 4 : In the next dialogue box, choose the AVR GCC



STEP 5 : Type in the project name and the initial file
name.




STEP 6 : Click on the next button.
STEP 7 : Choose AVR SIMULATOR for the Debug
Platform and then scroll down the right window to

choose ATmega8 & AVR processor.


STEP 8 : Click on the finish button. You should then see
the IDE.









STEP 9 : Type in the program as shown.




STEP 10 : When you have completed the program save it.
Its also a good practice to periodically save your
program as you type.
STEP 11 : Assemble you program. You may do this by
selecting Build from the Build Menu or by striking the
[F7] key.

STEP 12 : Continue assembling and correcting errors until
the program assembles without error.











MICROCONTROLLER PROGRAM CODE :

#include<avr/io.h>
#include<util/delay.h>


void usartinit(int baudrate)
{
UBRRL=baudrate;
UBRRH=(baudrate>>8);
UCSRC|=(1<<URSEL)|(1<<UCSZ1)|(1<<UCSZ0);

UCSRB=(1<<RXEN)|(1<<TXEN);

}
char read()
{


while(!(UCSRA & (1<<RXC)));
return UDR;
}



void usartwrite( char ch)
{

while(!(UCSRA & (1<<UDRE)));
UDR=ch;
}

void usart_string(unsigned char *str)
{
int i=0;

while(str[i]!='\0')
{
usartwrite(str[i]);
i++;
}}


void main()
{
char ch;

usartinit(77);

DDRB=0xff;
while(1)
{
ch=read();



if(ch=='a')
{
PORTB=0b00010010;
usart_string(" moves FORWARD");
}
if(ch=='b')
{
PORTB=0b00001100;
usart_string(" moves BACKWARDS");
}
if(ch=='c')
{
PORTB=0b00000010;
usart_string(" moves LEFT");
}

if(ch=='d')
{
PORTB=0b00010000;
usart_string(" moves RIGHT");
}

if(ch=='e')
{
PORTB=0b00000000;
usart_string("STOP");
}
}
}











USART






















SERIAL V/S PARALLEL
COMMUNICATION

2

SERIAL COMMUNICATION :
AVR microcontrollers have a dedicated hardware for serial
communication; this part is called Universal Synchronous
Asynchronous Receiver and Transmitter (USRT).
You just have to supply the data to transmit and it will do
the rest.
The data to be transmitted is written to one of the register
of USRT and USRT transmits it.
Also USART automatically senses the transmission of RX
line and then inputs the whole Byte and when it has the
byte it informs the CPU to read the data from one of its
registers.

























BAUD RATE AND BIT RATE
Baud rate is the number of bits transmitted in one
second.
Bit Rate is the number of data bits transmitted in
one second.
Both of them has the same unit bits/second.
Baud rate is determined by the number of bits in
one frame while bit rate is determined by the
number of data its in that frame.
Atmega16 support five different data sizes 5,6,7,8
and 9 bits.



RS232 COMMUNICATION
RS232 is a asynchronous serial communication
protocol widely used in computers and digital
systems.
It is called asynchronous because there is no separate
synchronizing clock signal as there are in other serial
protocols like SPI and I2C.
The Protocol is such that it automatically synchronize
itself.
We can use RS232 to easily create a data link between
our MCU based project and standard PC.
Excellent example is a commercial serial PC mouse.


















RS232
In Rs 232 there are two data lines RX and TX.
TX is the wire in which the data is sent out to other device.
RX is the line in which other device put the data it need to sent
to the device.
We know that a HIGH = +5V and LOW= 0V in TTL/MCU circuits
nut in RS232 a HIGH= -12V and a LOW =+12V.This increases the
range and reliability of data transfer.
Thus to interface a RS232 with the MCU we need to use an IC
MAX232.As there is clock line so for synchronization accurate
timing is required so transmissions are carried out with certain
standard speeds.
The speeds are measured in bits per second. Number of bits
transmitted is also known as baud rate. Some standard baud
rates are1200, 2400, 4800, 9600, 19200, 38400, 57600,
115200..etc






UART OF AVR MICROCONTROLLERS
The UART of AVR is versatile and can be setup
for various different mode as required by your
application.
The Universal Synchronous and Asynchronous
serial Receiver and Transmitter
(UART) is a highly flexible serial
communication device.
The UART of the AVR is Connected to the CPU
by the following Six Registers




It is a 16 bit register. The higher byte of the bud rate is stored in
UBRRH while the lower value of the baud rate is stored in UBRRL.
This register is used by the USART to generate the data
transmission at specified speed.
The UBRR value is calculated according to following formula
Where f
osc
is your CPU frequency
UBRR can hold only integer value. So it is better to use the baud
rates that give UBRR value that is purely integer or very close to
integer. So if UBRR value comes to be 7.68 and you decide to use
UBRR=8 then it has high error percentage, and communication is
unreliable.




USART BAUD RATE REGISTER


USART Initializing :

void usart_init()
{
UBRRL=25;
UCSRB|=(1<<TXEN)|(1<<RXEN);
UCSRC|=(1<<URSEL)|(1<<USBS)|(1<<UC
SZ1)|(1<<UCSZ0);
}






Transmission using USART :


void usart_transmit(unsigned int data)
{
while(!( UCSRA & (1<<UDRE)));
UDR=data;
}







Reception using USART :

unsigned int usart_receive(void)
{
while((UCSRA & (1<<RXC))==0);
return UDR;
}



Conclusion

We have successfully completed the project on PC Controlled Robot.
This project was about about handling a robot which could be used for
Geoexploration purposes where human reach is still restricted or
inhibited. While doing so apt knowledge of computer hardware and
software was gained by the help of research guides through a
continuous process of learning by practical analysic side by side. Use of
robot for data acquisition also brings forth advantages like accuracy,
repetitive nature of robot, long duration working without fatigue as
well as the direct data transmission by plotting a transmitter on it.



OTHER PROJECTS :

Working with LEDS
7 SEGMENT Display
Traffic light control
Line follower robot
Edge avoider robot
Obstacle avoider robot
LED matrix
LCD display
Relay


Bibliography

The books which were a real help are:
The AVR microcontroller and embedded systems using assembly
and C by Muhammad ali mazidi,sarmad naimi,sepehr naimi.
Robotics with embedded C by Toshendra K sharma.
Robotics-fundamentals and concepts by Ashitava Ghosal.
Embedded Microprocessor Systems Real World Applications by
Stuart R. Ball.
Mechatronics: An Introduction by the Robert H Bishop.



The useful sites were:
www.wikipedia.com
www.thetech.org/exhibitsevents/online/robot
www.mathworks.com
www.robomart.com
http://www.robotcafe.com

You might also like