HOME > Support >Developer >
User Manual of Humidity Pressure Sensor Function
2020 年 03 月 15 日
see the cloud document here http://note.youdao.com/groupshare/?token=82CF4F23F87E44E2BC35D6167A8F3A55&gid=7195236
Some QHYCCD Camera has humidity sensor , pressure sensor in the cmos/ccd chamber to return the current humidity value and pressure value. This document will introduce the APIs for these function.
How to know if supported
Before you call the temperature API. You need to use the IsQHYCCDControlAvailable API to check if the camera supports it. If QHYCCD_SUCCESS returned, it should support such a function. otherwise it does not support this function
//check if camera support to read the humidity sensor
ret = IsQHYCCDControlAvailable(h,CONTROL_HUMIDITY);
//check if camera support to read the pressure sensor
ret = IsQHYCCDControlAvailable(h,CONTROL_PRESSURE);
Get the value
There is two method to get the value .
(1)By using the GetQHYCCDParam API.
Please note this API return the double value. But if the camera has no sensor installed, it will return 0.0
Sample Codes
double humidity;
humidity=GetQHYCCDParam(h,CONTROL_HUMIDITY); //humidity range is 0.0 to 100.0 , it is 0.0% to 100.0%
double pressure;
pressure=GetQHYCCDParam(h,CONTROL_PRESSURE); //pressure range is 0.0 to 2000.0, it is 0.0mbar to 2000.0mbar
(2)By using the standalone APIs
uint32_t STDCALL GetQHYCCDPressure(qhyccd_handle *handle, double *pressure);
uint32_t STDCALL GetQHYCCDHumidity(qhyccd_handle *handle, double *hd);
Please note the API return value is QHYCCD_SUCCESS or QHYCCD_ERROR. If it is QHYCCD_ERROR, it means the sensor is not detected by camera hardware. Although a camera supports these sensor, but some early version of the camera may have no the sensor installed. So it will return QHYCCD_ERROR. And because the camera will detect if there is the sensor after InitQHYCCD() API. So if you want to use the return value to detect if there is the sensor, need to call it after InitQHYCCD(). Otherwise it will always return QHYCCD_ERROR. If you do not care if there is the sensor installed. You can just ignore the returned value. When in this case, you will get value of 0.0 for pressure or humidity.
Sample Codes
double humidity;
uint32_t ret;
ret=GetQHYCCDHumidity(h,&humidity); //humidity range is 0.0 to 100.0 , it is 0.0% to 100.0%
double pressure;
ret=GetQHYCCDPressure(h,&pressure); //pressure range is 0.0 to 2000.0, it is 0.0mbar to 2000.0mbar
You can call those APIs serval seconds periodically. Since the humidity and pressure is a slow changed value. So it is no necessary to call it too fast to reduce the communication between host computer and camera. for example,each 2-5 seconds call once it good.