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.

4066 Analog switch reliability

Status
Not open for further replies.

prprog

Member
The sensor is formed by a series of copper trace that do not touch. A resistance material is put over the sensor so, when it is press the resistance is lower and a voltage generated and detected by the Comparator (LM339).
The voltage activates the 4066 analog switch. If I don't used the .047uf capacitor the switching is unreliable. It fluctuates on-off.

With the .047uf cap it works better. It doesn’t fluctuate...but the switching is not fast enough. [I try a small Capacitor value and the erratic on-off behavior continues. A large cap value takes to long to activate the switch. (The 4066 substitutes a piano keyboard - this is how I know that its behavior is not fast enough). I believed this is because of the charging/discharge time of the cap. What can I do to make it switch faster?

(the control input lines off the 4066 are connected to ground. Also the inputs of the LM339.)

Thanks,
 

Attachments

  • electronic_switch.GIF
    electronic_switch.GIF
    6.4 KB · Views: 1,201
Last edited:
Instead of the capacitor (and its RC time constant) you may add histeresis to the comparator circuit.

Use a large value resistor between the comparator's output and its "+" input.

If the "+" input is the one attached to the sensor (1MΩ to ground) try 10MΩ, if the "+" input is the reference divider (two 100KΩ) try something like 470KΩ to 1MΩ.
 
Last edited:
I agree with ecerfoglio. You need hysteresis.
I would try to do it like this. It should work, if the resistance of your touch pad will go low enough. If not, you could try changing the 1Meg to a larger value. I built in lots of hysteresis for noise immunity, but you still might need a small capacitor across your touch pad, because your body will probably pick up noise from the mains.
 

Attachments

  • electronic_switch1.GIF
    electronic_switch1.GIF
    5.9 KB · Views: 658
The original circuit had the 100k and 10k resistors as negative feedback. A comparator must never have negative feedback because it is not frequency compensated like an opamp.
A comparator oscillates at a high frequency with negative feedback.
 
The original circuit had the 100k and 10k resistors as negative feedback. A comparator must never have negative feedback because it is not frequency compensated like an opamp.
A comparator oscillates at a high frequency with negative feedback.
Look again. Pin 3 is Vcc.:p
 
I agree with ecerfoglio. You need hysteresis.
I would try to do it like this. It should work, if the resistance of your touch pad will go low enough. If not, you could try changing the 1Meg to a larger value. I built in lots of hysteresis for noise immunity, but you still might need a small capacitor across your touch pad, because your body will probably pick up noise from the mains.

Thanks a lot ecerfoglio (Muchas gracias). I try a small cap .047 uf and the noise was gone. I also try the hysteresis suggestion - but it did not make to much of a difference. In summary it work now, but the switching is not fast enough. Any suggestions?

Thanks,
 
Thanks a lot ecerfoglio (Muchas gracias). I try a small cap .047 uf and the noise was gone. I also try the hysteresis suggestion - but it did not make to much of a difference. In summary it work now, but the switching is not fast enough. Any suggestions?

Thanks,
Did you try the circuit changes I suggested?
 
Did you try the circuit changes I suggested?

Yes I did. The results are the same. The new circuit (Roff suggested circuit) works...but still it needs the capacitor on the sensor, which makes its behaviour slower. I am using a .047uf cap.

Thanks.
 
Last edited:
I don't see why the 339 would not be fast enough. Perhaps it is your touch sensor. Maybe it is holding a charge and needs a little load. Just a thought
 
I don't see why the 339 would not be fast enough. Perhaps it is your touch sensor. Maybe it is holding a charge and needs a little load. Just a thought
As I said previously, I suspect he is injecting AC picked up by his body from nearby mains wires. You don't see many DC touch switch circuits, possibly for that reason. Perhaps if the application required a toggle function, you could make it work in the presence of mains noise.
 
I don't see why the 339 would not be fast enough. Perhaps it is your touch sensor. Maybe it is holding a charge and needs a little load. Just a thought

I did some test just using the sensor, some resistors and the 4066 and there is definetly AC noise pickup by the sensor. (touching the sensor with an rubber eraser does not make it work...but touching it bare hand makes a different behaviour, it works but very noisy . It turn on-off very fast).
The correct behaviour must be to stay on when touch.

How do I set "a little load" on the sensor? (for the comparator circuit)

Thanks a lot.
 
Last edited:
The original circuit had the 100k and 10k resistors as negative feedback. A comparator must never have negative feedback because it is not frequency compensated like an opamp.
A comparator oscillates at a high frequency with negative feedback.

It's possible to use a comparator as a poor man's op-amp (with negative feedback) but you need to add a capacitor in the feedback network to prevent oscillation.
 
It's possible to use a comparator as a poor man's op-amp (with negative feedback) but you need to add a capacitor in the feedback network to prevent oscillation.

The original circuit had negative feedback which is not wanted and then the uncompensated comparator will oscillate at a high frequency. A capacitor across the feedback resistor will make the oscillation worse because then the closed-loop high frequency gain is reduced to 1.

An opamp is compensated with an internal capacitor that reduces its gain at high frequencies so that it doersn't oscillate when negative feedback is applied. A comparator does not have an internal compensation capacitor so it has phase-shift and plenty of internal gain at high frequencies.
 

Attachments

  • LM339.PNG
    LM339.PNG
    13.5 KB · Views: 355
Last edited:
The original circuit had negative feedback which is not wanted and then the uncompensated comparator will oscillate at a high frequency. A capacitor across the feedback resistor will make the oscillation worse because then the closed-loop high frequency gain is reduced to 1.

An opamp is compensated with an internal capacitor that reduces its gain at high frequencies so that it doersn't oscillate when negative feedback is applied. A comparator does not have an internal compensation capacitor so it has phase-shift and plenty of internal gain at high frequencies.
The original circuit didn't have any feedback.:confused:
I think Hero means you can add a pole in the loop (cap from output to GND) to stabilize an LM393 which has negative feedback. I don't htink he was implying that that is needed here. I seem to recall trying that and getting some low-level oscillation on the output, but my memory may be faulty.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top