electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » Lunettas - circuits inspired by Stanley Lunetta
cmos pwm ?
Post new topic   Reply to topic Moderators: mosc
Page 1 of 2 [32 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Goto page: 1, 2 Next
Author Message
synthesist



Joined: Feb 17, 2011
Posts: 79
Location: austria
Audio files: 2

PostPosted: Mon Jan 07, 2013 5:11 am    Post subject: cmos pwm ?
Subject description: maybe with transistor
Reply with quote  Mark this post and the followings unread

hey !

To change the pulsewidth on a 40106 oscillator you only need to place a diode on the input of the inverter, the other end goes to a variable resistor with its wiper placed to the inverter output.

but how can one modulate the PW? Did anyone try it with a resistor yet?
or is there any other way?
Back to top
View user's profile Send private message
RingMad



Joined: Jan 15, 2011
Posts: 427
Location: Montreal, Canada
Audio files: 4

PostPosted: Mon Jan 07, 2013 8:19 am    Post subject: Reply with quote  Mark this post and the followings unread

Using the following schematic, one can control both the mark & space / duty cycle parts of the square wave. LEDs or diodes like 1N4148 work. You can also use a 4093 NAND gate instead of the 40106 (shorting the 2 inputs together).

To modulate, I guess you could replace the pots with opto-isolators ("Vactrols") LDR/LED combination.

James.


40106-osc-with-mark-space-schematic.jpg
 Description:
 Filesize:  78.48 KB
 Viewed:  57928 Time(s)

40106-osc-with-mark-space-schematic.jpg


Back to top
View user's profile Send private message Visit poster's website
PHOBoS



Joined: Jan 14, 2010
Posts: 5591
Location: Moon Base
Audio files: 705

PostPosted: Mon Jan 07, 2013 8:48 am    Post subject: Reply with quote  Mark this post and the followings unread

hmm, using a shiftregister or divider comes to mind,. but not sure how yet. thinking
_________________
"My perf, it's full of holes!"
http://phobos.000space.com/
SoundCloud BandCamp MixCloud Stickney Synthyards Captain Collider Twitch YouTube
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
elmegil



Joined: Mar 20, 2012
Posts: 2177
Location: Chicago
Audio files: 16

PostPosted: Mon Jan 07, 2013 9:19 am    Post subject: Reply with quote  Mark this post and the followings unread

A & B could be a single dual pot with the two sides wired opposite each other as well. That would give a pretty smoothly changing transition of pulse width.
Back to top
View user's profile Send private message
PHOBoS



Joined: Jan 14, 2010
Posts: 5591
Location: Moon Base
Audio files: 705

PostPosted: Mon Jan 07, 2013 9:38 am    Post subject: Reply with quote  Mark this post and the followings unread

elmegil wrote:
A & B could be a single dual pot with the two sides wired opposite each other as well. That would give a pretty smoothly changing transition of pulse width.

that works, but the frequency will be fixed. You could add another pot in series but because of the pot for the
PWM control the range will be limited. And in turn it will influence the PWM control.

That's a nice thing about the standard saw/triangle + comparator combo,.
you have indepent frequency and pulse width control.

_________________
"My perf, it's full of holes!"
http://phobos.000space.com/
SoundCloud BandCamp MixCloud Stickney Synthyards Captain Collider Twitch YouTube
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
PHOBoS



Joined: Jan 14, 2010
Posts: 5591
Location: Moon Base
Audio files: 705

PostPosted: Wed Aug 28, 2013 12:37 pm    Post subject: gated LFO with pulse width control Reply with quote  Mark this post and the followings unread

ok here is something I just came up with. I wanted to make 1 LFO using
a 4093 but didn't want to waste the other gates so I wondered if I could
add some pulse width control to it.

The first part around U1b is a standard (gated) oscillator but because of
the diode parallel to the potentiometer it creates a pulse. (the output is
high most of the time and the pulse is a low voltage). U1a inverts and
buffers the output. The next part, which looks similar to the oscillator,
adjusts the width of the pulse. Because of the diode the capacitor is
charged instantly and the discharge time is set with the potentiometer.

This creates a problem though, if you set the discharge time longer then
the time between pulses the output wouldn't oscillate anymore which is
what the connection between U1b and U1d is for. This will make sure that
the output still changes.

The circuit isn't perfect. I noticed that if you set the discharge time just
right (or wrong, depending how you look at it) it will toggle between a
short and a long pulse. Also the gate works a bit unusal, and it can be
used as a pulse lenghtener, and I think there is also some delay. Cool

note: replacing the 10uF with a 4.7uF gives a nicer control for the faster
settings, but you won't get the maximum on time at the lowest speed.


gated LFO with PW control.gif
 Description:
 Filesize:  24.86 KB
 Viewed:  1255 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

gated LFO with PW control.gif



_________________
"My perf, it's full of holes!"
http://phobos.000space.com/
SoundCloud BandCamp MixCloud Stickney Synthyards Captain Collider Twitch YouTube
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Cynosure
Site Admin


Joined: Dec 11, 2010
Posts: 966
Location: Toronto, Ontario - Canada
Audio files: 82

PostPosted: Wed Aug 28, 2013 4:20 pm    Post subject: Reply with quote  Mark this post and the followings unread

This is how I do it - especially if my oscillator is a 40106. You can replace the passive filter with VCF for CV control.

I have only tested it with a square wave, but it should work reasonably well for any waveform that spends half the cycle above the midpoint.


pwm.png
 Description:
 Filesize:  2.07 KB
 Viewed:  953 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

pwm.png



_________________
JacobWatters.com
Back to top
View user's profile Send private message
JingleJoe



Joined: Nov 10, 2011
Posts: 878
Location: Lancashire, England
Audio files: 14

PostPosted: Thu Aug 29, 2013 7:06 am    Post subject: Reply with quote  Mark this post and the followings unread

http://www.electro-music.com/forum/topic-55957.html
_________________
As a mad scientist I am ruled by the dictum of science: "I could be wrong about this but lets find out"


Green Dungeon Alchemist Laboratories
Back to top
View user's profile Send private message
Cynosure
Site Admin


Joined: Dec 11, 2010
Posts: 966
Location: Toronto, Ontario - Canada
Audio files: 82

PostPosted: Thu Aug 29, 2013 10:22 am    Post subject: Reply with quote  Mark this post and the followings unread

JingleJoe wrote:
http://www.electro-music.com/forum/topic-55957.html

I guess great minds think alike Smile

It is a pretty simple idea. I am sure that we aren't the only ones who thought of it.

_________________
JacobWatters.com
Back to top
View user's profile Send private message
PHOBoS



Joined: Jan 14, 2010
Posts: 5591
Location: Moon Base
Audio files: 705

PostPosted: Thu Aug 29, 2013 10:37 am    Post subject: Reply with quote  Mark this post and the followings unread

Cynosure wrote:
It is a pretty simple idea. I am sure that we aren't the only ones who thought of it.

check Tim Escobedo's PWM Wink

problem with this method is that it doesn't work with an LFO, or at least you won't get a very width pulse out of it.

_________________
"My perf, it's full of holes!"
http://phobos.000space.com/
SoundCloud BandCamp MixCloud Stickney Synthyards Captain Collider Twitch YouTube
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
jonasx26



Joined: Sep 20, 2009
Posts: 5
Location: Sweden

PostPosted: Fri Aug 30, 2013 12:59 pm    Post subject: Reply with quote  Mark this post and the followings unread

Hi! This might work as an alternate approach. Pulse width totally independent of frequency but the output frequency will be divided by 10.
Heavily inspired by something like a 80s "Allt om Elektronik" (swedish Elektor) article, maybe.. Can't remember where it's from. Anyways, I didn't come up with it. Drawn from memory, presented AS-IS but I'm pretty sure it will work.
I think the original used a NAND/NOR cross-coupled latch instead of the 4013 D-type. But this should be functionally equivalent.
OUT1 is the variable pulse width output.
OUT2 is a constant 50/50 square wave. Essentially the input divided by 10.


Variable Pulse Width.png
 Description:
Variable Pulse Width
 Filesize:  7.13 KB
 Viewed:  802 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

Variable Pulse Width.png



_________________
@jonasjberg Analog be harder than digital.
Back to top
View user's profile Send private message Visit poster's website
trav



Joined: Sep 11, 2012
Posts: 108
Location: Auckland
Audio files: 16

PostPosted: Sun Sep 01, 2013 2:13 pm    Post subject: Reply with quote  Mark this post and the followings unread

hey, I like that solution! sounds like what PHOBoS was thinking in his first post. use a multiplexor instead of S1 and you're in business.
Back to top
View user's profile Send private message
PHOBoS



Joined: Jan 14, 2010
Posts: 5591
Location: Moon Base
Audio files: 705

PostPosted: Mon Sep 02, 2013 7:30 am    Post subject: Reply with quote  Mark this post and the followings unread

trav wrote:
hey, I like that solution! sounds like what PHOBoS was thinking in his first post. use a multiplexor instead of S1 and you're in business.

It is indeed similar to my initial idea. I think I actually have a version of that circuit in a book somewhere that uses 2 4017 counters,
so you can set the dutycyle with 2 rotary switches in steps of 1% instead of 10%. Of course for audiofrequencies it's nice if you can
sweep it without steps, but using a mux might create nice effects.
Idea control the mux(es) with a random generator for random pulsewidth Very Happy

_________________
"My perf, it's full of holes!"
http://phobos.000space.com/
SoundCloud BandCamp MixCloud Stickney Synthyards Captain Collider Twitch YouTube
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
PHOBoS



Joined: Jan 14, 2010
Posts: 5591
Location: Moon Base
Audio files: 705

PostPosted: Wed Sep 11, 2013 7:49 am    Post subject: PWM with a single XOR gate
Subject description: can easily be added to a CD4046 VCO
Reply with quote  Mark this post and the followings unread

here's a method which I thought up while trying to sleep. (I count electrons not sheep).

I have a CD4046 VCO wired up with it's output (pin4) connected to the Internal Phase Comparator I (pin3), which is just an XOR. And at some
point I wondered what happens if you connect the output of the VCO to the signal input (pin14) which is the other input of the XOR. Well that
would mean that the inputs of the XOR are just shorted together and therefor it's output will always stay low. So not very intersting,..

But that got me thinking,. what if I delay one input ? Then the inputs would be different from each other for a short time and therefor it's output
will also be high for a moment. In other words I can control the pulse width. Very Happy A simple adjustable delay can be made with a potentiometer and
a capacitor, and by adding a diode parallel to the potentiometer, the capacitor will get discharged instantly when the input goes low and so will
the output.

I did expect one problem, that is without a schmitt trigger input such a simple delay might not work so well, and cause unwanted oscillations.
So I just breadboarded it but I had to use an external XOR (CD4070) because I have the VCO build on a PCB and only made the XOR output
available. Well, it works perfect. Laughing And the diode seems to take care of the unwanted behaviour I expected, without it I do see and hear some
extra oscillations.

The maximum 'on-time' is the same as the input signal and since the CD4046 has a pulse width of 50% I can't set it longer than
that. So with the right capacitor (dependent on the frequency) it's adjustable from 0 to 50%. But soundwise making it longer would sound
the same anyway. a 500K pot and 10nF capacitors seem to work nice.


fun fact: when I tried to adjust the circuit to work with NAND gates, I ended up with the same circuit I posted before. Cool


PWXOR.gif
 Description:
 Filesize:  15.08 KB
 Viewed:  56191 Time(s)

PWXOR.gif



_________________
"My perf, it's full of holes!"
http://phobos.000space.com/
SoundCloud BandCamp MixCloud Stickney Synthyards Captain Collider Twitch YouTube
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Cynosure
Site Admin


Joined: Dec 11, 2010
Posts: 966
Location: Toronto, Ontario - Canada
Audio files: 82

PostPosted: Wed Sep 11, 2013 12:20 pm    Post subject: Reply with quote  Mark this post and the followings unread

A very ingenious and elegant solution. Nice work Phobos! thumright
_________________
JacobWatters.com
Back to top
View user's profile Send private message
Psyingo



Joined: Jun 11, 2009
Posts: 248
Location: Canada

PostPosted: Thu Sep 12, 2013 9:31 am    Post subject: Reply with quote  Mark this post and the followings unread

pulse width % will vary with frequency. these circuits provides constant pulse duration, so the timbre of the notes will change. with a cap in line with a pot to ground bass notes will sound very thin and reedy, while the higher you go the closer the pulse width percentage will be to 50%. close enough for jazz, though, amirite?
Back to top
View user's profile Send private message
Cynosure
Site Admin


Joined: Dec 11, 2010
Posts: 966
Location: Toronto, Ontario - Canada
Audio files: 82

PostPosted: Thu Sep 12, 2013 10:45 am    Post subject: Reply with quote  Mark this post and the followings unread

Psyingo wrote:
pulse width % will vary with frequency. these circuits provides constant pulse duration, so the timbre of the notes will change. with a cap in line with a pot to ground bass notes will sound very thin and reedy, while the higher you go the closer the pulse width percentage will be to 50%. close enough for jazz, though, amirite?

Good point. It is probably ok for lunetta randomness or if you stay within a certain range, but will sound different as the frequency changes. I guess that is why a comparator on a saw wave is the most common method that I have seen.

It's just a pain to get a saw from a lunetta. The best method I have tested is a R2R ladder on all the outputs of a 4040, but that either requires a lot of resistors or a couple of (relatively) expensive ladder IC's.

_________________
JacobWatters.com
Back to top
View user's profile Send private message
Psyingo



Joined: Jun 11, 2009
Posts: 248
Location: Canada

PostPosted: Thu Sep 12, 2013 10:47 am    Post subject: Reply with quote  Mark this post and the followings unread

could always try this:
you know how the quote goes... "Don't fear the opamp"

Posted Image, might have been reduced in size. Click Image to view fullscreen.
Back to top
View user's profile Send private message
PHOBoS



Joined: Jan 14, 2010
Posts: 5591
Location: Moon Base
Audio files: 705

PostPosted: Thu Sep 12, 2013 10:58 am    Post subject: Reply with quote  Mark this post and the followings unread

yes I think you're correct. The pulse duration is set at a fixed time so if the frequency changes the pulse width will change too. And the pulse
duration will be a smaller % of one period at lower frequencies then at high frequencies. Of course without resquaring the signal it would just be a
passive highpass filter which would have a similar effect on the sound but it's not the same I think. (something with harmonics). So the thin and reedy
sound is in this case a result of changing the pulsewidth.

The circuits I came up work slightly different and work well with low frequencies. At least the first one was designed as an LFO the other one is
just an easy way to add pulse width control to a 4046 but can be used standalone and also works well with an LFO. But the pulse width does also
very with frequency. I don't think there is anyway around it unless you go for a different approach like a sawtooth oscillator + comparator.

edit: I think I need to type faster, this was a reply to psyingo's first post

_________________
"My perf, it's full of holes!"
http://phobos.000space.com/
SoundCloud BandCamp MixCloud Stickney Synthyards Captain Collider Twitch YouTube
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
PHOBoS



Joined: Jan 14, 2010
Posts: 5591
Location: Moon Base
Audio files: 705

PostPosted: Thu Sep 12, 2013 11:13 am    Post subject: Reply with quote  Mark this post and the followings unread

Posted Image, might have been reduced in size. Click Image to view fullscreen.

I would add a diode to create a saw instead of a triangle, else you don't just get pulse width control but phaseshifting aswell (unless that's a wanted feature).
well actually I'd just grab a quad opamp if I go that way, and leave out the 40106 completely.

