Top Banner
Shri Ramdeobaba Kamla Nehru Engineering College, Nagpur Department of Electronics & Communication Engineering PROJECT REPORT ON ‘‘Accelerometer Based Pointing Device’’ Guided By Prof. Vipul Lande Submitted By:
51
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Fin Report 2007

Shri Ramdeobaba Kamla Nehru Engineering College, Nagpur

Department of Electronics & Communication Engineering

PROJECT REPORT

ON

‘‘Accelerometer Based Pointing Device’’

Guided By

Prof. Vipul Lande

Submitted By:

Aditya Oke Nakul Pandey Aniket Gaonkar Rishi Gupta

Anshuman Bhatia Rohit Choudhary

Page 2: Fin Report 2007

CERTIFICATE

Shri Ramdeobaba Kamla Nehru Engineering College, Nagpur-13

This is to certify that the project titled

“Accelerometer Based Pointing Device”

has been successfully completed by the following students in recognition to the partial fulfillment for Eighth Semester B.E. E&C Engineering, Shri Ramdeobaba

Kamla Nehru Engineering College, Nagpur(2008-2009).

Submitted by

Aditya Oke Nakul Pandey Aniket Gaonkar Rishi Gupta

Anshuman Bhatia Rohit Choudhary

Prof. Vipul Lande Prof. K.M Bhurchandi(Project Guide) (HOD, E&C Department)

Dr. V. S. Deshpande(Principal, SRKNEC)

Page 3: Fin Report 2007

ACKNOWLEDGEMENT

The most essential part of good project development is a sound idea and

proper assistance which we got from our efficient guide. We take this

opportunity to express our sincere thanks and heartfelt gratitude to our project

guide Prof. Vipul Lande. We are deeply indebted to him for giving us the

clarity of vision and thought which enabled us to complete our project.

We are especially thankful to Mr.Apurva Kolte for his guidance and his

support for the development of project.

In all our endeavors we have always been guided and supported by our

respected principal Dr. V.S Deshpande. He has always instilled his

confidence in us. He has inculcated many skills in us which we will carry

throughout our lives.

We would like to thank Prof. K.M Bhurchandi, our Head of Department

and all staff members of Electronics & Communication Engineering

Department for extending the facilities without which our project would not

have been a success.

Lastly, our deep regards to all those who directly or indirectly helped us

in the completion of the project.

Page 4: Fin Report 2007

INDEX

Sr.No.

CHAPTER

Page No.

1.

2.

3.

4.

5.

6.

7.

Introduction

Accelerometer

Atmel Atmega32 Microcontroller

3.1 Reason for selecting Atmega32 microcontroller.3.2 Features3.3 Pin Configuration3.4 Pin description3.5 Block Diagram High Level Design

Hardware Design5.1 Interfacing RS232 (PC) with Microcontroller.5.2 Interfacing ADXL202E with Microcontroller.

Program Design6.1 Programming Atmega326.2 Acquisition and Conversion of data for further processing6.3 Movement of pointer6.4 Flow chart

ORCAD Design files 7.1 Schematic design using CAPTURE CIS 7.2 Layout design using LAYOUT PLUS.

1

Page 5: Fin Report 2007

8.

9.

10

11

12

Applications

Appendix9.1 Accelerometer ADXL202JE.

References.

Budget

Result and Conclusion

Page 6: Fin Report 2007

1. Introduction

Since the inception of computers there have been many advances whether they may be in the form of RAMs, hard disks, monitors etc. But we found that the way user interacts with the computer i.e. keyboard and mouse have remained just the same. Hence, we chose to concentrate upon them and decided to change the way a user interacts with computer via a pointing device.

The main objective of our project is to create an accelerometer based pointing device. Though the main application may seem like creating a simple computer mouse but it can be used for plethora of other applications which shall be explained in due course of this report. We have employed RS-232 protocol in order to interface the hardware with the CPU. Initially we had decided to use PS/2 port with its inherent capacity to provide supply voltage but we found that due to PS/2 the complexities increased manifold. Hence, at the prototype stage we decided to stick with the RS-232 but we maintain that upgradation to USB and PS/2 is very much possible.

In order to make the pointing device more comfortable and to remove the limitation of having to keep it on a flat surface we decided to use an accelerometer which has a capability to sense the tilt of the IC with respect to a fixed reference. This output was processed in the Atmega 32 microcontroller and the data was given serially to the computer using RS 232 port.

