Maker Pro
Maker Pro

4066 switches leaking in sample and hold circuit?

AFex54

Apr 10, 2015
144
Joined
Apr 10, 2015
Messages
144
Hi, I'm having a problem when using a 4066 switch in my sample and hold circuit, when I used a mechanical SPST switch to test the S&H circuit when it was on the breadboard it worked great so I know there's nothing wrong with the circuit itself.

when I use the 4066 switch it seems to be leaking with nothing connected to the control pin, I tested with 3 different ICs and they all behave the same so im guess im missing something.

Any ideas what it might be?

Does the control pin need some sort of connection to ground maybe? (I read something about a 'pulldown resistor')

here is a schematic I made for the circuit:
Untitled.png
 
Last edited:

Alec_t

Jul 7, 2015
3,587
Joined
Jul 7, 2015
Messages
3,587
All inputs of CMOS circuits need to be connected to something, not left floating, or you'll get weird results. An unconnected input will probably act as an antenna and pick up all sorts of interference which can cause havoc.
 

AFex54

Apr 10, 2015
144
Joined
Apr 10, 2015
Messages
144
All inputs of CMOS circuits need to be connected to something, not left floating, or you'll get weird results. An unconnected input will probably act as an antenna and pick up all sorts of interference which can cause havoc.
ok thanks, I did a bit of reading and Im pretty sure what I need is a pulldown resistor, to keep the input low even with nothing connected.
Do you know what value resistor I should use?
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
1 kΩ...10 kΩ, whatever you have at hand. Unless you want to switch real fast, this resistor's value is not very important. Too high and the input will still act as an antenna, too low and the resistor will dissipate lots of ower when a high signal is applied.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
though I didnt know how to alternate between ground and 9V other than using a SPDT switch haha
See here. Connect "COM" to the 4066's control input, "L1" to 9 V, "L2" to 0 V (ground). No need for a pull down resistor then.
 

Sunnysky

Jul 15, 2016
541
Joined
Jul 15, 2016
Messages
541
what sample time ?
or is this just a "track and hold circuit"

If using just a simple SPST switch, I would use 10k with 1uF to de-glitch contact bounce, but not critical. This would hold in 10ms .
 
Last edited:

AFex54

Apr 10, 2015
144
Joined
Apr 10, 2015
Messages
144
See here. Connect "COM" to the 4066's control input, "L1" to 9 V, "L2" to 0 V (ground). No need for a pull down resistor then.
other than with a spdt, cos mechanical switches are pretty much the extent of my knowledge on electronics.

1 kΩ...10 kΩ, whatever you have at hand. Unless you want to switch real fast, this resistor's value is not very important. Too high and the input will still act as an antenna, too low and the resistor will dissipate lots of ower when a high signal is applied.
I used a 2k resistor and now the 4066 is working properly, thanks!

but now I have a second smaller issue,
to generate a short trigger for the switch from a 9v pulse im using this differentiator you suggested to me a few months back for a different sample and hold circuit: https://www.electronicspoint.com/attachments/s_h-png.20729/

it is causing the the 4066 to stay closed when it should only be closed for a few μs

EDIT: the differentiator is reading around 6.5V at 'out' when there's no input, also the 9V input is coming from a simple button and not a 555 this time.

EDIT2: I think the problem is that the 555 output does not float while the SPST button would when open.
 
Last edited:

Sunnysky

Jul 15, 2016
541
Joined
Jul 15, 2016
Messages
541
What is you circuit sampling. 1us won't work on 9V with 0.1uF because the ON resistance is ~300Ohms or less @9V. thus need 1ms pulse. Do you really need 1us? then what hold time?
 

AFex54

Apr 10, 2015
144
Joined
Apr 10, 2015
Messages
144
What is you circuit sampling. 1us won't work on 9V with 0.1uF because the ON resistance is ~300Ohms or less @9V. thus need 1ms pulse. Do you really need 1us? then what hold time?
the circuit it sampling voltages from 0V to 9V from a potentiometer voltage divider and nope I dont need 1μs but 1 ms is a bit too long for my liking.
the hold time is completely variable, the voltage will be sampled manually with the SPST button

I just realised i made a mistake and the capacitor value is actually 0.01uf... would a shorter sample time than 1 ms be possible now?

To clarify it is for a CV(control voltage) keyboard for a synthesizer, so the sampling would take place when you press a key (i.e SPST button) and it would be held until the next time you press a key, however the voltage only matters for the duration of a note which would be about 10 seconds at most and 1-2 seconds on average.
 
Last edited:

Sunnysky

Jul 15, 2016
541
Joined
Jul 15, 2016
Messages
541
that's better 30μs, then would be good.

much less and the switch cannot compete the charge for a rapid change in voltage. using my est. 10RC = 10*300Ω*0.01μF= T= 30us

Then we need to know the switch voltage and impedance and if there is contact bounce or if it is already denounced to make it as simple as possible.

If you know that it comes from 9V CMOS logic chip then I would say it is 300 Ohm's as well.
 

AFex54

Apr 10, 2015
144
Joined
Apr 10, 2015
Messages
144
that's better 30μs, then would be good.

much less and the switch cannot compete the charge for a rapid change in voltage. using my est. 10RC = 10*300Ω*0.01μF= T= 30us

Then we need to know the switch voltage and impedance and if there is contact bounce or if it is already denounced to make it as simple as possible.

If you know that it comes from 9V CMOS logic chip then I would say it is 300 Ohm's as well.
yes the switch is a 4066 CMOS switch running on 9V , being triggered by 9V.
I have not yet added anything to prevent contact bounce
 

Sunnysky

Jul 15, 2016
541
Joined
Jul 15, 2016
Messages
541
Assuming bounce time is <30ms worst case , one solution is to use the leading edge to trigger a retriggerable 1-shot of 30ms where it's output leading edge triggers a 2nd one shot of 30us. Connecting the pins and choosing the RC time constants is easy for any design engineer with a schematic entry tool.. .. not on my iPad.

https://www.fairchildsemi.com/datasheets/74/74VHC123A.pdf
 

AFex54

Apr 10, 2015
144
Joined
Apr 10, 2015
Messages
144
Assuming bounce time is <30ms worst case , one solution is to use the leading edge to trigger a retriggerable 1-shot of 30ms where it's output leading edge triggers a 2nd one shot of 30us. Connecting the pins and choosing the RC time constants is easy for any design engineer with a schematic entry tool.. .. not on my iPad.

https://www.fairchildsemi.com/datasheets/74/74VHC123A.pdf
What are the negative effects of bouncing in this circuit?
I wouldnt think it would pose much of a problem for my application
 

AFex54

Apr 10, 2015
144
Joined
Apr 10, 2015
Messages
144
it depends. if you tried ok
ok.

the intial problem I was having with the differentiator circuit above was that the CMOS switch was being held closed even when the spst button was open, the differentiator has 6.5V at 'out' with its input floating, do you know why this is?

edit: sorry I think I made the mistake of trusting my voltameter too much, I was measuring from 'out' with the common probe on ground so what i was seeing is just the positive rail
 
Last edited:

AFex54

Apr 10, 2015
144
Joined
Apr 10, 2015
Messages
144
+rail should be 9V for pullup R on collector.
I checked again and now im getting 5V on the collector...

not sure what im doing wrong, checked for bad solders and there isnt any so i guess theres no explanation
 

Sunnysky

Jul 15, 2016
541
Joined
Jul 15, 2016
Messages
541
if Vbe= then collector current=0 then Resistor voltage on supply and collector side should be same. which is? 9v
if not check my assumptions or bad part or ESD damaged CD4066
 
Top