Upload
koundinya-raju
View
42
Download
0
Embed Size (px)
Citation preview
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
TOY CAR CONTROL USING ACCELEROMETERMINIPROJECT REPORT
Submitted in partial fulfilment of the requirements
For the award of the degree of
Bachelor of Technology
In
Electronics and Communication Engineering
Of
S UBMITTED BY
.............................................
REGISTER NO:-.................
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
PLACE:-...........................
DATE:-......./......./............
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
BONAFIDE CERTIFICATE
This is to certify that the mini project entitled “TOY CAR CONTROL USING ACCELEROMETER” is a bonafide record of the work done by.............................. (............................)of sixth semester B.Tech in Electronics and Communication Engineering, towards the partial fulfilment of the requirements as a part of the curriculum for the award of the Degree of Bachelor of Technology, by
Project Guide HOD, EC&E
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
ACKNOWLEDGMENT
I would like to express my sincere gratitude to all those who helped in making of this project.
I am also grateful to all my friends and classmates for helping me to make this project.
.......................................................
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
ABSTRACTAccelerometers can be used for measuring both dynamic and static measurements of acceleration.
The objective of our project is to “design a PIC board which can sense which direction we are moving our hand and then control a toy car with it”. This is implemented with the help of accelerometer. The design has a microcontroller which is the heart of the circuit, an accelerometer used as a tilt sensor, a driver IC and dc motors.
The movement represents different operations such as forward, reverse, left and right. By using this mechanism we move a toy car, by the tilt of accelerometers.
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
CONTENTSBonafide Certificate………………………………………………………………......................02
Acknowledgements………………………………………………….....................................03
Abstract............................................................................................……………04
Introduction................................................................….................................06
Block diagram.................................................................................................07
Circuit diagram...............................................................................................09
PCB layout......................................................................................................12
Photograph.....................................................................................................13
Program..........................................................................................................14
Application......................................................................................................21
Conclusion......................................................................................................22
References......................................................................................................23
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
INTRODUCTIONThe printed circuit board of our toy car is loaded with several units such as microcontroller, TILT Sensor, driver circuit and motors. Microcontroller is the heart of the circuit. The microcontroller used is PIC 16F877a. It is a flash type reprogrammable memory. It also provides sufficient power to inbuilt peripheral devices .The system used here is embedded systems. The application of this system makes user friendly cheaper solutions and enables to add features otherwise impossible to provide other means. The software used for the embedded system is called firmware. The language used is pic c.
Our project uses an accelerometer to control movements of a toy car based on the acceleration given, which depends on gravity.
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
BLOCK DIAGRAM
BLOCK DIAGRAM DESCRIPTION
1.MMA7260QT
The MMA7260QT capacitive accelerometer features signal conditioning, temperature compensation and g - Select allows selection among 4 sensitivities.
• Selectable Sensitivity (1.5 g/2g/4g/6g ) and Low Current Consumption : 500 μA
• Sleep Mode: 3 μ A and Low Voltage Operation: 2.2 V – 3.6 V
• 6mm x 6mm x 1.45mm QFN and High Sensitivity (800 mV/g @ 1.5g)
• Fast Turn on Time, Integral Signal Conditioning with Low Pass Filter and low cost
2. PIC16F877a
This powerful (200 nanosecond instruction execution) yet easy-to-program (only 35 single word instructions) CMOS FLASH-based 8-bit microcontroller packs Microchip's powerful PIC® architecture into a 40- or 44-pin package. 256 bytes of EEPROM data memory, self programming and 2 Comparators 8 channels of 10-bit ADC and 2 capture/compare/PWM functions synchronous serial port can be configured as either 3wire Serial Peripheral
Interface (SPI™) or the 2-wire Inter-Integrated Circuit (I²C™) bus Universal Asynchronous Receiver Transmitter (UART).
3. L293D
The L293 and L293D are quadruple high-current half-H drivers. The main features include the following:
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
PIC
16F877AACCELEROMETER
MMA7260QT
DRIVER IC
L293D
MOTOR
12V
MOTOR
12V
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
Featuring Unitrode L293 and L293D Products Now From Texas Instruments Wide Supply-Voltage Range: 4.5 V to 36 V Separate Input-Logic Supply Internal ESD Protection Thermal Shutdown High-Noise-Immunity Inputs Functional Replacements for SGS L293 and SGS L293D Output Current 1 A Per Channel (600 mA for L293D) Peak Output Current 2 A Per Channel (1.2 A for L293D) Output Clamp Diodes for Inductive Transient Suppression (L293D)
4.MOTOR
The motor we use is a 12V, 0.6A dc motor. Actually a set of 2 dc motors are used here which can move in both forward and reverse directions. The base mechanism is based on simple electromagnetism.
CIRCUIT DIAGRAM
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
CIRCUIT DIAGRAM DESCRIPTION
1.MMA7260QT
The Free scale accelerometer consists of two capacitive sensing cells (g-cell) and ASIC.The g-cell can be modelled as a set of beams attached to a movable central mass that move between fixed beams. The movable beams deflect from rest when subject to acceleration. As the beams move, distance from them to the fixed beams on one side will increase by the same amount that the distance to the fixed beams on the other side decreases. As the centre beam moves with acceleration, the distance between the beams changes and each capacitor's value will change, (C = Aε/D). Where A –area, ε -dielectric constant and D-distance between beams. Accelerometers are used for measuring tilt which is a static measurement where gravity is the acceleration. For highest degree resolution high sensitivity accelerometer is required. A simple tilt application can be implemented using an 8/10-bit microcontroller that has 1 or 2 ADC channels .To obtain the most resolution the IC should be mounted with the sensitive axis parallel to the plane of movement.
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
MMA7260QT PINOUT
2.PIC 16F877A
PIC16F877 is a microcontroller, which contain CPU, memory, peripherals etc all in a single chip. It is a 40 pin DIP flash type reprogrammable memory. Pins are arranged
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
as 5 ports (A(6),B(8),C(8),D(8) and E(3)).Ports A and E become analog inputs, so they have to set up for digital I/O if required. Port B is used for downloading the program to chip flash ROM and can generate an interrupt. Port C is used to access timers and serial ports. Port D act as slave port. Port E provides the control pins for this function.
16F877A pin-out
3.L293D
3. L293D
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.
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
Pin out of L293D
CIRCUIT FOR BREAK OUT BOARD OF ACCELEROMETER
PCB LAYOUT
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
PHOTOGRAPHS
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
PROGRAM
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
#include<16f877a> //header files
#define adc=10
int 16 x, y, a, n; // initialize variables
void motor fwd(int 16x); // function that sets motor forward
void motorbwd(int 16a); // function that sets motor backward
void motor_stat(int 16a); // function that sets motor stationery
void motor rgt(int 16y); // function that sets motor right
void motor lft(int 16y); // function that sets motor left
void main()
{
setup_adc_ports(ALL_ANALOG); // set ports
setup_adc(ADC_CLOCK_INTERNAL); // set ADC
while(1)
{
set_adc_channel(1); //set channel 1
delay_ms(10); // provide delay
y=read_adc();
set_adc_channel(0); //set channel 0
delay_ms(10);
x=read_adc();
if(x<300)
{
motorbwd(x);//rotate motor backward
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
while(1)
{
set_adc_channel(0);
delay_ms(10);
x=read_adc();
if(x>300)
{
motor_stat(x);//motor stationery
break;
}}}
else if(x>(400)
{
motorfwd(x);//rotate motor forward
while(1)
{
set_adc_channel(0);
delay_ms(10);
x=read_adc();
if(x<400)
{
motor_stat(x);
break;
}}}
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
if(y<300)
{
motorrgt(y) ; //rotate motor right
while(1)
{
set_adc_channel(1);
delay_ms(10);
y=read_adc();
if(y>300)
{
motor_stat(y);
break;
}}}
else if(y>300)
motor lft(y);
while(1)
{
set_adc_channel(1);
delay_ms(10);
y=read_adc();
if(y<400)
{
motor_stat(x);
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
break;
}}}}}
void motorfwd(int 16x)
{
output_low(pin_B0) ;//B0 low
output_low(pin_B5) ;//B5 low
output_low(pin_B2) ;//B2 low
output_low(pin_B3) ;//B3 low
output_high(pin_B0); //B0 high
output_low(pin_B5);
output_high(pin_B2);
output_low(pin_B3);
}
voidmotor bwd(int 16x)
{
output_low(pin_B0);
output_low(pin_B5);
output_low(pin_B2);
output_low(pin_B3);
output_high(pin_B5);
output_low(pin_B0);
output_high(pin_B3);
output_low(pin_B2);
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
}
void motor_stat(int16y)
{
output_low(pin_B0);
output_low(pin_B5);
output_low(pin_B2);
output_low(pin_B3);
}
void motorrgt(int 16y)
{
output_low(pin_B0);
output_low(pin_B5);
output_low(pin_B2);
output_low(pin_B3);
output_low(pin_B0);
output_high(pin_B5);
output_low(pin_B2);
output_low(pin_B3);
}
voidmotor lft(int 16y)
{
output_low(pin_B0);
output_low(pin_B5);
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
output_low(pin_B2);
output_low(pin_B3);
output_low(pin_B0);
output_low(pin_B5);
output_high(pin_B2);
output_low(pin_B3) ;
}
APPLICATION
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
Our project has typical applications like data collection in remote areas,used as toy,reduces man power,is automated and can be used for spy works.
CONCLUSION
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
We have designed a toy car which can be controlled using an accelerometer.Tilt given to the accelerometer controls the movement of the car. Tilt sensors have a secure place in the movement of equipment based on actions done. The system can be made free from challenges and will be cost effective in the near future.
REFERENCES
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
www.engineeringminiprojects.com www.electronicsengineeringprojects.com
1. Programming 8-bitPIC Microcontrollers In C by Martin P Bates,
Copyright 2001 by Martin P Bates All Rights Reserved.
2. PIC16F87X Tutorial by Example by Peter H. Anderson,Baltimore,MD,Jan,01
3. All material &facts about the PIC16F877 by Microchip Technology,Inc.
4. Ccs_c manual.
5. © Freescale Semiconductor, Inc., 2005-2008. All rights reserved(datasheet for MMA7260QT)
6 . Texas Instruments Incorporated(datasheet for L293D).
7. www.sunrom.com(break out board of MMA7260QT)
www.engineeringminiprojects.com www.electronicsengineeringprojects.com