2
\$\begingroup\$

I'm building a control mechanism for a seat heater in my car. Eventually, it will drive power relays to control the current to the heating elements. It works in a simulation on simulator.io, but it behaves erratically when realized on a solderless breadboard, with a 74LS76.

The idea is to press one button, which will (by tripping the clock input) cycle it through "Off," "Low," and "High," and for the initial state on vehicle power-up to always be "Off" (as opposed to a simple double-throw rocker switch, which remains latched).

I'm obviously doing something wrong, but I don't know enough about TTL to know what I'm doing wrong.

Here is a screenshot from simulator.io. The actual simulation can be accessed at https://simulator.io/board/6TOaOHKnHJ/1 screenshot from simulator.io

Here is what I currently have on the breadboard, with the 74LS76 pin numbers marked. The capacitor is (theoretically) supposed to ground the "clear" inputs on power-up, so that it always powers up in an "Off" state (again, the whole point of the circuit). seat heater realization

So far, I've switched from pulsing clock from Vcc without a pull-down, to pulsing it from Vcc with a pull-down, to the present pulsing it from ground with a pull-up, and I've gone from driving the LEDs directly from a high on the Q outputs (which of course overloaded them), to driving them directly from a low on the ~Q outputs, to the present driving them through a transistor from a high on the Q outputs.

Aside from bounce, the major erratic behavior seems to be one of states: theoretically, the only allowable states are "both LEDs off," "green LED only," and "both LEDs on"; yet this isn't how it behaves in practice.

It took a while for the parts (mainly some 74LS14s and a bigger solderless breadboard) to arrive, and they arrived just in time for all my free time to be consumed by a newsletter that had to make it out the door, but Sunday, I had a chance to build the Schmitt trigger RC debounce circuit given on "ganssle.com":

Schmitt trigger RC debouncer

For testing purposes, I inserted an LED with a dropping resistor between Vcc and the output. At first, I had a terrible time getting the thing to work at all, using the original value of 18k (actually, 20k was the closest I could get) for the resistor in parallel with the diode, and also failing to notice that my new solderless breadboard didn't have continuous top-to-bottom power rails. (In fact, because of the latter, I thought perhaps I'd blown the 74LS14 by feeding it signal with no power.) Even after I bridged the gaps in the power rails, it didn't start to actually work until I reduced that resistor to 4.7k.

Success, on the erratic cycling issue! Connecting the Schmitt trigger output to the clock inputs, the outputs cycle properly and reliably, at least from tapping a clip-lead from the debouncer input on ground. Hopefully, I'll have time this evening to move the control circuit onto the larger solderless breadboard, and try it with the actual switch.

That's a big piece of the problem, but it's not the whole problem: there's still the matter of the pre-clear: the control circuit appears to power up with the outputs in a "low power" state, rather than the desired "off" state. Currently, the pre-clear is (assuming I copied the resistor value onto the schematic correctly) just a 1 µF capacitor connecting pins 3 and 8 to ground, and a 1k resistor connecting it to Vcc. I may just need to play with the resistor value, or plug in a bigger capacitor, but failing that, would maybe something with a couple of the unused Schmitt triggers help?


Late last night, I experimented with the resistors on the *PRE and *CLR inputs, and found that if I increased both of them from 1k to 100k, the pre-clear function started working reliably, and if I added a 390k across the capacitor, it worked even better.

Not entirely sure why the pull-up on the *PRE inputs would have an effect, but I'm not going to argue with it.

Tonight, I should have time to see whether, now that the clock inputs are being fed from a Schmitt trigger debouncer, the 1k pull-up on them is still actually serving a purpose, or if it can be deleted. I suspect the latter.

