Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Modifying toggle switch to automate delay

Status
Not open for further replies.

speedorhaste

New Member
Here is my challenge:

My car is a convertible and the roof is folded up and down by a two way momentary close toggle switch. The switch sends the up/down signal to an ECU which then controls an electric motor, hydraulic pump, etc.

To operate the roof, you have to hold the toggle switch in the up / down position until the roof has completed its fold / unfold process. The process takes about 35 seconds in either direction.

What I would like to do is add an interface between the switch and the ECU so that the signal is held for the required time. I have worked out this is feasible by using, say, a 556 timer configured as a flip/flop, so that the two momentary contacts in the existing switch act as the set and reset buttons. The toggled outputs can then drive separate relays which send the signal to the ECU. To automatically provide the hold down time, I can insert 555 timers which are triggered by the flip flop output, and which complete the circuit to fire the relays. I am pretty sure this will work.

The only problem is that I need the ability to be able to interrupt the timer mid way through its cycle. This is necessary in case something obstructs the roof part way though its movement, or if you just want to raise/lower it part way for maintenance. Being constrained to use only the existing 2 way momentary on toggle switch, I am looking for a way to reset the active 555 timer, by either pressing the switch once again in the same direction, or alternatively in the reverse direction. With the circuit I have described so far, pressing the toggle again in the same direction would do nothing (as the flip/flop will not change state) and pressing in the reverse direction will send the roof movement back the other way - so neither action with this initial circuit idea can actually stop the roof mid way.

Can anyone give me a hint as to what I need to add to this circuit idea to provide the desired "hold" control? It may be the answer lies in a totally different approach (a programmed PIC for example) but that is way beyond my knowledge.

Hope someone finds this a useful challenge.
 
[QUOTETo operate the roof, you have to hold the toggle switch in the up / down position until the roof has completed its fold / unfold process. The process takes about 35 seconds in either direction.
][/QUOTE] The fact that you have to hold the switch is a fail safe in case somthing goes wrong. It is set up as a dead man switch.You should not try and bypass this Safety Feature. Andy
 
Andy

Thanks for your comments. I agree that the manual hold requirement might serve as a safety feature. However, there are other safety features, including the electric motor stopping as soon as there is any interference and motor lockout if the engine is running or the boot is open. So essentially you can't operate the roof unless the car is fully immobilised. One problem with the current design is that sometime if your finger slips off the button, the ECU loses track of where the roof is and locks it out - you have to then manually manipulate the roof through its entire cycle to reset the memory. Very frustrating. Other more recent models no longer require manual hold on the switch and set the roof in motion with one press. I am really just trying to replicate the new design.

Regards
 
OK will the roof stop its self at ether end? IE if you hold the button to long? I am thinking it may be better using limits for open and close insted of time, but if the limits are allready built in you maybe OK if not you may what to add them. Andy
 
Yes, when the roof reaches the end of its travel in either direction the electric motor, which drives the hydraulic pump, automatically shuts off. if you keep pressing the button after the roof has reached the end of travel there is (correctly) no response. So I think this means it has limits already built into the existing circuit.
 
The sunroof on my car does the following:
Tap OPEN , automatic open
Tap OPEN again, unit stops; tapping close - not sure what happens- either auto close or stop
HOLD OPEN; Drives in the open direction as long as open is pushed.

Same for CLOSE

Switch has Momentary contact for OPEN and Momentary for closed with Center OFF.

It has more options done with the same switch which aren't applicable here.


I think this is sort of what your trying to do?
 
Last edited:
Yes, that is correct. The switch is a two way toggle, momentary contact for open (press one way) and close (press the other way). But it currently has none of the smarts your car has. You hold all the way to open or close. The functions you describe is what I am trying to replicate, using the same switch.
 