Page 7: Fin Report 2007
Page 8: Fin Report 2007

2. AccelerometerWhat is an accelerometer?An accelerometer is an electromechanical device that will measure acceleration forces. These forces may be static, like the constant force of gravity pulling at your feet, or they could be dynamic - caused by moving or vibrating the accelerometer.

What are accelerometers useful for?By measuring the amount of static acceleration due to gravity, you can find out the angle the device is tilted at with respect to the earth. By sensing the amount of dynamic acceleration, you can analyze the way the device is moving.At first, measuring tilt and acceleration doesn't seem all that exciting. However, engineers have come up with many ways to make really useful products using them.

An accelerometer can help your project understand its surroundings better. Is it driving uphill? Is it going to fall over when it takes another step? Is it flying horizontally or is it dive bombing your professor? A good programmer can write code to answer all of these questions using the data provided by an accelerometer. An accelerometer can help analyze problems in a car engine using vibration testing, or you could even use one to make a musical instrument.

In the computing world, IBM and Apple have recently started using accelerometers in their laptops to protect hard drives from damage. If you accidentally drop the laptop, the accelerometer detects the sudden freefall, and switches the hard drive off so the heads don't crash on the platters. In a similar fashion, high g accelerometers are the industry standard way of detecting car crashes and deploying airbags at just the right time.

Various types of accelerometers

Capacitive Piezoelectric Piezoresistive Hall Effect Magnetoresistive Heat Transfer

Page 9: Fin Report 2007

Accelerometer’s use in our project

Accelerometer is the basic and major peripheral of our project. The first challenge we faced was selecting the best accelerometer out of the plethora of choices available. The selection parameters we had in mind were cost, performance and availability.

The accelerometers were available in the market in different variations i.e. single axis, dual axes and 3 axes accelerometer. Our requirement was to detect variations in the X-Y plane. i.e. along two axes simultaneously. We did not select a single axis accelerometer as we would have required two of them, while a 3 axes accelerometer would have led to wastage of resources in form of a unused channel and added cost. So we decided to go with a dual axes accelerometer for our application.

Cost Vs Performance for different types of accelerometers

Page 10: Fin Report 2007

Mounting of accelerometer

As the accelerometer obtained was in the form of a SMD package it was practically impossible to mount it using the normal soldering techniques as the leads that came out of the package were very close to each other and the size of the complete package was comparable to a finger nail. Hence we decided to mount it with the help of hot air soldering. This gave us two benefits, firstly the leads became more widely spaced and second, we were able to handle the package with more ease.

Page 11: Fin Report 2007

Testing of accelerometer

After the selection of appropriate accelerometer, we tested its characteristics

The output variation that was obtained from the accelerometer was in the form of analog voltage. In order to calibrate the accelerometer output with the extremities of the screen we found out the minimum and maximum voltage which could be obtained for maximum horizontal and vertical tilt.

Page 12: Fin Report 2007

3.Atmel Atmega32 Microcontroller

3.1 Reason for selecting Atmega32 microcontroller.

(1) Our accelerometer gives output in the form of analog values, in order to pass these values to the CPU it was required to convert them into digital form. We could have used a normal 8051 series microcontroller but as it requires external ADC (Analog to Digital Converter) to be interfaced. It would have led to additional hardware. This drawback was covered in the ATmega32 microcontroller which has an inbuilt ADC.

(2) The other reason for selecting ATmega32 is the flash memory of 32KB.

3.2 Features

High-performance, Low-power AVR® 8-bit Microcontroller

Advanced RISC Architecture– 131 Powerful Instructions – Most Single-clock Cycle Execution– 32 x 8 General Purpose Working Registers– Fully Static Operation– Up to 16 MIPS Throughput at 16 MHz– On-chip 2-cycle Multiplier

High Endurance Non-volatile Memory segments– 32K Bytes of In-System Self-programmable Flash program memory– 1024 Bytes EEPROM

Page 13: Fin Report 2007

– 2K Byte Internal SRAM– Write/Erase Cycles: 10,000 Flash/100,000 EEPROM– Data retention: 20 years at 85°C/100 years at 25°C – Optional Boot Code Section with Independent Lock Bits In-System Programming by On-chip Boot Program True Read-While-Write Operation– Programming Lock for Software Security

JTAG (IEEE std. 1149.1 Compliant) Interface– Boundary-scan Capabilities According to the JTAG Standard– Extensive On-chip Debug Support– Programming of Flash, EEPROM, Fuses, and Lock Bits through the JTAG Interface

