Shop OBEX P1 Docs P2 Docs Learn Events
Anybody played with Time-domain Reflectometer usin a prop ? — Parallax Forums

Anybody played with Time-domain Reflectometer usin a prop ?

Toby SeckshundToby Seckshund Posts: 2,027
edited 2014-03-26 12:33 in Propeller 1
One of the guys at work, a Windows lover (you know the sort), threw a right strop today at the lack of test equipment. His rants encompassed anything that was mentioned that day, which included the blessed Propeller. So the gauntlet is down. One TDR using a prop just to spite him.

All clues gratefully received.

Alan

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Style and grace : Nil point
«1

Comments

  • Graham StablerGraham Stabler Posts: 2,510
    edited 2009-11-23 21:35
    http://www.epanorama.net/circuits/tdr.html

    Like this but use a comparitor to detect returned signal and cnt to time the interpulse gap ?

    Graham
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2009-11-23 21:48
    Yeah seen that one ( not that many project out there ! ). I WILL have to do this, its a point of principle, now.

    I used them Decades back, in transmitter group, but recently we have been dumped a load of multi co-ax and multi-core cables. The wrong end is ALWAYS cut off first !

    The Strop was thrown as he had one when he was on telephones, he could have "anything he wanted". We reminded him he wasn't there now and there was dummies spat, and teddy bears everywhere. I smirked a bit too much and he laid into my interests, ie poor little defensless props.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Style and grace : Nil point
  • Graham StablerGraham Stabler Posts: 2,510
    edited 2009-11-23 22:01
    Well in that case you will want to add ADC functionality and a graphical output [noparse]:)[/noparse]
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2009-11-23 22:14
    I was thinking along the lines of a 2x20 lcd (here already) for menu and then a (crude) graphical plot and results. The LCDs are scounges from medical printers and would show the beast was made from old junk. Not that I should wish for it to become personal, but a screen, which was blue with "death" poping up on it would be a bonus.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Style and grace : Nil point
  • ElectricAyeElectricAye Posts: 4,561
    edited 2009-11-23 22:45
    I contemplated making a TDR last month, to measure the interface between a salt solution and an ice layer forming above it in a small tank. I have no idea if it would work, but if you manage to get one working with the Prop, I will definitely be here to heap praise upon you and to start jonesing the thing.

    Keep us posted, please?

    thanks,
    Mark
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2009-11-23 22:54
    I had no idea (again) that the principle was used for anything other than cables before I looked for inspirations earlier today. There seems to be more on it about moisture levels, than copper.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Style and grace : Nil point
  • ElectricAyeElectricAye Posts: 4,561
    edited 2009-11-24 02:58
    A nice little application of the concept, with some explanation of how it works, courtesy of the US Army Corps of Engineers...

    www.crrel.usace.army.mil/library/technicalreports/TR02-15.pdf
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2009-11-24 08:45
    The millitry do not seem to like me, probably wise.

    I considered an AVR approach, with its inbuilt comparator and A/D stuff, but that isn't the principle here. He didn't slag off the AVRs so they cannot be used.

    Will read up on half step techniques. The lenths of cables that I will be using will be 10-100 Mtrs, the tricky bit for timings.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Style and grace : Nil point
  • ColeyColey Posts: 1,110
    edited 2010-03-22 20:55
    Alan, did you get any further with this challenge?
    I'm looking at doing something similar myself to measure cable distances and would welcome sharing ideas with you....

    Regards,

    Coley

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    PropGFX - The home of the Hybrid Development System and PropGFX Lite
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2010-03-22 22:03
    No, as usuall, as soon as the other bugger shut up and I got playing with other thing (anchient EDO DRAM) the moment slipped by.

    I would like to continue any way, as the new job will make good use of it ( although they should have the resources to buy a proper one )

    I got as far as looking into the Half Step bits and dreaming of using an old 2x16 lcd as a readout graph/data. The longer cables are easier as the delays are big enough to be managable, but the shorter ones might be a problem.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Style and grace : Nil point
  • ColeyColey Posts: 1,110
    edited 2010-03-22 22:39
    I'm just about to buy a proper one but it struck me that we could make a quick n dirty prop based one that I could make for my engineers, resolution doesn't need to be great and as far as distances go I would be looking for anywhere between 100 and 1000M to measure.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    PropGFX - The home of the Hybrid Development System and PropGFX Lite
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2010-03-22 23:10
    Those are the easier distances, especially if you had a real one for callibration.

    I managed to guestimate the fault in a burried triax, that was 500 Mtrs, to within 5 Mtrs just by comparing the reflections to that of a known 100Mtr lenth and the pulse from the Pulse-and-Bar generator.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Style and grace : Nil point
  • George SuttonGeorge Sutton Posts: 180
    edited 2013-10-22 19:49
    Any recent information or ideas as to using a Propeller for a TDR system?
  • Toby SeckshundToby Seckshund Posts: 2,027
    edited 2013-10-23 11:27
    Hi,

    No, to my shame the moment of the initial "want" went by, then I changed jobs.

    But now I am back in a job that could use such a toy, at least until all of the copper stuff becomes fibre'd. I will have to start looking back up all of the info, but the trickiest bit is the reasonably short range stuff, cables that were hundreds of metres long did give a bit of a rest period before the echos came back!

    The half-step did seem to be the most common method, that (I think) was for the initial step to go to half level and the get held there, then when the reflection came back it would add or subtract from that half level and so give a clue to range and type of discontinuity.

    Alan
  • jmgjmg Posts: 15,173
    edited 2013-10-23 12:13
    . One TDR using a prop just to spite him.
    All clues gratefully received.

    The trick is to turn very small times into a measurable quantity.
    Some designs use a charge gate, either 3 diodes + Cap + current source, or 1 diode and open-drain, and then a ADC.
    Any recent information or ideas as to using a Propeller for a TDR system?

    I think it was Bean did some interesting looking tests a while back, using TWO props, and relying on similar but not non-locked clocks.

    From memory, that could detect length changes in short wires, using many samples.

    Such designs are easier if you know the phase step, and there is a new companion part that may be ideal.

    I have recently fired up a sample of a Si504, which is a nifty little part that swallows a single 4 byte real for frequency, and a 16 bit signed integer for offset trim. What could be simpler, or have more dynamic range ?

    Si504 delivers any freq 32KHz to 100MHz and seemed to have good short term stability, so two of those could give a nice way to give two clocks of close known offset , and controlled phase advance - measure, then trim, ( offset-trim is good to ~ 28ppb/step.)

    Maybe add a couple of TinyLogic D-FF( NXP 74AUP2G79 look good?) for the capture parts, to keep apertures smallest.
    One captures Cal Zero and one captures Delay-Time-Edge
  • BeanBean Posts: 8,129
    edited 2013-10-24 04:10
    I've been wanting to make a TDR with the propeller for awhile now.
    I'll have to dig up my old code that measures the wire length and see if it can be adapted for TDR use.

    Bean
  • RS_JimRS_Jim Posts: 1,766
    edited 2013-10-24 08:25
    Sometime back there was a discussion about DME and someone linked to this http://www.acam-usa.com/Time-To-Digital-Converters.html.
    I thought at the time that these chips would work with the prop in making a TDR. I never had the $50 to pursue it.
    Jim
  • BeanBean Posts: 8,129
    edited 2013-10-24 10:56
    I am working on it now...
    Looks like it's going to work. Just uses 1 resistor on a demo board.

    Bean
  • Brian FairchildBrian Fairchild Posts: 549
    edited 2013-10-24 11:00
    I've got a direct reading TDR (aka cable length tester) in my test kit drawer. Popping the lid shows the following actives...

    MAX639 - switch-mode regulator
    NME dc-dc converter
    78L05
    1 transistor
    PIC16C84 running on 4MHz xtal
    MAX404 - video opamp

    and that's it. Plus a few passives, the LCD display and a small relay.

    In operation you dial in the propagation velocity and get a direct readout of the cable length. It's meant for measuring how much cable is left on a part drum.
  • BeanBean Posts: 8,129
    edited 2013-10-24 11:25
    Here is what I came up with.
    The hard part was getting a signal that is NOT phase locked to the propeller clock.

    Please try this and let me know if it works for you. It seems to work for me.

    I have attached the .spin files in case you don't have PropBasic.

    Uses serial terminal @ 115200 baud to show results.

    Bean
    ' A non-phase locked 625KHz signal is generated on P0
    ' That signal is connected to P1 thru a 220 ohm resistor
    ' P1 and GND are connected to a BNC connector using short wires
    ' Connect a piece of 50 Ohm coax to the BNC connector and the program.
    ' Do not connect the other end of the coax to anything (leave it open)
    ' The program should show the time in picoSeconds for the round-trip to the end
    '  of the cable and back again. 
    '
    '
    DEVICE P8X32A, XTAL1, PLL16X
    FREQ 80_000_000
    
    BAUD             CON "T115200"
    
    PulseOutPin      PIN 0
    PulseInPin       PIN 0
    DelayPulseInPin  PIN 1
    
    PCTX             PIN 30
    
    i                VAR LONG
    inches           VAR LONG
    timeCnt          VAR LONG
    
    ascii            HUB STRING(15)
    sendStr          HUB STRING(80)
    
    Generate     TASK AUTO
    
    PROGRAM Start
    
    Start:
      PAUSE 1000
      COUNTERA 160, DelayPulseInPin, PulseOutPin, 1, 0 ' !A & B
      
      DO
        timeCnt = 0
        i = 1 << 18 ' Accumulate 1^18 measurements @ 625KHz
        DO
          WAITPNE PulseOutPin,PulseOutPin   ' Wait for pin low
          PHSA = 0
          WAITPEQ PulseOutPin,PulseOutPin   ' Wait for pin high
          timeCnt = timeCnt + PHSA
        LOOP i
    
        ' Convert (12.5nSec * 2^18) units to 1 pSec units
        timeCnt = timeCnt ** 204_800_000
    
        ' Built string to send to serial terminal
        sendstr = STR timeCnt, 10
        sendStr = sendStr + " pSec  "
        inches = timeCnt >> 8 ' Approx 128 pSec per inch in coax X 2 directions
        ascii = STR inches, 10
        sendStr = sendStr + ascii
        sendStr = sendStr + " approx inches.\r"
    
        SEROUT PCTX, BAUD, sendStr      ' Send to serial terminal
    
      LOOP ' Forever
    END
      
    
    
    TASK Generate
      LOW PulseOutPin
      ' Generate a 625KHz signal using the PLL counter mode so it is NOT phase locked
      OUTPUT PulseOutPin
      COUNTERA 16, PulseOutPin, 0, $1000_1000
      ' Modulate the counter to PREVENT the PLL from phase locking
      DO
        frqa = $1020_1000
        NOP
        NOP
        NOP
        NOP
        NOP
        NOP
        NOP
        NOP
        NOP
        NOP
        NOP
        NOP
        NOP
        NOP
        NOP
        frqa = $0FE0_0000
        NOP
        NOP
        NOP
        NOP
        NOP
        NOP
        NOP
        NOP
        NOP
        NOP
        NOP
        NOP
        NOP
        NOP
      LOOP
    ENDTASK
    

    Bean
  • jmgjmg Posts: 15,173
    edited 2013-10-24 14:02
    Bean wrote: »
    A non-phase locked 625KHz signal is generated on P0

    Can you expand on what you used here for the non-phase locked 625KHz signal ?

    Would a simple RC osc be sufficiently unlocked, or would LC be needed, or a ceramic resonator (455KHz is still easy to get?) or a HC4060+ crystal ?
  • BeanBean Posts: 8,129
    edited 2013-10-24 14:20
    I used the PLL in the counter, but normally the PLL will get phase locked to the propeller clock very quickly. So I have a tight loop that keeps moving the frequency input to the PLL.
    This causes the PLL to constantly adjust and it never gets phase locked.

    That is what the TASK Generate does. It runs on it's own cog.

    Those other methods would probably work too, but if the propeller can do it without extra hardware, I'd rather do it that way.

    Bean

    P.S. I'd like to hear if anyone has tried this. If you have please post here and let me know.
  • lonesocklonesock Posts: 917
    edited 2013-10-24 14:31
    Genius!

    Any idea how fast you have to update FRQx so the PLL doesn't lock? (Specifically, I'm wondering if a Spin loop would work.)

    I was also interested in why you chose 625 kHz.

    Thanks,
    Jonathan
  • BeanBean Posts: 8,129
    edited 2013-10-24 14:44
    The 625KHz isn't "magic" in any way. In fact it is not even considered in the calculation.
    It just needs to be slow enough to give the propeller some time to execute code before the next cycle, but fast enough so you don't have to wait a long time to get a reading.
    I was just using 625KHz for something else and it seemed to work, so I did bother trying other frequencies.

    I'm not sure exactly how fast you need to update FRQx, again I just played around until I got something working. Spin might be fast enough.

    Bean
  • jmgjmg Posts: 15,173
    edited 2013-10-24 15:04
    Bean wrote: »
    I used the PLL in the counter, but normally the PLL will get phase locked to the propeller clock very quickly. So I have a tight loop that keeps moving the frequency input to the PLL.
    This causes the PLL to constantly adjust and it never gets phase locked.

    That is what the TASK Generate does. It runs on it's own cog.

    Oops, I used he scroll wheel and did not even notice the extra code.

    Very nifty. What LSB do you seem to get using this ?

    Some info on the Prop PLL could be useful, in this type of app.

    Be nice to know the VCO-Osc design, and the loop filter time constants etc, to know what time-slot-coverage that actually gives.
    Certainly is simple.
  • BeanBean Posts: 8,129
    edited 2013-10-24 15:08
    jmg wrote: »
    Oops, I used he scroll wheel and did not even notice the extra code.

    Very nifty. What LSB do you seem to get using this ?

    Some info on the Prop PLL could be useful, in this type of app.

    Be nice to know the VCO-Osc design, and the loop filter time constants etc, to know what time-slot-coverage that actually gives.
    Certainly is simple.

    The results are displayed in picoSeconds and judging from the numbers it looks like a couple picosecond resolution.
    I've not verified that this is acurrate. I just got some reasonable numbers and it looks okay to me.

    Chip will have to answer about the PLL design, I don't know those answers.

    Bean
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2013-10-24 21:56
    Bean, that is superCool. I had to go back and look again at your earlier thread. Measure-the-speed-of-electricity...
    In post #29 in that thread you were discouraged about doing the task with a single Propeller, rather than with two running at slightly different frequencies. Is that what you've figured out how to do now?

    @JMG, here is a comment Chip made in response to a question about the PLL: "They are all 7-stage differential ring oscillators with full phase frequency detectors (not XORs) for feedback. They lock from any frequency to any other frequency in about 10us and adapt to small changes over several reference clocks. To ask how quickly their frequency changes is a good question. I've never tried to measure that. I have used them for FM broadcast quite succesfully, though. (Instead of outputting to a DAC for line-level audio, add/subtract the sample to/from FRQ to create FM.)"
  • jmgjmg Posts: 15,173
    edited 2013-10-24 22:47
    Bean, that is superCool. I had to go back and look again at your earlier thread. Measure-the-speed-of-electricity...
    In post #29 in that thread you were discouraged about doing the task with a single Propeller, rather than with two running at slightly different frequencies. Is that what you've figured out how to do now?

    @JMG, here is a comment Chip made in response to a question about the PLL: "They are all 7-stage differential ring oscillators with full phase frequency detectors (not XORs) for feedback. They lock from any frequency to any other frequency in about 10us and adapt to small changes over several reference clocks. To ask how quickly their frequency changes is a good question. I've never tried to measure that. I have used them for FM broadcast quite succesfully, though. (Instead of outputting to a DAC for line-level audio, add/subtract the sample to/from FRQ to create FM.)"

    Interesting. That makes Bean's 'permanent wiggle' on the VCO about 1/12 of that 'lock' time, so would make it pretty much triangular @ the VCO control voltage (ie always sweeping, chasing a lock target that keeps moving )

    Provided the internal Vcc/Gnd noise does not cause 'snap' effects, it should cover all time slots.

    Likely that differential ring oscillators helps give some PSRR.

    A key element here, easy to overlook, is the Prop pins can move Async, with a Local PLL/VCO -> Divider -> Pin, the pins
    are not sync'd to any SysCLK (unlike most other uC )
  • BeanBean Posts: 8,129
    edited 2013-10-25 04:16
    Bean, that is superCool. I had to go back and look again at your earlier thread. Measure-the-speed-of-electricity...
    In post #29 in that thread you were discouraged about doing the task with a single Propeller, rather than with two running at slightly different frequencies. Is that what you've figured out how to do now?

    Tracy, Yes, that is what I figured out. Even using the PLL the output edges get synced to the propeller clock because that is where the input edges occur. So I didn't think it was possible to create an edge that was not locked to the propeller clock.
    I thought I has seen in another post (maybe the one about noise while playing a WAV file ???) about modulating the input to the PLL. So I thought I would give that a try. It took some experimenting, but I finally got something usable.

    Bean
  • BeanBean Posts: 8,129
    edited 2013-10-25 04:19
    jmg wrote: »
    A key element here, easy to overlook, is the Prop pins can move Async, with a Local PLL/VCO -> Divider -> Pin, the pins
    are not sync'd to any SysCLK (unlike most other uC )

    Yes, without this "feature" my method would never work.

    By the way, if you just use a piece of wire instead of the 220 Ohm resistor (and no BNC either), it should measure the time delay for the signal to go through the wire. Of course the length will be wrong because it won't be a "round trip", plus the velocity factor is not the same as coax.

    Bean
Sign In or Register to comment.