LED switching circuit problem

djsfantasi

Joined Apr 11, 2010
9,163
Are you aware that there is a circuit that allows for a SPDT switch to control a Kato turnout? In this case, a momentary switch is not necessary. If you use this circuit (click on the link to view), with a DPDT switch, the other set of contacts can be used for indicator lights. As no logic is involved, it is immune to noise from the switch machine and other model RR sources.
 

eetech00

Joined Jun 8, 2013
3,960
/
You can't make a better debounce circuit than the SR-latch, which the two leftmost gates are configured as.
No need to suppress anything here - imagine if pin 1 is pulled low for the first time, pin 3 will go high. Any further instances of pin 1 going low will do nothing, as pin 3 is already latched high and that won't change until pin 6 is pulled low, flipping the circuit over (or the power is removed).
Yes, except separate contacts are driving both inputs of the FF at the same time. If the contacs bounce, and since both inputs are pulled high, both inputs will bounce between low and high.
 

Søren

Joined Sep 2, 2006
472
Hi,

Are you aware that there is a circuit that allows for a SPDT switch to control a Kato turnout? [snip] with a DPDT switch, the other set of contacts can be used for indicator lights. As no logic is involved, it is immune to noise from the switch machine and other model RR sources.
Given that a typical train layout will have the turnouts spread over quite some area, with the control panel at some accessible point at or near an edge of the "table", how wise would it be to have both the added inductance spread all over and all the wires acting as antennas?
I think it would be a minefield of emitted noise, that will play tricks with a lot of active circuitry in the layout.

Doesn't help much that the turnouts and their indicators are immune, if they foul up other stuff around them.
 

Søren

Joined Sep 2, 2006
472
Yes, except separate contacts are driving both inputs of the FF at the same time. If the contacs bounce, and since both inputs are pulled high, both inputs will bounce between low and high.
Well, it seems like a dual momentary, center off switch (double pole), so this won't happen.
Even if they were separate contacts you wouldn't get bounce, as the latch cannot change over unless the other side is pulled low (it effectively nix out the effects of contact bounce, since the first low is what changes the latch over - you do know the function and meaning of "latch"?

OK, then let's take the slightly desperate, albeit feeble, attempt to prove it to be fail-ridden - both buttons pressed concurrently, which I think you refer to - and let's forget for the moment, that only a true retard would try to shift a turnout both ways at the same time and expect it to happen - yes, given separate buttons, it could fail in less than 1 in a million activations, provided you were able to get the bounces to hit with a precision of less than 50ns, but honestly, how interesting do you think this very academic situation is - do you know any retarded person, Hell-bend on trying to destroy a turnout and with years of time to press buttons?
If so, just keep them from your toys ;)

I think that this imaginary retard would just grab a hammer and save those years anyway.
 

eetech00

Joined Jun 8, 2013
3,960
Well, it seems like a dual momentary, center off switch (double pole), so this won't happen.
Even if they were separate contacts you wouldn't get bounce, as the latch cannot change over unless the other side is pulled low (it effectively nix out the effects of contact bounce, since the first low is what changes the latch over - you do know the function and meaning of "latch"?
Yes i do...

OK, then let's take the slightly desperate, albeit feeble, attempt to prove it to be fail-ridden - both buttons pressed concurrently, which I think you refer to - and let's forget for the moment, that only a true retard would try to shift a turnout both ways at the same time and expect it to happen - yes, given separate buttons, it could fail in less than 1 in a million activations, provided you were able to get the bounces to hit with a precision of less than 50ns, but honestly, how interesting do you think this very academic situation is - do you know any retarded person, Hell-bend on trying to destroy a turnout and with years of time to press buttons?
If so, just keep them from your toys ;)

I think that this imaginary retard would just grab a hammer and save those years anyway.
Thats funny :p....but not constructive...:cool:

