构建一个通过物体工作的手势传感器

  发布人:amy2025 时间:2025-08-26

几年前,我创建了一个支持手势交互的嵌入式项目,允许用户通过向左或向右滑动来翻页。然而,一直困扰我的一个问题是,传统的手势传感器依赖于光信号,这意味着它们必须保持畅通无阻。这需要切一个洞来暴露传感器,这看起来并不美观。所以,我想知道:有没有一种方法可以隐藏手势传感器,同时保持良好的性能?这是一个我一直无法解决的挑战。

现在,当我开始创建另一个有趣的互动项目时,我开始再次寻找符合我要求的手势传感器。我不仅找到了一个,而且它也更强大——提供更高的灵敏度、更高的精度,甚至可以精确地跟踪手部运动的3D空间。有了这个,我可以在我的项目中加入更多创造性的互动。

最后,我成功地集成了一个可以通过实体物体检测运动的手势传感器。它使用I2C协议,使其相对容易与微控制器接口。复杂的算法预先配置并存储在传感器的固件中,允许微控制器通过简单的I2C通信检测手势。

代码

/**

* @fn begin

* @brief initialization function

* @return bool,returns the initialization status

* @retval true Initialization succeeded

* @retval fasle Initialization failed

*/

bool begin(void);

/**

* @fn reset

* @brief reset the sensor

*/

void reset(void);

/**

* @fn sensorDataRecv

* @brief get the sensor data

*/

void sensorDataRecv(void);

/**

* @fn enableGestures

* @brief enable gesture recognition function

* @return Result of enabling gesture recognition

* @retval -1 setup fails

* @retval 0 setup succeeds

*/

int8_t enableGestures(void);

/**

* @fn disableGestures

* @brief turn off gesture recognition function

* @return Result of disabling gesture recognition

* @retval -1 setup fails

* @retval 0 setup succeeds

*/

int8_t disableGestures(void);

/**

* @fn disableAirWheel

* @brief turn off AirWheel function

* @return Result of disabling AirWheel function

* @retval -1 setup fails

* @retval 0 setup succeeds

*/

int8_t disableAirWheel(void);

/**

* @fn enableAirWheel

* @brief enable AirWheel function

* @return Result of enabling AirWheel function

* @retval -1 setup fails

* @retval 0 setup succeeds

*/

int8_t enableAirWheel(void);

/**

* @fn disableApproachDetection

* @brief turn off proximity detection function

* @return Result of disabling proximity detection function

* @retval -1 setup fails

* @retval 0 setup succeeds

*/

int8_t disableApproachDetection(void);

/**

* @fn enableApproachDetection

* @brief enable proximity detection function

* @return Result of enabling proximity detection function

* @retval -1 setup fails

* @retval 0 setup succeeds

*/

int8_t enableApproachDetection(void);

/**

* @fn disableTouchDetection

* @brief turn off touch detection function

* @return Result of disabling touch detection function

* @retval -1 setup fails

* @retval 0 setup succeeds

*/

int8_t disableTouchDetection(void);

/**

* @fn enableTouchDetection

* @brief enable touch detection function

* @return Result of enabling touch detection function

* @retval -1 setup fails

* @retval 0 setup succeeds

*/

int8_t enableTouchDetection(void);

/**

* @fn getPositionX

* @brief get the X-axis position

* @return X-axis position

*/

uint16_t getPositionX(void);

/**

* @fn getPositionY

* @brief get the Y-axis position

* @return Y-axis position

*/

uint16_t getPositionY(void);

/**

* @fn getPositionZ

* @brief get the Z-axis position

* @return Z-axis position

*/

uint16_t getPositionZ(void);

/**

* @fn getTouchInfo

* @brief get touch information

* @return touch information

* @retval eDoubleTapCenter Double Tap Center electrode

* @retval eDoubleTapRight Double Tap Right electrode

* @retval eDoubleTapUp Double Tap Up electrode

* @retval eDoubleTapLeft Double Tap Left electrode

* @retval eDoubleTapDown Double Tap Down electrode

* @retval eTapCenter Tap Center electrode

* @retval eTapRight Tap Right electrode

* @retval eTapUp Tap Up electrode

* @retval eTapLeft Tap Left electrode

* @retval eTapDown Tap Down electrode

* @retval eTouchCenter Touch Center electrode

* @retval eTouchRight Touch Right electrode

* @retval eTouchUp Touch Up electrode

* @retval eTouchLeft Touch Left electrode

* @retval eTouchDown Touch Down electrode

*/

uint16_t getTouchInfo(void);

/**

* @fn getGestureInfo

* @brief get gesture information

* @return gesture information

* @retval eFilckR Flick Left to Right

* @retval eFilckL Flick Right to Left

* @retval eFilckU Flick Down to Up

* @retval eFilckD Flick Up to Down

* @retval eCircleClockwise Circle clockwise (only active if AirWheel disabled)

* @retval eCircleCounterclockwise Circle counterclockwise (only active if AirWheel disabled)

*/

uint8_t getGestureInfo(void);

/**

* @fn havePositionInfo

* @brief monitor position information

* @return Results of monitoring position information

* @retval true position information exists

* @retval false There is no position information

*/

bool havePositionInfo(void);

关键词: 传感器 微控制器 光信号

加入微信
获取电子行业最新资讯
搜索微信公众号:EEPW

或用微信扫描左侧二维码

相关电路