加速度和陀螺仪工作原理简介 - STMicroelectronics...陀螺仪 Drive mode SINGLE DRIVING...

22
加速度和陀螺仪工作原理简介AlgoBuilder Tool 介绍

Transcript of 加速度和陀螺仪工作原理简介 - STMicroelectronics...陀螺仪 Drive mode SINGLE DRIVING...

Page 1: 加速度和陀螺仪工作原理简介 - STMicroelectronics...陀螺仪 Drive mode SINGLE DRIVING MASS Yaw mode Pitch mode Roll mode 陀螺仪: 陀螺是测量角速度的装置,输出单位是

加速度和陀螺仪工作原理简介,AlgoBuilder Tool 介绍

Page 2: 加速度和陀螺仪工作原理简介 - STMicroelectronics...陀螺仪 Drive mode SINGLE DRIVING MASS Yaw mode Pitch mode Roll mode 陀螺仪: 陀螺是测量角速度的装置,输出单位是

加速度加速度计:加速度计是一种测量加速度的装置,F=M*a, 所以加速度大小与受到的外力大小成比例,在动态情况下,加速度计主要用来测量震动,冲击等。但在静态时因为只受到重力的作用且恒定不变,可利用加速度计内部相互正交的三个轴检测每个轴相对于重力方向或水平方向的夹角。

外力 Mass 改变位置 两个电容值产生差异 输出

2

Page 3: 加速度和陀螺仪工作原理简介 - STMicroelectronics...陀螺仪 Drive mode SINGLE DRIVING MASS Yaw mode Pitch mode Roll mode 陀螺仪: 陀螺是测量角速度的装置,输出单位是

陀螺仪

Drive mode

SINGLE DRIVING

MASS

Yaw mode

Pitch mode

Roll mode

陀螺仪:陀螺是测量角速度的装置,输出单位是度/秒,对时间积分可以测量内部三个正交轴的旋转角度。在空间姿态运算中具有重要作用。

根据科里奥利力原理直线运动的质点在旋转体系中受到一个等效的外力作用,这个力就是科里奥利力,如果直线运动速度不变,那么这个力是与外部旋转的角速度是成正比的。如右图MEMS陀螺内部提供driver mode , 目的就是提供一个固定的直线运动v, 当外部有旋转输入时,等效的科里奥利F将会改变MEMS

moving 块的位置,方向垂直于V,满足右手定则。和加速度一样moving块位置变化同时也改变了与之相连的电容值。

3

Page 4: 加速度和陀螺仪工作原理简介 - STMicroelectronics...陀螺仪 Drive mode SINGLE DRIVING MASS Yaw mode Pitch mode Roll mode 陀螺仪: 陀螺是测量角速度的装置,输出单位是

ST 工具简介• UNICO tool + Emotion board + sensor 适配板

旨在对sensor数据评估,sensor配置验证,以及简单的嵌入功能(wake up, free fall, click, tilt ,pedometer etc.)的调试。

• OPEN.MEMS + NUCLO 板 + sensor 扩展板主要是对ST 提供的算法(fusion , calibration, activity rec etc.)

进行验证

• AlgoBuilder + NUCLO 板+ sensor 扩展板(后面章节重点介绍)图形化的开发界面,不需要编写任何程序,丰富的算法支持,

信号处理,逻辑运算,快速的功能验证以及应用的实现

Emotion board

Nucleo board

AlgoBuilder

4

Page 5: 加速度和陀螺仪工作原理简介 - STMicroelectronics...陀螺仪 Drive mode SINGLE DRIVING MASS Yaw mode Pitch mode Roll mode 陀螺仪: 陀螺是测量角速度的装置,输出单位是

AlgoBuilder

• AlgoBuilder 提供了一套基于MEMS 传感器以及相关算法的图形化开发平台

• 目的:

• 根据ST提供的现有算法,以及用户定义的特别数据处理及其它功能,快速成型自己的应用• 可作为ST sensor及算法验证的推广工具。

• 功能:

• 图形化设计(拖拉控件,连接,设置属性)

• 通过集成的库(运动算法,传感器融合,陀螺仪与磁力计校准,计步器)提供多种功能模块• 用户可以自己创建功能模块• 可通过检测没有连接的输入,输出来验证你的设计• 图形化设计之后可生成最终的C 代码• 支持 NUCLEO-F401RE or NUCLEO-L476RG and X-NUCLEO-IKS01A2