Peripheral Features– Two 8-bit Timer/Counters with Separate Prescalers and Compare Modes– One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and Capture Mode.– Real Time Counter with Separate Oscillator– Four PWM Channels– 8-channel, 10-bit ADC, 8 Single-ended Channels, 7 Differential Channels in TQFP Package Only, 2 Differential Channels with Programmable Gain at 1x, 10x, or 200x– Byte-oriented Two-wire Serial Interface– Programmable Serial USART– Master/Slave SPI Serial Interface– Programmable Watchdog Timer with Separate On-chip Oscillator– On-chip Analog Comparator

Page 14: Fin Report 2007

Special Microcontroller Features– Power-on Reset and Programmable Brown-out Detection– Internal Calibrated RC Oscillator– External and Internal Interrupt Sources– Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, standby and Extended Standby

I/O and Packages – 32 Programmable I/O Lines – 40-pin PDIP, 44-lead TQFP, and 44-pad QFN/MLF

Operating Voltages– 2.7 - 5.5V for ATmega32L– 4.5 - 5.5V for ATmega32

Speed Grades– 0 - 8 MHz for ATmega32L– 0 - 16 MHz for ATmega32

Power Consumption at 1 MHz, 3V, 25°C for ATmega32L– Active: 1.1 mA– Idle Mode: 0.35 mA

Page 15: Fin Report 2007

3.3 Pin Configuration

Page 16: Fin Report 2007

3.4 Block Description

Page 17: Fin Report 2007

3.5 Pin Descriptions

VCC Digital supply voltage.

GND Ground.

Port A (PA7-PA0)Port A serves as the analog inputs to the A/D Converter.Port A also serves as an 8-bit bi-directional I/O port, if the A/D Converter is not used. Port pins can provide internal pull-up resistors(selected for each bit).The Port A output buffers have symmetrical drive characteristics with both high sink and source capability. When pins PA0 to PA7 are used as inputs and are externally pulled low, they will source current if the internal pull-upResistors are activated.

Port B (PB7-PB0)

Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port B output buffers have symmetrical drive characteristics with both high sink and source capability. As inputs, Port B pins that are externally pulled low will source current if the pull-up resistors are activated. The Port B pins are tri-stated when a reset condition becomes active, even if the clock is not running.

Page 18: Fin Report 2007

Port C (PC7-PC0)

Port C is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port C output buffers have symmetrical drive characteristics with both high sink and sourcecapability. As inputs, Port C pins that are externally pulled low will source current if the pull-up resistors are activated. The Port C pins are tri-stated when a reset condition becomes active,even if the clock is not running.

Port D (PD7-PD0) Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for each bit). The Port D output buffers have symmetrical drive characteristics with both high sink and sourcecapability. As inputs, Port D pins that are externally pulled low will source current if the pull-up resistors are activated.

RESETReset 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 given in 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.

Page 19: Fin Report 2007

ACCELEROMETERATMEGA 32 MOVEMENT

4. High Level Design

Basic Block Diagram

The above figure gives the brief overview of our project. We are using an accelerometer ADXL202E. The accelerometer measures static accelerationforces such as gravity, allowing it to be used as a tilt sensor. The accelerometer gives the output according to the tilt. The output of accelerometer is given to Atmega 32 IC, which consists of an inbuilt ADC. The output of the ATmega is given to the PC through RS 232.

Page 20: Fin Report 2007

5. Hardware Design

5.1 Interfacing RS232 (PC) with Microcontroller.

For interfacing Microcontroller with serial port of cable you require a serial port cable and max232 or HIN232 (level converter). RS-232 of the computer has LOGIC HIGH in the range of -3 to -25V( mostly around -8.5V) and LOGIC LOW around 3 to 25V (mostly 8.5V). We had to convert it to LOGIC HIGH (5V) and LOGIC LOW (0V) of microcontroller, so we use max232 or you can use any other level converters. Next is to get a serial port cable, if you are not getting a serial port cable, then buy a serial mouse costs around Rs.70 and take the cable from it. But mouse serial port cable has only 4 pins Rx, TX, DTS, GND, so it can't be used for programmers of some microcontrollers. But in our case we require only 3 pins (Rx, TX and GND).

Page 21: Fin Report 2007

5.2 Interfacing ADXL202E with Microcontroller.

Page 22: Fin Report 2007

