This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Reading deviation on TDC1000.

Other Parts Discussed in Thread: TDC1000, TDC7200, TDC7200EVM

My purpose to measure a water flow rate.

I have my own board with TDC1000 and TDC7200. Scope indicates nice clean signals – I send a predefined number of TX pulses and get an echo. The problem that I have a big deviation in Tu and Td times.

For example Tu and Td in microseconds

->

63.7429

63.6263

->

63.6458

63.6254

->

63.6427

63.6282

->

63.6364

63.6190

->

63.6406

63.6210


And then I calculate a flow rate:

double sos = 1496.7;      //im m/s @25*C
double length = 0.0907;   //in m
double diameter = 0.0375; //in m

double tof1, tof2, delta_tof;

if (tof1 > tof2)  //in us
    delta_tof = (tof1 - tof2) / 1000000;  //in sec
else
    delta_tof = (tof2 - tof1) / 1000000;  //in sec

double pipe_section = ((double)3.14 * diameter * diameter) / 4;  //im m^2
double velosity = (delta_tof * sos * sos) / (2 * length);  //im m/s
double flow = pipe_section * velosity * k;  //m3/s

flow *= 3600; //m3/h

textBoxVelocity.Text = velosity.ToString();
textBoxFlow.Text = flow.ToString();

 

Although a reference water meter installed on the pipe indicates a stable flow I get unstable results.

Also results differ from the meter reading.

  • And with no flow I get different times Tu and Td:

    ->

    63.2658

    63.2736

    ->

    63.2667

    63.2745

    ->

    63.2670

    63.2741

    ->

    63.2669

    63.2751

    ->

    63.2671

    63.2746

  • Our flow expert will come back to you on this as soon as possible. Thanks, Vishy

  • Thank you Vishy.

    I'd like to add some more info.

    This is how I set a measurement.

    double tof_up, tof_down;
    
    //clear error flags
     TDC1000_SPIByteWriteReg(TDC1000_1, 7, 3);
     //clear interrupt status flags 
     TDC7200_SPIByteWriteReg(TDC7200_1, 2, 31);
    
    //select TX1/RX2 pair – upstream
    TDC1000_SPIByteWriteReg(TDC1000_1,2,0);
    
    //send a start measurement command, measurement mode 2
    TDC7200_SPIByteWriteReg(TDC7200_1, 0, 131);
    
    //wait for INTB goes low – data is ready
    while( stopwatch1_int) ;
    
    tof1 = GetTof();
    
    //clear error flags
     TDC1000_SPIByteWriteReg(TDC1000_1, 7, 3);
     //clear interrupt status flags 
     TDC7200_SPIByteWriteReg(TDC7200_1, 2, 31);
    
    //select TX2/RX1 pair – downstream
    TDC1000_SPIByteWriteReg(TDC1000_1,2,4);
    
    //send a start measurement command, measurement mode 2
    TDC7200_SPIByteWriteReg(TDC7200_1, 0, 131);
    
    //wait for INTB goes low – data is ready
    while( stopwatch1_int) ;
    tof2 = GetTof();

    and I don’t get steady results

    Upstream (in picosec)

    66205420.000000

    66162456.000000

    66179536.000000

    66156752.000000

    66180220.000000

    66185644.000000

    66202948.000000

     

    Downstream (in picosec)

    66239200.000000

    66200104.000000

    66203424.000000

    66263884.000000

    66259276.000000

    66251032.000000

    66261396.000000

    66272248.000000

    Also the above calculations (in my first post) resulting in a wrong flow rate.

     

  • Most likely you do not have an optimal setting of PGA_GAIN, ECHO_QUAL_THLD, number of pulses. If you are testing the device in flow condition, program the LNA and PGA to active mode. Initially start with 12dB gain in PGA and lower the ECHO_QUAL_THLD to -35 mV. Set the number of pulses to the lowest value (3 pulses) that gives you a good Echo envelop. Set the AUTOZERO_PERIOD to 16 uS. Set the number of STOP pulses "NUM_RX" to 5 in TDC1000 and TDC7200. start acquisition of delta-TOF and use STOP pulses that have most stable positive edge on the scope display ( say STOP 3) for measurement of TOF. You may want to use the average of START to STOP 3,4, and five for measurement of TOF to lower the noise effect . To lower the standard deviation, implement a running ravage filter to lower (divide) the standard divination by the squarer root of N (try 20 initially). You my experiment with the parameters above to achieve an optimal performance. Finally, make sure that the length of the transducer wires connected to the input of your board is as short as possible. If you are using an ultrasonic flowmeter as a reference to check the performance of TDC1000, please notice that in the reference flow meter, various post processing of the raw data (averaging, offset calibration, temp compensation) is implemented and you need to enhance your algorithm accordingly.
  • Hi Bahram Mirshab,

    Thank you for your valuable tips. As a matter of fact I came to the same conclusion, PGA gain 12 db, several stops, take the middle one. I'll try more advanced technics you suggest. Another question I'd like to ask. On PGAOUT pin I see a nice echo signal 1V P-P riding on VCOM voltage about VCC/2. But on COMPIN pin, after the capacitor 50pF I see significant voltage drop. May be I should omit the capacitor?

    Another strange phenomenon I have. After I wrote to any register on TDC1000 first read, only the first one I get a wrong value. Any subsequent read is ok. For now I did a workaround - when I read from a register first read is a dummy one then I get a value.

  • Hi Evgeny,

    I will ask our software expert to reply to you regarding the condition you are  observing on the first SPI read cycle.

     

    Regards,

     

    B. Mirshab

  • Evgeny,
    Here are few ways to debug this issue:
    a) Please take a look at the TDC1000_TDC7200EVM firmware source code available in the install folder location C:\Program Files (x86)\Texas Instruments\TDC1000_7200EVM\Firmware. In the source code zip "TDC1000_7200EVM_Firmware_Source-v1.43.zip", please take a look at the sample code in subfolder "demo1_tdc1000_basic_rw\main.c". This shows a very simple example of writing a value to TDC1000 register and reading back to compare if the write was successful. SPI functions are in the sub folder "code\library" file TI_MSP430_spi_USCIB0_5xx.c
    b) I just tested on an EVM the above function to check read after a write matches the value written.
    c) Please make sure in your SPI function TDC1000 read/write bit is selected appropriately when you perform read/write
    d) EVM uses 12MHz SPI clock. Please make sure your SPI clock is not beyond 20MHz.
    e) Please make sure at the end of every read/write, chip select is deactivated (brought to high). In your code you seem to have an extra parameter (TDC1000_1 or TDC7200_1) that indicates the device to access.
    Thanks,
    Vishy
  • Evegany

    You should not remove the cap, that is a part of the filter. Most likely, the probe that You are using is loading the signal, you need to use very high impedance active probe to measure the signal at COMPin point.