Toy Car Control Using Accelerometer | Pic Microcontroller | Accelerometer

www.engineeringminiprojects.com www.electronicsengineeringprojects.

com

TOY CAR CONTROL USING ACCELEROMETER
MINIPROJECT REPORT
Submitted in partial fulfilment of the requirements For the award of the degree of Bachelor of Technology In Electronics and Communication Engineering Of

SUBMITTED BY
.............................................

REGISTER NO:-.................
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING

PLACE:-........................... DATE:-......./......./............

www.engineeringminiprojects.com www.electronicsengineeringprojects.com

www.engineeringminiprojects.com www.electronicsengineeringprojects.com

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING

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

...........electronicsengineeringprojects..........com www. .com www....electronicsengineeringprojects.engineeringminiprojects.................www.....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.com . www......engineeringminiprojects.

electronicsengineeringprojects. This is implemented with the help of accelerometer. by the tilt of accelerometers.com ABSTRACT Accelerometers can be used for measuring both dynamic and static measurements of acceleration.engineeringminiprojects. www.www.com .com www.com www.engineeringminiprojects. By using this mechanism we move a toy car. 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”. The movement represents different operations such as forward. a driver IC and dc motors. reverse. left and right. The design has a microcontroller which is the heart of the circuit.electronicsengineeringprojects. an accelerometer used as a tilt sensor.

.............................................. ..electronicsengineeringprojects... ……………04 Introduction....................06 Block diagram......... …....................................com www......engineeringminiprojects.......................... 09 PCB layout............14 Application......22 www.................................................................................13 Program........................................................................................................com www...................................................................................... ................................. ....12 Photograph..........21 Conclusion...... ...........................electronicsengineeringprojects.............engineeringminiprojects................................. ........................................03 Abstract....................02 Acknowledgements………………………………………………….................... .........com ....com CONTENTS Bonafide Certificate………………………………………………………………..................................................www........................ ...............................07 Circuit diagram............................................................................................... ..........................................................................................................

...com References........ which depends on gravity.The system used here is embedded systems..............com . The microcontroller used is PIC 16F877a..23 INTRODUCTION  The printed circuit board of our toy car is loaded with several units such as microcontroller........... .electronicsengineeringprojects.......www..engineeringminiprojects........ www... The language used is pic c....... driver circuit and motors..... It also provides sufficient power to inbuilt peripheral devices .... It is a flash type reprogrammable memory...... The application of this system makes user friendly cheaper solutions and enables to add features otherwise impossible to provide other means.com www... The software used for the embedded system is called firmware..... Microcontroller is the heart of the circuit.......... TILT Sensor.engineeringminiprojects......electronicsengineeringprojects..... Our project uses an accelerometer to control movements of a toy car based on the acceleration given....com www......

