Download as pdf or txt
Download as pdf or txt
You are on page 1of 15

ACELERÓMETRO

Profesor Cesar Hernán Rodríguez Garavito.


Sistemas Digitales.
Universidad de La Salle.
2017
ACELERÓMETRO
ACELERÓMETRO

Features:
• Selectable Sensitivity (1.5g/2g/4g/6g)
• Low Current Consumption: 500 µA
• Sleep Mode: 3 µA
• Low Voltage Operation: 2.2 V – 3.6 V
• 6mm x 6mm x 1.45mm QFN
• High Sensitivity (800 mV/g @ 1.5g)
• Fast Turn On Time
• Integral Signal Conditioning with Low Pass Filter
• Robust Design, High Shocks Survivability
• Pb-Free Terminations
• Environmentally Preferred Package
• Low Cost
ACELERÓMETRO

Principle of Operation
ACELERÓMETRO
g-Select
• The g-Select feature allows for the selection among 4 sensitivities
present in the device.

• The g-Select1 and g-Select2 pins can be left unconnected for


applications requiring only a 1.5g sensitivity as the device has an
internal pull-down to keep it at that sensitivity (800mV/g).
ACELERÓMETRO
Dynamic Acceleration
ACELERÓMETRO
Static Acceleration
ACELERÓMETRO
ACELERÓMETRO

Equation accel

∆𝑉
𝑉!"# = 𝑉$%% + 𝑔 sin 𝜃
∆𝑔

Vout : Voltaje de salida del acelerómetro


Voff : Voltaje de Offset
ΔV/Δg : Sensibilidad
g : valor de la gravedad.
θ : ángulo de inclinación
ACELERÓMETRO
Deduction accel’s X compontent

𝐴#
Θ= tan!"
𝐴$ % + 𝐴& %
ACELERÓMETRO #include <hidef.h> /* for
EnableInterrupts macro */
#include <math.h>
Lectura de Θ en C #include "derivative.h" /* include
peripheral declarations */

#define Config_ADC()
APCTL1=0b00000000;ADCCFG=0b00001000;
#define Config_ADC_Pin()
PTADD=0b00000000; PTAPE=0b11000000;

Donde: #define EndConversionAdc() ADCSC1_COCO


Ai : medida de la aceleración en el eje i. #define SelAdc3_Ax() ADCSC1 = 1
PTA1 – ADC1 - Ax #define SelAdc4_Ay() ADCSC1 = 8
#define SelAdc5_Az() ADCSC1 = 9
PTA6 – ADC8 - Ay #define Disable_COP() SOPT1_COPE=0;
PTA7 – ADC9 – Az //deshabilita el COP
#define Led1On() PTCD_PTCD3 = 1;
PTCDD_PTCDD3 = 1
#define Led1Off() PTCD_PTCD3 = 0;
PTCDD_PTCDD3 = 1
#define NRO_PI (float)3.1415927
//equivalencia del número PI
//constantes de la función de
transferencia Voltaje Vs gravedad
#define OFFSET (float)310
#define MAX_VAL (float)520
#define PENDIENTE (float)(MAX_VAL-
OFFSET)
ACELERÓMETRO
unsigned int GetResultAdc(void);
Lectura de Θ en C unsigned int GetResultAdc(void){
unsigned int out = ADCRH;
return ADCRH*256+ADCRL;
//variable usada para estados del }
Procedimiento ADC struct dataAcel{
char adcSt; unsigned int valX;
enum{ unsigned int valY;
INI_ADC, unsigned int valZ;
WAIT_AX, };
WAIT_AY, struct datagAcel{
WAIT_AZ float gx;
}; float gy;
//Inicialización del ADC del float gz;
MF51QE128 };
void Adc_Init(void); struct dataAcel datosAcel;
void Adc_Init(void){ float anguloRad,magnitudD,
Config_ADC(); anguloGrados,gTotal;
Config_ADC_Pin(); struct datagAcel acel;
adcSt = INI_ADC; unsigned long i;
}
ACELERÓMETRO case WAIT_AZ:
if(EndConversionAdc()){
datosAcel.valZ = GetResultAdc();
Lectura de Θ en C SelAdc3_Ax();
adcSt = WAIT_AX;
//Procedimiento ADC, actualiza }
estructura con valores break;
void Adc_Run(void); }
void Adc_Run(void){ }
switch(adcSt){
case INI_ADC:
SelAdc3_Ax();
adcSt = WAIT_AX;
break;
case WAIT_AX:
if(EndConversionAdc()){
datosAcel.valX = GetResultAdc();
SelAdc4_Ay();
adcSt = WAIT_AY;
}
break;
case WAIT_AY:
if(EndConversionAdc()){
datosAcel.valY = GetResultAdc();
SelAdc5_Az();
adcSt = WAIT_AZ;
}
break;
ACELERÓMETRO Lectura de Θ en C

//Función de conversión de radianes a grados


float Radianes2Grados(float rad);
float Radianes2Grados(float rad){
static float grados;
grados = (rad*(float)180)/NRO_PI;
return grados;
}
void main(void) {
Disable_COP();
EnableInterrupts; /* enable interrupts */
/* include your code here */
Adc_Init();
for(;;) {
for(i=0;i<1500;i++) Adc_Run();
// Angulo = tan-1(Ax/SQRT(Ay2 + Az2));
acel.gx = ((float)datosAcel.valX - OFFSET)/PENDIENTE;
acel.gy = ((float)datosAcel.valY - OFFSET)/PENDIENTE;
acel.gz = ((float)datosAcel.valZ - OFFSET)/PENDIENTE;
ACELERÓMETRO Lectura de Θ en C

gTotal = acel.gx+acel.gy+acel.gz;
magnitudD = pow(acel.gy,(float)2);
magnitudD += pow(acel.gz,(float)2);
magnitudD= sqrt(magnitudD);
magnitudD = acel.gx/magnitudD;
anguloRad = atan(magnitudD);
anguloGrados = Radianes2Grados(anguloRad);
if(anguloGrados > 45){
Led1On();
}else{
Led1Off();
}
} /* loop forever */
}

You might also like