• 利用流行的编译器 (SW4STM32 (GCC), IAR EWARM, Keil uVision)

• 生成FW 后可以把数据发到 Unicleo-GUI

• 工程和库存储在XML文件中• 软件可以通过网络跟新安装

5

Page 6: 加速度和陀螺仪工作原理简介 - STMicroelectronics...陀螺仪 Drive mode SINGLE DRIVING MASS Yaw mode Pitch mode Roll mode 陀螺仪: 陀螺是测量角速度的装置,输出单位是

AlgoBuilder环境设置

1. 安装 AlgoBuilder 到你到电脑

2. 安装 Unicleo-GUI 到你的电脑

Unicleo-GUI 主要用来显示 Algobuilder 创建的FW的输出3. 安装(SW4STM32, MDK-ARM (Keil), EWARM) 其中任一个IDE

AlgoBuilder 是利用其它编译器完成编译,所以用户必须安装至少一个IDE如果他想编译一个项目

1. 硬件准备• NUCLEO-F401RE or NUCLEO-L476RG

• X-NUCLEO-IKS01A2 扩展板• SensorTile

6

Page 7: 加速度和陀螺仪工作原理简介 - STMicroelectronics...陀螺仪 Drive mode SINGLE DRIVING MASS Yaw mode Pitch mode Roll mode 陀螺仪: 陀螺是测量角速度的装置,输出单位是

AlgoBuilder工作原理

AlgoBuilder

Libraries

(binary)

Firmware

Project Unicleo-GUI

GUI

XML Data

C code

Conversion

Engine

FW Template Compiler

7

Page 8: 加速度和陀螺仪工作原理简介 - STMicroelectronics...陀螺仪 Drive mode SINGLE DRIVING MASS Yaw mode Pitch mode Roll mode 陀螺仪: 陀螺是测量角速度的装置,输出单位是

AlgoBuilder

Library

Console

Block

Properties

Workspace Block

Description

Menu & Toolbar

软件界面 : 8

Page 9: 加速度和陀螺仪工作原理简介 - STMicroelectronics...陀螺仪 Drive mode SINGLE DRIVING MASS Yaw mode Pitch mode Roll mode 陀螺仪: 陀螺是测量角速度的装置,输出单位是

AlgoBuilder文件菜单:

• New Design

• Open Design

• Save Design

• Save Design As

• Application Settings

• 至少输入一个IDE 的目录• 如果想在工具栏执行Unicleo-GUI ,必须在这里输入Unicleo-GUI的目录• 可以选择filter 滤掉大量的编译文本信息, 通过突出的颜色显示错误和警告。• 在任何屏幕分辨率下可以设置字体大小。

9

Page 10: 加速度和陀螺仪工作原理简介 - STMicroelectronics...陀螺仪 Drive mode SINGLE DRIVING MASS Yaw mode Pitch mode Roll mode 陀螺仪: 陀螺是测量角速度的装置,输出单位是

编辑菜单:

• Undo – Redo

在工作区的任何操作都可以撤销或重新执行, 如 (add or delete block or connection, cut, copy and paste block or

connection, block move, change property value)

• Delete

• Copy

• Paste

• Cut

• Align Block Left

• Align Block Right

• Align Block Top

• Align Block Bottom

• Zoom In

• Zoom Out

• Zoom 1:1

• Fit All

10AlgoBuilder

Page 11: 加速度和陀螺仪工作原理简介 - STMicroelectronics...陀螺仪 Drive mode SINGLE DRIVING MASS Yaw mode Pitch mode Roll mode 陀螺仪: 陀螺是测量角速度的装置,输出单位是

当你要创建一个新项目,你应该按照以下步骤• 选择工程存放的目录• 选择编译的工具链• 选择连接的NUCLEO 板以上的设置也可随后再更改

Firmware 菜单:

• Firmware Settings

11AlgoBuilder

Page 12: 加速度和陀螺仪工作原理简介 - STMicroelectronics...陀螺仪 Drive mode SINGLE DRIVING MASS Yaw mode Pitch mode Roll mode 陀螺仪: 陀螺是测量角速度的装置,输出单位是

Function Blocks

Connections

Input - Output Input - Output

设计的规则:

为了保证你的项目可以验证和编译,需要遵守以下几条规则

• 不同功能模块只有输入和输出才可以连接

• 两个输入或输出是不能连接在一起的