heh...I have seen dispatchers do some weird things with the keyboard and switch controls you would'nt believe. Like flipping a switch like a crazy in an attempt to make it fail, or, a 220 lb signal supervisor forcing all their weight on a pushbutton trying to make a light come on that doesn't. :(

Anyway, if i'm wrong, ok, but please keep your comments constructive....
 

Søren

Joined Sep 2, 2006
472
I entirely agree, but it doesn't hurt to use a belt-and-braces approach.
If you hope to one day make designs for large production volumes, you really have to reevaluate that notion - anything not strictly needed should not be there - it's not about making "X-mas trees" of circuitry (which in itself may be begging for strange errors), but about knowing/finding what is the absolutely necessary core and cut away all the stuffing - even a 1 cent component matter, when designing for huge production runs.

For single units, it's not usually a big deal to spend a few dollars more, but isn't there enough over-engineered amateur circuits floating the net as is?

And I use the term over-engineered here about any circuit that is larger than necessary, only to compensate for the lack of knowledge/experience of the "designer" - it's like those people start out somewhere and then just keep adding circuitry until it works and if it shows a fault anyway, they just toss more components in that general direction, creating monsters of circuits that could have been a third the size, doing the job just as good or better.

In life critical applications, the game is a bit different of course, but the "extra" circuitry and redundancy serves quite a different purpose in such, by ensuring that even a failing sub-circuit won't bring the general function to its knees.
 

Søren

Joined Sep 2, 2006
472
Thats funny :p....but not constructive...:cool:
Then I sure missed the target, as I went for constructive and not funny at all. You didn't seem to catch on, when I first explained to you how it works, so I tried a different approach, but it seems that was in vain as well, so either you just trust my word or doubt it - either way, no skin of my back.

Anyway, if i'm wrong, ok, but please keep your comments constructive....
What do you mean by constructive? I took the time out of my life to help you understand it... Twice even, but that's not constructive? - Sorry, I'm an engineer, not a wet nurse and I have no intention of forcing you to learn. If you change your mind on the latter point, try building the latch part with separate switches and see if you can bounce it silly as a learning experience.
 

ebeowulf17

Joined Aug 12, 2014
3,307
Well, it seems like a dual momentary, center off switch (double pole), so this won't happen.
Even if they were separate contacts you wouldn't get bounce, as the latch cannot change over unless the other side is pulled low (it effectively nix out the effects of contact bounce, since the first low is what changes the latch over - you do know the function and meaning of "latch"?

OK, then let's take the slightly desperate, albeit feeble, attempt to prove it to be fail-ridden - both buttons pressed concurrently, which I think you refer to - and let's forget for the moment, that only a true retard would try to shift a turnout both ways at the same time and expect it to happen - yes, given separate buttons, it could fail in less than 1 in a million activations, provided you were able to get the bounces to hit with a precision of less than 50ns, but honestly, how interesting do you think this very academic situation is - do you know any retarded person, Hell-bend on trying to destroy a turnout and with years of time to press buttons?
If so, just keep them from your toys ;)

I think that this imaginary retard would just grab a hammer and save those years anyway.
I think the foolproof switching you're imagining here is done with a SPDT switch where only one gate input or the other would be bouncing. In that scenario, the first moment of switch contact would change states on the latch and subsequent bounces at that input would have no effect. With this DPDT switch wired as shown, if both contacts bounce, as can be reasonably expected, that means BOTH gate inputs will be alternating between high and low, which means the latch will almost certainly change states as the switch bouncing settles. Looks like a prime case for debouncing to me...
 

ebeowulf17

Joined Aug 12, 2014
3,307
/


Yes, except separate contacts are driving both inputs of the FF at the same time. If the contacs bounce, and since both inputs are pulled high, both inputs will bounce between low and high.
It took me several tries re-reading what you said here, double checking the schematic, and then imagining the alternating states as two separate contacts bounce, but I finally wrapped my head around it and you're absolutely right. Good catch!
 

djsfantasi

Joined Apr 11, 2010
9,163
Hi,


Given that a typical train layout will have the turnouts spread over quite some area, with the control panel at some accessible point at or near an edge of the "table", how wise would it be to have both the added inductance spread all over and all the wires acting as antennas?
I think it would be a minefield of emitted noise, that will play tricks with a lot of active circuitry in the layout.

Doesn't help much that the turnouts and their indicators are immune, if they foul up other stuff around them.
And what is your point? It is what it is. If designing a control for a noisy environment, would one's first choice be a circuit sensitive to noise?
 

Thread Starter

Brian Krupicka

Joined Nov 1, 2014
38
Thank you all for your responses.

The control panel is in a central location and all turnout wiring, toggle switches, LED wiring and IC board input wiring are grouped together.

However, I believe I have located the problem. The 13 DPDT MINI-toggle switches

(Mon) on-off-(Mon) on are the source of the problem. As drawn on the schematic the switches are wired for reverse polarity to accommodate the power requirements to the Kato turnouts. With a multi-input scope, I found the some of the contacts in the mini-switches make-before-brake, causing the main power supply to short, thereby causing the IC to be very unpredictable. I changed two of the 13 switches to larger toggle type and all appears to be working. I will change more switches today and report back to the group.



Thank you all for your support.

Brian
 

ebeowulf17

Joined Aug 12, 2014
3,307
Thank you all for your responses.

The control panel is in a central location and all turnout wiring, toggle switches, LED wiring and IC board input wiring are grouped together.

However, I believe I have located the problem. The 13 DPDT MINI-toggle switches

