Need your project to detect an angle or an incline? Here's your module, the Memsic 2125 (Mx2125)!What is This?
The Mx2125 is a tiny but powerful accelerometer, or a sensor that can gauge tilt. The module has six pins: two GND, one VCC, a x-axis pin, a y-axis pin, and a temperature sensor (using analog output). The accelerometer can measure the x and y axis tilt (or the pitch and roll).Wiring it Up
It's very easy to wire up the Mx2125. You only need 5-7 wires: a wire for power (an extra wire if you want to connect it a breadboard's power-bus), two wires for ground (again, add a wire if you want to connect them to the breadboard's power-bus), one wire for the x-axis output pin, and one wire for the y-axis output pin. If you just want to measure tilt, you won't need to wire the temp pin. There is a Fritzing diagram int he Schematics section showing how to wire up the module with 7 wires.
With the module facing up, the order of the pins (from top-left to bottom-left then top-right to bottom-right) are: temp, y-axis output, GND, VCC, x-axis output, and GND.
The best part is that there are no resistors or other components needed when wiring, just pin to Arduino (or what ever board you are using).Programming it (in Arduino c)
It's very easy to program the Mx2125. There are three simple steps to get input: 1) set the pinMode of the the pins that are attached to the x/y-axis output to INPUT, 2) use pulseIn to get input form the module, and 3) use a short equation to convert the input into milli-g (basically a unit that we can use).
That's it! There's a copy of the three steps in code form (plus outputting the information into the serial monitor) in the Attachments section of this project.Last Notes
The module runs on 5v, it may harm it if it is given too much voltage.
Please leave feedback on this tutorial, thank you!