



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Material Type: Lab; Professor: Goodman; Class: Senior Design; Subject: Electrical & Computer Egr; University: Michigan State University; Term: Spring 2007;
Typology: Lab Reports
1 / 5
This page cannot be seen from the preview
Don't miss anything!




Executive Summary: This application note explains how to initialize/calibrate a sensor when the device is first turned on, and also how to design algorithms to properly analyze the output of the sensor. How to convert a DC voltage into a desired DC voltage will also be briefly discussed. Key Words:
Introduction: Many electrical devices today have a sensor as one of its components. These sensors can be used for applications such as temperature sensing (thermometer) or acceleration sensing (accelerometer). In order to properly use these devices they must be initialized to cancel out unwanted “noise” that may throw off calculations. Most devices that use a senor also do analysis of their outputs, which requires algorithm design to perform specific calculations. These initialization and algorithms are executed using programmable microcontrollers. Also, all electrical devices are required to operate at very specific voltages. This usually can not be achieved by hooking batteries together and connecting them directly to the circuit. DC voltage regulators are commonly used to solve this problem. Using a PIC: There is no sensor that can just be hooked up directly to a display and turned on and the correct output is shown. The output needs to be processed, and using a PIC is a great way to do this. A PIC is a microcontroller that can be programmed by a computer program such as Microchip MPLab to perform certain functions and calculations. Initialization: To further explain why a sensor needs to be initialized a single axial accelerometer will be used as an example. Many companies use these accelerometers to measure vibrations of machinery or damaging shipping vibrations. When the axis of this accelerometer is faced perpendicular to the Earth it will give an output the represent the Earth’s gravitational pull, but if it is parallel to the Earth the output will represent no acceleration. Any company using this device will want it to start off at zero acceleration no matter the orientation of the accelerometer. The diagram below illustrates this problem: Accelerometer Output = 1G Accelerometer Output = 0G
Algorithm Design: All different sensing devices require different algorithms depending on the type of analysis necessary. Because of this an accelerometer that needs to calculate RMS (root mean square) value of its output subtracting any DC offset values that it senses will be used as an example. The best way to design an algorithm is to first decide what the device needs to accomplish then write it down on a piece of paper. The next step would be to convert that algorithm so it can be coded using a language such as C or C++. The equation for calculating the RMS value is shown below: This equation squares an input, averages it, and then takes the square root of that average. The variable “n” represents the number of values being averaged. The next step is to convert this into an algorithm that can be coded. The first line will subtract any DC levels from the output of the accelerometer. To calculate the DC level use function described in Initialization section. 2.5V is the voltage output that represents 0 acceleration for this accelerometer: calibrated_voltage = voltage_from_accel-offset; //sets initial value to 2.5V The next line will square the sample taken from the accelerometer: squared_volts = calibraed_voltage*calibrated_voltage; //squares output form accel. Next, these samples must be summed and averaged: average_temp = average_temp + squared_volts; average = average_temp/count; The variable “count” represents the number of samples that have been taken. Finally the square root of “average” must be calculated. Remember to add the right libraries or some of these calculations will not work. A library is a set of predefined functions that can be called by the user instead of having to write new algorithms every time. In this case for programming in C the “math.h” library must be included for the next line: RMS = sqrt(average); //takes the square root of the average calculated above Follow this process for any calculations and the correct algorithm can be achieved.
DC Voltage Regulation: Most components of an electronic device require a constant DC voltage supply. Batteries directly connected to the circuit can not be used because battery voltages tend to drop the more they are used. To solve this problem voltage regulators are used. Than can take any input and convert it to the desired output. The two most common types of regulators are linear and switching regulators. These can be either fixed or variable depending on their applications. Linear voltage regulators use elements such as transistors operating in their linear region to control the voltage. These regulators have a very stable output and are very resistive to outside noise, and they have a fast response time to changing voltages. Switching regulators uses switches that turn on and off at a certain duty cycle controlling the amount of charge that is transferred to the circuit. The benefit of switching regulators is they can generate output voltages that are higher than their input, and they can also generate voltages of opposite polarity. Also, they are much more power efficient than linear voltage regulators. A fixed voltage regulator always outputs the same voltage. Most circuit devices operate at a very common voltage such as 5V for example. For this, fixed voltage regulators can be used. If the voltage is uncommon however, a variable regulator needs to be used. A variable voltage regulator is the same as a fixed regulator except its output can be changed. These often require extra circuitry to function properly so they are avoided when space is important. Conclusion: The initialization process for a sensing device is very important in gathering accurate data that can be analysed correctly. Although all electronic devices are different, they can be initialized in a way very similar to the one described in this application note. The algorithms used to analyze data from a sensor can vary greatly, but the process to design those algorithms can be applied to all of them. This process can turn long complicated complications into a simple process. DC voltage regulars play a very important role in the operation of circuits. Most components require a constant input voltage, but the voltage supplied may not be. These convert, stabilize, and clean up the power before it reaches the circuit. References: Wikipedia Encyclopedia http://en.wikipedia.org/wiki/Root_mean_square http://en.wikipedia.org/wiki/Voltage_regulator MMA1250D Accelerometer Data Sheet http://www.compel.ru/images/catalog/120/MMA1250D.pdf