Using shift registers for continuity checking

Discussion in 'General Electronics Chat' started by solexious, Sep 22, 2009.

  1. solexious

    Thread Starter Active Member

    Nov 20, 2007
    55
    0
    Hello all,

    Included is the circuit I have connected to a micro controller. This works great, if I have the pins connected 1:1, also it correctly detects if I disconnect a pin or swap pins.

    What i'm having trouble with is if I short pins together, i.e. rather than pin 1 on output connected to 1 on the input and 2 output connected to 2 input, having pin 1 output connected to both 1 and 2 input, and 2 still also connected to 2. I get mixed results, some times its correct and shows the short, but it also can show as if its connected 1:1 or any thing in between.

    Any pointers what I can do to theis to correct it, im pretty sure its in my curcuit not the code running on my micro-controller.

    Thanks

    Sol
     
  2. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    You don't identify the connector in question. At any rate, using a connector that can't be misconnected is one way out. There are many that have polarity keys to prevent incorrect connections.
     
  3. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    OK, I think I see the problem.

    Let's say X2-1 and X2-2 have continuity to X1-1 and X1-2, but are also shorted together.
    IC4 QA is high, and IC4 QB is low. The short between Xx-1 and Xx-2 is also shorting the outputs of IC4 QA and QB, which are at different logic levels. This will be really hard on the IC, and may cause the output level to be in an indeterminate state (somewhere between the threshold levels for 0 and 1)

    I see you have resistor pull-down networks on the inputs of IC1-IC3; that's good.

    Now to correct the problem of a short in the harness also shorting IC4 thru IC6's outputs, you will either need to use diodes so that they can SOURCE current but not SINK it, or use some kind of buffer. IC4 through IC6's outputs need to be either a logic high, or high impedance. Standard silicon diodes could be used, but their Vf may be too high to get a reliable logic 1. Consider using Schottky diodes, like 1N5817 or perhaps a BAT54 (no suffix) just as examples.

    Any kind of fault needs to be reported. If the cable is supposed to be straight through, then a short between pins 1 and 2 could be reported as a short from 1:2 and again as a short from 2:1.

    [eta]
    If you don't want to deal with diodes, you might look at something like a demultiplexer. An SN74159 takes a 4-bit binary input and selects 1 of 16 outputs, which are open-collector. You'd need to change your resistor networks from pull-down to pull-up, etc.
     
    Last edited: Sep 22, 2009
  4. solexious

    Thread Starter Active Member

    Nov 20, 2007
    55
    0
    beenthere: Thank you, I should have explained better that this is designed to check cables made by others, and can only be inserted one way, but could be made incorrectly.

    SgtWookie: I see what you mean I think. I will add diodes to my breadboard of this schematic and see the results, thanks. I had added the pull down resistors to help in identifying non connected pins.
     
  5. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    Makes more sense as a cable tester.
     
  6. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    One thing I didn't ask about before - what value resistance does your resistor networks have?

    The 74HC164 can drive up to 10 LS TTL loads. A single LS TTL input draws 0.1mA current when the input is high, which would be equivalent to a 50k Ohm resistor. So, if your resistor networks are lower than that, definitely consider increasing them.

    More on diodes:
    This ties right in with the ability of the 74HC164's ability to source current, and the resistance of the networks. You need diodes with a low Vf to ensure that the 74HC165 inputs will be able to latch in a valid high logic level.
    A 1N914/1N4148 diode with 0.1mA current will have a Vf of around 0.5v; at 1mA around 0.6v.
    A 1N4002 diode with 0.1mA current will have a Vf of around 0.46v; at 1mA around 0.57v.
    A 1N5817 diode with 100mA current will have a Vf of around 0.32v. Best for breadboarding.
    A BAT54 diode with 1mA current will have a Vf of around 0.32v; if you're going to build a lot of these testers.
     
  7. solexious

    Thread Starter Active Member

    Nov 20, 2007
    55
    0
    The resistor networks are currently 10k, will swap them out for 50k ones to be on the safe side.

    I think I need to refresh my mind on diodes, just so I understand better.

    One other thing was, between the connectors the cable will be socapex connected and designed to take 240v at upto 13amps *when in normal use* and up to 40-50~ M long. Is there any thing I should consider in my design, as at the moment while breadboarding the pins are connected by thin 30cm~ jumper wires rather than what it will be testing...

    Thanks for your help

    Sol
     
  8. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Just took a look at TI's datasheet for the SN74HC165 datasheet; with a Vcc of 4.5v, an input of 2v will be considered a logic 1, so standard 1N400x silicon diodes (cheap and plentiful) should work fine. If you don't have any, Radio Shack stocks an assortment of 25 of them for a couple of bucks.

    Your circuit will be fine for basic continuity, cross-wiring and short checks. If you want to test them under high voltage and/or high load current, you'll need a modified approach. However, you need to do the low voltage, low power checks before getting into the high voltage/high power conditions anyway.
    [eta]
    What gauge wire are you using in the cables?
     
    Last edited: Sep 23, 2009
  9. solexious

    Thread Starter Active Member

    Nov 20, 2007
    55
    0
  10. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Yes, those should work just fine.
    I didn't realize you were in the UK. It would be a good idea to include that information in your profile.

    Yes, that's exactly what I meant.

    OK.
    There is a wire resistance calculator here: http://www.stealth316.com/2-wire-resistance.htm

    40 feet (12.192 meters) of 1.25mm2 wire would have about 0.1719 Ohms of resistance, and would drop about 2.235 volts with 13 Amperes of current flowing through it.
     
  11. solexious

    Thread Starter Active Member

    Nov 20, 2007
    55
    0
    I have added that to my profile, thanks for the poke.

    Great, I'm glad I was following along correctly.

    Using that calculator should amps be what is being drawn across the cable, so with a 40m cable at 1.25m2 and 0.0001 amps being drawn by the 74HC165N the voltage drop would be negligible? Or am I misinterpreting it? I don't need to do any load testing of the cable, only continuity.

    Thanks again for all your help

    Sol
     
  12. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Yes, at the tiny current you're sending across the cable, voltage drop will be negligible.
    OK, you should be good to go then.

    Don't forget that you should have 0.1uF (100nF) decoupling capacitors across the Vcc and GND terminals at each 74 series IC (your MCU too). This will help a great deal to keep the transients under control.
    Something like this: http://uk.farnell.com/cornell-dubilier/dsf050j104/film-capacitor/dp/4474545

    I didn't see them in your schematic.

    Not sure how familiar you are with Cadsoft's Eagle. Use the Erc button frequently, and particularly before you start generating a board. If your board and schematic get "out of sync", you will have a real mess until you can backtrack enough to clear it up.
     
  13. solexious

    Thread Starter Active Member

    Nov 20, 2007
    55
    0
    Great, thanks.

    I'm never sure when to use decoupling on ic's, guess its better to use them liberally?

    Will use it more with eagle, I must admit some times I give up with the board and delete it and start over if it gets out of sync.

    Sol
     
  14. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    "Rule of thumb" is one 0.1uF cap per IC. You should also have at least one larger electrolytic onboard somewhere. If you're using 555 timers, you'll need both a 220uF and a 0.1uF cap across Vcc/GND.

    Erc is your friend. Use it early, use it often.

    Also, when I start a schematic, the first thing I do is go into the frames.lbr, select one of appropriate size, and drop it with the lower left corner at location 0,0. I usually start with FRAME_A_L, which is an "A" size drawing (8-1/2"x11") in landscape format. This gives you a "playing field" with boundaries. If you find you need a larger one, you can always drop a different one in later. However, without the frame, you may find that you have trouble getting the schematic to print properly.
     
  15. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Another thing; you're using a +5 symbol on your schematic. That's OK, but you really should be using VCC symbols instead; because the library parts for 74xx series use VCC for their 5V supply. If you use a different supply symbol, the VCC pins on the IC's won't get air wires on the board.

    Also, don't connect two symbols (like +5, VCC) with a wire; Erc will complain bitterly about that, and it will make a mess of a board. If you for some reason must use two symbols that are actually the same (say, 5v) but IC's have different names for those pins in the library, you can use a jumper (see jumper.lbr) or a resistor of 0 Ohms to connect the two signals.
     
  16. solexious

    Thread Starter Active Member

    Nov 20, 2007
    55
    0
  17. solexious

    Thread Starter Active Member

    Nov 20, 2007
    55
    0
    On a sightly off topic note now I have added the capacitors to the ic vcc and gnd pins as you can see on the latest schematic, when dealing with the board the pins from the capacitors are wiring to the nearest vcc and gnd pads not to the exact pads they are wired to in the schematic.

    Any ideas why and how I can rectify this?

    Sol
     
  18. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Yes, that will work just fine.

    Sure, but I usually just locate them all together at an out-of-the-way spot, using a single GND and VCC, something like this:

    [​IMG]

    The less clutter on the schematic, the easier it'll be to understand.
    [eta]
    This was part of a schematic that was using 4000-series IC's; the library models used Vdd/Vss instead of Vcc/GND for the power pins.
     
    Last edited: Sep 24, 2009
  19. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Just move the caps next to the ICs you're using them on. Then click the Ratsnest button (looks like an X). That will re-route the air wires; it automatically connects the air wires to the nearest terminals/pins/etc with the same signal name. You might find it convenient to place C1 next to IC1, C2 next to IC2, etc.

    Don't worry whether the air wires are going to the exact spot you want to run the traces. If you get a trace with the same signal closer than any other terminal/pin/etc with the same signal name, clicking Ratsnest will cause the air wires to again select the nearest connection with the same signal name.

    Ratsnest will also tell you how many air wires are remaining; look for the message in the lower left corner. Once there are no air wires remaining, it won't let you route any more traces.

    [eta]

    Hint: The Polygon tool is very useful for "copper pour" areas and ground/power planes. I usually do the polygon close to the end; as clicking Ratsnest after adding a polygon will fill the polygon.

    Click the Polygon tool, select right angle for type of line to draw, width of .01, isolate of 0.016 or so, then click on the lower left corner of the board, the upper right corner of the board, and then the lower left again. Your board will have a border the same color as the layer. Click the Name tool (resistor with R2 bolded) from the menu, and change the signal name to GND or VCC or whatever signal name you want it to connect to. Then click Ratsnest. If you want more space between the traces and the copper pour, increase the Isolate parameter of the polygon. Don't use a width of 0 for the polygon, because it will make for a HUGE export or print file.

    You can un-fill the polygon by selecting Ripup and clicking near the edge of the polygon, but not on the line itself.
     
    Last edited: Sep 24, 2009
  20. solexious

    Thread Starter Active Member

    Nov 20, 2007
    55
    0
    Ah, great thank you. That does seem a better way to show it :)

    It just seems that they will attach to say the correct vcc pin, but rather than the gnd pin of the ic, to the closest pin i'm taking low for signal reasons, i.e. the clock inhibit pin.

    Still sifting though the erc and interpreting the errors, I see what you mean about using early and often!

    Sol
     
Loading...