If you're happy with the following functionality, a simple 4013 circuit can be used.
* Tapping the OPEN switch will toggle the self-resetting (35 seconds) OPEN flipflop and reset the CLOSE flipflop. The OPEN flipflop output drives the OPEN output.
* Tapping the CLOSE switch will toggle the self-resetting (35 seconds) CLOSE flipflop and reset the OPEN flipflop. The CLOSE flipflop output drives the CLOSE output.

If you want the HOLD = MANUAL CONTROL and TAP = AUTO CONTROL that KeepItSimpleStupid wrote of, the second more complex circuit should do it. It is the same as the above , except for the following:
* Holding the OPEN switch > 1 second disables the OPEN flipflop, but keeps the OPEN output on until the OPEN switch is released.
* Holding the CLOSE switch > 1 second disables the CLOSE flipflop, but keeps the CLOSE output on until the CLOSE switch is released.

You can also do the above with any PICmicro; it's a simple program, and you won't have any trouble getting someone to write it for you. You might even be able to get someone to program your PIC if they're in your country and you ask nicely.

Sorry about the attached images, if you can't make them out, I can scan and repost tomorrow.
 

Attachments

  • auto.jpg
    auto.jpg
    130.3 KB · Views: 198
  • auto + manual.jpg
    auto + manual.jpg
    241.5 KB · Views: 247
I'd like you to look at CPUStick™ and StickOS™ -- Embedded Systems Made Easy. You can put the Basic language system it uses in Windows to play. Of course, it doesn't do much. Look for "Stickos" on Youtube and there are some useful videos there. I just ran into this system recently and was impressed.

There is another development/breadboard system that uses StickOS that also seems promising. I'll see if I can locate that information and post a reference.

Your doing a one-of and development systems are usually costly.

I think we can assume that this system does not have to be powered at all times. That avoids quiesent current issues, wake up and all of those complications.

An interface to the switch with hardware or software switch debouncing (2 inputs) and also (2 ouputs) that would drive relays (one possible way) that simulates the switch. Using direction and a not enable relay may be safer than FWD and REVERSE relays.

Add one other input that detects whether or not the motor is running,you can add some built in safety to the mess.
e.g. If motor is not running within x sec, then turn off "switch".

I'll try to post a reference to the other development/breadboard system.
 
KeepItSimpleStupid; Um well that seems alittle overboard for somthing that can be done nicely with some simple analog circuitry. Andy
 
Thanks everyone for their contributions. I will be away for work for the next couple of days so won't be able to do much with this until probably the weekend - but you have given me plenty to look at. Not sure how I would cope with the Stickos stuff but I'll have a read of it to see if any of it gells.

Regards
 
Dougy83

I have had a chance now to look at your circuit, which has prompted me to look at and understand how a 4013 operates. I have a couple of questions:

When power is first applied to the circuit and neither the up or down toggle switch has been activated, what is the state of the outputs? Are both Q and /Q low?

If I understand your description and the circuit, each subsequent press of the toggle in the same direction (e.g. 2 presses up) will toggle the Q and /Q outputs between high and low. Is that correct? Ifso, this provides the ability to interupt the timed sequence in either direction of the roof without sending the roof back in the other direction.

For the inverting buffers in the second version, would a 4069 be suitable?

The output current of the 4013 is insufficient to drive a relay. Is that correct? I expect I would just need to insert an NPN transistor between the power supply and the output signal to drive a relay?

I do have trouble reading your sketches in terms of the capacitor values - having trouble working out what is a "U" and what is an "n". If they are all "U" (microfarads) then I should be fine.

Thank you greatly.
 
When power is first applied to the circuit and neither the up or down toggle switch has been activated, what is the state of the outputs? Are both Q and /Q low?

If I understand your description and the circuit, each subsequent press of the toggle in the same direction (e.g. 2 presses up) will toggle the Q and /Q outputs between high and low. Is that correct? Ifso, this provides the ability to interupt the timed sequence in either direction of the roof without sending the roof back in the other direction.

look at the Truth Table for the 4013. https://www.energies.alba-annuaire.fr/data/cd/CD4013.pdf Andy
 