(Mon) on-off-(Mon) on are the source of the problem. As drawn on the schematic the switches are wired for reverse polarity to accommodate the power requirements to the Kato turnouts. With a multi-input scope, I found the some of the contacts in the mini-switches make-before-brake, causing the main power supply to short, thereby causing the IC to be very unpredictable. I changed two of the 13 switches to larger toggle type and all appears to be working. I will change more switches today and report back to the group.



Thank you all for your support.

Brian
Just to clarify, when you say "toggle" switches, are you saying that you're using maintained switches (ones which stay in whichever position you last switched them to) as opposed to momentary switches with a center-off position as drawn? If so, this makes sense to me. If not, I'm very confused because I thought make-before-break and momentary-with-center-off were mutually exclusive traits.
 

ebeowulf17

Joined Aug 12, 2014
3,307
I think the foolproof switching you're imagining here is done with a SPDT switch where only one gate input or the other would be bouncing. In that scenario, the first moment of switch contact would change states on the latch and subsequent bounces at that input would have no effect. With this DPDT switch wired as shown, if both contacts bounce, as can be reasonably expected, that means BOTH gate inputs will be alternating between high and low, which means the latch will almost certainly change states as the switch bouncing settles. Looks like a prime case for debouncing to me...
Regarding me previous comments on switch debouncing, which may be irrelevant if the op already found a solution...

Doh! Boy do I hate being wrong, but looking at this again this morning with fresh eyes, I think I got it wrong last night.

With any given button push, one contact will be pushed to contact low and may bounce, but the other contact will be pushed to high, which is it's idle state anyway because of the pull up resistors, meaning the signal on that side won't be bouncing. With only one of the gate inputs on the latch bouncing and the other one stable, the latch would work as intended, keeping the output stable after the initial, intended switch.

Sorry I jumped in a little too soon on that one. My eyes played tricks on me!
 

Thread Starter

Brian Krupicka

Joined Nov 1, 2014
38
The switches are momentary (center off), however it appears the internal mechanical structure shorts out before changing state. It is only a conjecture on my part but the scope shows a sort when changing states up or down. Even though the center is off the wiper must move up to release before traveling in the down position or visa versa.
 

Alec_t

Joined Sep 17, 2013
14,335
Søren said:
If you hope to one day make designs for large production volumes, you really have to reevaluate that notion
Again, I entirely agree. But we're talking one model railway, not mass production :D.
 

Søren

Joined Sep 2, 2006
472
And what is your point? It is what it is. If designing a control for a noisy environment, would one's first choice be a circuit sensitive to noise?
I already stated my point - reread it if you need to.

When designing for an environment that most likely have several circuits, which probably aren't designed for a network of EMI antennas surrounding them, it's better to stay clear of adding such.
None of us know what other circuitry is in this layout, but I hope that most of us at least know, that a healthy dose of added EMI is a thing to avoid.
It's not hard to bolster the circuit that we're debating anyway.
 

Søren

Joined Sep 2, 2006
472
Again, I entirely agree. But we're talking one model railway, not mass production :D.
Yeah, won't hurt anyone, but it doesn't hurt to begin thinking in terms of minimalism either - while it might not mean that much now, it may be what gets you picked over the next guy later in your life.
Habits can be considered a kind of self-programming :)
 

djsfantasi

Joined Apr 11, 2010
9,163
I already stated my point - reread it if you need to.

When designing for an environment that most likely have several circuits, which probably aren't designed for a network of EMI antennas surrounding them, it's better to stay clear of adding such.
None of us know what other circuitry is in this layout, but I hope that most of us at least know, that a healthy dose of added EMI is a thing to avoid.
It's not hard to bolster the circuit that we're debating anyway.
I guess I asked, because I have a fairly good idea of what other circuitry is in the layout. And as a matter of course, a healthy dose of EMI cannot be avoided. Model RR that are designed for DCC are robust enough in such a noisy environment, and the DCC circuits themselves do much to reduce the EMI.

However, the method of wiring this particular layout is going to have a lot of EMI and is even using some fairly old Model RR technology which is contributing to more EMI (Kato turnouts are fairly old model RR tech.) We are talking about intermittent solenoid operation at fairly high currents.

I understand your point, but doubt you understood mine. My suggestion was a circuit that was immune to EMI. When designing circuits for operation underwater, one doesn't demand that they drain the pond because the electronics will operate better without haring to deal with the moisture.
 

Alec_t

Joined Sep 17, 2013
14,335
Søren said:
it doesn't hurt to begin thinking in terms of minimalism either - while it might not mean that much now, it may be what gets you picked over the next guy later in your life.
Not at my time of life! (I've been retired for years) :).
 
Top