HOME > Support >Manual >
QHY174M-GPS On-Line Technology Document
2018 年 10 月 24 日
This document is an on-line document on a cloud server. It is always updating without notifications.The author is Dr.Qiu

Drivers and software
1.System Driver
Note: This driver package includes the Native WDM driver. WDM driver is a monopolization driver. Please avoid this driver is working together with other image software. Otherwise two application will both request the frames and it will cause the unstable.

1.BroadCast Driver
QHYCCD BroadCast WDM driver. This driver is using to share the video streaming to multiple target. Unlike the Native WDM, this WDM driver will need the application software (like the easyTimeStamp) to active it and then send the video in easyTimeStamp software to anyother target software which support standard WDM driver.  This driver is not a monopolization driver. Multi-software can sharing the video steaming at the same time.


Demo Software 
1.EasyTimeStamp

please download the software from this link:



2.SharpCAP
This software is the default software for QHY5III series and QHY COLDMOS series camera to capture and recording the videos. You need download the lastest version from the SHARPCAP website. And replace the qhyccd.dll to the newest version (can be found in QHY174GPS-DEMO folder), Or use the version update software of QHYCCD to make sure all driver/software is the lastest one.

The current SharpCAP should support the QHY174 GPS function. It has a window to display the GPS time information. Please note the GPS data is also embeded in the top of the image head (some pixels on the from first image pixel data) . You can readout this information accroding this data structure in this document.


Basic Concept

CMOS Timing:  Normally speaking the CMOS works based on the CMOS input clock. So the exposure starting and ending time is sync with this clock.

CMOS Strobe and Trigger:  Some CMOS sensor has the strobe signal to indicate the starting and ending time of the shutter. It can be used for flash etc. But this signal maybe not precision to the real exposure starting and ending time.  The delay may exist. The Trigger is an input signal to CMOS sensor and the CMOS sensor will starting exposure after received this signal. It still not so precision and the delay may exist.

Global Shutter. Most Interline progressive CCD sensor is global shutter and all the pixel start and finish exposure at the same time. But most cmos sensor is rolling shutter. Rolling shutter is a line scan based exposure. Different line is exposure at different time. This is not very suitable for high precision time domain imaging. Some CMOS like the IMX174 used in QHY174GPS is the global shutter and the start/ending exposure time is the same for all pixels.

PPS signal. The PPS signal is come from the GPS module. It gives the precision time of one second begins. This time is well synced in all GPS satellite and it is about 50ns error (three delta error) with the UTC time? In QHY174 this signal is used to clear the local 0.1us(10MHz) counter to zero.

Local 0.1us Counter (LUC). In order to get the microsecond local clock. The QHY174GPS has a LUC. The LUC's clock is come from a 10MHz VCOX(voltage controlled oscillator crystal).  This counter is used to count the start and ending time of the shutter measure waveform.

Shutter Measure Waveform. This waveform is a signal in the QHY174GPS. It is defined by two register. One edge of this waveform is the exposure beginning time and another edge is ending time. The register need to be set to generate this waveform. The camera will use LUC to get the count of this waveform then get the precision start and ending exposure time which is sync with GPS PPS signal.

Calibration LED.  The camera has a built-in calibration LED. Which is located in one edge of the CMOS sensor. When the LED flash. The CMOS sensor may "see" this light. The Calibration LED can emit a light pulse. The width of the light pulse can be defined by a register. The position of the pulse can be defined by another register. The LED's control logic clock is synced with the CMOS input clock.  This pulse is used to calibration each exposure time's start and ending time. You can adjust start time of this pulse and check the image, for shutter starting time, When you increase the pulse position and found the LED pulse from invisible to visible. This position is just the starting position. When you increase the position and found the LED pulse from visible to invisible. This is the ending position.

Master/Slave Mode. The QHY174GPS works in two modes. Master mode is that the CMOS is free running and the camera will make the time stamp of each frame's starting and ending exposure time. The slave mode is that the Camera is triggered by the time. You need set a start time and the interval to each two frames. The camera will wait this time comes and begin to exposure continuous at this interval time.  In current FPGA code the slave mode does not support ROI.  The master mode support ROI.


JS: Julian second. In order to reduce the bit width of counter, this is a deducted Julian time. Defined by QHYCCD. The GPS time information in the image header is using JS to record.66



Use the software

A demo software is comes with the QHY174GPS camera. This software has some basic function.

Install QHY5III series system driver
Run Easy Timestamp Software.
Click "Connecer.t" Button if camera connected to computer it will find the camera and the series number.
Click "Master mode" Button. The camera will start working and the picture will be shown
You can set the exposure time and the gain of the camera
In the status bar you will see the GPS information of each frame. The GPS status is indicate the GPS working status. :

0: GPS is just powered up.
1: GPS begin to work but not received any time information
2: GPS get the time information but has not locked.  The PPS signal and the location information has not come. In this status the time is still not precision
3. GPS get locked. The PPS signal comes. The time is precision.

