Skip to content

Commit ce693e1

Browse files
committed
[lis2dh12] Add base accelerometer component documentation (I2C)
1 parent ffbd0ec commit ce693e1

File tree

3 files changed

+84
-0
lines changed

3 files changed

+84
-0
lines changed

public/images/lis2dh12.jpg

11.2 KB
Loading

src/content/docs/components/index.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@ Sensors are organized into categories; if a given sensor fits into more than one
529529
["LD2420", "/components/sensor/ld2420/", "ld2420.jpg", "Motion & Presence"],
530530
["LD2450", "/components/sensor/ld2450/", "ld2450.png", "Motion & Presence"],
531531
["RD-03D", "/components/sensor/rd03d/", "rd03d.webp", "Motion & Presence"],
532+
["LIS2DH12", "/components/sensor/lis2dh12/", "lis2dh12.jpg", "Accelerometer"],
532533
["MPU6050", "/components/sensor/mpu6050/", "mpu6050.jpg", "Accelerometer & Gyroscope"],
533534
["MPU6886", "/components/sensor/mpu6886/", "mpu6886.jpg", "Accelerometer & Gyroscope"],
534535
["MSA301", "/components/sensor/msa3xx/", "msa301.jpg", "Accelerometer"],
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
---
2+
description: "Instructions for setting up the LIS2DH12 digital tri-axial accelerometer."
3+
title: "LIS2DH12 Sensor"
4+
---
5+
6+
import APIRef from '@components/APIRef.astro';
7+
8+
<span id="lis2dh12-component"></span>
9+
10+
## Component/Hub
11+
12+
The `lis2dh12` sensor platform allows you to use your ST LIS2DH12 ultra-low-power tri-axial
13+
accelerometer ([datasheet](https://www.st.com/resource/en/datasheet/lis2dh12.pdf))
14+
with ESPHome via the [I²C](/components/i2c) bus.
15+
16+
LIS2DH12 is a high-performance accelerometer with selectable resolution (12-bit, 10-bit, or 8-bit)
17+
and configurable output data rates from 1 Hz to 5376 Hz.
18+
19+
This component provides acceleration data in m/s². XYZ axes can be
20+
calibrated and transformed to match the physical orientation of the sensor.
21+
22+
```yaml
23+
# Example I2C configuration
24+
lis2dh12_i2c:
25+
range: 4G
26+
resolution: high
27+
output_data_rate: 100Hz
28+
update_interval: 10s
29+
```
30+
31+
### Configuration variables
32+
33+
- **update_interval** (*Optional*, [Time](/guides/configuration-types#time)): The interval for updating acceleration sensors.
34+
Defaults to `10s`.
35+
36+
- **range** (*Optional*, string): The range of the sensor measurements. One of `2G`, `4G`, `8G`, `16G`.
37+
Defaults to `2G` which means it picks up accelerations between `-2g` and `2g`.
38+
39+
- **resolution** (*Optional*, string): ADC resolution mode. One of `high` (12-bit), `medium` (10-bit), `low` (8-bit).
40+
Defaults to `high`.
41+
42+
- **output_data_rate** (*Optional*, string): Output data rate. One of `1Hz`, `10Hz`, `25Hz`, `50Hz`, `100Hz`,
43+
`200Hz`, `400Hz`, `1620Hz`, `5376Hz`. Defaults to `100Hz`.
44+
45+
- **calibration** (*Optional*):
46+
47+
- **offset_x** (*Optional*, float): X-axis zero position calibration, in m/s². From -4.5 to 4.5. Defaults to `0`.
48+
- **offset_y** (*Optional*, float): Y-axis zero position calibration, in m/s². From -4.5 to 4.5. Defaults to `0`.
49+
- **offset_z** (*Optional*, float): Z-axis zero position calibration, in m/s². From -4.5 to 4.5. Defaults to `0`.
50+
51+
- **transform** (*Optional*):
52+
53+
- **mirror_x** (*Optional*, boolean): Mirror X-axis. Defaults to `false`.
54+
- **mirror_y** (*Optional*, boolean): Mirror Y-axis. Defaults to `false`.
55+
- **mirror_z** (*Optional*, boolean): Mirror Z-axis. Defaults to `false`.
56+
- **swap_xy** (*Optional*, boolean): Swap X and Y axis. Defaults to `false`.
57+
58+
- All options from [I²C Device](/components/i2c#i2c-device). Default address is `0x19`.
59+
60+
## Sensor
61+
62+
Acceleration data is available through sensors configuration.
63+
You can use shorthand notation like `acceleration_x: "Acceleration X"` or use regular notation. For
64+
regular notation only the **name** is required. All options from [Sensor](/components/sensor).
65+
66+
```yaml
67+
sensor:
68+
- platform: lis2dh12_base
69+
acceleration_x: Accel X
70+
acceleration_y: Accel Y
71+
acceleration_z: Accel Z
72+
```
73+
74+
### Configuration variables
75+
76+
- **acceleration_x** (*Optional*): X-axis acceleration, m/s².
77+
- **acceleration_y** (*Optional*): Y-axis acceleration, m/s².
78+
- **acceleration_z** (*Optional*): Z-axis acceleration, m/s².
79+
80+
## See Also
81+
82+
- [Sensor Filters](/components/sensor#sensor-filters)
83+
- <APIRef text="lis2dh12_base.h" path="lis2dh12_base/lis2dh12_base.h" />

0 commit comments

Comments
 (0)