Sensor Mapping

Discussion in 'General Electronics Chat' started by Silverknight, Jul 23, 2008.

  1. Silverknight

    Thread Starter Member

    Jul 23, 2008
    17
    0
    I've seem to have stumbled across a bit of a dilema. I am making a testing module that will sense if a short is in place out of 400 independant points. I am using an optocoupler to turn on a digital high to a d-latch if a fault is detected.

    Once a fault occurs the data will be displayed into 3 7-segment displays.

    My dilema is I need to take the raw data from the latches and send it out so that it will be able to be read on the 7-segment displays. I really don't want to sit down and write out a 400 bit kmap, to come up with the equations to create quite a large digital circuit. And I don't know of a microprocessor that may already be set up to do this for me.

    I have a parallax chip (bs2px24) at my disposal, however I am pretty new when it comes to programming in bs2. if I have to buy a different chip it's not a problem.

    Do any of you have any ideas on an easier way to do this or have you done something similar before?

    Also I would love to know if there may be a way of looking up the function of a microcircuit and get a model number from it. anyone ever heard of anything like that?

    Thanks in advance for any help
     
  2. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Well, since you have a BS2px, you could use the various LCDx commands to drive an LCD display directly rather than resorting to 7-segment LEDs. That would simplify your display task considerably.

    Increment a variable each time a new test begins; if a fault occurs then write the number to the display, and proceed to the next test.
     
  3. Silverknight

    Thread Starter Member

    Jul 23, 2008
    17
    0
    I'll have to look into those lcd commands.

    All 400 sensors are running simultaneously. The test stops as soon as one failure is detected. (for it's own safety)

    Attached is the circuit diagram V1 is running at 3KV with a max of 20mA, hence the resistor network. The Diodes are just there to stop any feedback.

    The probes on the left represent the logic levels that I need to input into a 3 digit display.
     
  4. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Well, maybe you could use some CMOS 4021 PLL in SER out static shift registers.

    Tie the parallel load pin to ground with a 10k or larger resistor. Connect an 8-diode common cathode diode array, cathode to the parallel load pin, anodes to the parallel inputs. Connect the emitters of eight of your optocouplers to the eight parallel inputs, and all collectors to Vdd. If an event triggers, it'll latch the data. Daisy-chain 50 of these shift registers.

    Clock the shift registers from the Stamp. Keep track of how many clocks you've issued until you get to the high bit. Output that number to the display, and then reset the shift registers by issuing one more clock.
    See the attached. R3 is on the data input of the shift register furthest from the Stamp. Since you'll only be trapping a single event, only one of the bits will be set. Once you've found that set bit, one more clock will guarantee that all shift registers are zero. I only put in 7 optocouplers per shift register, as I was running tight on space. P0 should have them too.

    You could reduce the number of shift registers you'd need by making an x-y array. You'd need a lot more diodes.
     
    Last edited: Jul 23, 2008
  5. Silverknight

    Thread Starter Member

    Jul 23, 2008
    17
    0
    Thank you Sgt. I'll give that a shot tonight. What software are you using to design with? I would love to see the full file that you designed.
     
  6. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    That was just CircuitMaker Student Version. It's obsolete, and limited to 50 components in a simulation. I just use it for quick & dirty simulations, because I got used to using it.

    Linear Technology's LTSpice/SwitcherCadIII is much better for analog simulations using their IC's, but I haven't gone to the trouble of loading all the logic devices I'd need in the library.

    If I were going to get serious about doing something like this, I'd use Cadsoft's Eagle Layout Editor or Altium Designer. But it takes me a lot longer to search through those libraries to find something suitable. I just wanted to give you a quick example.

    And what you see in the diagram is the full schematic I'd thrown together for you. I wasn't about to do all 50 shift registers; I'm not that masochistic ;)
     
  7. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Directly related:
    Have a look at this PDF from Parallax:
    http://www.parallax.com/Portals/0/Downloads/docs/prod/stamps/BS2Appnotesv1_9.pdf
    Application Notes for the Basic Stamp 2
    Look at the 2nd note; "Using Shiftin and Shiftout"
    It starts on the 7th (relative) page of the Adobe file.

    They describe Shiftout as used with a bunch of latches, and Shiftin as used with a serial ADC. But you can use almost the exact same code.
     
  8. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    See the attached for a bit more detailed schematic.

    Six 8-bit static shift registers in an X-Y array with the nodes connected using dual K-A-K diodes will not only handle your 400 test points, but leave you with plenty of expansion room.

    Note that each input to the shift registers require 10k pull-down resistors, which I hadn't thought about in my 1st example. Otherwise, leakage current from the optocouplers would bring the inputs high.

    Note that the BS2px24 is included, with the wiring for an LCD display according to the Parallax application note. You'll need an LCD with a 44780 controller. They're quite common.

    At the bottom of the schematic, there are a number of capacitors. A 0.1uF cap is needed next to each logic IC. There is a 220uF cap that goes at the board power input. It would certainly help to sprinkle plenty of 0.1uF caps around the optocouplers. VDD/VSS connections to the shift registers are not shown.

    I only showed the first column of optocouplers; it would've made the schematic far too busy and large to include them all.

    You can use the SHIFTIN function (as I mentioned in my last post) to clock the data in from the X and Y shift registers, a bit at a time. Count the bits until you get a 1. Multiply the Y count value by 24, then add the X count value. That's your error code. Don't forget to give each an extra clock to ensure that the shift registers are cleared.

    In your initialization sequence, issue 24 clock pulses to both the X and Y clocks. That will ensure that there are no garbage '1' bits in the registers. It's easier to do that than wasting a pin and hard-wiring a load command. It wouldn't be a bad idea to cycle through again to see if you have any "stuck bits".

    The schematic was created using Cadsoft's Eagle Layout Editor 4.16r2
     
    Last edited: Jul 24, 2008
  9. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Something else I just thought of; prior to clocking the data, you'll need to assert a logic low on the load input of the shift registers. This will ensure that if the failed bit is still high, it won't hang the shift register in load (which would prevent it from clocking data through).

    It's going to take another I/O pin from the Stamp to do that, and a divider network at the P/S\ pin (pin 9) for each shift register..
     
  10. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Here's an updated version with the changes I suggested in my prior post incorporated.

    The Parallel Load/Shift\ from the registers are now all wired together, so they will all load/shift together. This eliminates the necessity of clocking all the registers through a complete cycle for initialization.
    They are all wired to P11 (pin 16) of the BS2px24. During testing, this pin should be set to INPUT, and will normally be low. If a fault occurs, the pin will rise to nearly Vdd (less the Vf of the diodes used, drop across the optoisolator transistor, and after the voltage dividers are considered). You should use Shottky diodes for a low Vf.

    Since they're now all wired together, only one 100k pull-down resistor should be used, otherwise the fault may not be able to pull the P/S\ lines high enough.

    Once the BS2px24 "sees" a high on P11, it should change P11 to an output and assert a logic low prior to using SERIN to read the register contents.

    Note that it would be impractical to build a circuit this complex on a single board. Instead, I suggest you have the LCD, BS2px24, shift registers and resistors all on a motherboard. For each column, you could use 40-pin dual-row headers to connect daughterboards that contain the dual diodes and optoisolators. This would help a great deal to simplify troubleshooting and repair. Build a number of spare daughterboards to help minimize downtime.

    Keep in mind some sort of built-in diagnostic routines to verify proper operation of the array. If you don't think of such things beforehand and build them in, you will be unhappy with yourself later.
     
  11. Silverknight

    Thread Starter Member

    Jul 23, 2008
    17
    0
    Thank you Sgt.,

    You bring up a good point about verification. I've already got some failsafe fault examples to test the full application of this device. (Plus Calibration) Especially since our customers require Cal dates on every test requested. :) :) And That's just one more great way to prove that the machine is working as intended.

    As for the motherboard idea, I have been a bit concerned about the real estate of the x-y array. That's a good idea with the 40 pin interface into the cmos/controller motherboard. I'll have to use that. I had been wondering if they've already condensed an array such as this into a chip form or not. If not then we're most likely looking at surface mount instead of through hole.
     
  12. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Actually, I did some more fiddling with it last night, and realized that you could use 25-pin female D-type connectors on the motherboard and matching male right-angle DB25 connectors on the daughterboards. That would give you a reasonably priced industry standard connection that would ensure correct insertion of the daughterboards, and you'd have a wide variety of vendors to choose from.

    In the schematic, I removed the entire array of diodes and the few optocouplers I'd placed, and added 24 DB25 female connectors, oriented vertically. Pin 1 of each connector is connected to an x-axis shift register parallel input. Pins 2 through 16 are connected to the Y-axis shift register parallel inputs. That leaves pins 17 thru 25 for Vdd, Vss and onboard diagnostic signals.

    If 5 pins were used as address select lines, one for clock, and each daughterboard had a DIP switch for address select, the daughtercards could be selected by address and clocked through a diagnostics routine, checking every signal path from the daughterboards' optoisolator input through the dual diodes, DB25 connector, the x-y shift registers, right through to the BS2px24 Stamp - and the Stamp still has enough I/O pins left over to output data and clocks to shift registers/counters.
     
  13. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    I appear to have erred on my pin count. I'm actually using up to pin 18 for the x-y array; so Vdd and Vss will require two more pins. 4 bits + clock isn't enough for unique addressing of 24 boards.

    However, it would probably be a good idea to leave the entire DB25 connector as just signal inputs to the shift registers to allow for expansion; with ground/Vss and Vdd in there too. Might as well wire the remaining shift register inputs to the DB25 connector as well, and design the daughtercards with pads/vias for populating the remaining components if your requirements change - they frequently do.

    A separate DB9 connector could be used for diagnostics I/O.
     
  14. Silverknight

    Thread Starter Member

    Jul 23, 2008
    17
    0
    Yeah, I was kinda figuring as much with the pins. I like the sub-d 25 idea, that should make for a pretty stable connection beween mother and daughter boards. Since we're looking at testing 400 points at one time we figure we're pretty much looking at around a server box setup as casing for this unit.
     
  15. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Figure a minimum of 0.7" per DB25 connector (including spacing) The daughterboards will need 90° connectors; 0.6" would make interference a problem. That's 16.8". The Y-axis shift registers' traces would be easier to route if they were located at one end of the connector array.
     
  16. Silverknight

    Thread Starter Member

    Jul 23, 2008
    17
    0
    I meant to bring this up to you earlier but on the connection between U9B and the diode array, is the same as U9A. Was there a specific purpose for this that I didn't think of? When I built the sim model I have it set up isolated from eachother. (you wouldn't know how I would be able to set up the bs2px24 in multisim 10.1 would you?)

    Thanks
     
  17. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Actually, take another look. They're connected to different dual diodes. U9A's emitter is connected to U1's P8 input via D385, while U9B's emitter is connected to U1's P7 input via D386. So, they're on a different X-axis input bit. The Y-axis input bit is the same, though.

    I just grabbed an 8 pin DIP optoisolator model out of my library rather than using something like a 4N25, just to get the pin and package count down. Initially, there didn't seem to be any reason to have separate access to the base and collector of the optoisolator, however that could make diagnostics easier - or more of a pain!

    Well, another reason was to show that you could split a dual optoisolator between two X-axis channels. However, with the motherboard/daughterboard idea, that's pretty much out the window.

    That's fine - it doesn't matter. Better to use all the same components and have a half-package of an optoisolator unused than to complicate things.
    Sorry, no. I don't have Multisim.

    You could emulate portions of it using discrete logic ICs, but that would be a lot of work. Better to use several simulated signal generators with start delays.
     
  18. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    I'd kind of glossed over this sentence without really thinking about it before:
    You may not have realized it, but 20mA @ 3kV is 60W! :eek:

    To get within the realm of a reliable resistor wattage, you need to double that. 100W resistors are rather large and expensive (perhaps $5/each, or $2000 for 400 data lines), not to mention will generate a good bit of heat. At that power level, they'd only be available in wirewound, which will create additional problems due to their inductance.

    This section obviously needs some re-thinking.

    There's something else to consider; voltage vs clearances. The dielectric insulation of dry air is roughly 3,000,000V/meter, or 76.2v per mil (0.001"), so 0.040" is required. However in humid air, that can go down to roughly 35v/mil, or .085". This is a problem, because standard DIP IC pin spacings are .1" on centers, and the pins have width. Actually, at the body of a DIP, spacings can drop to .037", which wouldn't even be sufficient clearance to operate in dry air conditions. This means that you will not be able to use DIP or SIP resistors with standard .1" spacings, even if their wattage were high enough.

    Let's see what we can do to get the power dissipation problem under control.

    If you used three 10M Ohm resistors in series per line, output current would be 0.1mA, and power dissipation would be 1/10W per resistor, so you could use 1/4W resistors for reliability. But, where are you going to find 1kV working voltage resistors? A typical rating for 1/4W resistors is 250WV, with a max of 300V.

    So, browsing around on the Mouser.com site, I came across these:
    http://www.mouser.com/Search/ProductDetail.aspx?qs=h%2bhkcrc5EeOSrKtn7uiMlA==
    4.7M 1/2W 500WV carbon composition. You could use six in series for just over 0.1mA of current, but that's a lot of real estate to use up. Carbon composition resistors are not very stable over the long term, either.

    Just stumbled across Vishay's VR37 line of high Ohmic/high voltage resistors. WVDC is 3,500, WVAC is 2,500. Just what you're looking for.
    http://www.mouser.com/Search/ProductDetail.aspx?qs=z8dK4%2bNfT9Rhi8RMJ0y9Lw==
    Unfortunately, Mouser doesn't stock them, a reel of 5,000 is their minimum order quantity, which would be around $280. But, a 33M resistor across 3kV would give you 0.91mA of current with .273W of power dissipation. Double it for reliability, and that's .546W - the resistors I've linked to are 1/2 W. This should be OK for reliability.

    The dielectric of the insulation is rated for 700v, so you'd need to mount the resistors off the board about .2".

    Digikey has a similar Vishay resistor:
    http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=PPCHJ33MCT-ND
    It's a different model, but has the same 3,500WVDC rating. The big differences are that you could buy 1,000 of them for $116.25 (under $0.12/ea), and they have 2,305 of them in stock as of this writing.

    So, what can you do with 0.91mA? Drive the base of a transistor, perhaps. Feed a comparator that has a clamp limiter or Zener diode on the input. It won't be enough current to drive an optoisolator directly, that's for certain.

    Your cabling is going to be a problem. With a 3kV potential, your minimum spacing between pins should be .17" or greater. That's not .17" on center, either. If your pins are .025" in diameter, you would need about .2" (5.08mm) between centers. If the resistors and voltage clamps were on the DUT side, you could get away with smaller connectors.
     
    Last edited: Jul 26, 2008
  19. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    OK, have a look at the attached.

    I did away with the optocouplers entirely. I suppose they could still be used, but right now I'm using the 0.91mA output from the 3kV source via the 33M resistor to drive the base of a 2N3904 NPN transistor.

    The base/emitter junction of the 2N3904 won't rise above around 0.8v at that low current. The transistor has an open-collector output when the DUT is disco'ed from the ATE. I just threw a pair of DB9 connectors in there because they were available in the simulator. Note that the jumper wires around the connectors wouldn't actually exist - they're just there for the sake of the simulation (for some reason, you can't plug them together in the sim)

    R2 limits the base current for Q2, a 2N3906 PNP. R1 keeps Q2 biased OFF if there is no input from Q1.

    U1 represents the X-axis shift registers. U2 represents the Y-axis shift registers. Rpd1 and Rpd2 represent single resistors in the 10k SIP pull-down resistor networks. I didn't bother to put in the diode array and pulldown resistors for the P/S\ inputs; this was just to give you a general idea of a possible workable solution to your new dilemma.

    Now instead of the 2N3904/2N3906 pairs and all of the associated parts and real estate that will be consumed, you should consider using something like a ULN2801A instead of the 2N3904. This is an 8-channel Darlington pair array, in an 18 pin DIP package. This particular model has no base current limiting resistor on the input, which you don't need. They also incorporate clamping diodes for the outputs.

    Newark seems to have the best price on them at the moment:
    http://www.newark.com/jsp/search/productdetail.jsp?SKU=89K1141&CMP=AFC-OP
    Roughly $0.55/each

    For the 2N3906, you could use something like an M54581P, M54562P, MIC2981, MIC2982, or UDN2981A through UDN2984A. The first two are made by Mitsubishi, the second two by Micrel, and the last series by Allegro. They all contain eight non-inverting source drivers (basically, PNP Darlingtons) in an 18 pin DIP package. They're more expensive than the ULN2801A series, but they will help to reduce your parts count considerably.

    Digikey has the UDN2981A available, $1.42 when you're buying 25 or more. You'll need an absolute minimum of 50 if you make zero spare daughterboards. Might as well get 100 of 'em, they're $1.065/each then.
    http://search.digikey.com/scripts/DkSearch/dksus.dll?Detail?name=620-1120-ND
     
    Last edited: Jul 26, 2008
  20. Silverknight

    Thread Starter Member

    Jul 23, 2008
    17
    0
    ok, sorry about that, I took the weekend off.

    As far as power dissapation is concerned, the resistor network would only have a very split second in which it had current running through it. The voltage being supplied is being supplied from a hypot system (hypotultra 7650 from Associated Research) so as soon as it sees a threshold or a flashover, it immediately shuts off. So for that split second that a failure were to occur, it would turn on the led of the optoisolator which would let the 5v through to latch the voltage then run through the bs2.

    As far as the pricing on the parts. No need for concern there. We are dealing with Military and space grade parts and therefore will be making this tester be pretty resilient. However I do like your resistor ideas and will probably wind up incorporating a higher resistance.

    Oh and as far as the optoisolators are concerned, I was mainly going to ust them in ic sockets where I could basically use them as a fuse but in a different context. :) Whereas they are about .44 a piece so not too bad if we blow through a coulple every now and then. (Obviously with a potential of 3KV there's bound to be some breakdown over time.)
     
Loading...