HumanPose is a host-side library for DFRobot’s on-device Human Pose modules (e.g. SEN0670). Inference runs on the module; this library talks over I2C / UART from the host (Arduino, etc.) to configure the sensor and pull detection results.
This repository provides an Arduino library for HumanPose modules built on DFRobot’s in-house pipeline. Detection runs on the module itself (lower latency, simpler deployment than cloud-only flows).
Keypoint layouts match widely used conventions so you can plug into common tooling:
- Body pose (17 keypoints) — Topology matches the common COCO 17 person keypoints (nose, eyes, ears, shoulders, elbows, wrists, hips, knees, ankles). Points are 2D coordinates in the image frame, aligned with that ordering for labeling and visualization.
- Hand (21 keypoints) — Naming follows the MediaPipe Hands 21-landmark skeleton (wrist, thumb chain, and index–pinky MCP / PIP / DIP / Tip), which is convenient for drawing hand skeletons and gesture logic.
Features include human pose, hand detection, fixed gesture classes, and learned-class similarity; outputs may include bounding boxes, keypoints, confidence / similarity scores, and more. On-module behavior and updates follow the product documentation; this library is a binary-protocol client and does not require ArduinoJson.
- To use this library, first download the library file, paste it into the
\Arduino\librariesdirectory, then open the example folder and run the examples in it. - This library is binary-protocol only and does not require ArduinoJson.
The Arduino driver allocates three internal buffers:
RX_MAX_SIZE: receive bufferTX_MAX_SIZE: send buffer (default unified to32on all platforms)AT_PAYLOAD_MAX_SIZE: binary AT payload assembly buffer
- Small-memory profile (
DFR_HUMANPOSE_SMALL_RAM_PROFILE=1): static RAM ~=(RX_MAX_SIZE + 1) + (TX_MAX_SIZE + 1) + AT_PAYLOAD_MAX_SIZE - Large-memory profile:
heap RAM at
begin()~=RX_MAX_SIZE + TX_MAX_SIZE + AT_PAYLOAD_MAX_SIZE
Default totals (buffers only, excluding result objects and String storage):
| Platform profile | Defaults (RX,TX,AT_PAYLOAD) |
Approx. bytes |
|---|---|---|
| UNO/Nano/Mini tiny profile | 192, 32, 192 |
~416 (+2 sentinel bytes) |
| Other small-memory profile | 256, 32, 192 |
~480 (+2 sentinel bytes) |
| ESP8266 | 2048, 32, 2048 |
~4128 |
| ESP32 | 4096, 32, 4096 |
~8224 |
| Other large-memory platforms | 4096, 32, 4096 |
~8224 |
Define macros before including the header:
#define RX_MAX_SIZE 1024
#define TX_MAX_SIZE 256
#include "DFRobot_HumanPose.h" /**
* @fn begin
* @brief Initialize the sensor
* @return True if initialization is successful, otherwise false
*/
bool begin();
/**
* @fn getResult
* @brief Get detection results from the sensor
* @return Status code of type `eCmdCode_t`. Returns `eOK` if successful, otherwise returns an error code.
* @note After calling this function, the detection results will be stored in the internal result array.
* You can access the results using availableResult() and popResult() methods.
*/
eCmdCode_t getResult();
/**
* @fn setConfidence
* @brief Set the detection confidence threshold
*
* Sets the minimum confidence score required for a detection to be considered valid.
* Higher values result in fewer but more reliable detections. Lower values allow more
* detections but may include false positives.
*
* @param confidence Threshold score value (0-100). Default is typically 60.
* @return Status code of type `eCmdCode_t`. Returns `eOK` if successful, otherwise returns an error code.
*/
eCmdCode_t setConfidence(uint8_t confidence);
/**
* @fn setIOU
* @brief Set the Intersection over Union (IOU) threshold
*
* Sets the IOU threshold used for non-maximum suppression during object detection.
* This parameter helps filter out overlapping detections.
*
* @param iou IOU threshold value (0-100). Default is typically 45.
* @return Status code of type `eCmdCode_t`. Returns `eOK` if successful, otherwise returns an error code.
*/
eCmdCode_t setIOU(uint8_t iou);
/**
* @fn setModelType
* @brief Set the detection model
*
* Selects which detection model to use.
*
* @param model Model type of type `eModel_t`, with possible values including:
* - `eHand` - Hand detection model
* - `ePose` - Human pose detection model
* - `eGesture` - Fixed gesture classification model (MODEL 4)
* @return Status code of type `eCmdCode_t`. Returns `eOK` if successful, otherwise returns an error code.
*/
eCmdCode_t setModelType(eModel_t model);
/**
* @fn setLearnSimilarity
* @brief Set the similarity threshold for learned targets
*
* Sets the similarity threshold used when matching detected objects against learned targets.
* This parameter is used for gesture recognition and learned pose matching.
*
* @param Similarity Similarity threshold value (0-100). Default is typically 60.
* @return Status code of type `eCmdCode_t`. Returns `eOK` if successful, otherwise returns an error code.
*/
eCmdCode_t setLearnSimilarity(uint8_t Similarity);
/**
* @fn getConfidence
* @brief Get the current detection confidence threshold
*
* Retrieves the currently configured detection confidence threshold.
*
* @param confidence Pointer to store the confidence threshold value (0-100)
* @return Status code of type `eCmdCode_t`. Returns `eOK` if successful, otherwise returns an error code.
*/
eCmdCode_t getConfidence(uint8_t* confidence);
/**
* @fn getIOU
* @brief Get the current IOU threshold
*
* Retrieves the currently configured IOU threshold value.
*
* @param iou Pointer to store the IOU threshold value (0-100)
* @return Status code of type `eCmdCode_t`. Returns `eOK` if successful, otherwise returns an error code.
*/
eCmdCode_t getIOU(uint8_t* iou);
/**
* @fn getLearnSimilarity
* @brief Get the current similarity threshold
*
* Retrieves the currently configured similarity threshold value.
*
* @param Similarity Pointer to store the similarity threshold value (0-100)
* @return Status code of type `eCmdCode_t`. Returns `eOK` if successful, otherwise returns an error code.
*/
eCmdCode_t getLearnSimilarity(uint8_t* Similarity);
/**
* @fn setKeypointOutput
* @brief Configure whether INVOKE output includes keypoints.
* @param enable 1: include keypoints, 0: boxes only
* @return Status code of type `eCmdCode_t`.
*/
eCmdCode_t setKeypointOutput(bool enable);
/**
* @fn getKeypointOutput
* @brief Get current keypoint output mode.
* @param enable Pointer to store 1(include keypoints)/0(boxes only)
* @return Status code of type `eCmdCode_t`.
*/
eCmdCode_t getKeypointOutput(uint8_t *enable);
/**
* @fn getLearnList
* @brief Get the list of learned targets for the specified model
*
* Retrieves a list of all learned target names for the specified detection model.
* This function is useful for gesture recognition and pose learning applications.
*
* @param model Model type of type `eModel_t`:
* - `eHand` - Get list of learned hand gestures
* - `ePose` - Get list of learned poses
* - `eGesture` - Not applicable (returns empty list;)
* @return Vector of strings containing the names of learned targets. Returns empty vector on error.
*/
LearnList getLearnList(eModel_t model);
/**
* @fn availableResult
* @brief Check if detection results are available
* @return True if detection results are available, otherwise false
*/
bool availableResult();
/**
* @fn popResult
* @brief Get and pop the next detection result
* @return Pointer to Result object. Returns NULL if no results are available.
* @note Depending on current model, cast as PoseResult / HandResult / Result (`eGesture` uses Result).
* On low-memory boards (`DFR_HUMANPOSE_LOW_MEMORY=1`), box-only output is used and popResult() returns Result base objects.
* After use, the result will be marked as used.
*/
Result *popResult();
/**
* @fn setBaud
* @brief Set the UART baud rate
*
* Configures the UART communication baud rate. Users can choose the appropriate
* baud rate based on their needs to ensure stable and effective communication
* with the device.
*
* @param baud Baud rate configuration of type `eBaudConfig_t`, with possible values including:
* - `eBaud_9600` - 9600 baud (default UART link)
* - `eBaud_14400` - 14400 baud
* - `eBaud_19200` - 19200 baud
* - `eBaud_38400` - 38400 baud
* - `eBaud_57600` - 57600 baud
* - `eBaud_115200`- 115200 baud
* - `eBaud_230400`- 230400 baud
* - `eBaud_460800`- 460800 baud
* - `eBaud_921600`- 921600 baud (high speed)
* @return True if the baud rate is set successfully, otherwise false
*/
bool setBaud(eBaudConfig_t baud);
// Result base class contains the following public members:
uint8_t id; // Detected target ID
uint16_t xLeft; // Bounding box top-left X coordinate
uint16_t yTop; // Bounding box top-left Y coordinate
uint16_t width; // Bounding box width
uint16_t height; // Bounding box height
/**
* @brief Score of the result (0-100).
*
* Meaning depends on `id`:
* - if `id == 0`: `score` is the detection confidence (probability/quality of detection).
* - if `id != 0`: `score` is the similarity score (match degree to a learned class/gesture/pose).
*/
uint8_t score; // score (0-100)
String name; // Detected target name
bool used; // Used flag
// PoseResult class (human pose detection result) additionally contains the following keypoints:
PointU16 nose; // Nose
PointU16 leye; // Left eye
PointU16 reye; // Right eye
PointU16 lear; // Left ear
PointU16 rear; // Right ear
PointU16 lshoulder; // Left shoulder
PointU16 rshoulder; // Right shoulder
PointU16 lelbow; // Left elbow
PointU16 relbow; // Right elbow
PointU16 lwrist; // Left wrist
PointU16 rwrist; // Right wrist
PointU16 lhip; // Left hip
PointU16 rhip; // Right hip
PointU16 lknee; // Left knee
PointU16 rknee; // Right knee
PointU16 lankle; // Left ankle
PointU16 rankle; // Right ankle
// HandResult class (hand detection result) additionally contains the following keypoints:
PointU16 wrist; // Wrist
PointU16 thumbCmc; // Thumb CMC
PointU16 thumbMcp; // Thumb MCP
PointU16 thumbIp; // Thumb IP
PointU16 thumbTip; // Thumb tip
PointU16 indexFingerMcp; // Index finger MCP
PointU16 indexFingerPip; // Index finger PIP
PointU16 indexFingerDip; // Index finger DIP
PointU16 indexFingerTip; // Index finger tip
PointU16 middleFingerMcp; // Middle finger MCP
PointU16 middleFingerPip; // Middle finger PIP
PointU16 middleFingerDip; // Middle finger DIP
PointU16 middleFingerTip; // Middle finger tip
PointU16 ringFingerMcp; // Ring finger MCP
PointU16 ringFingerPip; // Ring finger PIP
PointU16 ringFingerDip; // Ring finger DIP
PointU16 ringFingerTip; // Ring finger tip
PointU16 pinkyFingerMcp; // Pinky finger MCP
PointU16 pinkyFingerPip; // Pinky finger PIP
PointU16 pinkyFingerDip; // Pinky finger DIP
PointU16 pinkyFingerTip; // Pinky finger tip| MCU | Work Well | Work Wrong | Untested | Remarks |
|---|---|---|---|---|
| Arduino Uno | √ | |||
| Arduino Leonardo | √ | |||
| Arduino MEGA2560 | √ | |||
| FireBeetle-ESP32 | √ | |||
| ESP8266 | √ | |||
| FireBeetle-M0 | √ | |||
| Micro:bit | √ | |||
| Raspberry Pi | √ |
- Date 2026-04-13
- Version V1.0.0
Written by thdyyl(yuanlong.yu@dfrobot.com), 2026-04-13 (Welcome to our website)