There are two types of outputs from the accelerometer. One being an analog output giving variations in voltage as we vary the tilt while the other gives the variation in duty cycle according to the tilt. The change in duty cycle didn’t serve our purpose that’s why we selected the analog output of the accelerometer. This output was given to the ADC pins of the microcontroller.

6. Program Design

Page 23: Fin Report 2007

6.1 Programming Atmega32

What we needed to do in Atmega32 was to collect the digital value and pass it on to computer through RS-232 port.This was made fairly simple because of the use of the programming software Code Vision. The digital values were stand in integer form in variables which was subsequently passed on to PC through RS-232.

6.2 Acquisition and Conversion of data for further processing

This was the most difficult part that we experienced during the programming. Firstly on observing the values on hyper terminal we found that integer values were obtained. Now we proceeded towards writing a program which further processed these integer values but we found that the desired output was not obtained.

So to debug the program we wrote a program in C to observe the output of RS-232. Then we found that the values were not directly obtained as integers. Now on observing the output of this we initially thought that some random values were obtained. Now we try to establish coherence between the values obtained and how we could form the required integer values. After careful observation we found that each integer number was broken into individual digits and their ASCII values were obtained on RS 232 port.

6.3 Movement of Pointer

Page 24: Fin Report 2007

Initially the pointer was set by default at the centre of the screen. The coordinates of the centre of the screen were considered as the threshold values for x and y direction. We divided the screen into two parts both in x and y direction. Now for the movement in x direction we compared the updated value for x with its threshold value, if the updated value is greater than the threshold value then move the pointer in right direction and if it is less than the threshold value then move the pointer in left direction. Similar procedure was repeated for the movement of pointer in y direction (i.e. upward and downward movement)

Now our next aim was to form an integer no from the data available for conversion of ASCII values into decimal digits was subtracted 48 from each ASCII values. For ex – ASCII code obtained was 48. That meant that the digit was 0, which was obtained as 48-48=0. While testing the accelerometer we found that the integer no will always be a 3 digit no. So we built a program for a 3 digit no. knowing fully that the no. obtained is not a 2 digit no. 4 digit no. Now our next problem was to detect the point from where a new integer no began. On observation we found that a new integer number was always preceded by two consecutive ASCII values of space. Now geared with all these information we could easily form the required integer no. Now by running this logic twice get two integer nos. one for x and other for y respectively. And this whole procedure is repeated to obtain the updated values.

6.4

Page 25: Fin Report 2007

’’’’’ Flow chart from PowerPoint has been attached ’’’’’

7. Orcad Design Files

7.1 Schematic design using CAPTURE CIS.

Page 26: Fin Report 2007

7.2 Layout design using LAYOUT PLUS.

Page 27: Fin Report 2007

8. Applications

Graphics user interface

The most important use of a pointing device is that of a computer mouse.

Page 28: Fin Report 2007

With the help of accelerometers we can build a mouse that can be operated without it being kept on a hard surface (as the regular mouse is operated).In order to make our application more user friendly we decided to incorporate a GUI menu which would enable the user to choose one service (Game for this case) from many options available using the pointing device.

We have kept an option to extend this program in order to include as many services as possible. When we click on start button, it gives a list of applications which were created by us. These applications also operate with the help of the pointing device. We designed a few games in order to display the capabilities of our pointing device in single axis as well as in dual axis.

Other applications

It can be used in space explorations to operate the rovers.

It can be used for inertial navigation.

It can be used for scrolling in any text document.

It can be used for motion sensing and motion control in robotics.

9. Appendix

9.1 Accelerometer ADXL202JE

Page 29: Fin Report 2007
Page 30: Fin Report 2007
Page 31: Fin Report 2007
Page 32: Fin Report 2007
Page 33: Fin Report 2007
Page 34: Fin Report 2007
Page 35: Fin Report 2007
Page 36: Fin Report 2007
Page 37: Fin Report 2007
Page 38: Fin Report 2007
Page 39: Fin Report 2007
Page 40: Fin Report 2007
Page 41: Fin Report 2007

10. References

http://www.wikipedia.org

http://www.cornell.edu

ATMega32 Microcontroller: http://www.atmel.com/dyn/resources/prod_documents/doc2503.pdf

Analog Devices ADXL202 accelerometer: http://www.analog.com/UploadedFiles/Data_Sheets/567227477ADXL202E_a.pdf

Serial port complete-Jan axelson

Page 42: Fin Report 2007

11. Budget

COMPONENTS COST

Page 43: Fin Report 2007

12. Result and Conclusion