# PCIR-Examples **Repository Path**: pointcloudai/PCIR-Examples ## Basic Information - **Project Name**: PCIR-Examples - **Description**: PCIR-xxCx series demo - **Primary Language**: C - **License**: MIT - **Default Branch**: master - **Homepage**: http://www.pointcloud.ai - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 2 - **Created**: 2020-03-02 - **Last Updated**: 2024-10-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # PCIR-Examples ## 产品描述 该工程是点云智能给人脸识别机器提供温度检测模组(PCIR-xxCx 系列产品的使用说明)。例程包括python例程,java例程,规格书,串口指令文档,及硬件设计文档。该产品系列支持Melexis MLX90640,MLX90641,MLX90621. 1. [Python 例程](https://gitee.com/pointcloudai/PCIR-Examples/tree/master/visual_monitor) 命令行参数:python ir_demo.py -p serialPort example: `python3 ir_demo.py -p /dev/cu.usbserial-1410`(/dev/cu.usbserial-1410 这个端口名称就是使用者实际的使用名称 例如:COMx on windows or /dev/cu.xxxxx on OSX) 2. [Android 例程](https://gitee.com/pointcloudai/PCIR-Examples/tree/master/android_visual_monitor) ## 产品详情 **1. 产品外观** ![MLX90640_1](https://images.gitee.com/uploads/images/2020/0324/182357_9950db7a_5484807.png "90640_board.png") ![MLX90640_2](https://images.gitee.com/uploads/images/2020/0324/181221_ca126112_5484807.png "90640_board.png") **2. 电脑端开发套件(购买咨询:support@pointcloud.ai)** 1. 安装电脑端驱动 ([串口驱动](http://www.wch.cn/downloads/category/30.html)). 2. 连接Type-c线到电脑端和设备端. 3. 安装python3 环境和 pySerial包(use pip tool). 3. 在PC端运行Visual monitor 该开发套件支持Windows 10, mac OS ,Unbuntu 系统。 ![开发套件](https://images.gitee.com/uploads/images/2020/0324/182443_5826c56b_5484807.png "90640_devkit.png") **2. 运行Visual Monitor 例程** 这个例程图形化的方式在电脑端显示拍摄物体的温度数据。 ## Python 源代码 [visual monitor](https://gitee.com/pointcloudai/PCIR-Examples/tree/master/visual_monitor) ![MLX90640 Visual Monitor例程](https://images.gitee.com/uploads/images/2020/0317/230625_d4215c52_5484807.png "visual_monitor.png") ## 文档列表 1. [串口命令行列表](https://gitee.com/pointcloudai/PCIR-Examples/blob/master/Doc/200313PCIR-xxCx%20series%E6%8C%87%E4%BB%A4%E6%89%8B%E5%86%8C%20v1.4.pdf) 2. [产品规格书](https://gitee.com/pointcloudai/PCIR-Examples/blob/master/Doc/%E4%BA%A7%E5%93%81%E8%A7%84%E6%A0%BC%E4%B9%A6.pdf) 3. [硬件接口使用](https://gitee.com/pointcloudai/PCIR-Examples/blob/master/Doc/PCIR-40C%E7%A1%AC%E4%BB%B6%E4%BD%BF%E7%94%A8%E6%8C%87%E5%8D%97.pdf) 4. [版型尺寸](https://gitee.com/pointcloudai/PCIR-Examples/tree/master/Doc) ## 接口调用 1. 接口: UART 2. 串口速率: **230400** [固件版本 ver1.0 速率:460800] ## 返回数据帧格式 ### Evaluate 模式 该模式提供给客户用于快速评估产品的性能,指标是否满足产品的需求。产品模组只要插上电就可以连续往上位机发送数据。数据格式使用ASCII码显示温度数据。 1. 插上电后输出的分辨率每个模组不一样 PCIR-40CA/PCIR-40CB 为 32x24=768个数据,PCIR-41CA/PCIR-41CB 为 16x12=198个数据.PCIR-21CA/PCIR-21CB 为 16*4=64个数据. 3. 数据格式为小数点后两位的ascii数值 4. 例如: 一帧数据 = 32x24(768 个数据,逗号隔开 \r\n为一帧) ​ \r\n36.01,35.02,34.03....................37.01,36.21,36.01,35.02,34.03\r\n ### Operate 模式 该模式提供给客户集成到他们的脸部识别产品上: 数据格式: 'DAT' + Data Bytes Length[2 bytes] + Envirment Temp[4 Bytes float type] + data[pixelx4bytes float] + '\r\n' 例如mlx90640 32x24 点阵: 3Bytes + 2Byte + 4Bytes + 32X24X4 + 2Bytes = 3083Bytes example mlx90641 16x12 pixel: 3Bytes + 2Byte + 4Bytes + 16X12X4 + 2Bytes = 779Bytes ## 串口命令列表: **串口命令典型使用方法:** 1.设置Operate模式: 'CMDE\x00\x19' ,即16进制: 43 4D 44 4D 00 19 2.设置2Fps: 'CMDF\x02\x1C', 即16进制:43 4D 44 46 02 1C 3.打开端口接收数据: 'CMDC\x01\x18',即16进制:43 4D 44 43 01 18 4.解析数据帧 'DAT',读取2个字节 解析数据长度, 计算帧长度判断真尾是否为'\r\n'. 命令的使用说明详见[设计文档](https://gitee.com/pointcloudai/PCIR-Examples/tree/master/Doc)中的命令手册。 1. 命令行长度 6BYTE = 'CMD'+Type[1Byte]+Value[1Byte]+CRC[1Byte].(除了设置common offset 命令长度 9 BYTES) Open command: Type = C Value = [1-open | 0-close | 2- 1 Frame if Mode command ==0] Mode command: Type = M Value = [0-receive frame manual | 1-receiver frame continuous] Object command: Type = O value = [1-body measure| 0-object measure] Freq command: Type = F Value = [0-1/2fps | 1-1fps | 2-2fps | 3-3fps | 4-4fps] Version command: Type = V Value = [0] Evaluate command: Type = E Value = [ 0-Operate mode | 1- Evaluate mode | 2- get Evaluate mode status] (当该命令设置模式状态时, 该状态会写入ROM中,即使掉电也会保存状态) Offset get command: Type = T Value = [0-get common offset] Offset set command: this command have 9BYTE= 'CMDE'+Value[4Byte float format]+CRC[1Byte]. (当设置offset 命令时,该值会写入ROM中,即使掉电也会保存) 2. 命令返回列表: 'RETCMD + Type[1Byte] + Value[multiple Byte] + '\r\n' Open result: 'RET' + Open Command[6 bytes] + '\r\n' Mode result: 'RET' + Mode Command[6 bytes] + '\r\n' Object result: 'RET' + Object Command[6 bytes] + '\r\n' Freq result: 'RET' + Freq Command[6 bytes] + '\r\n' Version result: 'RETCMDV' + firmware version[4 bytes] + ',' + calibrate version[4 bytes] + '\r\n' Evaluate command: 'RETCMDE' + type[1 bytes] + '\r\n' Offset command: 'RETCMDT' + common offset[6 bytes] + '\r\n' 3. 错误指令返回列表: 'RETERR' + command[6 bytes] + '\r\n' ## 校准 the difference distance need calibration for accurate body temperature measurement. we offer calibration file to adjust actual temperature value suitable for real environment. **for use calibration tools you maybe install** [esp32-idf framework](https://docs.espressif.com/projects/esp-idf/en/stable/get-started/) 1. src [src code](https://gitee.com/pointcloudai/PCIR-Examples/tree/master/calibration) 2. calibration file: data/cali.dat there have two line. following is file structure of cali.dat ( **file name Can not be change** ) 1 calibration version 2.0 common offset of temperature 3. compile to .bin file that firmware can recognition cd [caliration directory] ./spiffsgen.py 20480 ./data/ ./cali_001.bin 4. upload to device **/dev/cu.usbserial-1420 is changed to your real usb serial port** ./esptool.py -p /dev/cu.usbserial-1420 -b 230400 --before default_reset --after hard_reset --chip esp32 write_flash --flash_mode dio --flash_size detect --flash_freq 40m 0x110000 ./cali_001.bin