Main Content

LIS3DH Accelerometer Sensor

Measure linear acceleration, voltage, and temperature from LIS3DH sensor

  • Library:
  • Embedded Coder Support Package for Texas Instruments C2000 Processors / Sensors

  • block icon for LIS3DH Accelerometer Sensor

Description

The LIS3DH Accelerometer Sensor block measures linear acceleration, voltages at ADC inputs, and temperature using the LIS3DH Accelerometer sensor interfaced with the C2000 board.

The block also provides the option to enable the high pass filter, FIFO and FIFO interrupt. An interrupt is generated if Generate data ready interrupt is selected. After selecting Generate data ready interrupt, if FIFO is disabled data ready interrupt is generated and if FIFO is enabled FIFO interrupt is generated.

Ports

Output

expand all

The block outputs acceleration as a 1-by-3 vector when FIFO is disabled. When FIFO is enabled, the block outputs n-by-3 vector, where n is the number of samples. Each value represents the measurement of acceleration in m/s^2 along the X, Y, and Z axes.

Dependencies

This output port appears only if you select the Acceleration (m/s2) parameter.

Data Types: single | double | int16

The block outputs voltage applied on ADC1 pin of the LIS3DH sensor.

Dependencies

This output port appears only if you select the Voltage (external input at ADC1) parameter.

Data Types: single | double | int16

The block outputs voltage applied on ADC2 pin of the LIS3DH sensor.

Dependencies

This output port appears only if you select the Voltage (external input at ADC2) parameter.

Data Types: single | double | int16

The block outputs voltage applied on ADC3 pin of the LIS3DH sensor.

Dependencies

This output port appears only if you select Voltage (external input) for ADC3 input parameter.

Data Types: single | double | int16

Temperature (in ℃) measured by LIS3DH sensor connected to C2000 board.

Dependencies

This output port appears only if you select Temperature for ADC3 input parameter.

Data Types: single | double | int16

Status of acceleration measurement, specified as a value 0, 1, or 2. The value 0 indicates that the data read is new, 1 indicates that the data read is not new, and 2 indicates that the data is overwritten.

If Enable FIFO is selected, then 0 indicates that the specified samples are collected, 1 indicates that specified number of samples are not collected, and 2 indicates that the data is overwritten.

Dependencies

This output port appears only if you select the Status parameter.

Data Types: uint8

The block outputs the number of pending samples to be read as a value ranging from 0-32.

Dependencies

This output port appears only if you select the Enable FIFO parameter.

Data Types: uint8

Parameters

expand all

Specify the module on the board that you are using for I2C communication.

The I2C addresses to communicate with the accelerometer peripheral on the LIS3DH sensor are decided by the state of the SA0 pin on the hardware board. This table provides the I2C addresses corresponding to the pin and their state.

Pin NamePin StateI2C Address
SA000x18
10x19

Select this parameter to set Acceleration as one of the output ports.

Select Temperature to set Temperature as one of the output ports or select Voltage (external input) to set ADC3 Voltage as one of the output port.

Select this parameter to set ADC1 Voltage as one of the output ports.

Select this parameter to set ADC2 Voltage as one of the output ports.

Select this parameter to set Status as one of the output ports.

If this option is selected, an interrupt is generated on pin INT1 of the sensor when data is ready, allowing you to trigger other subsystems to perform any action.

Select the full scale for measuring linear acceleration (the range of acceleration that the sensor needs to measure).

Select the data register bit resolution for the sensor.

Select the output data rate at which accelerometer data is sampled, which also determines the bandwidth.

Select this option to enable the option Number of samples to read from FIFO (1-32), which allows you to set the number of samples to be read.

Enter a value for number of samples (1-32) to be read from FIFO.

Dependencies

This parameter appears only if you select the Enable FIFO parameter.

Enable the high pass filter for reading accelerometer values.

Select the required bandwidth of the high pass filter for reading accelerometer values. The HPF cutoff frequency depends on the Accelerometer output data rate (Hz). The HPF cutoff frequencies for the selected Accelerometer output data rate (Hz) are shown in this table. The values 00, 01, 10, and 11 are the HPF mode configurations.

HPF cutoff frequency[2:1]Acceleration output data rate - 1 HzAcceleration output data rate - 10 HzAcceleration output data rate - 25 HzAcceleration output data rate - 50 HzAcceleration output data rate - 100 HzAcceleration output data rate - 200 HzAcceleration output data rate - 400 HzAcceleration output data rate - 1600 HzAcceleration output data rate - 5376 Hz
000.020.20.5124832100
010.0080.080.20.51241650
100.0040.040.10.20.512825
110.0020.020.050.10.20.51412

Dependencies

This parameter appears only if you select the Enable high pass filter parameter.

Specify how often this block reads the data from the LIS3DH sensor. When you set this parameter to -1, Simulink determines the best sample time for the block based on the block context within the model.

Version History

Introduced in R2022b