Componentes y Precios:
Laser rojo en Dx 1,4$
Características en Inglés:
The MPU-6050 sensor contains a MEMS accelerometer and a MEMS
gyro in a single chip.
It is very accurate, since it contains 16-bits analog to digital
conversion hardware for each channel. Therefor it captures the x, y, and z
channel at the same time.
Specification:
16bit AD converter-chip, 16-bit
data output
Use Chip: MPU-6050
Power supply :3-5v (internal low dropout regulator)
Communication: IIC communication protocol standard
Gyro Range: ± 250 500 1000 2000 ° / s
Acceleration range: ± 2 ± 4 ± 8 ± 16g
Using Immersion Gold PCB, welding machines to ensure quality
Size: 2 x 1.6 x 0.1mm
Application:
Motion sensing games
Augmented
Reality
Electronic Image Stabilization (EIS: Electronic Image
Stabilization)
Optical Image Stabilization (OIS: Optical Image Stabilization)
"Zero-touch"
gestures User Interface
Pedestrian navigation
Gesture shortcuts
Para comprobar la efectividad del medidor le he conectado un servo que se mueva con el eje x del sensor y en la pala del servo he conectado un laser led que se enciende sólo cuando se mueve.
MPU6050_____Arduino Nano
VCC________3.3v (podría ir en 5v porque tiene un regulador interno)
GND________GND
SCL_________PinA5
SDA_________PinA4
Pins XDA, XCL, ADO y INT on the MPU6050 no se usan en esta prueba. are not used. Los pines del servo (TowwerPro 9g) se conectan al Pin9, +5v y GND en el arduino nano.
Servo --> Arduino
Marron --> GND
Rojo --------> +5v (no funciona con +3.3v)
Amarillo -->Pin9
Laser --> Arduino
azul --> GND
Rojo --> Pin 13
Laser --> Arduino
azul --> GND
Rojo --> Pin 13
#include <Servo.h>
#include <Wire.h>
#include <I2Cdev.h>
#include <MPU6050.h>
MPU6050 mpu;
int16_t ax, ay, az;
int16_t gx, gy, gz;
Servo myservo;
int val;
int prevVal;
void setup()
{ pinMode(13, OUTPUT);
Wire.begin();
Serial.begin(38400);
Serial.println("Initialize MPU");
mpu.initialize();
Serial.println(mpu.testConnection() ? "Connected" : "Connection failed");
myservo.attach(9);
}
void loop()
{ int n=1;
mpu.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
if (n>180) n= 1;
val = map(ay, -17000, 17000, 0, 179);
if (val != prevVal)
{ digitalWrite(13,HIGH);
myservo.write(val);
prevVal = val;
}
delay(50);
digitalWrite(13,LOW);
}
Fotos varias del montaje
No hay comentarios:
Publicar un comentario