Shop OBEX P1 Docs P2 Docs Learn Events
TTL vs. CMOS inputs? — Parallax Forums

TTL vs. CMOS inputs?

Professor ChaosProfessor Chaos Posts: 36
edited 2007-02-14 02:54 in BASIC Stamp
Hi all -

I am using a BS2 to automate some functions of an AC-powered model railroad. I am using a circuit (see attachment) with an AC optocoupler to detect the presence of the train; the train wheels complete an AC circuit which turns on the optocoupler. I connect the transistor end of the optocoupler to a BS2 pin. Because the AC signal is very noisy (intermittent contact between track and wheels), I have a 47uf capacitor (in series with a 2k resistor) across the optocoupler output to smooth/debounce the signal.

This circuit works very well when the outputs are connected directly to the Stamp. I tried connecting the outputs to a SN74HC165 shift register instead, to see if I could conserve input pins. Operation is a little erratic with the shift register - the signal goes low from time to time when it would stay high if directly connected to the Stamp pin.

I am wondering if this is a CMOS v. TTL voltage issue? The optocoupler is described as "transistor output" which I am assuming equates to TTL, and from what I gather the BS2 is a TTL input. The SN74HC165 is a CMOS device though. Is it possible that the problem is hooking a TTL output to a CMOS input? Could I solve it by using a TTL version of the shift register?

Thanks for your thoughts.
837 x 647 - 42K

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2007-02-14 02:23
    I think part of the problem is the circuit. I would reverse the whole output circuit with the 10K resistor in the collector lead and the Stamp pin connected to the collector. The emitter should be grounded. I would put the filtering on the LED side. I'd get a simple bridge rectifier (like from Radio Shack) with the capacitor at the output, a current limiting resistor between that and the optocoupler. If you need a current limiting resistor from the track to the bridge rectifier, use a much smaller one than you have. You want the capacitor to charge very quickly from the track (without excessive arcing) and discharge slower through the optocoupler (maybe at 10ma).
  • Professor ChaosProfessor Chaos Posts: 36
    edited 2007-02-14 02:54
    Mike, can you explain why those changes are desirable? I should note that the circuit seems to work fine when connected directly to an input pin; it just is a little flaky when connected to a shift register.

    One issue with filtering the LED side is that I have several of these circuits together, using 4-channel optocouplers. It would be kind of bulky to have 8 or 16 bridge rectifiers stuck in.
Sign In or Register to comment.