_________________
"My perf, it's full of holes!"
http://phobos.000space.com/
SoundCloud BandCamp MixCloud Stickney Synthyards Captain Collider Twitch YouTube
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Psyingo



Joined: Jun 11, 2009
Posts: 248
Location: Canada

PostPosted: Thu Sep 12, 2013 11:22 am    Post subject: Reply with quote  Mark this post and the followings unread

PHOBoS wrote:
Posted Image, might have been reduced in size. Click Image to view fullscreen.

I would add a diode to create a saw instead of a triangle, else you don't just get pulse width control but phaseshifting aswell (unless that's a wanted feature).
well actually I'd just grab a quad opamp if I go that way, and leave out the 40106 completely.


very very true. many ways to do it, and i hadn't considered the phasing issue. The OP referred to a 40106 oscillator, but you could do it any way. many ways to do the same thing.
Back to top
View user's profile Send private message
SUGARAT



Joined: Jan 21, 2015
Posts: 19
Location: California
Audio files: 1

PostPosted: Wed Feb 25, 2015 3:18 pm    Post subject: ANOTHER WAY! Reply with quote  Mark this post and the followings unread

Another way to do it is to use a second osc to modulate the pulse width.

If you use a D flipflop and send one osc into the clock and the other into data and also XOR(XNOR?) it with the Q out, you will have a square wave with the period of one and the mark of the other.

