รหัสสินค้า | M0664 |
หมวดหมู่ | Gyro..Accelero..Magneto.. |
ราคา | 60.00 บาท |
น้ำหนัก | 2 กรัม |
สถานะสินค้า | พร้อมส่ง |
ลงสินค้า | 16 ก.ค. 2559 |
อัพเดทล่าสุด | 15 ส.ค. 2568 |
จำนวน | ชิ้น |
GY-521 GY521 MPU-6050 MPU6050 Module 3 Axis analog gyro sensors+ 3 Axis Accelerometer Module
link
http://arduino.cc/playground/Main/MPU-6050
http://www.geekmomprojects.com/gyroscopes-and-accelerometers-on-a-chip/
library
https://github.com/jrowberg/i2cdevlib/tree/master
Features:
MPU-6050 Accelerometer + Gyro
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.
Name: MPU-6050 module (three-axis gyroscope + triaxial accelerometer)
Use Chip: MPU-6050
Power supply :3-5v (internal low dropout regulator)
Communication: IIC communication protocol standard
16bit AD converter-chip, 16-bit data output
Gyro Range: ± 250 500 1000 2000 ° / s
Acceleration range: ± 2 ± 4 ± 8 ± 16g
Using Immersion Gold PCB, welding machines to ensure quality
2.54mm pin spacing
Size:2x1.6x0.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
Market:
Smart phone
Tablet device
Handheld games
3D remote controller
Portable navigation devices
Packing includes:
10 x MPU-6050 Module
*
http://www.mediafire.com/file/pnz1dh5s1zoy5tx/MPU6050_Lib.rar/file
http://www.remotexy.com
*
#include "Wire.h"
#include "I2Cdev.h"
#include "MPU6050.h"
MPU6050 mpu6050_0x68(0x68); // <-- use for AD0 low
MPU6050 mpu6050_0x69(0x69); // <-- use for AD0 high
int16_t ax, ay, az;
int16_t gx, gy, gz;
int16_t tempMPU6050;
/////////////////////////////////////////////
// RemoteXY include library //
/////////////////////////////////////////////
// #define REMOTEXY__DEBUGLOGS Serial
// XY_CONNECTION : 0 LAN (wifi,W5100,w5500)
// XY_CONNECTION : 1 AP (AP mode)
// XY_CONNECTION : 2 Bluetooth BT
// XY_CONNECTION : 3 Bluetooth BLE
// XY_CONNECTION : 4 OTG (USB HARDWARE SERIAL)
// XY_CONNECTION : 5 OTG (USB SOFTWARE SERIAL)
// XY_CONNECTION : 6 Clud server
#define XY_CONNECTION 0
//////////////////////////////////////////////
// RemoteXY include library //
//////////////////////////////////////////////
// RemoteXY select connection mode and include library
#if XY_CONNECTION == 0
#define REMOTEXY_MODE__ESP32CORE_WIFI
#include
#include
// RemoteXY connection settings
#define REMOTEXY_WIFI_SSID "YOUR_SSID" //<-----------------
#define REMOTEXY_WIFI_PASSWORD "YOUR_PASS" //<-----------------
#define REMOTEXY_SERVER_PORT 6377
#endif
#if XY_CONNECTION == 1
/* RemoteXY select connection mode and include library */
#define REMOTEXY_MODE__ESP32CORE_WIFI_POINT
#include
#include
// RemoteXY connection settings
#define REMOTEXY_WIFI_SSID "YOUR_SSID" //<-----------------
#define REMOTEXY_WIFI_PASSWORD "YOUR_PASS" //<-----------------
#define REMOTEXY_SERVER_PORT 6377
#endif
//-----------------------------------------
//
// RemoteXY configurate
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
{ 255,0,0,154,0,33,1,8,13,1,
130,1,1,13,61,74,17,129,0,2,
18,15,4,12,65,100,100,114,101,115,
115,0,67,6,14,24,19,5,2,26,
11,129,0,4,24,7,6,203,97,88,
0,67,6,14,30,19,5,2,26,11,
67,6,14,36,19,5,2,26,11,129,
0,4,30,7,6,203,97,89,0,129,
0,4,35,7,6,203,97,90,0,67,
6,37,24,21,5,2,26,11,67,6,
37,36,21,5,2,26,11,67,6,37,
30,21,5,2,26,11,67,6,14,47,
19,5,2,26,11,67,6,14,53,19,
5,2,26,11,67,6,14,59,19,5,
2,26,11,67,6,37,47,21,5,2,
26,11,67,6,37,53,21,5,2,26,
11,67,6,37,59,21,5,2,26,11,
129,0,4,59,7,6,203,103,90,0,
129,0,4,53,8,6,203,103,89,0,
129,0,4,46,8,6,203,103,88,0,
67,6,20,70,17,5,2,26,11,67,
6,41,70,16,5,2,26,11,129,0,
4,70,14,5,203,84,101,109,112,46,
0,129,0,42,83,18,3,203,109,99,
117,99,105,116,121,46,99,111,109,0,
130,1,3,42,56,3,1,129,0,10,
2,45,10,203,77,80,85,54,48,53,
48,0,129,0,19,17,14,6,203,48,
120,54,56,0,129,0,43,17,14,6,
203,48,120,54,57,0 };
// this structure defines all the variables of your control interface
struct {
// output variable
char txt_0x68_aX[11]; // string UTF8 end zero
char txt_0x68_aY[11]; // string UTF8 end zero
char txt_0x68_aZ[11]; // string UTF8 end zero
char txt_0x69_aX[11]; // string UTF8 end zero
char txt_0x69_aZ[11]; // string UTF8 end zero
char txt_0x69_aY[11]; // string UTF8 end zero
char txt_0x68_gX[11]; // string UTF8 end zero
char txt_0x68_gY[11]; // string UTF8 end zero
char txt_0x68_gZ[11]; // string UTF8 end zero
char txt_0x69_gX[11]; // string UTF8 end zero
char txt_0x69_gY[11]; // string UTF8 end zero
char txt_0x69_gZ[11]; // string UTF8 end zero
char txt_0x68_temp[11]; // string UTF8 end zero
char txt_0x69_temp[11]; // string UTF8 end zero
// other variable
uint8_t connect_flag; // =1 if wire connected, else =0
} RemoteXY;
#pragma pack(pop)
/////////////////////////////////////////////
// END RemoteXY include //
/////////////////////////////////////////////
void setup() {
RemoteXY_Init ();
Serial.begin(115200);
#if XY_CONNECTION == 0
// We start by connecting to a WiFi network
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(REMOTEXY_WIFI_SSID);
//-----------------------------------------------------
uint8_t i = 0;
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
i++;
if(i>20) {
Serial.println();
Serial.println("*** Disconnected from AP so rebooting ***");
Serial.println();
ESP.restart();
}
}
Serial.println("WiFi connected");
Serial.print("IP address: "); Serial.println(WiFi.localIP());
Serial.print("MAC address: "); Serial.println(WiFi.macAddress());
//-----------------------------------------------------
#endif
Wire.begin();
Serial.println("Initialize MPU");
mpu6050_0x68.initialize();
mpu6050_0x69.initialize();
Serial.println(mpu6050_0x68.testConnection() ? "Connected68" : "Connection failed 68");
Serial.println(mpu6050_0x69.testConnection() ? "Connected69" : "Connection failed 69");
delay(1000);
}
void loop()
{
RemoteXY_Handler ();
mpu6050_0x68.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
tempMPU6050 = mpu6050_0x68.getTemperature();
// แปลงค่าแกนให้เป็นมุม 0-180 องศา
ax = map(ax, -18000, 18000, 0, 180);
ay = map(ay, -18000, 18000, 0, 180);
az = map(az, -18000, 18000, 0, 180);
gx = map(gx, -18000, 18000, 0, 180);
gy = map(gy, -18000, 18000, 0, 180);
gz = map(gz, -18000, 18000, 0, 180);
sprintf(RemoteXY.txt_0x68_aX,"%d", ax);
sprintf(RemoteXY.txt_0x68_aY,"%d", ay);
sprintf(RemoteXY.txt_0x68_aZ,"%d", az);
sprintf(RemoteXY.txt_0x68_gX,"%d", gx);
sprintf(RemoteXY.txt_0x68_gY,"%d", gy);
sprintf(RemoteXY.txt_0x68_gZ,"%d", gz);
//sprintf(RemoteXY.txt_0x68_temp,"%d", tempMPU6050);
sprintf(RemoteXY.txt_0x68_temp,"%0.2f", (tempMPU6050 + 12412.0) / 340.0);
Serial.print("Axyz_0x68 \t"); Serial.print(ax);
Serial.print("\t"); Serial.print(ay);
Serial.print("\t"); Serial.print(az);
Serial.print("\t");
Serial.print("Gxyz_0x68 \t"); Serial.print(gx);
Serial.print("\t"); Serial.print(gy);
Serial.print("\t"); Serial.println(gz);
mpu6050_0x69.getMotion6(&ax, &ay, &az, &gx, &gy, &gz);
tempMPU6050 = mpu6050_0x69.getTemperature();
// แปลงค่าแกนให้เป็นมุม 0-180 องศา
ax = map(ax, -18000, 18000, 0, 180);
ay = map(ay, -18000, 18000, 0, 180);
az = map(az, -18000, 18000, 0, 180);
gx = map(gx, -18000, 18000, 0, 180);
gy = map(gy, -18000, 18000, 0, 180);
gz = map(gz, -18000, 18000, 0, 180);
sprintf(RemoteXY.txt_0x69_aX,"%d", ax);
sprintf(RemoteXY.txt_0x69_aY,"%d", ay);
sprintf(RemoteXY.txt_0x69_aZ,"%d", az);
sprintf(RemoteXY.txt_0x69_gX,"%d", gx);
sprintf(RemoteXY.txt_0x69_gY,"%d", gy);
sprintf(RemoteXY.txt_0x69_gZ,"%d", gz);
sprintf(RemoteXY.txt_0x69_temp,"%0.2f", (tempMPU6050 + 12412.0) / 340.0);
Serial.print("Axyz_0x69 \t"); Serial.print(ax);
Serial.print("\t"); Serial.print(ay);
Serial.print("\t"); Serial.print(az);
Serial.print("\t");
Serial.print("Gxyz_0x69 \t"); Serial.print(gx);
Serial.print("\t"); Serial.print(gy);
Serial.print("\t"); Serial.println(gz);
delay(50);
}
หน้าที่เข้าชม | 5,173,264 ครั้ง |
ผู้ชมทั้งหมด | 1,572,604 ครั้ง |
ร้านค้าอัพเดท | 25 ก.ย. 2568 |