Introduction: 3 Axis Accelerometer LIS2HH12 Module
This Instructable is considered beginner level with some experience with arduino software and soldering.
The LIS2HH12 Module is made by Tiny9. Tiny9 is a new company getting into selling sensor modules for DIY tinkers, companies, or inventors.
There are at least two purposes of an accelerometer: To determine an angle in particular axes. (X,Y,or Z or all), or to determine acceleration change in an axes.
Accelerometers are used everywhere. They are used in:
Phones, Fitness bands, Drones, Robotics, Missiles, and Helicopters just to name a few. How you want to use an accelerometer is up to a person's imagination.
Step 1: Materials
Materials you need are:
All items are at this location-https://www.tinee9.com/collections/frontpage
Arduino Nano or preferred arduino device
USB to Arduino Cable
Wire strippers Wire
2x 10 Kohm resistors
1x 100 ohm resistor
Step 2: The Sesnor
LIS2HH12 module is based off the ST 3-Axis accerlerometer. The module is a tiny package and allows for 2 5-pin headers to be soldered to it. This mitigates vibration noise that is introduced to the accelerometer. from external sources of varying frequencies.
You can buy this chip from these locations:
Main features for this chip are:
Low-power mode 5uA draw
Performs +/-2 g,4 g,8 g
I2C or SPI protocol
Max Rating 4.8V (Do not go above 4.8 volts or you will break the Accelerometer chip)
Step 3: Project Platform
Project Platform for the accelerometer is Arduino.
The Development board I am using is a Arduino Nano.
Currently the Tiny9 LIS2HH12 accelerometer has only basic code for the Arduino but will be hopefully expanding the code for more technical projects and for Raspberry Pi or any platform that has enough fan base recommended by YOU. :-)
Step 4: Breadboard
If you have headers on both of your Arduino nano and LIS2HH12 Module you can put the Arduino Nano and accelerometer on the Breadboard like this, straddling the split line allowing access to the breakout pins.
Make sure the 3.3V pins on the Module is facing the Arduino.
If you do not have header on them get some and solder them to the boards.
Step 5: Placing Resistors on the Board
The I2C protocol that we will be using in this project needs 2 10 Kohm pull-up resistors to the supply rail on the chip (+3.3 Pins); one on the Clock line (CL) and one on the Data Line (DA)
Since the LIS2HH12 accelerometer max voltage is 4.8V and in this project we are using the 5V off of the Nano, I have placed a 100 ohm resistor from the 5V pin on the Nano to the red supply rail on the breadboard to bring down the supply rail a little.
Step 6: Connecting the Rest of the Board
Now we are going to connect the rest of the module to the arduino.
The Gnd Pin on the module and arduino should have a jumper wires going from it to the Blue Rail on the Breadboard.
Connect the +3.3 Pin on the module to the red supply rail on the breadboard.
These last two step allowed us to power up the module when we power the arduino via battery or USB
Jumper Wire from the +3.3 Pin on the Module to the CS pin on the module (This enables the I2C bus on the module)
Jumper wire from the Gnd Pin on the module to the A0 pin on the module (This tells the accelerometer which address it will respond to when talking on the I2C Bus)
Jumper wire from A5 on the arduino to CL on the Module (This allows the clock on the arduino to sync with the acceleromter.
Jumper wire from A4 on the arduino to DA on the module (This allows the data to be transferred between the arduino and the module.)
Step 7: Download Files
Go to Github address https://github.com/Tinee9/LIS2HH12TR and download the files.
Go to this location on your computer
C:\Program Files (x86)\Arduino\libraries
Create a Folder Called Tiny9
Place the .h and .cpp Files in that Tiny9 Folder
Step 8: Open Up .ino
Open up the .ino file you downloaded in the Arduino IDE (Program/software)
Step 9: Upload Sketch
Once you have connected your arduino via USB cable to the computer, there should be a port number highlighted under tools tab in the arduino IDE.
My port happens to be COM 4 but yours might be 1 or 9 or something else.
If you have multiple COM options then choose the one that represents the Arduino that you are using. (How to determine which COM port for multiple choices can be on a different instructable if requested.)
Once you have the Arduino Port chosen, click the upload button.
Step 10: Enjoy
After it has finished Uploading you should be able to open the Serial Monitor in the Tool Tab and you should see something like this popping on your Monitor.
The Graph displays the x,y, and z axis in that order.
Z axis should say close to 1.0 +/- some counts because Z is pointing up.
Now you can rotate your breadboard and enjoy watching the numbers change showing you how the module's axises are affected by gravity and acceleration.
We have a be nice policy.
Please be positive and constructive.