You may need to wait some time to get it locked.

The button of "onAir" is using QHYCCD BroadCast WDM video driver to send the video streaming out . You can use this function to do live video broadcast.

Note: The last version has added the continous frame save function.





Using BroadCast WDM Video driver to make live broadcast

Video Live BroadCast through Internet is an interesting thing. Now you can use QHYCCD's BroadCast WDM Video driver and EasyTimeStamp software to share the astronomy realtime video to the world.

1. Please install the BroadCast driver.
2. We will use AMCAP software and easyTimeStamp software to show how it works
3. Please open the amcap software for first. You will see two camera. One is "QHYCCD Camera (WDM)". This is the BroadCast driver.  And another is QHY Camera (Native WDM). This is the native WDM driver. If you have connect USB cable to camera and select the broadCast driver you may see grey screen. This is due to the video streaming has not been sent out from easyTimeStamp.  If you select the native WDM driver, you will see video immdiately. But this video is not sending by easyTimeStamp, just go through the native WDM driver directly.

4. Please select the BroadCast driver(QHYCCD Camera (WDM))




5. run EasyTimeStamp software. You will see the video appear on easyTimeStamp software. And click the "OnAir" Button. The video streaming will be send to AMCAP. 








Programming with QHYCCD API

Please refer the help document of the QHYCCD API to do the basic image operations. The following is the additional API to operate the GPS part.


Adjust the VCOX frequency.
The VCOX is 10MHz output but the frequency will drift with the temperature and time. In order to get accurate 10MHz frequency you can set it . For first you need to know the current frequency of it. You can read the clock count of each two PPS signal.  If it is 10MHz, the count will be 10,000,000. (Please note when the GPS is not locked, there is no PPS signal and the count will be 10,000,500, this is no use, please do not use this value to calibrate the VCOX).

Please do not adjust the frequency beyond the counter of 10,000,500.  Because the FPGA will regard the 10,000,500 is the condition that the PPS signal losing.

set_GPS_VCOX_Freq(unsigned short i);  The input range of i is 0-4095


Set the Calibration LED Enable
set_GPS_LEDCAL_Mode(unsigned char i);
i=0:disable LED light    1:enable LED light

Set LED pulse position for shutter starting exposure
set_GPS_POSA(unsigned char is_slave,unsigned long pos,unsigned char width);

is_slave:  0:master mode  1: slave mode. This value should be set depend on which mode camera is using.
pos: LED pulse light position
width: LED pulse light width
When you changed the exposure. You must set this position. The measurement circuit will use this position as the shutter starting time.


Set LED pulse position for shutter ending exposure
set_GPS_POSB(unsigned char is_slave,unsigned long pos,unsigned char width);

is_slave:  0:master mode  1: slave mode. This value should be set depend on which mode camera is using.
pos: LED pulse light position
width: LED pulse light width
When you changed the exposure. You must set this position. The measurement circuit will use this position as the shutter ending time.


Set Master/Slave Mode
set_GPS_MasterSlave(unsigned char i);
i=0: Master mode   1:Slave mode

When in slave mode, set the parameter.
set_GPS_SlaveMode_Parameter(unsigned long target_sec,unsigned int target_us,unsigned int deltaT_sec,unsigned int deltaT_us,unsigned int expTime)



The target_sec is the "JS" that QHYCCD defined. It is reference to a time.






Data Structure of the Image Head

The camera records the GPS information and insert into each frame's head. This function can be enabled by the API of
ret=SetQHYCCDParam(g_hCam,CAM_GPS,1);

and can be disabled by call the API:
ret=SetQHYCCDParam(g_hCam,CAM_GPS,0);



ImageHead Shift


Sequence Number is a hardware counter of the frames. It will start from zero and each frame it will add one. It will start from the cmos camera start working

0  Sequence Number MSB
1  Sequence Number
2  Sequence Number
3  Sequence Number LSB


4 temporary Sequence Number   (Normally no use)


5 Image Width  MSB
6 Image Width LSB

7 Image Height MSB
8 Image Height LSB

Latitude is the current latitude report by GPS. 
9    latitude MSB
10  latitude
11  latitude
12  latitude LSB

Latitude is the current longitude report by GPS.
13  longitude MSB
14  longitude
15  longitude
16  longitude LSB

17 Start_Flag

Shutter start time  (JS)
18 Start Second MSB
19 Start Second
20 Start Second
21 Start Second LSB

22 Start micro second MSB
23 Start micro second
24 Start micro second LSB

25 End flag

Shutter end time  (JS)
26 End Second MSB
27 End Second
28 End Second
29 End Second LSB

30 End micro second MSB
31 End micro second
32 End micro second LSB

33 now flag:  this can be used for the GPS statu indicator   bit[7..4] is the