• 只有输入和输出是同一类型才可以连接,但当输入是可变的输入时,它是个列外,因为它可以获得输出的类型

• 只有相同size的输入和输出才可以连接,有些输入和输出的size是可变的,可以通过它们的属性窗口修改

• 通过连接线的线宽来指示输入和输出的size,通过连接线的颜色来指示输入和输出的类型

12AlgoBuilder

Page 13: 加速度和陀螺仪工作原理简介 - STMicroelectronics...陀螺仪 Drive mode SINGLE DRIVING MASS Yaw mode Pitch mode Roll mode 陀螺仪: 陀螺是测量角速度的装置,输出单位是

库:

• Comparison –比较两个值得功能模块• Constants –定义常量的功能模块• Display –通过图形显示输出• Graphics – 图形效果的指示• Logic Operators –逻辑操作• Math Operations –常用的数学和三角运算• Other –其它多种功能• Sensor Hub –整个FW 执行的基础,通过这个模块可以从硬件扩展板上读取传感器数据

• Signal –信号处理模块(滤波,峰值检测)• User Input –这个模块可以让用户通过 Unicleo-GUI 实时的输入数据到算法• Vector Operations –矢量的操作(magnitude, normalization)

13AlgoBuilder

Page 14: 加速度和陀螺仪工作原理简介 - STMicroelectronics...陀螺仪 Drive mode SINGLE DRIVING MASS Yaw mode Pitch mode Roll mode 陀螺仪: 陀螺是测量角速度的装置,输出单位是

库:

以下是现有提供的算法库

• MotionAW – Activity recognition for wrist

• MotionFX – Sensor fusion

• MotionGC – Gyroscope calibration

• MotionID – Motion intensity detection

• MotionMC – Magnetometer calibration

• MotionPW – Pedometer for wrist

14AlgoBuilder

Page 15: 加速度和陀螺仪工作原理简介 - STMicroelectronics...陀螺仪 Drive mode SINGLE DRIVING MASS Yaw mode Pitch mode Roll mode 陀螺仪: 陀螺是测量角速度的装置,输出单位是

显示:

几种可选的输出数据的显示 15AlgoBuilder

Page 16: 加速度和陀螺仪工作原理简介 - STMicroelectronics...陀螺仪 Drive mode SINGLE DRIVING MASS Yaw mode Pitch mode Roll mode 陀螺仪: 陀螺是测量角速度的装置,输出单位是

用户输入:

输入模块提供了一个用户和运行程序间交互的接口

16AlgoBuilder

Page 17: 加速度和陀螺仪工作原理简介 - STMicroelectronics...陀螺仪 Drive mode SINGLE DRIVING MASS Yaw mode Pitch mode Roll mode 陀螺仪: 陀螺是测量角速度的装置,输出单位是

ST 传感器完整的软件支持 17

底层驱动

Standard C Platform Independent drivers

Windows drivers

Linux drivers

X-CUBE-MEMS-XT1

X-CUBE_MEMS1 平台

Development Tool based on Low level drivers

Runs on STM32

Sample implementation of device embedded features

算法库

Generic sw libraries

Accuracy, Calibration, Positioning, Activity tracking, Health monitoring

Dedicated sw libraries

FSM & Prog Sensor Libs

AlgoBuilder 工具

Dedicated software Tool for libraries development

Graphical design apps to build and use algorithms

Go to st.com

Go to ST.com

MEMS and Sensors Software -

STMicroelectronics

Open.MEMS - STMicroelectronics

从底层驱动到上层算法以及开发工具

Page 18: 加速度和陀螺仪工作原理简介 - STMicroelectronics...陀螺仪 Drive mode SINGLE DRIVING MASS Yaw mode Pitch mode Roll mode 陀螺仪: 陀螺是测量角速度的装置,输出单位是

算法库the Right SW for Your Sensor

Accuracy/Calibration Position tracking Health care

18

Activity/Sport tracking

Accelerometer

Calibration

Gyroscope

CalibrationTilt

SensingeCompass

Sensor

FusionVertical

Context

Activity

Recognition

Activity

Recognition

for Wrist

Motion

Intensity

Detection

Pedometer

Fitness

Activities

Gesture

Recognition

Active

Time Carry

Position

Pose

EstimationFall

Detection

Standing vs

Sitting

Desk Detection

Pedometer

Sleep

Monitoring

All libraries are available in X-CUBE-MEMS1, X-CUBE-MEMS-XT1 package

Sensor

