CTMU time domain reflectometer

Status
Not open for further replies.

Thread Starter

teddydogowners

Joined Jul 5, 2016
6
Hi!

I am in the process of using a PIC24FJ64GA106 to design a time domain reflectometer in Proteus, using MPLAB X IDE and C16. However, I am having problems with the current calibaration and capactiance calibration. I have referred all app notes and the datasheet, but I am still getting the value of CTMUIsrc as 0 and that of CTMUCap as NaN. Could someone take a look at the code and see if I'm doing something wrong?

Attached is the code and the Proteus schematic.

Thanks in advance!

(BTW, there might be some discrepancies in the comments in the code, I haven't been able to clear them out yet. Sorry about that.)
 

Attachments

Sensacell

Joined Jun 19, 2012
3,442
Huh?

Looking at the schematic, I don't understand how this could become a TDR?
I couldn't begin to help you with this code unless you explain what it's supposed to do in the first place?
 

Thread Starter

teddydogowners

Joined Jul 5, 2016
6
Ah sorry, the circuit isn't complete yet, I'm testing it bit by bit. The PIC generates a pulse, pulse goes through a transistor to create a fast falling edge, edge goes to transmission line, the reflection is fed to a comparator which produces a pulse whose length is equal to the distance between the start of the transmission line and the reflection. I have to find the length of this pulse. For this I use the CTMU. The rising edge of the pulse is EDGE1 and the falling edge is EDGE2. I'm using the TDR as a liquid level sensor. I use this page as a reference.

http://www.edn.com/design/sensors/4...r-low-cost-liquid-level-measurement--Part-III

Basically I just need the CTMU calibrated properly, and I'm having trouble with that.

Sorry about the confusion, and thanks for the quick reply.
 

Sensacell

Joined Jun 19, 2012
3,442
Have you done the math on how fast the reflections will come back?

Unless your cables are REALLY long, your concept is unlikely to work.

The key to a TDR is to have ULTRA FAST edges driving the cable, otherwise the pulse comes bouncing back while the stimulus is still changing state, all you get is an indistinguishable mess. You need clean pulses to detect reliably.

In your average coax cable, a pulse will travel about 1 foot per nanosecond.
It's hard to design a transistor switch to transition in less than 20 nS, that's already 10 feet of cable.
 
Last edited:

Thread Starter

teddydogowners

Joined Jul 5, 2016
6
Have you done the math on how fast the reflections will come back?

Unless your cables are REALLY long, your concept is unlikely to work.

The key to a TDR is to have ULTRA FAST edges driving the cable, otherwise the pulse comes bouncing back while the stimulus is still changing state, all you get is an indistinguishable mess. You need clean pulses to detect reliably.

In your average coax cable, a pulse will travel about 1 foot per nanosecond.
It's hard to design a transistor switch to transition in less than 20 nS, that's already 10 feet of cable.
I've done a simulation of this already, using a voltage pulse instead of the PIC. The pulse had a rise time of 1ns. This pulse went to the transistor and the transistor created a fast falling edge. This edge is the pulse which is sent down the transmission line. I plotted graphs of the signal, and it worked fine even for 6 foot lengths of air. I also tested it by generating a pulse from the PIC itself, and that also gave decent results.

At the moment all I need is for the CTMU to measure stuff. I realized this might be because Proteus can't show float values. When I open the PIC variable window during simulation it always shows the values of all the variables as 0, except for the loop counters i and j. I tries defining a variable t=1/8000000 and it showed as zero. Then I changed it to t=1/8 and it still showed zero. The code might be working but I have no idea.
 

Thread Starter

teddydogowners

Joined Jul 5, 2016
6
It would have been wrong if it showed anything other than 0.

Take a class in programming 101.
I'm sorry, but how is that wrong? Isn't a double or float datatype supposed to store fractional data? I'm programming the PIC with C. I've worked with C for close to three years now, and until now, every time I type double t=1/8, it has resulted in 0.125.
 

nsaspook

Joined Aug 27, 2009
13,260
I'm pretty sure the simulation (I don't normally sim so I can't really can help you with it) has no value for ADC input (channel 1) pin capacitance needed for a hardware calibration. You need to add an external cap of that equivalent value to the pin.
 

Thread Starter

teddydogowners

Joined Jul 5, 2016
6
I'm pretty sure the simulation (I don't normally sim so I can't really can help you with it) has no value for ADC input (channel 1) pin capacitance needed for a hardware calibration. You need to add an external cap of that equivalent value to the pin.
I did try putting a capacitance across that pin, but no change. I'm pretty sure I'm not getting the circuit right.

I also heard of another method to calibrate it, where you use the equation "Time=Gain*Voltage + Offset". Here gain and offset are constants. Charge the capacitance twice for two known times, measure the voltages with the ADC, and the get the values of gain and offset. I tried this too, but it doesn't give any results either.

Also, I read in the data sheet that the ctmu charges the s/h capacitance of the ADC during current calibration and time measurement. Does this happen?
 

BobaMosfet

Joined Jul 1, 2009
2,113
Hi!

I am in the process of using a PIC24FJ64GA106 to design a time domain reflectometer in Proteus, using MPLAB X IDE and C16. However, I am having problems with the current calibaration and capactiance calibration. I have referred all app notes and the datasheet, but I am still getting the value of CTMUIsrc as 0 and that of CTMUCap as NaN. Could someone take a look at the code and see if I'm doing something wrong?

Attached is the code and the Proteus schematic.

Thanks in advance!

(BTW, there might be some discrepancies in the comments in the code, I haven't been able to clear them out yet. Sorry about that.)
Have you flow-charted your code? How can you expect anybody else to figure out your logic, and then debug your code, if you haven't documented your logic- which defines what it IS supposed to do, not what it's actually doing?
 
Status
Not open for further replies.
Top