Electronics-Related.com
Forums

Circuit for Randomized Pulse Width Modulation

Started by Robert Martin January 8, 2019
On Wednesday, January 9, 2019 at 3:13:48 PM UTC+11, Robert Martin wrote:
> On 9/1/19 11:04 am, bill.sloman@ieee.org wrote: > > On Wednesday, January 9, 2019 at 10:48:46 AM UTC+11, Robert Martin wrote: > >> I have a CD4060 outputting a 5Vpp 4Hz (4 hertz) square wave at 50% duty > >> cycle. > >> > >> How can I randomly pulse width modulate this so that when a low pass > >> filter is added a constantly changing, "wave-like" arbitrary waveform > >> will be produced? > >> > >> I would prefer analog or CMOS IC's, not a microprocessor, and minimum > >> parts count. > >> > >> The "randomness" does not need to be true but only a reasonable > >> approximation. > >> > >> Thank you for any ideas or available circuit diagrams. > > > > https://en.wikipedia.org/wiki/Pseudorandom_binary_sequence > > > > You can make a pseudorandnom binary sequence in a single-chip processor - it can also be done with long shift registers, and some parts seem to have been designed for the job, but the single-chip microprocessor or a programmable logic chip are the minimum part solution. > > > > I would prefer not to use a micro.
Of course. You'd have to learn more than the bare minimum required to get the job done.
> This circuit uses only two IC's. > http://www.seekic.com/circuit_diagram/Signal_Processing/PSEUDO_RANDOM_BIT_SEQUENCE_GENERATOR.html > > > Any comments? Would clocking it at 4Hz present any problems?
The circuit uses three integrated circuits - two 5-stage shift register and the exclusive-OR gate package. It is singularly un-impressive, clearly designed by somebody who couldn't be bother finding out what parts are available. You can get much longer shift registers - designed for the job - that only provide external output from the stages you need to feed into the exclusive-OR gate, and you can program a programmable-logic device to do all the same jobs in one chip. Clocking it at 4Hz wouldn't present any problems
> Do I understand correctly that the output would be a 4Hz PWM signal at > about 2Vpp?
If you built it with TTL-logic powered from 5V and didn't put a pull-up on the output you'd see about 2V peak to peak. Most people would use CMOS these days, which would give you rail to rail swing - which could be up to 15V with old 4000-series CMOS. More modern parts are mostly only rated for lower supply voltages - 5V or lower. -- Bill Sloman, Sydney
On 10/1/19 12:31 am, Martin Brown wrote:
> On 08/01/2019 23:48, Robert Martin wrote: >> I have a CD4060 outputting a 5Vpp 4Hz (4 hertz) square wave at 50% >> duty cycle. > > XOR it with another free running oscillator of about the same frequency > but with a bit of frequency modulation dither added. >
Yes, but the essence of my original question is how to create "dither" or a degree of randomness at ELF. Robert Martin
>> How can I randomly pulse width modulate this so that when a low pass >> filter is added a constantly changing, "wave-like" arbitrary waveform >> will be produced? >> >> I would prefer analog or CMOS IC's, not a microprocessor, and minimum >> parts count. > > It would be so much easier to do in a PIC or with a shift register. > > https://en.wikipedia.org/wiki/Linear-feedback_shift_register >> >> The "randomness" does not need to be true but only a reasonable >> approximation. >> >> Thank you for any ideas or available circuit diagrams. >> >> Robert Martin > >
On 10/1/19 12:47 am, George Herold wrote:
> On Wednesday, January 9, 2019 at 8:16:36 AM UTC-5, Robert Martin wrote: >> On 9/1/19 5:26 pm, bitrex wrote: >>> On 01/08/2019 06:48 PM, Robert Martin wrote: >>>> I have a CD4060 outputting a 5Vpp 4Hz (4 hertz) square wave at 50% >>>> duty cycle. >>>> >>>> How can I randomly pulse width modulate this so that when a low pass >>>> filter is added a constantly changing, "wave-like" arbitrary waveform >>>> will be produced? >>>> >>>> I would prefer analog or CMOS IC's, not a microprocessor, and minimum >>>> parts count. >>>> >>>> The "randomness" does not need to be true but only a reasonable >>>> approximation. >>>> >>>> Thank you for any ideas or available circuit diagrams. >>>> >>>> Robert Martin >>> >>> I think the simplest way to do it without a uP would to build an analog >>> white noise source a la: >>> >>> <http://www.electro-music.com/forum/phpbb-files/2tran_wn_203.gif> >>> >>> and then aggressively low-pass filter it. then feed your square wave >>> into one input of a comparator and the appropriately-scaled low-passed >>> noise into the other. >> > >> >> I tried using noise, as recommended earlier on this group and elsewhere. >> The filtered amplitude below 10Hz was too low to produce a workable result,
>>
> That makes sense (loss of signal) how about filter it at ~10-100 kHz > and then send it into a counter/ divider to get to lower frequency. > > George H.
Good suggestion. I'll first apply a 1KHz LPF and clip its output to simulate a logic signal into a divide by 100 counter. Robert Martin
On Wednesday, January 9, 2019 at 3:39:10 PM UTC-5, Robert Martin wrote:
> On 10/1/19 12:47 am, George Herold wrote: > > On Wednesday, January 9, 2019 at 8:16:36 AM UTC-5, Robert Martin wrote: > >> On 9/1/19 5:26 pm, bitrex wrote: > >>> On 01/08/2019 06:48 PM, Robert Martin wrote: > >>>> I have a CD4060 outputting a 5Vpp 4Hz (4 hertz) square wave at 50% > >>>> duty cycle. > >>>> > >>>> How can I randomly pulse width modulate this so that when a low pass > >>>> filter is added a constantly changing, "wave-like" arbitrary waveform > >>>> will be produced? > >>>> > >>>> I would prefer analog or CMOS IC's, not a microprocessor, and minimum > >>>> parts count. > >>>> > >>>> The "randomness" does not need to be true but only a reasonable > >>>> approximation. > >>>> > >>>> Thank you for any ideas or available circuit diagrams. > >>>> > >>>> Robert Martin > >>> > >>> I think the simplest way to do it without a uP would to build an analog > >>> white noise source a la: > >>> > >>> <http://www.electro-music.com/forum/phpbb-files/2tran_wn_203.gif> > >>> > >>> and then aggressively low-pass filter it. then feed your square wave > >>> into one input of a comparator and the appropriately-scaled low-passed > >>> noise into the other. > >> > > >> > >> I tried using noise, as recommended earlier on this group and elsewhere. > >> The filtered amplitude below 10Hz was too low to produce a workable result, > >> > > > That makes sense (loss of signal) how about filter it at ~10-100 kHz > > and then send it into a counter/ divider to get to lower frequency. > > > > George H. > > Good suggestion. I'll first apply a 1KHz LPF and clip its output to > simulate a logic signal into a divide by 100 counter. > > Robert Martin
Robert, now that I think about it, I'm not sure that is going to work... or be that useful. If you've got random pulses coming at some rate... then counting to some number is giving you a running average of the counts And I don't think you'll see a lot of variation. One of the pseudo-random shift register things may be better... you can clock at the rate you like. There are not many low frequency noise sources... maybe 1/f noise in the old carbon comp resistors? Geiger counter with weakish source, some chaotic pendulum... George H.
On 10/1/19 1:08 am, bill.sloman@ieee.org wrote:

>> This circuit uses only two IC's. >> http://www.seekic.com/circuit_diagram/Signal_Processing/PSEUDO_RANDOM_BIT_SEQUENCE_GENERATOR.html >> >> >> Any comments? Would clocking it at 4Hz present any problems? > > The circuit uses three integrated circuits - two 5-stage shift register and the exclusive-OR gate package. > > It is singularly un-impressive, clearly designed by somebody who couldn't be bother finding out what parts are available. > > You can get much longer shift registers - designed for the job - that only provide external output from the stages you need to feed into the exclusive-OR gate, and you can program a programmable-logic device to do all the same jobs in one chip. > > Clocking it at 4Hz wouldn't present any problems > >> Do I understand correctly that the output would be a 4Hz PWM signal at >> about 2Vpp? > > If you built it with TTL-logic powered from 5V and didn't put a pull-up on the output you'd see about 2V peak to peak. > > Most people would use CMOS these days, which would give you rail to rail swing - which could be up to 15V with old 4000-series CMOS. More modern parts are mostly only rated for lower supply voltages - 5V or lower. >
Thank you. I always liked the CMOS logic series. Here is my first attempt with a CD4021. https://app.box.com/s/vywrm8iswo3yts3jnyyj19maamla4amq It is an 8 bit adaptation of this 10 bit circuit I posted earlier. http://www.seekic.com/circuit_diagram/Signal_Processing/PSEUDO_RANDOM_BIT_SEQUENCE_GENERATOR.html I am sure there are mistakes, so comments would be very much appreciated. Robert Martin
On 01/09/2019 09:08 AM, bill.sloman@ieee.org wrote:
> On Wednesday, January 9, 2019 at 3:13:48 PM UTC+11, Robert Martin wrote: >> On 9/1/19 11:04 am, bill.sloman@ieee.org wrote: >>> On Wednesday, January 9, 2019 at 10:48:46 AM UTC+11, Robert Martin wrote: >>>> I have a CD4060 outputting a 5Vpp 4Hz (4 hertz) square wave at 50% duty >>>> cycle. >>>> >>>> How can I randomly pulse width modulate this so that when a low pass >>>> filter is added a constantly changing, "wave-like" arbitrary waveform >>>> will be produced? >>>> >>>> I would prefer analog or CMOS IC's, not a microprocessor, and minimum >>>> parts count. >>>> >>>> The "randomness" does not need to be true but only a reasonable >>>> approximation. >>>> >>>> Thank you for any ideas or available circuit diagrams. >>> >>> https://en.wikipedia.org/wiki/Pseudorandom_binary_sequence >>> >>> You can make a pseudorandnom binary sequence in a single-chip processor - it can also be done with long shift registers, and some parts seem to have been designed for the job, but the single-chip microprocessor or a programmable logic chip are the minimum part solution. >>> >> >> I would prefer not to use a micro. > > Of course. You'd have to learn more than the bare minimum required to get the job done. > >> This circuit uses only two IC's. >> http://www.seekic.com/circuit_diagram/Signal_Processing/PSEUDO_RANDOM_BIT_SEQUENCE_GENERATOR.html >> >> >> Any comments? Would clocking it at 4Hz present any problems? > > The circuit uses three integrated circuits - two 5-stage shift register and the exclusive-OR gate package. > > It is singularly un-impressive, clearly designed by somebody who couldn't be bother finding out what parts are available. > > You can get much longer shift registers - designed for the job - that only provide external output from the stages you need to feed into the exclusive-OR gate, and you can program a programmable-logic device to do all the same jobs in one chip. > > Clocking it at 4Hz wouldn't present any problems > >> Do I understand correctly that the output would be a 4Hz PWM signal at >> about 2Vpp? > > If you built it with TTL-logic powered from 5V and didn't put a pull-up on the output you'd see about 2V peak to peak. > > Most people would use CMOS these days, which would give you rail to rail swing - which could be up to 15V with old 4000-series CMOS. More modern parts are mostly only rated for lower supply voltages - 5V or lower. >
I could whip up a code sketch and have an ATTiny 8 pin uP on a board outputting the required wave form with pseudo-random duty cycle modulation in literally ten minutes
On 01/09/2019 05:24 PM, bitrex wrote:

>>> Any comments? Would clocking it at 4Hz present any problems? >> >> The circuit uses three integrated circuits - two 5-stage shift >> register and the exclusive-OR gate package. >> >> It is singularly un-impressive, clearly designed by somebody who >> couldn't be bother finding out what parts are available. >> >> You can get much longer shift registers - designed for the job - that >> only provide external output from the stages you need to feed into the >> exclusive-OR gate, and you can program a programmable-logic device to >> do all the same jobs in&nbsp; one chip. >> >> Clocking it at 4Hz wouldn't present any problems >> >>> Do I understand correctly that the output would be a 4Hz PWM signal at >>> about 2Vpp? >> >> If you built it with TTL-logic powered from 5V and didn't put a >> pull-up on the output you'd see about 2V peak to peak. >> >> Most people would use CMOS these days, which would give you rail to >> rail swing - which could be up to 15V with old 4000-series CMOS. More >> modern parts are mostly&nbsp; only rated for lower supply voltages - 5V or >> lower. >> > > I could whip up a code sketch and have an ATTiny 8 pin uP on a board > outputting the required wave form with pseudo-random duty cycle > modulation in literally ten minutes
If Robert Martin needs this function in small quantity I could easily do a thousand of them in a DIP package with the programmer array I have at home, let's make a deal bro :)
On Thursday, January 10, 2019 at 9:18:12 AM UTC+11, Robert Martin wrote:
> On 10/1/19 1:08 am, bill.sloman@ieee.org wrote: > > >> This circuit uses only two IC's. > >> http://www.seekic.com/circuit_diagram/Signal_Processing/PSEUDO_RANDOM_BIT_SEQUENCE_GENERATOR.html > >> > >> > >> Any comments? Would clocking it at 4Hz present any problems? > > > > The circuit uses three integrated circuits - two 5-stage shift register and the exclusive-OR gate package. > > > > It is singularly un-impressive, clearly designed by somebody who couldn't be bother finding out what parts are available. > > > > You can get much longer shift registers - designed for the job - that only provide external output from the stages you need to feed into the exclusive-OR gate, and you can program a programmable-logic device to do all the same jobs in one chip. > > > > Clocking it at 4Hz wouldn't present any problems > > > >> Do I understand correctly that the output would be a 4Hz PWM signal at > >> about 2Vpp? > > > > If you built it with TTL-logic powered from 5V and didn't put a pull-up on the output you'd see about 2V peak to peak. > > > > Most people would use CMOS these days, which would give you rail to rail swing - which could be up to 15V with old 4000-series CMOS. More modern parts are mostly only rated for lower supply voltages - 5V or lower. > > > > Thank you. I always liked the CMOS logic series. Here is my first > attempt with a CD4021. > > https://app.box.com/s/vywrm8iswo3yts3jnyyj19maamla4amq > > It is an 8 bit adaptation of this 10 bit circuit I posted earlier. > > http://www.seekic.com/circuit_diagram/Signal_Processing/PSEUDO_RANDOM_BIT_SEQUENCE_GENERATOR.html > > I am sure there are mistakes, so comments would be very much appreciated.
I haven't looked at it in detail, but one failure mode with pseudo-random binary sequence generators is that if the shift register gets completely filled with either ones or zeros (depending on the implementation) they don't do anything. A crude - but often effective - solution is to trigger a pair of monstables - one for rising edges and one for falling edged - each time they see a transition, and if neither has been triggered for a period longer than the length of the shift register multiplied by the clock period you set or clear the shift register. It's short - 8-stages is 256 possible state - so it would repeat once a minute if clocked at 4Hz. It's decades since I've done it (to confuse bats that a female friend was testing) so this may not be reliable advice. -- Bill Sloman, Sydney
On 10/1/19 7:53 am, George Herold wrote:
> On Wednesday, January 9, 2019 at 3:39:10 PM UTC-5, Robert Martin wrote: >> On 10/1/19 12:47 am, George Herold wrote: >>> On Wednesday, January 9, 2019 at 8:16:36 AM UTC-5, Robert Martin wrote: >>>> On 9/1/19 5:26 pm, bitrex wrote: >>>>> On 01/08/2019 06:48 PM, Robert Martin wrote: >>>>>> I have a CD4060 outputting a 5Vpp 4Hz (4 hertz) square wave at 50% >>>>>> duty cycle. >>>>>> >>>>>> How can I randomly pulse width modulate this so that when a low pass >>>>>> filter is added a constantly changing, "wave-like" arbitrary waveform >>>>>> will be produced? >>>>>> >>>>>> I would prefer analog or CMOS IC's, not a microprocessor, and minimum >>>>>> parts count. >>>>>> >>>>>> The "randomness" does not need to be true but only a reasonable >>>>>> approximation. >>>>>> >>>>>> Thank you for any ideas or available circuit diagrams. >>>>>> >>>>>> Robert Martin >>>>> >>>>> I think the simplest way to do it without a uP would to build an analog >>>>> white noise source a la: >>>>> >>>>> <http://www.electro-music.com/forum/phpbb-files/2tran_wn_203.gif> >>>>> >>>>> and then aggressively low-pass filter it. then feed your square wave >>>>> into one input of a comparator and the appropriately-scaled low-passed >>>>> noise into the other. >>>> > >>>> >>>> I tried using noise, as recommended earlier on this group and elsewhere. >>>> The filtered amplitude below 10Hz was too low to produce a workable result, >> >> >> >>> That makes sense (loss of signal) how about filter it at ~10-100 kHz >>> and then send it into a counter/ divider to get to lower frequency. >>> >>> George H. >> >> Good suggestion. I'll first apply a 1KHz LPF and clip its output to >> simulate a logic signal into a divide by 100 counter. >> >> Robert Martin > > Robert, now that I think about it, I'm not sure that is going to work... or be that useful. If you've got random pulses coming at some rate... > then counting to some number is giving you a running average of the counts > And I don't think you'll see a lot of variation. > One of the pseudo-random shift register things may be better... > you can clock at the rate you like. There are not many low frequency > noise sources... maybe 1/f noise in the old carbon comp resistors? > Geiger counter with weakish source, some chaotic pendulum... > > George H. >
Thank you for the update. You are certainly right about a shortage of LF noise sources. A friend once used a photocell pointed at trees blowing in the wind. Clever but not very portable. Robert Martin
On 10/1/19 9:33 am, bitrex wrote:
> On 01/09/2019 05:24 PM, bitrex wrote: > >>>> Any comments? Would clocking it at 4Hz present any problems? >>> >>> The circuit uses three integrated circuits - two 5-stage shift >>> register and the exclusive-OR gate package. >>> >>> It is singularly un-impressive, clearly designed by somebody who >>> couldn't be bother finding out what parts are available. >>> >>> You can get much longer shift registers - designed for the job - that >>> only provide external output from the stages you need to feed into >>> the exclusive-OR gate, and you can program a programmable-logic >>> device to do all the same jobs in&nbsp; one chip. >>> >>> Clocking it at 4Hz wouldn't present any problems >>> >>>> Do I understand correctly that the output would be a 4Hz PWM signal at >>>> about 2Vpp? >>> >>> If you built it with TTL-logic powered from 5V and didn't put a >>> pull-up on the output you'd see about 2V peak to peak. >>> >>> Most people would use CMOS these days, which would give you rail to >>> rail swing - which could be up to 15V with old 4000-series CMOS. More >>> modern parts are mostly&nbsp; only rated for lower supply voltages - 5V or >>> lower. >>> >> >> I could whip up a code sketch and have an ATTiny 8 pin uP on a board >> outputting the required wave form with pseudo-random duty cycle >> modulation in literally ten minutes > > If Robert Martin needs this function in small quantity I could easily do > a thousand of them in a DIP package with the programmer array I have at > home, let's make a deal bro :)
> Thank you for the tempting offer, but I am determined to nut this out using common IC's, not a micro. If anyone here is able to design such a circuit that provides a random PWM output at around 4Hz with low parts count, do let me know. Here please, not by PM. We can work something out. Robert Martin