Friday 12 April 2013

The Accelerometer

The accelerometer is a device that measures the current forces acting on the device. It is useful in calculating acceleration or detecting vibrations on an object. Even the smallest tilt and movements can be detected from these devices.

Operation



Generally there are two main ways in which the accelerometer operates. One way is by the microscopic crystal structure in the accelerometer that is stressed by accelerating forces causing a small voltage to be generated. The other is by using the change capacitance between two microstructures close to each other which is caused when one of the structures moves due to an accelerative force. Using these changes, the direction and magnitude can be found by manipulating the changes observed from the change in voltage or through a circuit that changes the capacitance to a visible change in voltage. Other ways this can be done is by the piezo-resistive effect, hot air bubbles and light.

Accelerometers that use the Piezoelectric effect are man-made and the acceleration is calculated based on the charges gained from microscopic crystalline structures when they are accelerated. The accelerometer used for this project will be a dual axis accelerometer which is capable of detecting the forces of acceleration on the X and Y axis. Using these values and the effect is has on the duty cycle of the system, it is possible to relate the readings and find the direction in which the accelerometer is moving.

Scaling raw data provides a way to convert raw measurement data from the data acquisition system – in our case the PIC24fj128GA010 with the accelerometer. Linearly scaling with asymmetric data is a possible way of converting raw data to useable data.



(Eq.1)

Where

Scaled Value is the usable scaled data

UR is the unit range

SR is the sensor range

SO is the sensor output

Offset is the offset



The scaled value from this linear scaling formula can then be manipulated further to get the required data output. This formula is essential and can be used to find useful data from the raw data being outputted by the data acquisition system. The period and the duty cycle is an important value for this project. The period is found to be the time it takes to go through one cycle of being in one on state and one off state, while the duty cycle is the ratio of time that the signal is on versus the time that it is off . Knowing the period and the duty cycles, we can calculate the scale value using (Eq. 1).

The accelerometer used in this design is a digital accelerometer which uses pulse width modulation for the output. It will produce a square wave in which the time the voltage is high will be proportional to the amount of acceleration. The advantage to this accelerometer is that it is very stable and produces a direct output signal.

Application

For this design project, there are 3 main uses of the accelerometer being installed. The accelerometer is used to measure the speed of the ride, the tilt that the ride seat experiences, and the amount of G forces being exerted on the riders.

To retrieve the speed of the ride from the accelerometer, the time it takes between two peaks in the G force reading is recorded. This value is the RPM of the smaller rotation of the ride, and the exact speed in m/s could be calculated by knowing the radius of this rotation. Because the ride is gear operated with a single drive motor, the RPM of the main rotation can be calculation by knowing this gear ratio or knowing how many smaller rotations are completed within one large rotation.

An equation can be used to measure the tilt angle of the ride. Because the tilt angle is a combination of the x-axis and y-axis, by using the arc tangent function of the y-axis/x-axis the angle theta can be obtained. Another possibility would be to use a look up table where the values of specified angles can be assigned to different values of the y-axis/x-axis ratio though this would be very time consuming but may save resources and reduce the overall iteration time of the program. In figure 6, the axis are labels according to the orientation of the accelerometer.

The G-force experienced by the rider is directly calculated from the x-axis and y-axis readings through the analog to digital converter of the microcontroller. This is a necessary measurement as riders who experience discomfort may feel sick and are less likely to spend more money on other rides. The operator can then reduce the speed of the ride if the G-force is viewed to be beyond a recommended value.

Implementation of The Accelerometer

The accelerometer produces a pulse width modulated signal which is read by detecting the rising and falling edges of the signal and processing the data. To do this on a dual axis accelerometer, two interrupt service routines are required.

For this project, PIN RD8 and RD10 were used as input where the corresponding interrupts were IC1 and IC3. These interrupts were implemented by first clearing both of the status flags by setting the ICxIF flag to 0. The pins RD8 and RD10 were set as an input by setting the TRISDx to 1. The main routine of the accelerometer consists of a signal algorithm where one interrupt is enabled (ICxIE) and the calculations are done to determine the tilt angle, the speed and the G force. The previous interrupt is then disabled and the second interrupt is enabled where the calculations occur again. This method guarantees the continuous update of the data taking into account both axis of the accelerometer.

For these methods to work, it is crucial for the interrupts to be configured properly. Both interrupts follow the exact same algorithm and are triggered on every rising and falling edge. The value of the interrupt capture buffer is stored in an array where the duty cycle is calculated by counting the time between one rising and one falling edge. The total period is also calculated by counting the time between the two rising edges.

Before exiting the interrupt subroutine, the interrupt flag is cleared and the program resumes until another rising or falling edge is detected.

0 comments:

Post a Comment