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
- Arduino UNO
- ADXL 335 Gyro sensor (GY-61)
- Connecting wires
- 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:
- acceleration ( speed of movements) in three directions x, y, z;
- a rotation or an angle (in three directions);
- 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
- Open the Arduino Software.
- Initialize codings in the A0-A4 pins; this includes the GND, +Vcc, X-axis, Y axis, and Z axis.
- In the void setup, the A0-A4 pins are defined as input/output and Vcc and Gnd.
- In the void loop the x-axis, y-axis, and z-axis values are read and they are printed on the Serial Monitor.
- Compile and upload the coding, the output can be verified using the serial monitor.
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.