electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links  |  Store
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 
Live streaming at radio.electro-music.com

  host / artist show at your time
  bingsatellites Mostly Ambient
Please visit the chat
 Forum index » DIY Hardware and Software » Developers' Corner
pwm in, pwm (half frequency) out [solved]
Post new topic   Reply to topic Moderators: DrJustice
Page 1 of 1 [8 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
befacosynth



Joined: Jul 20, 2010
Posts: 21
Location: Barcelona

PostPosted: Fri Jul 15, 2011 10:24 am    Post subject: pwm in, pwm (half frequency) out [solved]
Subject description: how to divide frequency an keep the same duty cycle
Reply with quote  Mark this post and the followings unread

hi!

i want to add this to my new vco, but i can't find how, i also don't know if useful in any way, but i want to try; the idea is to take the pwm signal and divide the frequency by two but keeping the same duty cycle, any ideas?

_________________
Nueva web y foro sobre sintes en español en
http://www.befaco.org

Last edited by befacosynth on Thu Jul 21, 2011 4:11 pm; edited 1 time in total
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1092
Location: West Red Spot, Jupiter
Audio files: 138

PostPosted: Fri Jul 15, 2011 12:07 pm    Post subject: Reply with quote  Mark this post and the followings unread

If you halve the PWM carrier frequency, the high and low sections of each cycle must be twice as long. This will preserve the duty cycle.
_________________
FPGA Synth Stuff
FatMan Mods
dsPIC Synth Stuff
I am formerly known as ScottG here

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
If butts had nipples, why have tits?
Back to top
View user's profile Send private message Visit poster's website
befacosynth



Joined: Jul 20, 2010
Posts: 21
Location: Barcelona

PostPosted: Fri Jul 15, 2011 12:39 pm    Post subject: Reply with quote  Mark this post and the followings unread

but...
how to do this electronically?
Thanks

_________________
Nueva web y foro sobre sintes en español en
http://www.befaco.org
Back to top
View user's profile Send private message Visit poster's website
JovianPyx



Joined: Nov 20, 2007
Posts: 1092
Location: West Red Spot, Jupiter
Audio files: 138

PostPosted: Fri Jul 15, 2011 1:11 pm    Post subject: Reply with quote  Mark this post and the followings unread

If this is a digital thing, it's easy to change the code to do it.

I assume you mean an analog "box" where PWM goes in and comes out at 1/2 the carrier frequency. I could do it with a PIC, but that would be digital - essentially, I would input the PWM on a digital pin and time the high and low phases. I would sample a high, low, high and a low and output a single high and a single low both at twice the time. There would be a 2 cycle lag however.

As for pure analog? Maybe someone eles?

I'm not really sure why you would really want to do this. PWM is always better when the carrier frequency is _higher_, not when it's _lower_.

_________________
FPGA Synth Stuff
FatMan Mods
dsPIC Synth Stuff
I am formerly known as ScottG here

Time flies like a banana.
Fruit flies when you're having fun.
BTW, Do these genes make my ass look fat?
If butts had nipples, why have tits?
Back to top
View user's profile Send private message Visit poster's website
ian-s



Joined: Apr 01, 2004
Posts: 2519
Location: Auckland, New Zealand
Audio files: 42
G2 patch files: 584

PostPosted: Fri Jul 15, 2011 3:57 pm    Post subject: Reply with quote  Mark this post and the followings unread

I think he means regular analog pwm as in early roland/arp synths. Typically a comparator is connected to a sawtooth and a modulation source, so it produces a rectangle whose width varies with the modulation voltage.
The effect is a thicker tone than a static rectangle.

Because dividers only toggle on one edge, preserving the duty cycle does not seem to be easy though. Might be possible with some extra logic. Perhaps it would be better to generate a half frequency triangle (by conditionally inverting the sawtooth with the sub square) and add another pwm comparator? You could then have two identical pulse widths or allow each rectangle to be modulated independently.
Back to top
View user's profile Send private message
befacosynth



Joined: Jul 20, 2010
Posts: 21
Location: Barcelona

PostPosted: Fri Jul 15, 2011 4:28 pm    Post subject: Reply with quote  Mark this post and the followings unread

that is the idea ian! i make the first pwm from the saw and comparator, but how i can make the second saw without messing all around with a square-to-ramp converter (in a wide vco this is difficult to make well done), what you mean with 'by conditionally inverting the sawtooth with the sub square'?
some like a 'analog logic AND ' perhaps?

_________________
Nueva web y foro sobre sintes en español en
http://www.befaco.org
Back to top
View user's profile Send private message Visit poster's website
ian-s



Joined: Apr 01, 2004
Posts: 2519
Location: Auckland, New Zealand
Audio files: 42
G2 patch files: 584

PostPosted: Sat Jul 16, 2011 1:08 am    Post subject: Reply with quote  Mark this post and the followings unread

A triangle core vco sometimes uses a couple of opamps and a switch (cmos or fet) to create a sawtooth from the triangle wave. The square wave is used to switch the inversion on and off every half cycle.

There is an example on this page which uses the technique to produce both a 1F and 2F sawtooth, the only difference being the offset on the triangle.

If you have a sawtooth core, you could use the same switched inverter with a standard square sub octave (4013?) switching the slope on alternate cycles giving a 1/2 F triangle that you can then make a second pwm output from. Might have to de-glitch the triangle though.
Back to top
View user's profile Send private message
befacosynth



Joined: Jul 20, 2010
Posts: 21
Location: Barcelona

PostPosted: Thu Jul 21, 2011 4:19 pm    Post subject: Reply with quote  Mark this post and the followings unread

hi!

i didn't find in th bergfotron's page, but i do on my own way, here is the solution (attached)
as you said there is a spike on the saw, therefore is on the pwm but we can erase it withe the feedback network C7-R40
Thanks for the ideas!
BTW the combined sound with the original pwm (same duty cycle, half freq) is interesting, a plus for a new VCO


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

sub_pwm.png



_________________
Nueva web y foro sobre sintes en español en
http://www.befaco.org
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: DrJustice
Page 1 of 1 [8 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » Developers' Corner
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
emSynth

Please support our site. If you click through and buy from
our affiliate partners, we earn a small commission.


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