FusionMagnetometer

Calibration

Accelerometer

Gyroscope / IMU

Magnetometer

eCompass Pressure Sensor

Accelerometer

Gyroscope / IMU

Pressure SensorPressure Sensor

Accelerometer

Accelerometer

Gyroscope / IMU

Magnetometer

eCompass

Page 19: 加速度和陀螺仪工作原理简介 - STMicroelectronics...陀螺仪 Drive mode SINGLE DRIVING MASS Yaw mode Pitch mode Roll mode 陀螺仪: 陀螺是测量角速度的装置,输出单位是

ST.COM提供算法库的列表(1/3) 19

Library Name Description Sensors Recommended part numberROM*

(KB)

RAM*

(KB)

ODR

(Hz)

ARM Cortex

core

supported

MotionACAccelerometer

Calibration

Calibrates the accelerometer in real time.

Library acquires data from accelerometer

and calculates offset and scale factor coefficients together

with the calibration quality value.

A

H3LIS331DL, H3LIS200DL,

H3LIS100DL, LIS331HH,

LIS331DLH

14 220 to

100M3, M4

MotionARActivity

Recognition

Real-time information on the type of activity performed by

the user including stationary, walking, fast walking, jogging,

biking, or driving.

ALIS2DW12, LIS2HH12, LIS2DH,

LIS3DH7.2 1.6 16 M3, M4

MotionAT Active Time

Based on type of activity, detects motion intensity and

pedometer data in real time using wrist algorithms to

determine the number of active seconds.

ALIS2DW12, LIS2HH12, LIS2DH,

LIS3DH16.5 5.6 50 M3, M4

MotionAWActivity

Recognition for

Wrist

Real-time information on the type of activity performed by

the user including stationary, standing, sitting, lying,

walking, fast walking, jogging or biking.

ALIS2DW12, LIS2HH12, LIS2DH,

LIS3DH12 3 16 M3, M4

MotionCPCarrying

Position

Real-time information about how the user is carrying a

device (e.g. cell phone): on desk, in hand, near head, shirt

pocket, trouser pocket, swinging arm and jacket pocket.

ALIS2DW12, LIS2HH12, LIS2DH,

LIS3DH5.6 12 50 M3, M4

MotionEC eCompass

Real-time information about device orientation and

movement: device orientation (quaternions, Euler angles),

device rotation (virtual gyroscope functionality), gravity

vector and linear acceleration.

M, A

LSM303AGR, LSM303AH,

LSM303C, LSM303D,

LSM303DLHC

3 0.1 50 M3, M4

MotionFAFitness

Activities

Real-time information about the repetition quantity of

various fitness activities performed by a user.A, G, P

LSM6DSL, LSM6DS3, LSM6DSO

LPS22HH, LPS22HB, LPS22HD,

LPS33HW, LPS35HW

11.9 8.6 25 M3, M4

* Real size might differ for different IDEs (toolchain)

A = accelerometer, G = gyroscope, M = magnetometer, P = pressure sensor

ST MEMS/promotional_material/brochure/en.ST12274_BRSTMSENS0818_EP.pdf

Page 20: 加速度和陀螺仪工作原理简介 - STMicroelectronics...陀螺仪 Drive mode SINGLE DRIVING MASS Yaw mode Pitch mode Roll mode 陀螺仪: 陀螺是测量角速度的装置,输出单位是

ST.COM提供算法库的列表 (2/3) 20

Library Name DescriptionSensors

usedRecommended part number

ROM*

(KB)

RAM*

(KB)

ODR

(Hz)

ARM Cortex

core

supported

MotionFD Fall DetectionReal-time information about user fall events. It is

able to distinguish if the user fell or not.A, P

LIS2DW12, LIS2HH12, LIS2DH, LIS3DH

LPS22HH, LPS22HB, LPS22HD,

LPS33HW, LPS35HW

2.4 3.4 25 M3, M4

MotionFX Sensor Fusion

Real-time motion-sensor data from the

accelerometer, gyroscope (6-axis fusion)

and magnetometer (9-axis fusion) and real-time

motion-fusion sensing.

It also performs gyroscope bias and magnetometer

hard iron calibration..

A, G,

(M

optional)

LSM6DSL, LSM6DSM, LSM6DS3,

LSM6DSO, LIS3MDL, LIS2MDL, LSM9DS145 8 100 M0, M3, M4

MotionGCGyroscope

Calibration