Updates:

  1. Deleted the pull-up on the clock, as planned. Works fine.
  2. When I moved the main circuit onto the larger breadboard, and tightened things up so that it would fit on the PC board, it started malfunctioning (but it would work normally if I had a voltmeter between Q on the second FF and ground.
  3. This morning, I tried increasing the resistors between that and the output transistor, and I tried adding a pull-down resistor, none of which worked. I finally swapped in a different 74LS76, and everything works now. It might be that I damaged the FF; it might be that one or more pins weren't making good contact. I've bagged the "iffy" 74LS76, and will try swapping it back in once everything is moved to the PC board.

Because it's TTL, I bought my ICs in triplicate. If I'd had the guts to try this in CMOS, I'd have probably bought ten of each IC.

\$\endgroup\$
12
  • 4
    \$\begingroup\$ The whole point of building this,... Add that to your question. Use the Edit function for that. \$\endgroup\$ Commented Oct 21, 2021 at 17:36
  • 3
    \$\begingroup\$ You have no "debouncing" on your switch. When you close a real switch, it doesn't work like an ideal switch, making contact in one go. It "bounces"a few times. Your circuit is fast enough to detect each bounce. I would add a 100 nF capacitor across the switch and see how that goes. You might want to read: circuitbasics.com/switch-debouncing Also a sidenote: I am not a fan of 74LS logic, I am more a fan of CMOS logic so I would use HEF4013 or similar. That also has the advantage that it can run directly from the 12 V in your car. 74LS logic cannot handle more than 5.5 V. \$\endgroup\$ Commented Oct 21, 2021 at 17:46
  • 1
    \$\begingroup\$ Yes, but with a 7805, one can practically build a 5V supply in one's sleep, and TTL has the advantage that it's not going to fry from a static charge I can't even feel. \$\endgroup\$ Commented Oct 21, 2021 at 18:00
  • 1
    \$\begingroup\$ At the frequencies involved, and with your wiring layout, it may or may not be safe to assume that both flip flops are seeing the same clock \$\endgroup\$ Commented Oct 21, 2021 at 18:50
  • 1
    \$\begingroup\$ TTL has the advantage that it's not going to fry from a static charge Oh? Well, then I have some news for you, although 74LS logic is indeed less sensitive to ESD than CMOS, it is still possible to damage 74LS logic with ESD. Then again, ALL logic ICs have some form of ESD protection and it is quite hard to "zap" them. As a kid I used many 4000 series CMOS chips and didn't even know about ESD. Yet I never zapped one. If you're just a bit carefull and don't do "stupid" things then ESD is not really an issue nor a reason. \$\endgroup\$ Commented Oct 21, 2021 at 19:55

1 Answer 1

5
+50
\$\begingroup\$

You have a switch driving your clocks. Physical switches are non-ideal, and what you think is a single switch transition can have a ton of "switch bounce", appearing as dozens of transitions to devices they are attached to.

You won't see this in your simulation, as simulated switches are ideal.

You can reach expected behavior by "debouncing" your switches.

\$\endgroup\$
12
  • 2
    \$\begingroup\$ A Schmitt trigger provides hysteresis. It may be enough, or it may not, depending on the nature of your specific switch. The approach you take depends on how much hardware you're comfortable adding, and how much you will be slowed down if a marginal approach proves insufficient. If you want a guaranteed fix, and money and space are no object, I suggest a SR latch and a DPST switch (jayanth911.blogspot.com/2013/11/…). The other erratic behaviors may all be a result of bounce -- you really don't know until you deal with the bounce. \$\endgroup\$ Commented Oct 21, 2021 at 18:18
  • 1
    \$\begingroup\$ SPDT is correct. \$\endgroup\$ Commented Oct 21, 2021 at 18:47
  • 1
    \$\begingroup\$ You have limited choices here, @hbquikcomjamesl -- you can look on an oscilloscope, or you can try it and see. Working without an oscilloscope is a bit like doing a complicated manual task while wearing mittens, but many people manage to do a lot of good work without one. \$\endgroup\$ Commented Nov 1, 2021 at 18:06
  • 1
    \$\begingroup\$ You got that right. At this point, until either (a) my oscilloscope turns up, (b) I'm able to beg or borrow one, or (c) somebody can come up with a way to use the antique waveform monitor have around the house (I used to work video crews regularly, and am absolutely terrible at eyeballing exposure) as a general purpose oscilloscope, I'm stuck with "try and see." \$\endgroup\$ Commented Nov 1, 2021 at 18:27
  • 1
    \$\begingroup\$ The debouncer works. Now (as I've detailed in the question) I just need to get the pre-clear working. \$\endgroup\$ Commented Nov 2, 2021 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.