Oscillating cd40106 and using momentary switches for latching on/off state and capacitance

Thread Starter

crmack

Joined Jun 28, 2019
7
Hi Everyone,

I think this is a pretty dumb question but I am having trouble finding the answer or I am not understanding the answers I'm finding online...

Running at 9V I am oscillating the Schmitt Triggers on the CD40106, this will be used for audio purposes, eventually it will be used as a drone synth with 6 oscillators.

What I want to do is to turn each oscillator on and off as well as switch between capacitors to change the frequency range of each oscillator. This is easy with mechanical toggle switches but I have a bunch of momentary switches that I would like to use.

So, essentially, I'm wondering if it is possible and, if it is, how would I go about getting this functionality. As far as I understand 555 or CD4013 might be useful in this context.

For example what I would like to do is: One press of momentary switch connects pins 1 and 2 of CD40106 for oscillation, another press disconnects. For the 2nd momentary switch 1 press would connect pin 1 of CD40106 to a 0.1uF capacitor, 2nd press would connect a 1uF capacitor.

Sorry for the newbie question.

Thanks
 

MrChips

Joined Oct 2, 2009
30,707
Doable.

For each push-button you need a switch debouncer followed by a T-type flip-flop (which you can make from D-type or J-K flip-flops).

To enable the oscillator, use a logic gate.

To switch the capacitor, leave the 0.1μF capacitor connected. You need to only connect the 1μF capacitor with an analog gate or FET.
 

Thread Starter

crmack

Joined Jun 28, 2019
7
Thanks MrChips for heading me in the right direction.

I'll do some reading now as to how to implement in my circuit.
 

eetech00

Joined Jun 8, 2013
3,858
Hi Everyone,

I think this is a pretty dumb question but I am having trouble finding the answer or I am not understanding the answers I'm finding online...

Running at 9V I am oscillating the Schmitt Triggers on the CD40106, this will be used for audio purposes, eventually it will be used as a drone synth with 6 oscillators.

What I want to do is to turn each oscillator on and off as well as switch between capacitors to change the frequency range of each oscillator. This is easy with mechanical toggle switches but I have a bunch of momentary switches that I would like to use.

So, essentially, I'm wondering if it is possible and, if it is, how would I go about getting this functionality. As far as I understand 555 or CD4013 might be useful in this context.

For example what I would like to do is: One press of momentary switch connects pins 1 and 2 of CD40106 for oscillation, another press disconnects. For the 2nd momentary switch 1 press would connect pin 1 of CD40106 to a 0.1uF capacitor, 2nd press would connect a 1uF capacitor.

Sorry for the newbie question.

Thanks
Hi

If you use a CD4093B NAND chip there are four gates in a package. You can use a one gate to make a Gated Astable oscillator and a second gate to make a debouncer. FYI...this is a square wave generator.

What frequencies are you planning to make selectable? You can vary the frequency by varying the resistance used in the oscillator time constant.

eT
 
Last edited:

Thread Starter

crmack

Joined Jun 28, 2019
7
Thanks eT.

If you use a CD4093B NAND chip there are four gates in a package. You can use a one gate to make a Gated Astable oscillator and a second gate to make a debouncer. FYI...this is a square wave generator.
So, in that case I'd have 2 oscillators and 2 debouncers per chip and then I could I run the debounced switches into something like a SN7476 for the flip flop? I'll definitely try this out.

What frequencies are you planning to make selectable? You can vary the frequency by varying the resistance used in the oscillator time constant.
Yeah, I'm aware you can do this but I want each oscillator to have a limited frequency range when turning the pot so there is the ability for a bit of fine-tuning while also being able to switch different oscillators from a bass to mid and mid to treble etc via switching the capacitor.

Thanks again for your response
 

danadak

Joined Mar 10, 2018
4,057
This is strictly for future design consideration, if you ever get into processors.

This approach uses on chip DDS components to set fairly precise frequency to
on chip WaveDACs to generate sine, triangle, square, saw, user defined.....

A component refers to an onchip resource.

The onchip A/D samples 4 pots to control the DDS frequency, hence WaveDAC output
frequency. You can easily set the range of control in code. No capacitors needed to
switch freq range, DDS does all that for you. Just tell it in code with a simple write
of the freq you want, it generates the freq for that channels WaveDAC which sets
the output waveform frequency.

Just showing you some of the stuff you can do beyond discrete logic these days.
All on one chip, in this case a $ 10 board.

upload_2019-9-9_8-27-42.png

I was building synthesizers out of gates and flops and basic binary counters
in the 70's, and now retired thinking I should tackle one in todays technology
for fun.

The above takes some coding, my estimate maybe 20-30 lines of C code
would suffice. This chip can do up to 4 channels, as shown. Still a number
of other resources left. Like you could use a PC to talk to it and control the
channels from PC. That would take PC code, like Python, to do.

Solution all on one chip. Loads of fun and very flexible to change, improve....
like a breadboard on a chip. Tools and compiler free.


Regards, Dana.
 
Last edited:

MrChips

Joined Oct 2, 2009
30,707
SN7476 is old school. If you want to use ancient components, switch to SN74LS76.

You will find selecting CMOS gates to be beneficial.
Look up 74HCxx and CD4xxx logic gates. For example, 74HC74, 74HC109, 74HC112, CD4013, CD4027, CD4096.
 