Thanks Andy,

I have looked at the same table from elsewhere but struggle to understand which state corresponds with initial power up. In the circuit, /Q is tied to D, so value of D depends on value of /Q - which one is determined first? Assuming that the appropriate line in the truth table at power up is one of the last three as there is no signal on CLK, the answer does not matter. Input S is not used in the simpler circuit, so do I presume this is tied to 0 volts (?). Input R is initially low, so got that one sorted. Input CLK is initially low, and no rising or falling signal, so OK with that. Those combinations of inputs (CLK = X, D = X, R = 0, S = 0) don't align with any of the options in the table. If I created another line with S = 0, does that force Q to 0? Obviously what I want on start up is Q = 0.
 
When power is first applied to the circuit and neither the up or down toggle switch has been activated, what is the state of the outputs? Are both Q and /Q low?
Q & /Q will be in opposite - but unknown (oops) - states.
If I understand your description and the circuit, each subsequent press of the toggle in the same direction (e.g. 2 presses up) will toggle the Q and /Q outputs between high and low. Is that correct? Ifso, this provides the ability to interupt the timed sequence in either direction of the roof without sending the roof back in the other direction.
That's the plan.

For the inverting buffers in the second version, would a 4069 be suitable?
I'd recommend an inverting gate with a schmitt trigger input, e.g. 40106, 74C14 or 4093.

The output current of the 4013 is insufficient to drive a relay. Is that correct? I expect I would just need to insert an NPN transistor between the power supply and the output signal to drive a relay?
That's right. The transistor will work too. Remember to put a flyback/freewheel diode across the relay coil to protect the transistor.

I do have trouble reading your sketches in terms of the capacitor values - having trouble working out what is a "U" and what is an "n". If they are all "U" (microfarads) then I should be fine.
Yeah, sorry; they're all 'u's.

I have looked at the same table from elsewhere but struggle to understand which state corresponds with initial power up. In the circuit, /Q is tied to D, so value of D depends on value of /Q - which one is determined first?
It could be anything. Sorry for the oversight. Simply connect the 10uF cap between supply+ and the R pin instead of to gnd. And the first circuit should have the series 10k and diode in parallel with the 4M7 resistor, as per the second circuit or else the outputs will be disabled for 30seconds.
Input S is not used in the simpler circuit, so do I presume this is tied to 0 volts (?).
yes

Input R is initially low, so got that one sorted.
It will be initially high once you switch the 10u cap connections thus providing a known powerup state.
Those combinations of inputs (CLK = X, D = X, R = 0, S = 0) don't align with any of the options in the table
For that state, the outputs don't change. If CLK changes, the outputs will reflect the D input.
Obviously what I want on start up is Q = 0.
The 10u cap from the +ve supply to R will do that.
 
Last edited:
Thanks, think I have got all that. I'll do so more work on this over the next couple of days and try to complete a full circuit in my spare time. At least I am learning something as I progress with this!
 
Just so I understand what is happening on the reset input, by changing the 10uf cap to connect to ground:

On start up is it taken high as the cap rapidly charges up

This sets Q low

Does the cap then discharge through Q until it goes low (but this does not change the state of the outputs)

If Clk is pulsed positive, Q goes high and the reset cap starts to charge via the RC network until it goes high again and turns Q off?
 
Just so I understand what is happening on the reset input, by changing the 10uf cap to connect to ground:
It shouldn't connect to ground but to the supply positive

On start up is it taken high as the cap rapidly charges up; This sets Q low
Yep, the Reset input is taken high on startup

Does the cap then discharge through Q until it goes low (but this does not change the state of the outputs)
Yes. The use of the 10k and the diode make the discharge time quite quick.


If Clk is pulsed positive, Q goes high and the reset cap starts to charge via the RC network until it goes high again and turns Q off?
That's correct. The reason that the RC is there is so that the relay turns off after 30 seconds or so; otherwise it would stay on until you toggled it off manually.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top