Maybe not the best way if you need frequency and pw to always be synced or if you don't want to use a bunch of chips, but this way gives you a lot of control and makes some really crazy sounds if you hit it just right.
Back to top
View user's profile Send private message
izash



Joined: Apr 22, 2010
Posts: 8
Location: Israel

PostPosted: Mon Feb 13, 2017 4:03 pm    Post subject: Re: PWM with a single XOR gate
Subject description: Solenoid Tambourine with PWM
Reply with quote  Mark this post and the followings unread

Dear Phobos,
Thank you for the elegant little PWM solution. It helped me so much to control the shuffle of my Solenoid Tambourine (see video below).
Now if you have a simple Voltage Controlled PWM trick up your sleeve for my Servo drum module...
Izhar
https://youtu.be/0pvNjgsVgSg

PHOBoS wrote:
here's a method which I thought up while trying to sleep. (I count electrons not sheep).

The maximum 'on-time' is the same as the input signal and since the CD4046 has a pulse width of 50% I can't set it longer than
that. So with the right capacitor (dependent on the frequency) it's adjustable from 0 to 50%. But soundwise making it longer would sound
the same anyway. a 500K pot and 10nF capacitors seem to work nice.
[img][/img][url][/url]
Back to top
View user's profile Send private message
PHOBoS