The now time is the time that of the vertical sync of the CMOS sensor. It does not the precision time of shutter open or close
34 now second MSB
35 now second
36 now second
37 now second LSB

38 now micro second MSB
39 now micro second
40 now micro second LSB


The counter value of two PPS. it should be about 10,000,000. But since the temperature of the crystal. It is not exactly the 10,000,000. You can adjust the VCXO to let it close to it.  And when the PPS signal lost, it will become 10,000,500. When exceed this value, FPGA will generate a second to instead of the GPS PPS signal to avoid the second counter lost one second.
41 count of PPS MSB
42 count of PPS
43 count of PPS LSB




Reference codes:

    unsigned int seqNumber=0;
    unsigned int seqNumber_old=0;
    unsigned char tempNumber=0;
    unsigned short width=0;
    unsigned short height=0;
    unsigned int latitude=0;
    unsigned int longitude=0;

    unsigned char start_flag=0;
    unsigned int  start_sec=0;
    unsigned int  start_us=0;

    unsigned char end_flag=0;
    unsigned int  end_sec=0;
    unsigned int  end_us=0;



    unsigned char now_flag=0;
    unsigned int  now_sec=0;
    unsigned int  now_us=0;

    unsigned int max_clock=0;

            seqNumber=256*256*256*imageHead[0]+256*256*imageHead[1]+256*imageHead[2]+imageHead[3];
            tempNumber=imageHead[4];
            width=256*imageHead[5]+imageHead[6];
            height=256*imageHead[7]+imageHead[8];
            latitude= 256*256*256*imageHead[9]+256*256*imageHead[10]+256*imageHead[11]+imageHead[12];
            longitude=256*256*256*imageHead[13]+256*256*imageHead[14]+256*imageHead[15]+imageHead[16];

            start_flag=imageHead[17];
            start_sec=256*256*256*imageHead[18]+256*256*imageHead[19]+256*imageHead[20]+imageHead[21];
            start_us =256*256*imageHead[22]+256*imageHead[23]+imageHead[24];

            end_flag=imageHead[25];
            end_sec=256*256*256*imageHead[26]+256*256*imageHead[27]+256*imageHead[28]+imageHead[29];
            end_us =256*256*imageHead[30]+256*imageHead[31]+imageHead[32];

            now_flag=imageHead[33];
            now_sec=256*256*256*imageHead[34]+256*256*imageHead[35]+256*imageHead[36]+imageHead[37];
            now_us =256*256*imageHead[38]+256*imageHead[39]+imageHead[40];
            max_clock=256*256*imageHead[41]+256*imageHead[42]+imageHead[43];


        decodeJS(start_sec,timeZone,JD,h,m,s);    //this function can convert the JS to the JD time
and maybe you can use the following API(windows or Linux) to convert the JD time to local time. 
      JulianDateToDateTime(JD)





Void decodeJS(unsigned int JS,double timeZone,double &JD,unsigned char &h,unsigned char &m,unsigned char &s){

unsigned int k;


JD=JS/3600/24+2450000;

k=fmod(JS,3600*24);
h=k/3600;
k=fmod(k,3600);
m=k/60;
k=fmod(k,60);
s=k;

JD=double(JD)+ 0.5+ ((double)(h+timeZone)*3600+(double)m*60+(double)s)/3600/24;

}



How to use Slave Mode to sync all QHY174GPS camera to start exposure together
no matter where the camera located in, no matter how long distance between them. You can get the sync exposure start time for all QHY174GPS camera. This is a wonderful function and you can build you observe team very fastly and let them get sync capture, up to 1us precision, arround the whole earth.

To activr the slave mode is very simple. Just use two API:

//  set the parameters at first
set_GPS_SlaveMode_Parameter(target_sec,target_us,deltaT_sec,deltaT_us,expTime) ;
// switch camera to slave mode
set_GPS_MasterSlave(1);

the target_sec is the JS we defined in our system. The second you get from the image head is just this value.
expTime unit is us. Please note the deltaT must > expTime.

eg. Today is 2017.10.19 0:30 and we can get the JS=695925030
Now we want to let the camera start exposure at 0:40:000000 (10minutes later). The exposure time is 100ms per frame. The interval is 200ms per frame.

target_sec=695925030+600;
target_us=0;
deltaT_sec=0
deltaT_us=200*1000;
expTime=100*1000;

set_GPS_SlaveMode_Parameter(target_sec,target_us,deltaT_sec,deltaT_us,expTime) ;




If want to switch back from the slave mode to master mode ,just call:
set_GPS_MasterSlave(0);





Dimentions

Newsletter
         
Meet us
Contact us

  Room B809, Build A, XingYuan Science and Technology Park, 97#, ChangPing Road, ChangPing, Beijing, 100084

  +86(10)-53953350

  sales@qhyccd.com

    Question  |  Navigation  |  Forum