基于RSL10可穿戴设备的人体行为识别系统
<p align="center" style="text-align:center"> </p><p align="center" style="text-align:center"><span style="font-size:24px;"><span style="font-family:"Times New Roman""><b><span class="16"><span style="font-family:微软雅黑"><span style="font-weight:bold"><font face="微软雅黑">基于</font>RSL10可穿戴设备的人体行为识别系统</span></span></span></b></span></span></p>
<p align="center" style="text-align:center"> </p>
<p align="right" style="text-align:right"><span style="font-size:10.5pt"><span style="font-family:"Times New Roman""><b><span style="font-size:16.0000pt"><span style="font-family:微软雅黑"><span style="font-weight:bold"><font face="微软雅黑">作者:</font></span></span></span></b><b><span style="font-size:16.0000pt"><span style="font-family:微软雅黑"><span style="font-weight:bold">Justice_Gao</span></span></span></b></span></span></p>
<p style="text-align:justify"> </p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:"Times New Roman""><b><span class="15" style="font-size:16.0000pt"><span style="font-family:微软雅黑"><span style="font-weight:bold"><font face="微软雅黑">一、作品简介</font></span></span></span></b></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:"Times New Roman""><span style="font-size:12.0000pt"><span style="font-family:微软雅黑"><span style="font-weight:normal"><font face="微软雅黑"> 可穿戴设备数量在日常生活中呈指数增长,广泛应用于各个领域,例如医疗保健、生活娱乐、制造业等。</font> <font face="微软雅黑">利用可穿戴设备进行人体活动识别,可在不侵犯用户隐私的前提下有效地监控个人身体状况,具有很好的应用前景。本发明首先利用可穿戴设备采集人体活动是的多种传感器数据(包括加速度计、角速度计),通过蓝牙与手机建立通信连接,在手机端部署识别模型,进行人体活动识别,例如走路、跑步、坐下去、站起来、弯腰、起床、跌倒等常见活动。该项目的难点在于需要开发低功耗的数据采集系统,并获取一定量的数据,提取各类活动特征,通过机器学习方法实现有效识别。未来推广后,该项目可应用于老年人或病患安全监控、儿童异常行为识别、健身爱好者运动量评估等。</font></span></span></span></span></span></p>
<p style="text-align:justify"> </p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:"Times New Roman""><b><span class="15" style="font-size:16.0000pt"><span style="font-family:微软雅黑"><span style="font-weight:bold"><font face="微软雅黑">二、系统框图</font></span></span></span></b></span></span></p>
<p align="justify" style="text-align:justify"><span style="font-size:10.5pt"><span style="text-justify:inter-ideograph"><span style="font-family:"Times New Roman""><span style="font-size:12.0000pt"><span style="font-family:微软雅黑"><span style="font-weight:normal"><font face="微软雅黑"> 如图</font>1所示,将RSL10的纽扣传感器穿戴在身上,主要是在胸口,也可以在腰部增加一个,通过采集数据、数据处理、特征提取、训练机器学习模型、服务器部署算法等过程,</span></span></span></span></span></span><span style="font-size:16px;">通过小程序与云服务器通信,定时将用户运动时产生的六轴数据发送至服务器,并投放至存储在服务器上的机器学习算法模型中进行动作识别,最后服务器返回识别结果至小程序端,并以页面展示和语音播报两种方式呈现,以达到实时检测的效果。在用户完成运动时,将运动期间存储的六轴数据发至服务器,并投放至<b>波峰检测</b>代码中,根据波峰和动作的对应关系计算出每种动作的完成个数,并返回至小程序端进行页面显示。</span></p>
<p align="justify" style="text-align:justify"></p>
<p>图1 系统框图</p>
<p style="text-align: center;"> </p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:"Times New Roman""><b><span class="15" style="font-size:16.0000pt"><span style="font-family:微软雅黑"><span style="font-weight:bold"><font face="微软雅黑">三、部</font></span></span></span></b><b><span class="15" style="font-size:16.0000pt"><span style="font-family:微软雅黑"><span style="font-weight:bold"><font face="微软雅黑">分功能说明</font></span></span></span></b></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:"Times New Roman""><span class="15" style="font-size:12.0000pt"><span style="font-family:微软雅黑"><span style="font-weight:normal"><font face="微软雅黑"> </font></span></span></span></span></span><font face="微软雅黑" style="font-family: 微软雅黑; font-size: 12pt; text-indent: 21pt;">如图</font><span style="font-family: 微软雅黑; font-size: 12pt; text-indent: 21pt;">2所示,RSL10是一款超低功耗的芯片,采用ARM Cortex-M3处理器和LPDSP32 DSP内核。内部包含DC/DC电源管理模块,AES128加密引擎、DMA、88kB数据存储RAM、384kB Flash,ADC、SPI主从总线、I2C、PWM、UART、Timers,可以很好应用于可穿戴式应用。</span></p>
<p style="text-align:justify"></p>
<p>图2 RSL10内部资源</p>
<p><span style="font-size:16px;"><span style="font-family:"Times New Roman""><span class="15"><span style="font-family:微软雅黑"><span style="font-weight:normal"><font face="微软雅黑"> </font></span></span></span></span></span></p>
<p><span style="font-size:16px;"><span style="font-family:"Times New Roman""><span class="15"><span style="font-family:微软雅黑"><span style="font-weight:normal"><font face="微软雅黑"> 如图</font>3所示,</span></span></span></span>BHI160集成了MCU及6轴惯性测量单元(IMU),包括一个3轴陀螺仪和3轴加速度计。Fuser Core是超低功耗32位微控制器,专为Bosch Sensortec的传感器融合和运动识别算法优化定制。与标准微控制器相比,其耗电显著降低,与Cortex M0相比省电最高达95%,与以Cortex M4为基础的设备相比省电最高达90%。</span></p>
<p style="text-align:justify"></p>
<p>图3 BHI160传感器外设接口示意图 </p>
<p> </p>
<p><span style="font-size:10.5pt"><span style="text-justify:inter-ideograph"><span style="font-family:"Times New Roman""><span class="15" style="font-size:12.0000pt"><span style="font-family:微软雅黑"><span style="font-weight:normal"><font face="微软雅黑">嵌入式软件部分的主要作用是采集加速度和角速度原始传感器,通过蓝牙上传到手机端进行算法处理,识别人体行为。系统及</font>BHI160传感器都初始化以后,与手机建立蓝牙连接,通过蓝牙将数据传输给手机应用端。数据的第一个字节为包序列,后19个字节分别为方向、加速度、角度等数据。</span></span></span></span></span></span></p>
<p style="text-align: center;"> </p>
<p>图4 嵌入式软件流程图</p>
<pre>
<code>//-----------------------------------------------------------------------------
// Copyright (c) 2018 Semiconductor Components Industries LLC
// (d/b/a "ON Semiconductor").All rights reserved.
// This software and/or documentation is licensed by ON Semiconductor under
// limited terms and conditions.The terms and conditions pertaining to the
// software and/or documentation are available at
// http://www.onsemi.com/site/pdf/ONSEMI_T&C.pdf ("ON Semiconductor Standard
// Terms and Conditions of Sale, Section 8 Software") and if applicable the
// software license agreement.Do not use this software and/or documentation
// unless you have carefully read and you agree to the limited terms and
// conditions.By using this software and/or documentation, you agree to the
// limited terms and conditions.
//-----------------------------------------------------------------------------
#include <stdio.h>
#include <math.h>
#include <BDK.h>
#include <BSP_Components.h>
#include <BLE_Components.h>
#include <SoftwareTimer.h>
#include <bsec_integration.h>
uint8_t ble_data_tx;
/** Converts measured orientation data into degrees.
*
* GREEN LED will be turned on if board heading is within 10 degrees of
* magnetic north (<=10 or >=350).
*/
void ao_vector_cb(bhy_data_generic_t *data, bhy_virtual_sensor_t sensor)
{
float h = data->data_vector.x / 32768.0f * 360.0f;
float p = data->data_vector.y / 32768.0f * 360.0f;
float y = data->data_vector.z / 32768.0f * 360.0f;
if (h > 350.0f || h < 10.0f)
{
LED_On(LED_GREEN);
}
else
{
LED_Off(LED_GREEN);
}
ble_data_tx = data->data_vector.x>>8;
ble_data_tx = data->data_vector.x;
ble_data_tx = data->data_vector.y>>8;
ble_data_tx = data->data_vector.y;
ble_data_tx = data->data_vector.z>>8;
ble_data_tx = data->data_vector.z;
ble_data_tx++;
BLE_ICS_Notify(ble_data_tx, 20);
printf("Orientation: h=%.1f� p=%.1f�, y=%.1f� (%d)\r\n", h, p, y, data->data_vector.status);
}
/** Converts measured linear acceleration data based on sensors dynamic range
* and prints it to debug terminal.
*
* Also turns on RED LED if total acceleration applied to the board is over 1g.
*/
void la_vector_cb(bhy_data_generic_t *data, bhy_virtual_sensor_t sensor)
{
/* Linear Acceleration sensor values are scaled using dynamic range. */
uint16_t dyn_range = BHI160_NDOF_GetAccelDynamicRange();
float x = data->data_vector.x / 32768.0f * dyn_range;
float y = data->data_vector.y / 32768.0f * dyn_range;
float z = data->data_vector.z / 32768.0f * dyn_range;
if (fabsf(x) + fabsf(y) + fabsf(z) >= 1.0f)
{
LED_On(LED_RED);
}
else
{
LED_Off(LED_RED);
}
ble_data_tx = data->data_vector.x>>8;
ble_data_tx = data->data_vector.x;
ble_data_tx = data->data_vector.y>>8;
ble_data_tx = data->data_vector.y;
ble_data_tx = data->data_vector.z>>8;
ble_data_tx = data->data_vector.z;
ble_data_tx++;
BLE_ICS_Notify(ble_data_tx, 20);
printf("Linear Accel: x=%.2f g, y=%.2f g, z=%.2f g\r\n", x, y, z);
}
void gyro_vector_cb(bhy_data_generic_t *data, bhy_virtual_sensor_t sensor)
{
uint16_t dyn_range = BHI160_NDOF_GetGyroDynamicRange();
float x = data->data_vector.x / 32768.0f * dyn_range;
float y = data->data_vector.y / 32768.0f * dyn_range;
float z = data->data_vector.z / 32768.0f * dyn_range;
if (fabsf(z) > 45.0f)
{
LED_On(LED_BLUE);
}
else
{
LED_Off(LED_BLUE);
}
ble_data_tx = data->data_vector.x>>8;
ble_data_tx = data->data_vector.x;
ble_data_tx = data->data_vector.y>>8;
ble_data_tx = data->data_vector.y;
ble_data_tx = data->data_vector.z>>8;
ble_data_tx = data->data_vector.z;
ble_data_tx++;
BLE_ICS_Notify(ble_data_tx, 20);
printf("Rate of Rotation: x=%.2f �/s, y=%.2f �/s, z=%.2f �/s\r\n", x, y, z);
}
void CustomService_WriteInd(struct BLE_ICS_RxIndData *ind)
{
/* Print at most ind->data_len characters from ind->data array. */
printf("APP: Received message \'%.*s\'\r\n", ind->data_len, ind->data);
/* Echo received message back to TX characteristic. */
//BLE_ICS_Notify(ind->data, ind->data_len);
}
int main(void)
{
int32_t retval;
/* Initialize all needed BDK components. */
BDK_Initialize();
BDK_BLE_Initialize();
BLE_BASS_Initialize(50,1);
BLE_ICS_Initialize(&CustomService_WriteInd);
/* Initialize all LEDs to eliminate any currents from disabled DIO pads. */
LED_Initialize(LED_RED);
LED_Initialize(LED_GREEN);
LED_Initialize(LED_BLUE);
/* Increase I2C bus speed to 400kHz. */
HAL_I2C_SetBusSpeed(HAL_I2C_BUS_SPEED_FAST);
/* Initialize BHI160.
* This may take a while depending on bus speed because RAM patch has to be
* uploaded into BHI160 to enable support for BMM150 magnetometer.
*
* Set temporary timer to see how long it took to initialize and load the
* RAM patch.
*/
LED_On(LED_GREEN);
{
printf("Initializing BHI160.\r\n");
struct SwTimer tim;
struct SwTimer_Duration tim_dur;
SwTimer_Initialize(&tim);
SwTimer_Start(&tim);
retval = BHI160_NDOF_Initialize();
ASSERT_DEBUG(retval == BHY_SUCCESS);
SwTimer_GetElapsed(&tim, &tim_dur);
SwTimer_Remove(&tim);
printf("BHI160 initialized in %lu seconds and %lu ns.\r\n",
tim_dur.seconds, tim_dur.nanoseconds);
}
LED_Off(LED_GREEN);
/* Enable desired virtual sensor outputs. */
retval = BHI160_NDOF_EnableSensor(BHI160_NDOF_S_ORIENTATION, &ao_vector_cb, 5);
ASSERT_DEBUG(retval == BHY_SUCCESS);
retval = BHI160_NDOF_EnableSensor(BHI160_NDOF_S_LINEAR_ACCELERATION, &la_vector_cb, 50);
ASSERT_DEBUG(retval == BHY_SUCCESS);
retval = BHI160_NDOF_EnableSensor(BHI160_NDOF_S_RATE_OF_ROTATION, &gyro_vector_cb, 50);
ASSERT_DEBUG(retval == BHY_SUCCESS);
printf("APP: Entering main loop.\r\n");
while (1)
{
BDK_Schedule();
SYS_WAIT_FOR_INTERRUPT;
}
return 0;
}
</code></pre>
<p><span style="font-size:16px;">数据处理算法主要对六轴原始数据进行特征提取,主要包括:</span></p>
<ul>
<li><span style="font-size:16px;">滤波:对原始数据用三阶低通滤波器滤波</span></li>
<li><span style="font-size:16px;">FFT:对原始数据快速傅里叶变换</span></li>
<li><span style="font-size:16px;">分割数据:对原始数据进行区间分割(将每组20s长的数据 分割成多个2.56s长的小区间数据。为减小误差,分割区间时要求前后两区间具有50%重叠区,因此20s数据可以最多被分成 13 个2.56s的小区间)</span></li>
<li><span style="font-size:16px;">特征提取:对上述每个小区间进行特征提取</span></li>
<li><span style="font-size:16px;">保存特征:将提取特征后的特征数据进行存储,以便投入机器学习算法模型训练。</span></li>
</ul>
<p></p>
<p>图5 设备实物图 </p>
<p><span style="font-size:16px;">微信小程序软件设计主要分行为识别与行为识别的技术统计等用户交互功能。</span></p>
<p></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:"Times New Roman""><b><span class="15" style="font-size:16.0000pt"><span style="font-family:微软雅黑"><span style="font-weight:bold"><font face="微软雅黑">四、作品源码</font></span></span></span></b></span></span></p>
<p style="text-align:justify"><font face="微软雅黑"><b> </b></font></p>
<p style="text-align:justify"> 数据处理算法不提供,涉及知识产权,见谅。</p>
<p style="text-align:justify"> </p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:"Times New Roman""><b><span class="15" style="font-size:16.0000pt"><span style="font-family:微软雅黑"><span style="font-weight:bold"><font face="微软雅黑">五、作品功能演示视频</font></span></span></span></b></span></span><br />
<a href="https://training.eeworld.com.cn/course/6118/learn?preview=1#lesson/30684">https://training.eeworld.com.cn/course/6118/learn?preview=1#lesson/30684</a></p>
<p style="text-align:justify"> </p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:"Times New Roman""><b><span style="font-size:16.0000pt"><span style="font-family:微软雅黑"><span style="font-weight:bold"><font face="微软雅黑">六、项目总结</font></span></span></span></b></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:"Times New Roman""><a href="https://bbs.eeworld.com.cn/thread-1162946-1-1.html"><b><u><span class="16" style="font-size:12.0000pt"><span style="background:#ffffff"><span style="font-family:微软雅黑"><span style="color:#0000ff"><span style="letter-spacing:0.0000pt"><span style="font-weight:bold"><span style="text-decoration:underline"><span style="text-underline:single"><span style="font-style:normal"><font face="微软雅黑">大</font></span></span></span></span></span></span></span></span></span></u></b><b><u><span class="16" style="font-size:12.0000pt"><span style="background:#ffffff"><span style="font-family:微软雅黑"><span style="color:#0000ff"><span style="letter-spacing:0.0000pt"><span style="font-weight:bold"><span style="text-decoration:underline"><span style="text-underline:single"><span style="font-style:normal"><font face="微软雅黑">赛分享一之</font>RSL10蓝牙SoC之开发环境搭建</span></span></span></span></span></span></span></span></span></u></b></a></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:"Times New Roman""><a href="https://bbs.eeworld.com.cn/thread-1168936-1-1.html"><b><u><span class="16" style="font-size:12.0000pt"><span style="background:#ffffff"><span style="font-family:微软雅黑"><span style="color:#0000ff"><span style="letter-spacing:0.0000pt"><span style="font-weight:bold"><span style="text-decoration:underline"><span style="text-underline:single"><span style="font-style:normal"><font face="微软雅黑">大赛分享二:</font>RSL10蓝牙SoC之BHI160传感器数据采集</span></span></span></span></span></span></span></span></span></u></b></a></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:"Times New Roman""><a href="https://bbs.eeworld.com.cn/thread-1168937-1-1.html"><b><u><span class="16" style="font-size:12.0000pt"><span style="background:#ffffff"><span style="font-family:微软雅黑"><span style="color:#0000ff"><span style="letter-spacing:0.0000pt"><span style="font-weight:bold"><span style="text-decoration:underline"><span style="text-underline:single"><span style="font-style:normal"><font face="微软雅黑">大赛分享三:</font>RSL10蓝牙SoC之BMM150地磁传感器数据采集</span></span></span></span></span></span></span></span></span></u></b></a></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:"Times New Roman""><a href="https://bbs.eeworld.com.cn/thread-1168942-1-1.html"><b><u><span class="16" style="font-size:12.0000pt"><span style="background:#ffffff"><span style="font-family:微软雅黑"><span style="color:#0000ff"><span style="letter-spacing:0.0000pt"><span style="font-weight:bold"><span style="text-decoration:underline"><span style="text-underline:single"><span style="font-style:normal"><font face="微软雅黑">大赛分享四:</font>RSL10蓝牙SoC之BME680传感器数据采集</span></span></span></span></span></span></span></span></span></u></b></a></span></span></p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:"Times New Roman""><a href="https://bbs.eeworld.com.cn/thread-1168954-1-1.html"><b><u><span class="16" style="font-size:12.0000pt"><span style="background:#ffffff"><span style="font-family:微软雅黑"><span style="color:#0000ff"><span style="letter-spacing:0.0000pt"><span style="font-weight:bold"><span style="text-decoration:underline"><span style="text-underline:single"><span style="font-style:normal"><font face="微软雅黑">大赛分享五:</font>RSL10蓝牙SoC之使用J-Scope调试语音信号</span></span></span></span></span></span></span></span></span></u></b></a></span></span></p>
<p style="text-align:justify"> </p>
<p style="text-align:justify"><span style="font-size:10.5pt"><span style="font-family:"Times New Roman""><b><span style="font-size:16.0000pt"><span style="font-family:微软雅黑"><span style="font-weight:bold"><font face="微软雅黑">七、其他</font></span></span></span></b></span></span></p>
<p><span style="font-size:16px;"> 感谢论坛举办这次大赛,感谢安森美和安富利能够提供开发板和赛前培训。</span></p>
<p><span style="font-size:16px;"> 感谢各位!</span></p>
<p></p>
<p>楼主的人体行为识别系统数据处理算法总结的到位,识别系统设计过程值得借鉴</p>
<p> </p>
页:
[1]