Introduction
In this tutorial, we will learn about the MMA7361 module, how it works, and we will build a simple project using the MMA7361 and an Arduino.
Triple Axis Accelerometer Sensor Module - MMA7361
The MMA7361 module will be our primary component for this tutorial. This module has a built-in accelerometer that outputs changes in the object’s orientation in the X, Y, and Z-axis.
Pin Out
The MMA7361 has ten pins.
Pin | Description |
---|---|
5V | 5V Power |
3V3 | 3.3V Power |
GND | Ground |
GS (g-Select) | Input pin to initiate Self-Test |
ST (Selftest) | Self-Test |
X | XOUT |
Y | YOUT |
Z | ZOUT |
SL (Sleep) | Sleep mode, Low Active |
0G (0g-Detect) | Linear Freefall digital logic output signal |
How it Works
Every object has its orientation in relation to the X, Y, and Z-axis. The module has three pinouts, one for each axis. The module outputs analog signal from 0-1023 per axis. The higher the value, the more significant the change in orientation.
Project - Arduino Object X, Y & Z Orientation Monitor
After learning about the MMA7361 module and its work, it is now time to build a project using it. Our project will get the analog values for X, Y, and Z from the MMA7361 module and display them on the serial monitor.
Comoponents
For this project, we need the following components:
- Arduino Uno Board (1 pc.)
- Triple Axis Accelerometer Sensor Module MMA7361 (1 pc.)
- Jumper Wires
Wiring
The MMA7361module pins are connected to the Arduino Uno board as follows:
MMA7361 Pin | UNO Board Pin |
---|---|
5V | 5V Power |
3V3 | Not used |
GND | Ground |
GS (g-Select) | Not used |
ST (Selftest) | Not used |
X | A0 |
Y | A1 |
Z | A2 |
SL (Sleep) | Not used |
0G (0g-Detect) | Not used |
Code
void setup()
{
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}
void loop()
{
Serial.print("X = ");
Serial.println(analogRead(A0)); // print analog value of x axis orientation change
Serial.print("Y = ");
Serial.println(analogRead(A1)); // print analog value of y axis orientation change
Serial.print("Z = ");
Serial.println(analogRead(A2)); // print analog value of z axis orientation change
delay(100); //100 milliseconds delay
}
Project Test
After wiring the components to the Arduino correctly, connect the Arduino to your pc and upload the program.
Next, open the Serial Monitor in the Arduino IDE.
It will display the analog value received from the Triple Axis Accelerometer Sensor Module MMA7361 with labels X, Y and Z. Each analog signal will vary depending on the changes in the orientation of the sensor with relation to each axis.