Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- STMicroelectronics Community
- MEMS and sensors
- MEMS (sensors)
- Aligning the coordinate systems of accelerometer a...

Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

Aligning the coordinate systems of accelerometer and vehicle?

Options

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

2022-06-14 08:03 AM

I have an accelerometer located in an arbitrary position on a car. As the accelerometer already has a coordinate system by default, I want to find some method that allows transforming the data I have from the sensor and aligning them with the coordinate system of the car.

- When the vehicle is stationary on a flat, horizontal surface, use the three components relative to g-sensor, Gxs, Gys and Gzs(Gxs is the g value obtained on g-sensor Xs, the Gys and Gzs are g component relative to g-sensor Ys and Zs) and make rotation can rotate the Gzs aligned with gravity direction and Xs-Ys plane parallel to with horizontial.
**But how to align the Xs to vehicle X-axis?** - In theory, the euler angle can be obtained by rotating the coordinate axis of the G-sensor three times, and use this conversion matrix for conversion. But In practice this is not feasible.

**Is there any simple way to aligning the coordinate systems of accelerometer and vehicle?**

**Thanks.**

Solved! Go to Solution.

1 ACCEPTED SOLUTION

Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

2022-07-12 04:56 AM

Aligning **device** (sensor/PCB) **reference frame** to **car reference frame** is pure matter of vector math.

Let's assume we have *car reference frame* Left-Forward-Up where X-axis points Left, Y-axis points Forward and Z-axis points Up:

```
|X_car|
|Y_car|
|Z_car|
```

and *sensor device frame*:

```
|X_sens|
|Y_sens|
|Z_sens|
```

The optimal option would be to mount sensor device to perfectly align with car reference frame and no transformation would be needed:

```
|X_car| |X_sens|
|Y_car| = |Y_sens|
|Z_car| |Z_sens|
```

However in real situation the sensor device could be only placed in arbitrary position which could be very different from optimal. This means for us to use transformation matrix to transform *sensor data* to *car data* and vice-versa:

```
|X_car| |T_xs_xc, T_ys_xc, T_zs_xc| |X_sens|
|Y_car| = |T_xs_yc, T_ys_yc, T_zs_yc| * |Y_sens|
|Z_car| |T_xs_zc, T_ys_zc, T_zs_zc| |Z_sens|
```

where:

```
|T_xs_xc, T_ys_xc, T_zs_xc|
|T_xs_yc, T_ys_yc, T_zs_yc|
|T_xs_zc, T_ys_zc, T_zs_zc|
```

is transformation matrix.

Transformation matrix coefficients have to be calculated for real sensor device placed on car using vector math.

4 REPLIES 4

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

2022-06-14 09:50 AM

Vector Matrix Mathematics. Been a while but by multiplying a vector [x y z] against the correction matrix [9 number in grid] you get a new vector [x' y' z'].

I did this for a similar arrangement, but the 3d sensor on a patient's elbow, and it was magnetically measured against another 3d field generator, combining the sets of xyz coordinates was fun.

We had to change to use angles like you mention, otherwise the graphic figure's forearm turned into a helicopter when the put arm in right orientation over their head and one of the vectors when to zero in the math.

I'm sorry but many decades and jobs since and don't have the code.

All I recall was we used vector matrix math, and we had to convert from xyz to angles to properly define rotation when vector pointed straight up. Rotate equator, rotate North/South, and rotate for spin last (otherwise that turned into the helicopter).

(Wrote all this just to pass on the warning about using xyz versus safer using vector+angles)

Paul

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

2022-06-14 11:07 AM

**But how to align the Xs to vehicle X-axis?**

The accelerometer data sheet will give you the X-axis orientation relative to the accelerometer package. Then physically orient the package on the PCB and the PCB to the vehicle.

By pointing the PCB x-axis down and measuring the Y and Z values, the X-axis direction can be calibrated prior to vehicle installation.

Cheers, Hal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

2022-07-12 04:56 AM

Aligning **device** (sensor/PCB) **reference frame** to **car reference frame** is pure matter of vector math.

Let's assume we have *car reference frame* Left-Forward-Up where X-axis points Left, Y-axis points Forward and Z-axis points Up:

```
|X_car|
|Y_car|
|Z_car|
```

and *sensor device frame*:

```
|X_sens|
|Y_sens|
|Z_sens|
```

The optimal option would be to mount sensor device to perfectly align with car reference frame and no transformation would be needed:

```
|X_car| |X_sens|
|Y_car| = |Y_sens|
|Z_car| |Z_sens|
```

However in real situation the sensor device could be only placed in arbitrary position which could be very different from optimal. This means for us to use transformation matrix to transform *sensor data* to *car data* and vice-versa:

```
|X_car| |T_xs_xc, T_ys_xc, T_zs_xc| |X_sens|
|Y_car| = |T_xs_yc, T_ys_yc, T_zs_yc| * |Y_sens|
|Z_car| |T_xs_zc, T_ys_zc, T_zs_zc| |Z_sens|
```

where:

```
|T_xs_xc, T_ys_xc, T_zs_xc|
|T_xs_yc, T_ys_yc, T_zs_yc|
|T_xs_zc, T_ys_zc, T_zs_zc|
```

is transformation matrix.

Transformation matrix coefficients have to be calculated for real sensor device placed on car using vector math.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

2022-07-12 05:20 AM

Dear Martin,

Thanks for your helps and detail explanations.

I have got a transformation matrix from the mechanical angle and got the expected transform values after test.

Thanks,

E-John