ما پوشش داده ایم، شتاب سنج، GPS، قطب نما... اما ژیروسکوپ نداریم. چرا؟ مطمئن نیستم، اما امروز فکر کردم که به آن پایان خواهم داد، بنابراین یک ژیروسکوپ 3 محوره L3G4200D را از sparkfun گرفتم.
![](https://duino4projects.com/wp-content/uploads/2018/01/L3G4200D-Tripple-Axis-Gyroscope-Arduino.png)
L3G4200D یک سنسور سرعت زاویه ای 3 محوره است که با نام ژیروسکوپ/ژیروسکوپ با مقیاس 250، 500 یا 2000 درجه در ثانیه قابل انتخاب توسط کاربر است. می خواستم در مورد اینکه ژیروسکوپ چیست بنویسم، اما Sparkfun کار بسیار خوبی در این زمینه انجام داده است، بنابراین به نقل از آنها:
ژیروسکوپ ها سرعت زاویه ای را اندازه گیری می کنند، سرعت چرخش چیزی حول یک محور. اگر میخواهید جهت یک جسم در حال حرکت را نظارت کنید، یک شتابسنج ممکن است اطلاعات کافی برای دانستن نحوه جهتگیری آن را در اختیار شما قرار ندهد. برخلاف شتابسنجها، ژیروسکوپها تحت تأثیر جاذبه قرار نمیگیرند، بنابراین مکمل خوبی برای یکدیگر هستند. معمولاً سرعت زاویهای را میبینید که بر حسب واحد چرخش در دقیقه (RPM) یا درجه در ثانیه (°/s) نشان داده میشود. سه محور چرخش یا به صورت x، y، و z یا رول ، گام و انحراف ارجاع داده میشوند .
اتصال آن
L3G4200D دارای پین های زیادی بر روی آن است زیرا از SPI و I2C پشتیبانی می کند اما برخی ویژگی های دیگر مانند وقفه های قابل برنامه ریزی را نیز دارد. ما قصد داریم تا حد امکان با این ساده پیش برویم.
L3G4200D از هر دو SPI و I2C پشتیبانی می کند، اما ما فقط می خواهیم I2C را در اینجا صحبت کنیم. I2C یک اتصال سریال 2 سیمه است، بنابراین شما فقط باید خطوط SDA (داده) و SCL (ساعت) را برای ارتباط به آردوینو خود متصل کنید. در آردوینو شما (همه چیز به جز مگا) SDA روی پایه آنالوگ 4 و SCL روی پایه آنالوگ 5 است. در آردوینو مگا، SDA دیجیتال 20 و SCL دیجیتال 21 است.
برای جزئیات بیشتر: ژیروسکوپ سه محور L3G4200D + آردوینو
در ادامه، متن انگلیسی این مطلب را میتوانید مشاهده نمایید:
![](https://duino4projects.com/wp-content/uploads/2018/01/L3G4200D-Tripple-Axis-Gyroscope-Arduino.png)
The L3G4200D is a 3-axis angular rate sensor, aka gyro/gyroscope with a user selectable 250, 500 or 2000º/Sec scale. I was about to write about what a gyro is, but Sparkfun has done a really great job of that, so to quote them:
Gyroscopes measure angular velocity, how fast something is spinning about an axis. If you’re trying to monitor the orientation of an object in motion, an accelerometer may not give you enough information to know exactly how it’s oriented. Unlike accelerometers gyros are not affected by gravity, so they make a great complement to each other. You’ll usually see angular velocity represented in units of rotations per minute (RPM), or degrees per second (°/s). The three axes of rotation are either referenced as x, y, and z, or roll, pitch, and yaw.
Hooking It Up
The L3G4200D has a lot of pins on it because it supports both SPI and I2C but also has some other features as well such as programmable interrupts. We are going to go as simple with this as possible.
The L3G4200D supports both SPI and I2C, but we are just going to talk I2C here. I2C is a 2-wire serial connection, so you just need to connect the SDA (Data) and SCL (Clock) lines to your Arduino for communication. On your Arduino (everything but the mega) SDA is on analog pin 4, and SCL is on analog pin 5. On an arduino mega, SDA is digital 20, and SCL is digital 21.
For more detail: L3G4200D Tripple Axis Gyroscope + Arduino