# Working With Gyro And Accelerometer Sensor

## Introduction

In this article, we are going to see how to work with a gyro sensor ADXL335 to read the angle of an object and print the angle in the Serial Monitor of Arduino. The ADXL335 has three axes: X, Y, and Z. The X-axis will show left turns and the Y-axis will show right turns and the Z-axis will calculate up and down.

Requirements
1. Arduino UNO
2. ADXL 335 Gyro sensor (GY-61)
3. Connecting wires
4. Arduino Software.
Gyrosensor
The accelerometer uses very little current, so it can be plugged into your board and run directly. You'll use the other three analog inputs to read the accelerometer's analog outputs.

This sensor can be used to detect:
1. acceleration ( speed of movements) in three directions x, y, z;
2. a rotation or an angle (in three directions);
3. orientation
We can put the module in 4 directions to determine minimum-maximum-values with direction is given below,

direction –>   0deg   x = 349  y = 341  z = 425
direction /\    90deg  x = 281  y = 345  z = 357
direction <–  180deg  x = 350  y = 345  z = 288
direction V   270deg  x = 419  y = 341  z = 355

Circuit diagram
1. Open the Arduino Software.

1. Initialize codings in the A0-A4 pins; this includes the GND, +Vcc, X-axis, Y axis, and Z axis.

1. In the void setup, the A0-A4 pins are defined as input/output and Vcc and Gnd.

1. In the void loop the x-axis, y-axis, and z-axis values are read and they are printed on the Serial Monitor.

1. Compile and upload the coding, the output can be verified using the serial monitor.

## Summary

In this article, we learned how to work with a Gyro sensor and Arduino by printing the angle of the object in the serial monitor.  