How-To: Use the MMA7660 3-Axis Accelerometer Module with Arduino
by Miguel Alatorre, ameriDroid technician:
On ameridroid.com, there is a wide selection of items to tinker with. There are boards like the NVIDIA Jetson Nano and Khadas VIM3 for AI applications, to the PiJuice HAT to power a Raspberry Pi on the go, to momentary push button and maintained rocker switches. One of these items is the 3-Axis Digital Accelerometer with the MMA7660 sensor chip.
Importing a Library into Arduino IDE
Selecting a Library in Arduino IDE
Using the module with an Arduino or a compatible module is simple: Just connect power and ground from the module to the Arduino, then connect SCL on the module to pin A5 on the Arduino, and connect SDA to pin A4. From there, the sample code from this guide from Arduino Learning works perfectly. Though, as mentioned in their guide, an additional library is required. For those who aren’t sure how to import libraries to the Arduino IDE, download the MMA7660 Library. In the IDE, go to the “Sketch” tab and select “Include Library,” then “Add .ZIP Library.” From here, just navigate to the library location and click "Open."
If you haven't ever uploaded code to a microcontroller or Arduino, you may want to read our article on the ameriDroid Learn page about "How to: Get Started Programming a Sub-$5 Microprocessor."
Sample output from Arduino IDE
Now just upload the code and open the “Serial Monitor.” See the image for an example of the output.
That’s all there is to it!
[Editor's note: From here, you can use this module for your own projects by accessing the data from a single-board computer or a standard desktop or laptop computer by writing or scripting a program on the computer that communicates with the microcontroller through the serial port.]
For more product updates and how-to tutorials, follow us on YouTube, our ameriBlog, Facebook, Twitter and Instagram!
Leave a comment