eetech00

Joined Jun 8, 2013
3,858
Thanks eT.



So, in that case I'd have 2 oscillators and 2 debouncers per chip and then I could I run the debounced switches into something like a SN7476 for the flip flop? I'll definitely try this out.



Yeah, I'm aware you can do this but I want each oscillator to have a limited frequency range when turning the pot so there is the ability for a bit of fine-tuning while also being able to switch different oscillators from a bass to mid and mid to treble etc via switching the capacitor.

Thanks again for your response
Hi

I missed the toggle part...sorry.
The debouncer would drive a gate that produces a pulse to toggle a CD4013B FF.
The FF would gate the oscillator on/off.

As for devices, stay within the same device family.

eT
 

Thread Starter

crmack

Joined Jun 28, 2019
7
You will find selecting CMOS gates to be beneficial.
Look up 74HCxx and CD4xxx logic gates. For example, 74HC74, 74HC109, 74HC112, CD4013, CD4027, CD4096.
As for devices, stay within the same device family.
Thanks MrChips and eT, I'll stick to the 4000 series of ICs for this project then. I'll keep looking into implementing these into the circuit as logic is pretty new to me at this point.

Solution all on one chip. Loads of fun and very flexible to change, improve....
like a breadboard on a chip. Tools and compiler free.
Thanks Dana, I'll definitely look into this in the future. I've always wanted to do a string synth sort of thing with DAC.
 

AnalogKid

Joined Aug 1, 2013
10,986
Switching between two things with a single-pole pushbutton switch is called a toggle or alternate-action function. One toggle circuit can be built with two inverters, or two NAND gates, or one 555, or 1/2 of a CD4013 dual D flipflop. In all cases, switch debouncing can be built into the toggle circuit.

ak
 

crutschow

Joined Mar 14, 2008
34,281
Here's an example of a PB toggle circuit using a CD4013 D-FF configured as the toggle.
R1 and C1 provide the debounce function by preventing the FF from toggling more than once during the bounce time of the switch (set for about 170ms here, red trace).
100ms of simulated switch bounce is shown for first toggle (blue trace) which is ignored by the circuit.

upload_2019-9-10_23-5-55.png
 
Last edited:

danadak

Joined Mar 10, 2018
4,057
Here's an example of a PB toggle circuit using a CD4013 D-FF configured as the toggle.
R1 and C1 provide the debounce function by preventing the FF from toggling more than once during the bounce time of the switch (set for about 170ms here, red trace).
100ms of simulated switch bounce is shown for first toggle (blue trace) which is ignored by the circuit.

View attachment 185887
Here is a rough equivalent of issue where protection diode current limit of 10 mA
is exceeded, eg. the need for series limiting R between cap and D input, or any
CMOS input, should be used when a large valued Cap is used on input.

upload_2019-9-11_6-32-15.png


D1, D2 are CMOS input protection diodes. I used generic Diode to do sim. V1
is pseudo equivalent to supply collapsing/turnoff.


Regards, Dana.
 
Last edited:

Thread Starter

crmack

Joined Jun 28, 2019
7
Here's an example of a PB toggle circuit using a CD4013 D-FF configured as the toggle.
Thanks heaps crutschow. I'm away at the moment but will give this a go when I get back home. Really appreciate the schem. I think I understand everything except for the two capacitors tied to Pb...

Here is a rough equivalent of issue where protection diode current limit of 10 mA
is exceeded, eg. the need for series limiting R between cap and D input, or any
CMOS input, should be used when a large valued Cap is used on input.
Also thanks Dana, I haven't properly looked into what you're doing here with this one but will do so when I have more time. Very much appreciate this.
 

Thread Starter

crmack

Joined Jun 28, 2019
7
Hi everyone,

Resurrecting this thread as I've had time to implement everyone's suggestions into a circuit and it works really well. So thanks to everyone who has helped thus far.

The problem I'm having now is:

How do you stop the PB button circuit from oscillating between its two states if the push button is held down? i.e.: I'm using a bicolour LED as an indicator for the moment, it works well, flip-flops between states nicely with good timing for the button press etc., however, if you hold the push button down it's starts flip-flopping between the two states until the button is released again.

Is there a way to stop this? I'm essentially using crutshow's schem:
Here's an example of a PB toggle circuit using a CD4013 D-FF configured as the toggle.
R1 and C1 provide the debounce function by preventing the FF from toggling more than once during the bounce time of the switch (set for about 170ms here, red trace).
100ms of simulated switch bounce is shown for first toggle (blue trace) which is ignored by the circuit.

View attachment 185887
Thanks
 

crutschow

Joined Mar 14, 2008
34,281
if you hold the push button down it's starts flip-flopping between the two states until the button is released again.

Is there a way to stop this? I'm essentially using crutshow's schem:
Well it may be essentially my circuit, but it's not my exact circuit, since that will not flip more than once, no matter how long you hold the button down. :confused:
Post a schematic of the exact circuit you used.
 

danadak

Joined Mar 10, 2018
4,057
There is another problem with that circuit, the high C load attached
directly to a pin, in this case you D input of F-F. When part powers
down, depending on supply loads, that can cause high discharge
current thru input protection diode to supply rail, and cause failure
and/or erratic behavior of part.

So a R in series with input, between C and input, will limit current to
spec of 10 mA max.


Regards, Dana.
 
Top