Joined: Jan 14, 2010
Posts: 5591
Location: Moon Base
Audio files: 705

PostPosted: Mon Feb 13, 2017 6:14 pm    Post subject: Re: PWM with a single XOR gate
Subject description: Solenoid Tambourine with PWM
Reply with quote  Mark this post and the followings unread

That's great to hear Very Happy
Nice Solenoid Tambourine, I love those mechanical robotic instruments.
Have you seen my Solenoid Pionoid ? (you can hear it in Friday Night Pianoid Music)

I don't know much about servos and don't have a whole lot of experience with them but maybe you can
get some inspiration from the voltage controlled servo I used for the spring reverb in my Frankensynth.

_________________
"My perf, it's full of holes!"
http://phobos.000space.com/
SoundCloud BandCamp MixCloud Stickney Synthyards Captain Collider Twitch YouTube
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
kaputtpanzer



Joined: Nov 02, 2009
Posts: 139
Location: Cologne
Audio files: 15

PostPosted: Sun Nov 18, 2018 11:02 am    Post subject: Reply with quote  Mark this post and the followings unread

I added some rudimentary cv input to the xor pw controller. Works in simulation. I hope I find some time to breadboard this soon. The duty cycle range (which can be controlled by the control voltage) depends on the input frequency and the capacitance at the second input of the xor gate. With the additional capacitors and switches it should be possible to voltage control the duty cycle (~10-50%, maybe 50-90% with a nand gate instead a xor gate) over a relatively wide range of input frequencies. Not very elegant, but it should work just fine.


pwcvsch.png
 Description:
 Filesize:  11.52 KB
 Viewed:  410 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

pwcvsch.png



pwcv.PNG
 Description:
 Filesize:  32.27 KB
 Viewed:  391 Time(s)
This image has been reduced to fit the page. Click on it to enlarge.

pwcv.PNG


Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic Moderators: mosc
Page 1 of 2 [32 Posts]
View unread posts
View new posts in the last week
Goto page: 1, 2 Next
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » Lunettas - circuits inspired by Stanley Lunetta
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use