Adafruit LIS3DH Triple-Axis Accelerometer Breakout Created by lady ada Last updated on 2017-11-14 02:21:20 AM UTC
Guide Contents Guide Contents Overview Pinouts Power Pins I2C Pins SPI pins: Other Pins Assembly 2 3 6 6 6 6 7 8 Prepare the header strip: Add the breakout board: And Solder! Wiring & Test I2C Wiring SPI Wiring Download Adafruit_LIS3DH library Download Adafruit_Sensor Accelerometer Demo Accelerometer ranges Raw data readings Normalized readings 12 12 13 14 14 15 16 17 17 Tap & Double tap detection Reading the 3 ADC pins Downloads Datasheets Schematic Fabrication Print © Adafruit Industries 8 9 9 htt
Overview The LIS3DH is a very popular low power triple-axis accelerometer.
This sensor communicates over I2C or SPI (our library code supports both) so you can share it with a bunch of other sensors on the same I2C bus. There's an address selection pin so you can have two accelerometers share an I2C bus. To get you going fast, we spun up a breakout board for this little guy. Since it's a 3V sensor, we add a low-dropout © Adafruit Industries https://learn.adafruit.
3.3V regulator and level shifting circuitry on board. That means its perfectly safe for use with 3V or 5V power and logic. It's fully assembled and tested. Comes with a bit of 0.1" standard header in case you want to use it with a breadboard or perfboard. Two 2.5mm (0.1") mounting holes for easy attachment. © Adafruit Industries https://learn.adafruit.
Pinouts The little chip in the middle of the PCB is the actual LIS3DH sensor that does all the motion sensing. We add all the extra components you need to get started, and 'break out' all the other pins you may want to connect to onto the PCB. For more details you can check out the schematics in the Downloads page. Power Pins The sensor on the breakout requires 3V power. Since many customers have 5V microcontrollers like Arduino, we tossed a 3.3V regulator on the board.
level is on Vin! SCL - this is the SPI Clock pin, its an input to the chip SDA - this is the Serial Data In / Master Out Slave In pin, for data sent from your processor to the LIS3DH SDO - this is the Serial Data Out / Master In Slave Out pin, for data sent from the LIS3DH to your processor. It's 3.3V logic level out CS - this is the Chip Select pin, drop it low to start an SPI transaction.
Assembly Prepare the header strip: Cut/break the header strip into two pieces, one 3 pin and one 8 pin. It will be easier to solder if you insert it into a breadboard - long pins down © Adafruit Industries https://learn.adafruit.
Add the breakout board: Place the breakout board over the pins so that the short pins poke through the breakout pads © Adafruit Industries https://learn.adafruit.
And Solder! Be sure to solder all pins for reliable electrical contact. We'll start with the main 8 pins for power & the I2C/SPI interface. (For tips on soldering, be sure to check out our Guide to Excellent Soldering (https://adafru.it/aTk)). © Adafruit Industries https://learn.adafruit.
If you want to have the board be more mechanically stable, or want to use the ADC pins, solder in the 3 ADC pads too You're done! Check your solder joints visually and continue onto the next steps © Adafruit Industries https://learn.adafruit.
Wiring & Test You can easily wire this breakout to any microcontroller, we'll be using an Arduino. For another kind of microcontroller, as long as you have 4 available pins it is possible to 'bit-bang SPI' or you can use two I2C pins, but usually those pins are fixed in hardware. Just check out the library, then port the code. I2C Wiring Use this wiring if you want to connect via I2C interface Connect Vin to the power supply, 3-5V is fine.
SPI Wiring Since this is also an SPI-capable sensor, we can use hardware or 'software' SPI. To make wiring identical on all Arduinos, we'll begin with 'software' SPI. The following pins should be used: Connect Vin to the power supply, 3V or 5V is fine. Use the same voltage that the microcontroller logic is based off of.
Download Adafruit_LIS3DH library To begin reading sensor data, you will need to download Adafruit_LIS3DH from our github repository. You can do that by visiting the github repo and manually downloading or, easier, just click this button to download the zip Download Adafruit LIS3DH library https://adafru.it/jzc Rename the uncompressed folder Adafruit_LIS3DH and check that the Adafruit_LIS3DH folder contains Adafruit_LIS3DH.cpp and Adafruit_LIS3DH.
Accelerometer Demo Open up File->Examples->Adafruit_LIS3DH->acceldemo and upload to your Arduino wired up to the sensor Depending on whether you are using I2C or SPI, change the pin names and comment or uncomment the following lines.
Normally, sitting on a table, you'll see X and Y are close to 0 and Z will be about ~1 m/s^2 because the accelerometer is measuring the force of gravity! (My table is a bit tilted so Y is closer to 0.2 m/s^2. You can also move around the board to measure your movements and also try tilting it to see how the gravity 'force' appears at different axes. Not that you'll see there's two sets of data! Accelerometer ranges Accelerometeres don't 'naturally' spit out a "meters per second squared" value.
or LIS3DH_RANGE_16_G When reading the range back from the sensor, 0 is ±2g, 1 is ±4g, 2 is ±8g and 3 is ±16g range Raw data readings You can get these raw readings by calling lis.read() which will take a snapshot at that moment in time. You can then grab the x, y and z data by reading the signed 16-bit values from lis.x , lis.y and lis.z . When you are done with that data, call read() again to get another snapshot.
The tap detection works by looking for when one of the axes has an acceleration higher than a certain threshhold for longer than a certain timelimit. The threshhold is in 'raw' values so you have to adjust it based on the scale/range you've configured for the sensor: // Adjust this number for the sensitivity of the 'click' force // this strongly depend on the range! for 16G, try 5-10 // for 8G, try 10-20. for 4G try 20-40.
You can get the current click status register with lis.getClick() . Note that will return the raw 8-bit reg known as LIS3DH_REG_CLICKSRC Even though that register has 'axis' bits that theoretically tell you which axis the click is from, unless you bolt the breakout to a huge thing like a table and thwack the table, any 'direct hits' to the sensor itself will register on any/all axes because of the small scale. Reading the 3 ADC pins Finally, there are 3 extra 10-bit analog-digital-converter pins available.
I connected a trimpot from ground (left pin) to 3.3V (right pin) and conneted the wiper (center pin) to ADC1 For pins that don't have anything connected, such as ADC2 and ADC3 you'll notice the values flicker around a lot. If you don't like this, just tie the pins to GND and it will keep the values 'steady' The values of the ADC range from -32512 to 32512 but note that they correspond to ~1.8V to ~0.9V.
Downloads Datasheets LIS3DH datasheet LIS3DH app note ST design resources Fritzing object available in the Adafruit Fritzing Library EagleCAD PCB files on GitHub Schematic click to enlarge Fabrication Print Dimensions in inches © Adafruit Industries https://learn.adafruit.
© Adafruit Industries Last Updated: 2017-11-14 02:21:19 AM UTC Page 22 of 22