engineeringminiprojects.com www.6 V www.com .engineeringminiprojects.com www.MMA7260QT 12V The MMA7260QT capacitive accelerometer features signal conditioning.5 g/2g/4g/6g ) and Low Current Consumption : 500 μA • Sleep Mode: 3 μ A and Low Voltage Operation: 2.Select allows selection among 4 sensitivities.com BLOCK DIAGRAM MOT OR PIC ACCELEROME TER 16F87 7A DRIVER IC 12V MOT OR BLOCK DIAGRAM DESCRIPTION 1.electronicsengineeringprojects. temperature compensation and g .electronicsengineeringprojects. • Selectable Sensitivity (1.www.2 V – 3.

45mm QFN and High Sensitivity (800 mV/g @ 1.electronicsengineeringprojects. PIC16F877a This powerful (200 nanosecond instruction execution) yet easy-toprogram (only 35 single word instructions) CMOS FLASH-based 8-bit microcontroller packs Microchip's powerful PIC® architecture into a 40. • 256 bytes of EEPROM data memory.5g) • Fast Turn on Time.electronicsengineeringprojects.2 A for L293D) Output Clamp Diodes for Inductive Transient Suppression (L293D) 4.com • 6mm x 6mm x 1. Integral Signal Conditioning with Low Pass Filter and low cost 2. L293D The L293 and L293D are quadruple high-current half-H drivers.www.or 44-pin package. 3.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.engineeringminiprojects.com .com www.engineeringminiprojects.MOTOR www.com www. 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). The main features include the following: • • • • • • • • • • Featuring Unitrode L293 and L293D Products Now From Texas Instruments Wide Supply-Voltage Range: 4.

www.com The motor we use is a 12V.com www.6A dc motor. 0.engineeringminiprojects.com www.com .engineeringminiprojects. The base mechanism is based on simple electromagnetism. CIRCUIT DIAGRAM www.electronicsengineeringprojects.electronicsengineeringprojects. Actually a set of 2 dc motors are used here which can move in both forward and reverse directions.

(C = Aε/D).www.com www. the distance between the beams changes and each capacitor's value will change.electronicsengineeringprojects.com www. 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. The movable beams deflect from rest when subject to acceleration. Accelerometers are used for measuring tilt which is a static measurement where gravity is the acceleration.engineeringminiprojects. As the beams move.com . ε -dielectric constant and D-distance between beams.electronicsengineeringprojects. Where A –area. For highest degree resolution high sensitivity accelerometer is required.The g-cell can be modelled as a set of beams attached to a movable central mass that move between fixed beams.To obtain the most resolution the IC www.engineeringminiprojects.MMA7260QT The Free scale accelerometer consists of two capacitive sensing cells (g-cell) and ASIC. As the centre beam moves with acceleration. A simple tilt application can be implemented using an 8/10-bit microcontroller that has 1 or 2 ADC channels .com CIRCUIT DIAGRAM DESCRIPTION 1.

engineeringminiprojects.electronicsengineeringprojects.com .com www.electronicsengineeringprojects.www.PIC 16F877A www.com should be mounted with the sensitive axis parallel to the plane of movement.engineeringminiprojects.com www. MMA7260QT PINOUT 2.

D(8) and E(3)). which contain CPU. Pins are arranged as 5 ports (A(6).Ports A and E become analog inputs.engineeringminiprojects. Port B is used for downloading the program to chip flash ROM and can generate an interrupt.electronicsengineeringprojects. Port C is used to access timers and serial ports. 16F877A pin-out 3. It is a 40 pin DIP flash type reprogrammable memory. memory.com .www.C(8).electronicsengineeringprojects. The L293 is designed to provide bidirectional drive currents of up to 1 A at voltages from 4.B(8). Port D act as slave port.com PIC16F877 is a microcontroller.5 V to 36 V. peripherals etc all in a single chip.engineeringminiprojects.L293D 3. so they have to set up for digital I/O if required. The L293D is designed to provide www. L293D The L293 and L293D are quadruple high-current half-H drivers.com www. Port E provides the control pins for this function.com www.

com www. dc and bipolar stepping motors. solenoids.www.engineeringminiprojects. All inputs are TTL compatible.com bidirectional drive currents of up to 600-mA at voltages from 4.electronicsengineeringprojects. as well as other high-current/high-voltage loads in positive-supply applications.5 V to 36 V.com .electronicsengineeringprojects.engineeringminiprojects. Pin out of L293D CIRCUIT FOR BREAK OUT BOARD OF ACCELEROMETER PCB LAYOUT www. Both devices are designed to drive inductive loads such as relays.com www.

com www.engineeringminiprojects.com PHOTOGRAPHS www.com .electronicsengineeringprojects.com www.www.electronicsengineeringprojects.engineeringminiprojects.

com PROGRAM #include<16f877a> //header files #define adc=10 www.com www.www.electronicsengineeringprojects.engineeringminiprojects.electronicsengineeringprojects.engineeringminiprojects.com www.com .

// provide delay y=read_adc().engineeringminiprojects. //set channel 0 delay_ms(10). // function that sets motor backward void motor_stat(int 16a). y.//rotate motor backward while(1) { set_adc_channel(0). // initialize variables void motor fwd(int 16x). // function that sets motor right void motor lft(int 16y).com www.electronicsengineeringprojects.electronicsengineeringprojects. // function that sets motor forward void motorbwd(int 16a). a. // set ADC while(1) { set_adc_channel(1).www. if(x<300) { motorbwd(x). n. x=read_adc(). // function that sets motor left void main() { setup_adc_ports(ALL_ANALOG). set_adc_channel(0).com . // function that sets motor stationery void motor rgt(int 16y). www.engineeringminiprojects. //set channel 1 delay_ms(10).com www.com int 16 x. // set ports setup_adc(ADC_CLOCK_INTERNAL).

if(x>300) { motor_stat(x). x=read_adc(). delay_ms(10).com www. x=read_adc().com delay_ms(10).www.//motor stationery break.engineeringminiprojects. }}} else if(x>(400) { motorfwd(x).com www.engineeringminiprojects.electronicsengineeringprojects.//rotate motor forward while(1) { set_adc_channel(0). if(x<400) { motor_stat(x). //rotate motor right while(1) www. break.com .electronicsengineeringprojects. }}} if(y<300) { motorrgt(y) .

if(y>300) { motor_stat(y). delay_ms(10). break.//B0 low www.com .engineeringminiprojects. if(y<400) { motor_stat(x). y=read_adc().electronicsengineeringprojects.electronicsengineeringprojects. }}}}} void motorfwd(int 16x) { output_low(pin_B0) . while(1) { set_adc_channel(1). }}} else if(y>300) motor lft(y).engineeringminiprojects.www.com { set_adc_channel(1).com www. y=read_adc(). break. delay_ms(10).com www.

www.engineeringminiprojects.//B2 low output_low(pin_B3) .com www. //B0 high output_low(pin_B5). } voidmotor bwd(int 16x) { output_low(pin_B0). } void motor_stat(int16y) { output_low(pin_B0).com . output_low(pin_B0). output_low(pin_B3).electronicsengineeringprojects.electronicsengineeringprojects. output_low(pin_B2).//B5 low output_low(pin_B2) . output_low(pin_B2). output_high(pin_B2).engineeringminiprojects. output_low(pin_B3). www.com www.//B3 low output_high(pin_B0). output_high(pin_B5).com output_low(pin_B5) . output_low(pin_B5). output_low(pin_B2). output_high(pin_B3). output_low(pin_B5).

engineeringminiprojects.com . output_low(pin_B2).com www.com www. output_high(pin_B2). } www. output_low(pin_B3) .com output_low(pin_B3).electronicsengineeringprojects.www. output_low(pin_B2).engineeringminiprojects. output_low(pin_B0).electronicsengineeringprojects. output_high(pin_B5). output_low(pin_B3). output_low(pin_B0). } voidmotor lft(int 16y) { output_low(pin_B0). output_low(pin_B5). output_low(pin_B2). output_low(pin_B5). output_low(pin_B3). output_low(pin_B5). output_low(pin_B3). } void motorrgt(int 16y) { output_low(pin_B0).

used as toy.reduces man power. www.engineeringminiprojects.electronicsengineeringprojects.com www.www.is automated and can be used for spy works.com www.com APPLICATION Our project has typical applications like data collection in remote areas.electronicsengineeringprojects.engineeringminiprojects.com .

com www.Tilt given to the accelerometer controls the movement of the car.www.engineeringminiprojects.com CONCLUSION We have designed a toy car which can be controlled using an accelerometer.com .com www.engineeringminiprojects. The system can be made free from challenges and will be cost effective in the near future.electronicsengineeringprojects. Tilt sensors have a secure place in the movement of equipment based on actions done.electronicsengineeringprojects. www.

Programming 8-bitPIC Microcontrollers In C by Martin P Bates. 5.www.com .MD. All rights reserved(datasheet for MMA7260QT) www. All material &facts about the PIC16F877 by Microchip Technology. 4.engineeringminiprojects. 2005-2008.com REFERENCES 1.Jan.com www. 2..Baltimore. Copyright 2001 by Martin P Bates All Rights Reserved. PIC16F87X Tutorial by Example by Peter H.Inc.01 3.com www. © Freescale Semiconductor.engineeringminiprojects.electronicsengineeringprojects. Ccs_c manual.electronicsengineeringprojects. Anderson. Inc.

engineeringminiprojects. Texas Instruments Incorporated(datasheet for L293D).www.engineeringminiprojects.com www.com . www.com www. 7.sunrom.com(break out board of MMA7260QT) www.electronicsengineeringprojects.electronicsengineeringprojects.com 6 .

Sign up to vote on this title
UsefulNot useful

Master Your Semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master Your Semester with a Special Offer from Scribd & The New York Times

Cancel anytime.