I'm getting unreliable behaviour from my Curtain Controller. Is there a design flaw in the first part of the circuit, shown here please:
I've not shown the subsequent sections as they are working OK. (For those interested, X & Y go to exclusive OR logic, then outputs from that, together with X, control the motor power and direction respectively).
This section I've shown appeared to be OK too until recently. But now the 'toggle' button is not operating if the curtain is in its closed state. (I may have swapped the 4001 while looking at another problem. Can't think of any other changes.)
Anyway, I'm beginning to wonder if it ever *should* have worked! Is it OK to send pulses simultaneously to both Set inputs of these two bistables? The idea is that, whichever is not already set will now be set, giving alternate opening or closing of the curtain. The simultaneous RESET works OK, and that seems identical IMO. And the diodes from pins 4 and 11 ensure both bistables cannot be in a Set state simultaneously. Also I *am* getting a +ve pulse when I press the toggle button. And, as mentioned, that is closing the curtain when they are open; it's just the reverse that's no longer working.
I don't like those 0.1uF capacitors and I don't see what you need them for. It looks like you're momentarily shorting the outputs and the power supply with them.
It's a crazy looking cicuit but I've just done a quick truth table / dummy run for "Toggle" on the back of an envelope and it seems to work. Initial condition was "open stop" closed. Then "toggle" was momentarily pressed.
I don't think toggle does anything if you press it again while the curtain is moving. Is that right? It would be nice if it reversed the motion.
Idea was to reduce bounce noise. Copied uncritically from a similar circuit I found. But I too had wondered about their possible redundancy. One single very brief +ve going pulse is all that the bistables should need, and subsequent ones should be ignored. Can't do any harm though, I'd have thought?
Thanks. That nudged my confidence up, and this morning I swapped the
4001 again. Happy to report that it now toggles OK. Maybe one gate of the replaced 4001 was flakey? I should have made the trial swap earlier.
Correct. Never thought to try that before. Now that I look again at the circuit
I'm not sure how you would analyse it? Intuitively, it seems to me it could go either way. If X was high (motor on, curtain opening) and two pulses arrive from the toggle via the diodes, then one of them would switch Y high. That *could* prevail, by resetting X...? But, at least in my tests just now, it doesn't. Whatever is happening just continues until a stop switch is reached.
?? Don't keep me in suspense .
Anyway, I'm not sure about that. (Even leaving all learning curve considerations aside; I'm still on the low slopes.)
But what I think I will do is add a current limiting switch to reset both bistables. If that works OK, I could get rid of both the microswitches. I'd just operate with the toggle (two actually; in parallel, either side of bed).
As you see from this photo, that would be a welcome simplification of the mechanics and wiring. Not to mention the aesthetic improvement .
That circuit uses too many switches- all that's needed is latched OPEN CLOSE STOP where each momentary is latched and overrides all the others- with built-in impossibility of sending open/close motor control simultaneously- and no debouncing necessary- a single 4001:
Thanks. But how does that use fewer switches? You would need *two* STOP switches, one at each limit. And one of the further two switches in my design was the EMERGENCY STOP, which presumably your circuit would then need too, for equal functionality, as your STOPs would be inaccessible microswitches? And the other switch in my circuit was TOGGLE, which also provides additional function, namely the desirable one-button operation.
What's your view on the reliability of that Toggle of mine? Using it, or some improved version of it, the two manual switches, OPEN and CLOSE, would become redundant. In practice, when I press the toggle button, usually I get immediate movement in the required direction. But, occasionally it seems that the 'wrong' bistable has clearly been set and I see brief motion hard against the present limit, and I have to repeat the button press. No big deal, but untidy...
As mentioned, I'm also thinking of removing the two limit switches as well. Instead I'd use current limiting to detect when the limits are reached. That would leave me with just the one N/O TOGGLE button (paralleled for convenience, each side of bed).
I see now: you want two limit switches, one toggle, and one stop.
I am not sure that toggle works because you have the one latch jamming a "1" on the other latch SET input which prevents it from from changing state due to TOGGLE on its RESET input, and the latch already in the '1' state similarly does not change state with TOGGLE on its RESET input. How did you simulate this?
If you want to eliminate the OPEN/CLOSE switches then you can do something like shown here which uses the two limit switches, the single TOGGLE switch, and the single STOP switch. This differs from yours in that the particular limit switch closed forces the 4013 into the appropriate state to move in the opposite direction when TOGGLE is pressed- there is therefore no second-guessing about which limit the curtain is at or which direction the motor should move. The 4013 will not respond to the CK input when either SET/RESET is '1'- so when TOGGLE is pressed when the circuit is at a limit, the TOGGLE momentary serves to override the STOP-LATCH action for as long as its pressed. You could hold TOGGLE down run the curtain against the stops, the limit switch will close and reverse the motor drive automatically via the 4013, ad infinitum. Or you could press TOGGLE to get it going, the limits are reached, and the motor drive is removed as usual. Or you could STOP the motor at any time before a limit is reached, and the next TOGGLE will resume motion in the opposite direction. Or you could TOGGLE the motion at any time. So as far as I can tell, this covers everything- all you need to know is that either of the momentaries pressed by the user are held down until the motor moves/stops- then you can release. Make the
4013 one-shot about 100ms. O.LIMIT means the curtain "open" limit etc.
Yes. Or, if a current limiting approach proves viable, I'd only need the toggle and emergency stop. And I could eliminate the latter too. I intend to add a power supply switch anyway. During this experimental stage it's darned inconvenient having to unscrew a connector in my 13V line, which is what I've been doing. Once added, I could obviously use it as an 'emergency stop', so no need for a STOP button.
I'm not sure either! After several successful tests last night, in both directions, this morning the toggle failed to open the curtains. I had to use the Stop button to remove motor power. (That has to be done fairly quickly to avoid overheating of the PNP I use in the
13V-to-3.5V supply.) I then manually opened them, after which the toggle *did* work, in either direction. So at best that indicates unpredictability, which squares with your analysis above.
I didn't! Last night I started trying to do just that, but so far unsuccessfully. Of course, I can easily simulate specific states. But for a transient analysis I'm trying to provide appropriately timed input signals to voltage-controlled switches, to simulate each button and microswitch. Ambitiously I retained the debouncing
and also tried to include noise in my input signals. Today I'll simplify, and post later if I make progress.
BTW, another thought occurred to me. How about arbitrarily delaying one of those 'simultaneous' stop pulses I had, with a simple RC? Maybe cleaned up with another NOR or two. If the first pulse arrived at the bistable that was already on, it would be ignored. A moment later, the second, which must be off, would be switched on. Does that sound promising?
(See my comments at end.)
That looks good. I'll have to study it properly later.
But if I rebuild (as is looking increasingly likely), I'm still rather keen on the current limiting idea. What do you think? Big attractions are that it would get rid of both limit switches, and provide protection in the event of jamming. So far my project hasn't been immune from that. The basic mechanism I've improvised has been basically sound. But, as you see here
the Open Stop (OS) microswitch is being forced well beyond its correct operating point. I've improved this since the photo by reducing motor voltage (and hence the associated over-run), but jamming remains possible.
For completeness, I'd also add that one other requirement is to retain the versatility of being able to trigger operation electronically. That's why I went for a bistable approach rather than the inherently more reliable method I'd used for my window opener project years ago, with NC microswitches actually disconnecting *power* at the limits. For example, I've added a simple LDR/Schmitt circuit for automatic dawn/dusk operation (when we're away).
Forgot to respond to that point. This is what the rest looks like. (Except for power supply; I've recently replaced 3 NiCads and their trickle charge with a simple 13V to 3.5V supply. 13V drops to about
Sounds promising, I'll try it. Just gone down with a lousy cold though, so may be a day or so before I can renew my enthusiasm!
So far haven't measured stall & running current. What would be a reasonable delta to make detection reliable anyway? 20%? Presumably I'd have to insert some simple RC delay section to ensure that the high switch-on current didn't spuriously turn the motor off again?
The toggle approach seems very attractive to me. Not only does it reduce wiring and eliminate the rather ugly microswitches, but you can after all always *see* whether a curtain (blind) is open or closed. The action a user wants is simply 'change state'. As you may have seen in my last reply to Fred, I'm probably not even going to retain the STOP switch, as the power supply ON/OFF will cover the need for emergency stops.
I did like your idea of cutting off *movement* quickly following the curtains reaching either limit, even though extra complexity in the circuit would be needed. But, with microswitches eliminated in favour of a current limiting circuit, I reckon that wouldn't matter any more. I've inserted elastic in the cord (in two places), so that would allow some tolerance.
Leaving this thing on while away for two weeks holiday still worries me a bit though! I'm inclined to think of adding some sort of temperature-based fail safe too...
I've now successfully simulated my basic circuit. For each 'scenario', I had to consider whether the limit switches were held on or not. I didn't really have any serious doubts about that affecting operation, but tediously simulated both to be sure. Here are the 4 results so far. Note that clean pulses are assumed.
I've shown the circuit setup (for just the last, most complex scenario). Those parts on the left are just voltage controlled switches, fed with appropriately timed pulses to represent what's going on. For example, the Open switch is pressed for 100 ms, starting (arbitrarily) at time t = 200 ms.
Building on that foundation, I'll now simulate the existing 'iffy' toggle, to see if that sheds any further light.
I am certain that you cannot TOGGLE those latches.
I would stay with the limit switches and clean up the packaging. Is there some reason why you can't use a reed switch(s)? Is the motor interfering with it? Forget the current limiting and use a PTC resettable fuse for protection against some kind of stall malfunction. And for unattended operation put a thermal fuse in line with the 12V that melts at 150oF motor case temperature.
You can add an external overdrive of the basic circuit for an LDR triggered mode like shown below. The logic is that if the LDR commands OPEN and the circuit is in any state except O.LIMIT then the motor is driven into O.LIMIT where the STOP_LATCH overdrive, SODR, is removed which turns the motor off- and similarly for CLOSE. The nice thing is that there is no memory in play so that it is immune to prime power failure - the shades will always end up in the right position when power returns. This EXT interface overrides everything else so the only way to turn it off is to throw the EXT SW to the OFF position. There can be no over limit failure with the motor commanded beyond the stops because the LIMIT switches over drive the 4013 output via R/S so that the motor is commanded away from the limit once it is reached- it doesn't move away because the STOP_LATCH kills the motor drive. It is important that the LIMIT switches close and remain closed regardless of motor over travel- reeds are ideal for this. This is a total of four chips 2x NOR, 1x OR, and 1x 4013. You can easily simulate this- just omit the 4013 one shot which is not needed to verify logic operation. Hopefully CM has switches you can open/ close interactively.
It may be better to require that TOGGLE be held down with automatic STOP when it is released. Then you get your reversing action and stop in a single switch. A TGL2 input to the SODR logic has been added to debounce that output, and this should be included in the previous schematic as well. The circuit now looks like this: View in a fixed-width font such as Courier.
Can this motor be PWM'ed? You might give that a try- you need something like 25% duty off the 12V. And since there is not a lot of difference between stall/run current, this is even more reason to go with a thermal fuse on the case to break the power. Getting back to the suggested circuit in this subthread- although the LIMIT switches do not require debouncing in manual mode due to the latching action of the 4013, they do require debouncing in EXT mode because the bounce transmits directly through the SODR output enabling/disabling the OPEN/CLOSE outputs. This is fixed with a 555 one-shot which catches any bounce having effect on your final relay drivers, and it debounces the EXT MODE switch as well. Once again , there is no memory and operation is immune to power failures which I assume may be of some importance to unattended operation.
I did think about PWM at one stage, but decided that it was probably a bit OTT for a curtain controller. The motor is now running at a reasonably 'calm' speed.
Re the stall/run delta, did you see my latest figures measurements? They appear to show a quite large difference. My earlier 3.0/2.4A were recalled from trying identical motor on the bench, fed from variable power supply. I now realise that supply was probably inadequately rated to give a reliable result. The *actual* motor is powered by a heavier duty fixed 13V supply, via long cable pair to bedroom, and - as you saw - measuring current proved more difficult than I'd expected.
OK, good point, thanks.
I reckon my next step will be to redesign the connectors, so that I can swap trial circuits more readily. At present, all wires go to a set of 14 connector blocks on outside of enclosure, and then by permanent wires to circuits. I need to isolate the relay/motor section and make the rest easily 'pluggable'.
I'll then try your alternative circuit below, and at least the two others from you and John Fields that are pending experiment.
I assume you saw my simulations described in news: firstname.lastname@example.org and shown at
You are not going to be able to do a toggle with just the NOR latches-that requires a master-slave set-up, so you might as well just use a 4013 or some other FF in the logic family.
It doesn't make any sense to have all those switches- too complicated. How fast does this mechanism move the curtains? I expect it's fast if you had to "tame" the motor. If that's the case then a single TOGGLE with automatic stop when released has to be simpler to operate than all this direction control with separate stop switch. If it's slow moving then a single TOGGLE with automatic stop on release modified so that say a 5 second hold down prevents stop on release and runs curtains to limit would be a workable substitute.