Compasses Accelerometers and Gyros TYWu Compass Principles The
- Slides: 59
Compasses, Accelerometers, and Gyros, TYWu
Compass • Principles – The earth is a huge magnet. – Any freely suspended magnet will align itself with the earth’s magnetic poles. – The compass is a selfcontained unit requiring no external power source.
Compass • Principles – The strength of the earth's magnetic field is about 0. 5 to 0. 6 gauss and has a component parallel to the earth's surface that always points toward the magnetic north pole. – In the northern hemisphere, this field points down. At the equator, it points horizontally and in the southern hemisphere, it points up. – This angle between the earth’s magnetic field and the horizontal plane is defined as an inclination angle. Another angle between the earth's magnetic north and geographic north is defined as a declination angle in the range of ± 20º depending on the geographic location.
Compass • Northerly Turning (Dip) Error – The earth’s magnetic field causes the compass to dip to the low side of the turn. – In the Northern Hemisphere: Lag North, Lead South. LAG NORTH
Compass • Acceleration/De celeration Error – Most pronounced on headings of east and west. – Accelerate north, Decelerate south.
Compass • 3 -Axis Digital (Electronic) Compass • 3 -Axis Digital Magnetometer – LSM 303 DLH (MEMS) • LSM 303 DLH has a magnetic field full-scale of ± 1. 3 / ± 1. 9 / ± 2. 5 / ± 4. 0 / ± 4. 7 / ± 5, 6 / ± 8. 1 gauss • Fully selectable by the user. • High current in wiring and printed circuit traces can be the cause of errors in magnetic field measurements for compassing.
Compass • Compensated Compassing
Compass • A Working Electronic Compass System – Hardware design to make sure the MCU can get clean raw data from the accelerometer and the magnetic sensor – Accelerometer calibration to obtain parameters to convert accelerometer raw data to normalized values for pitch and roll calculation – Magnetic sensor calibration to obtain parameters to convert magnetic sensor raw data to normalized values for the heading calculation
Accelerometers • Gyroscopes & Accelerometers Used in the Airplane & Vehicle
Accelerometers • 3 -Axis Digital Accelerometer – LSM 303 DLH (MEMS) • A linear acceleration full-scale of ± 2 g / ± 4 g / ± 8 g • Fully selectable by the user.
Accelerometers • 3 -Axis Digital Accelerometer – ADXL 335 • Single-supply operation: 1. 8 V to 3. 6 V • Measure acceleration with a minimum full-scale range of ± 3 g. • Measure the static acceleration of gravity in tiltsensing applications, as well as dynamic acceleration resulting from motion, shock, or vibration.
Accelerometers • ADXL 335 – Application • • • Mobile devices Gaming systems Disk drive protection Image stabilization Sports and health devices
Accelerometers • ADXL 335
Accelerometers • ADXL 335 • Output Response vs. Orientation to Gravity • However, the spec. and my experiment are inconsistent!
Accelerometers • Specification
Accelerometers • MMA 7361
Accelerometers • MMA 7361
Accelerometers • MMA 7361
Accelerometers • MMA 7361
Gyro • 3 Axes of Angular Freedom – Spin Axis – Horizontal Axis – Vertical Axis
Gyro • Applications – Motion control with MMI (man-machine interface) – Appliances and robotics – Gaming and virtual reality input devices – Navigation – Etc.
Gyro • Roll, Pitch, and Yaw
Gyro • 3 -Axis Digital Gyroscope (MEMS Motion Sensor) – L 3 G 4200 D
Gyro • Dual axis pitch and roll ± 100°/s analog gyroscope – LSM 303 DLH
Experiment I • Arduino • LSM 303 DLH 3 D Compass and Accelerometer Carrier with Voltage Regulators
Experiment I • LSM 303 DLH Arduino Library – https: //github. com/ryantm/LSM 303 DLH/tree/master/LS M 303 DLH • Wire Library – This library allows you to communicate with I 2 C / TWI devices. On most Arduino boards, SDA (data line) is on analog input pin 4, and SCL (clock line) is on analog input pin 5. On the Arduino Mega, SDA is digital pin 20 and SCL is 21
Experiment I • SDA is defined in. /libraries/SD/utility/Sd 2 Pin. Map. h
Experiment I • The board for the LSM 303 DLH can be purchased on Pololu • Make the following connections with wires between Arduino Uno/Duemilanove and LSM 303 DLH board – – 5 V -> VIN GND -> GND Analog Pin 5 -> SCL Analog Pin 4 -> SDA
Experiment I • Sketch #include <Wire. h> #include <LSM 303 DLH. h> LSM 303 DLH compass; void setup() { Serial. begin(9600); Wire. begin(); compass. enable(); }
Experiment I void loop() { compass. read(); Serial. print("Accel. : "); Serial. print("X="); Serial. print(compass. a. x); Serial. print(", Y="); Serial. print(compass. a. y); Serial. print(", Z="); Serial. println(compass. a. z); Serial. print("Compass: "); Serial. print("X="); Serial. print(compass. m. x); Serial. print(", Y="); Serial. print(compass. m. y); Serial. print(", Z="); Serial. println(compass. m. z); delay(1000); }
Experiment I • Results
Experiment I • Results
Experiment II • L 3 G 4200 D 3 -Axis Gyro Carrier with Voltage Regulator
Experiment II • LPR 510 AL Dual. Axis (Pitch and Roll or XY) Gyro with ± 100°/s and ± 400°/s Ranges
Experiment II • LPR 510 AL IC – Output Response vs. Rotation
Experiment II • Mechanical characteristics
Experiment II • LPR 510 AL – The axes of rotation are pitch (x) and roll (y) for LPR 510 AL
Experiment II • These two-axis gyros are essentially carrier boards or breakout boards for ST’s LPR 510 AL, LPY 510 AL, LPR 550 AL, and LPY 550 AL MEMS (micro-electro-mechanical systems) gyroscopes.
Experiment II • LPR 510 AL – For 5 V microcontroller applications, the power down (PD) and self test (ST) lines should not be driven high. It is always safe for you to drive these lines low.
Experiment II • LPR 510 AL – The self-test input is pulled low by default. To activate the self-test feature, drive the line to Vdd (the same pull-up trick as above can be used for 5 V applications).
Experiment II • LPR 510 AL – The devices can be powered directly through the Vdd/3. 3 V pin using a supply that is within the gyro chips’ acceptable power supply range of 2. 7 V to 3. 6 V.
Experiment II • LPR 510 AL – Alternatively, the boards can be powered by higher voltages, up to 16 V, using the VIN pin, which connects to a low-dropout 3. 3 V regulator. In this configuration, the 3. 3 V pin can serve as an output to be used as a reference voltage or power source for other low-power devices (up to around 50 m. A, depending on the input voltage).
Experiment II • LPR 510 AL – Please note that unlike some other gyros and accelerometers, the outputs are not ratiometric with the Vdd/3. 3 V power line (i. e. at zero rate of rotation, the output should equal Vref, not half of the Vdd/3. 3 V supply).
Experiment II • Connection LPR 510 AL Arduino UNO VIN 3. 3 V GND Y A 1 X A 0 PD GND
Experiment II • Result – Steady State Position 258/1023*5 V = 1. 26 V (But, the value described in data sheet is 1. 23 V)
Experiment III AREF • ADXL 335 & Arduino • (Z Y? ) A 0 A 1 A 2
Experiment III • Sketch #define parameter 0. 009765625 // AXDL 335 用,代表 10 位元的 ADC 轉換 1 個刻度所代表的 G 值。 (3. 3/1024/0. 33) #define rad 57. 295779513082 // 徑度。(360/2*PI) double X, Y, Z, Xangle, Yangle, Zangle; int Xread, Yread, Zread; int Xref = 505; int Yref = 496; int Zref = 496; // XYZ 軸的偏差矯正參數,可透過此參數調整 XYZ 軸 0 G 時的標準值 int Xinput = 0; // X 軸的類比電壓輸入腳位 int Yinput = 1; // Y 軸的類比電壓輸入腳位 int Zinput = 2; // Z 軸的類比電壓輸入腳位
Experiment III void setup() { Serial. begin(9600); // 串列傳輸的鮑率設定 analog. Reference(EXTERNAL); // 設定外部參考電壓 } void loop() { Xread = analog. Read(Xinput); // 將 X 軸的輸入電壓存到所設定的變數 Yread = analog. Read(Yinput); // 將 Y 軸的輸入電壓存到所設定的變數 Zread = analog. Read(Zinput); // 將 Z 軸的輸入電壓存到所設定的變數 X = (Xread-Xref)*parameter; // 計算 X 軸的 G 值 Y = (Yread-Yref)*parameter; // 計算 Y 軸的 G 值 Z = (Zread-Zref)*parameter; // 計算 Z 軸的 G 值 Xangle = asin(constrain(X, -1, 1) )*rad; // 計算出 X 軸的傾斜角度 Yangle = asin(constrain(Y, -1, 1) )*rad; // 計算出 Y 軸的傾斜角度 Zangle = asin(constrain(Z, -1, 1) )*rad; // 計算出 Y 軸的傾斜角度
Experiment III Serial. print(" X = "); print. Double(X, 2); Serial. print(" G"); Serial. print(9, BYTE); Serial. print(" Y = "); print. Double(Y, 2); Serial. print(" G"); Serial. print(9, BYTE); Serial. print(" Z = "); print. Double(Z, 2); Serial. print(" G"); Serial. print(9, BYTE); Serial. print("thida. X = "); print. Double(Xangle, 1); Serial. print(9, BYTE); Serial. print(" thida. Y = "); print. Double(Yangle, 1); Serial. print(9, BYTE); Serial. print(" thida. Z = "); print. Double(Zangle, 1); Serial. println(" "); delay(500); }
Experiment III void print. Double( double val, byte precision){ if(val < 0. 0){ Serial. print('-'); val = -val; } Serial. print (int(val)); //prints the int part if( precision > 0) { Serial. print(". "); // print the decimal point unsigned long frac; unsigned long mult = 1; byte padding = precision -1; while(precision--) mult *=10;
Experiment III if(val >= 0) frac = (val - int(val)) * mult; else frac = (int(val)- val ) * mult; unsigned long frac 1 = frac; while( frac 1 /= 10 ) padding--; while( padding--) Serial. print("0"); Serial. print(frac, DEC) ; } }
Experiment III • Result
Experiment III • Another Sketch (Very Simple) const int xpin = A 0; // x-axis of the accelerometer const int ypin = A 1; // y-axis const int zpin = A 2; // z-axis (only on 3 -axis models) int sample. Delay = 500; //number of milliseconds between readings void setup() { Serial. begin(9600); pin. Mode(xpin, INPUT); pin. Mode(ypin, INPUT); pin. Mode(zpin, INPUT); }
Experiment III void loop() { int x = analog. Read(xpin); int y = analog. Read(ypin); int z = analog. Read(zpin); float zero_G = 512. 0; float scale = 102. 3; Serial. print(((float)x - zero_G)/scale); Serial. print("t"); Serial. print(((float)y - zero_G)/scale); Serial. print("t"); Serial. print(((float)z - zero_G)/scale); Serial. print("n"); delay(sample. Delay); }
Experiment IV • MMA 7361 Analog 2 Analog 1 Analog 3 3. 3 V AREF 3. 3 V GND 3. 3 V
Experiment IV • Sketch • http: //120. 107. 171. 121/~tywua/sub/ISAR/M Y_MMA 7361. pde
Experiment IV • Result
Demo • Prototype of Mimic Robotic Arm in Arduino and Gyroscope – http: //www. youtube. com/watch? v=ai 2 Ri. GMy. V 08
Reference • References – http: //www. instructables. com/id/Accelerometer. Gyro-Tutorial/step 2/Gyroscope/ – http: //www. arduino. cc/playground/Main/Gyro
- George‚äôs gyros
- Gold gyros vukovar
- Compass traversing
- The square and compasses
- Compass least error east
- Explain how a compass works
- Compass uses
- Stphmkre
- Tywu
- Tywu
- Servo library zip file download
- Tywu
- Tywu
- Tywu
- Tywu
- Tywu
- Tywu
- Effectual angle
- Tinkercad debugger
- Hát kết hợp bộ gõ cơ thể
- Bổ thể
- Tỉ lệ cơ thể trẻ em
- Gấu đi như thế nào
- Thang điểm glasgow
- Hát lên người ơi
- Các môn thể thao bắt đầu bằng tiếng nhảy
- Thế nào là hệ số cao nhất
- Các châu lục và đại dương trên thế giới
- Công thức tiính động năng
- Trời xanh đây là của chúng ta thể thơ
- Mật thư anh em như thể tay chân
- 101012 bằng
- Phản ứng thế ankan
- Các châu lục và đại dương trên thế giới
- Thơ thất ngôn tứ tuyệt đường luật
- Quá trình desamine hóa có thể tạo ra
- Một số thể thơ truyền thống
- Bàn tay mà dây bẩn
- Vẽ hình chiếu vuông góc của vật thể sau
- Biện pháp chống mỏi cơ
- đặc điểm cơ thể của người tối cổ
- V. c c
- Vẽ hình chiếu đứng bằng cạnh của vật thể
- Fecboak
- Thẻ vin
- đại từ thay thế
- điện thế nghỉ
- Tư thế ngồi viết
- Diễn thế sinh thái là
- Dot
- Số nguyên là gì
- Tư thế ngồi viết
- Lời thề hippocrates
- Thiếu nhi thế giới liên hoan
- ưu thế lai là gì
- Sự nuôi và dạy con của hổ
- Khi nào hổ con có thể sống độc lập
- Sơ đồ cơ thể người
- Từ ngữ thể hiện lòng nhân hậu