Used to calibrate the gyroscope in real time using

angular zero-rate level coefficients

(offset).. The MotionGC library minimize the offset.

A, GL3GD20H, LSM6DSL, LSM6DSM,

LSM6DS3, LSM6DSO, LSM9DS11.6 0.2

25 to

200M0, M3, M4

MotionGRGesture

Recognition

Real-time information about the gesture just

performed by the user with the device, such as a

cell phone, including pick-up, glance, wake up.

A LIS2DW12, LIS2HH12, LIS2DH, LIS3DH 8.2 4.7 50 M3, M4

MotionIDMotion Intensity

Detection

Real-time information about the user motion

intensity. It is able to distinguish motion intensity in

a range from 0 (still) to 10 (sprinting).

A LIS2DW12, LIS2HH12, LIS2DH, LIS3DH 1 0.5 16 M3, M4

MotionMCMagnetometer

Calibration

Used to calibrate the magnetometer in real time

using hard iron (HI) and scale factor

coefficients.

M

LIS2MDL, LIS3MDL, LSM303AGR,

LSM303AH, LSM303C, LSM303D,

LSM303DLHC

20 3 <100 M0, M3, M4

* Real size might differ for different IDEs (toolchain)

A = accelerometer, G = gyroscope, M = magnetometer, P = pressure sensor

ST MEMS/promotional_material/brochure/en.ST12274_BRSTMSENS0818_EP.pdf

Page 21: 加速度和陀螺仪工作原理简介 - STMicroelectronics...陀螺仪 Drive mode SINGLE DRIVING MASS Yaw mode Pitch mode Roll mode 陀螺仪: 陀螺是测量角速度的装置,输出单位是

ST.COM提供算法库的列表(3/3) 21

Library Name DescriptionSensors

usedRecommended part number

ROM*

(KB)

RAM*

(KB)

ODR

(Hz)

ARM Cortex

core

supported

MotionPE Pose Estimation

Provides real-time information about the user

current pose such as sitting, standing and

lying down.

A LIS2DW12, LIS2HH12, LIS2DH, LIS3DH 11 3 16 M3, M4

MotionPMPedometer for

Mobile

Provides real-time information about the number of

steps and cadence just performed by

the user carrying the device, such as a cell phone.

A LIS2DW12, LIS2HH12, LIS2DH, LIS3DH 7.9 3.7 50 M3, M4

MotionPWPedometer for

Wrist

Provides real-time information about the number of

steps and cadence which the user just

performed wearing the device on the wrist (e.g. a

smart watch).

A LIS2DW12, LIS2HH12, LIS2DH, LIS3DH 3.1 1.9 50 M3, M4

MotionSD

Standing and

Sitting Desk

position

Provides real-time information about the user

working mode: sitting at the desk or standing

desk position.

A, P

LIS2DW12, LIS2HH12, LIS2DH, LIS3DH

LPS22HH, LPS22HB, LPS22HD,

LPS33HW, LPS35HW

2.4 1.1 25 M3, M4

MotionSMSleep

Monitoring

Provides real-time information if the man wearing

the device is sleeping or not.A LIS2DW12, LIS2HH12, LIS2DH, LIS3DH 2.2 2.2 16 M3, M4

MotionTL Tilt Sensing

Provides real-time information about the tilt angles

of the user carrying the device, i.e. cell

phone. The library is also able to perform 6-position

accelerometer calibration.

A LIS2DW12, LIS2HH12, LIS2DH, LIS3DH 3.7 0.1 50 M3, M4

MotionVC Vertical Context

Provides real-time information about vertical

movement. The library is able to detect if there is

change of altitude and distinguish type of vertical

movement: stairs, elevator, and escalator.

A, P

LIS2DW12, LIS2HH12, LIS2DH, LIS3DH

LPS22HH, LPS22HB, LPS22HD,

LPS33HW, LPS35HW

10 3.9 50 M3, M4

* Real size might differ for different IDEs (toolchain)

A = accelerometer, G = gyroscope, M = magnetometer, P = pressure sensor

ST MEMS/promotional_material/brochure/en.ST12274_BRSTMSENS0818_EP.pdf

Page 22: 加速度和陀螺仪工作原理简介 - STMicroelectronics...陀螺仪 Drive mode SINGLE DRIVING MASS Yaw mode Pitch mode Roll mode 陀螺仪: 陀螺是测量角速度的装置,输出单位是

谢谢!