LIS3DSH Accelerometer
Contents
Description
The LIS3DSH from STMicroelectronics is described in the datasheet (P2) as an ultra-low-power high-performance three-axis linear accelerometer belonging to the "nano" family with an embedded state machine that can be programmed to implement autonomous applications
.
STM have provided two sources of documentation. The datasheet is quite general. For driver development it's necessary to refer to AN3393 Application Note which provides a much more detailed discussion of the sensor than the datasheet.
This accelerometer is described as being suitable for gaming, virtual reality, pedometers, intelligent power saving for handheld devices and display orientation, etc.
The LIS3DSH measures acceleration with a capacitive type sensor.
The values in the following table have been sourced from the product datasheet.
| Parameter | LIS3DSH |
|---|---|
| Package and size | 16-lead LGA package, footprint 3mm x 3mm x 1mm. |
| Operating voltage range | 1.7V to 3.6V |
| Supply current typically |
ODR: 3.125Hz = 11 µA ODR: 1600Hz = 225 µA Power down mode: = 2µA |
| Package alignment error | N/A |
| Cross axis sensitivity | N/A |
| Zero-g level offset accuracy | Typically ±40 mg |
| Measurement ranges | ±2g, ±4g, ±6g, ±8g, ±16g. Default is ±2g. |
| Output resolution | 16-bit. |
| Sensitivity | Varies from 0.06 mg/LSB (±2g) through to 0.73 mg/LSB (±16g) |
| Output data rate (ODR) | 3.125Hz to 1600Hz. |
| Serial interfaces | I2C, SPI (4-wire and 3-wire). |
I2C and SPI (4-wire & 3-wire) are available. I2C is selected by tying the CS pin to High.
I2C supports standard (100HkHz) and fast data (400kHz) transfer modes.
There is a choice of two I2C addresses depending upon the state of the SDO (ALT ADDRESS) pin:
- 0x1D : SDO pin connected to VDDIO i.e operating voltage.
- 0x1E : SDO pin connected to GND
Acceleration Sampling Options
This accelerometer has a simple range of user options unlike some of the more complicated devices available from other manufacturers.
Power Modes
-
Power-down Mode
Very low current consumption mode (typically 2 µA) where data conversions are stopped but the serial interface is still available. This is the default mode after the power-up sequence has completed. -
Normal Mode
Output data rates (ODR) is configurable in nine steps between 3.125 and 1600Hz and are user selectable.
Additional User Selections
-
Acceleration ranges
Ranges available: ±2g, ±4g, ±6g, ±8g, ±16g. Default is ±2g. -
Anti-aliasing Filter
The LIS3DSH has a low-pass bandwidth filter that has four user configurable settings.The default setting appears to be 800Hz.
The datasheet and the AN3393 Application Note documents provide conflicting bandwidth values across the other three settings.
Measuring Acceleration
The LIS3DSH measures both static and dynamic acceleration. Acceleration is reported in units of g where 1g = 9.81 m/s2 i.e. the acceleration due Earth's gravity.
Static acceleration is that which is imparted upon the sensor by the Earth's gravitational field. If the sensor is laid horizontally on a (perfectly) flat surface and is completely motionless then the acceleration along the X-axis and Y-axis will be 0g The z-axis acceleration will be 1g
Dynamic acceleration refers to the component of acceleration resulting from the motion or changes in velocity experienced by the sensor over time.
The raw acceleration value is read from two 8-bit registers. The two bytes are combined to a single 16-bit binary representation. This is converted from its Two's Complementary format to a signed integer.
This is then scaled by simple division with the divisor being the sensitivity (LSB/g). The sensitivity depends upon the measurement range. The float type result is the acceleration value in units of g.
FIFO Queue
The FIFO is a queue mechanism (First In - First Out) that when activated automatically begins storing datasets of raw acceleration values. This is a common feature on most of these styles of sensor.
The FIFO stores X-axis, Y-axis and Z-axis acceleration values. Unlike some other accelerometers on the market the LIS3DSH does not offer any selectivity options i.e. all three DOF values are always stored. The FIFO can hold up to a maximum of 32 complete X, Y and Z samples.
The FIFO give the microcontroller host "breathing space" to carry on with other tasks as the sensor continues to produce acceleration samples. A configurable interrupt is available that will alert the host when the FIFO is near full. At this time the entire FIFO contents can be burst read and processed.
Refer to the datasheet for further details of the FIFO. It's operation is quite simple compared to some of the LIS3DSH's competitors.
Sensor Generated Interrupts
Many intelligent digital accelerometer sensors offer a set of functional interrupts. The LIS3DSH is no exception.
The chip has two interrupt pins; INT1 and INT2. The sensor's interrupts can be mapped to either of these pins. Host microcontrollers can define which interrupts are assigned to these pins then monitor the pins for the assigned activities.
Many other digital interfaced accelerometers have a fixed set of defined-action interrupts e.g. free-fall, tap, double-tap, pulse and step counting, orientation detection, and so on.
The LIS3DSH does not come with such a set of predefined interrupt conditions. It uses a very different mechanism for interrupt generation which is both powerful and complex.
It embeds two state machines able to run a user-defined program. The program may also have conditional branches. What this means is that it is up to the user to define the activity to be captured then 'code' the algorithm into one of the state machines.
While this brings in a degree of complexity it also means that the user can very closely define what is required.
The AN3393 Application Note contains a very detailed section on the use and programming of the interrupt-generating state machines.
LIS3DSH Chip ID
LIS3DSH chips have a product ID value written to non-volatile memory at point of manufacture.
This value can be read from the WHO_AM_I register and should return 0x3F.
LIS3DSH MicroPython Driver for micro:bit
An LIS3DSH MicroPython driver specifically written for the BBC micro:bit has been developed as part of this series on MicroPython for the micro:bit. The driver webpage also provides a detailed description of the driver's methods and properties with sample code.
The driver implements the base functionality (i.e. acceleration measurements, setting output data rates, setting measurement ranges) offered by this sensor. Also included is a simple tool for measuring angles from the horizontal.
The FIFO and all interrupts (with the exception of Data Ready) are not available in this driver. The state machines are not used.
Inertial Measurement, Magnet Field Sensing
How they work
Weather Station Sensors
How they work
Pressure, Humidity, Temperature
Distance Sensors
Images
LIS3DSH breakout board
This LIS3DH breakout board has a very simple design with the minimum number of components.
There is no LDO (voltage regulator), so maximum voltage is 3.6V.
The direction of the X, Y and Z axis are also not marked.
The ADC1, ADC2 and ADC3 pins aren't used as the LIS3DSH doesn't have a user accessible ADC function. This same board is also used as an LIS3DH breakout which does use these pins.
Micrograph of the LIS3DSH sensor
It is the DSH marking that signifies this chip as an LIS3DSH.
LIS3DSH breakout board's 10kΩ pullup resistors on the SCL and SDA (I2C) pins.