Author Topic: Folding a waveform  (Read 5879 times)

0 Members and 1 Guest are viewing this topic.

Offline D4rmondTopic starter

  • Newbie
  • Posts: 7
Folding a waveform
« on: March 06, 2016, 01:03:04 pm »

Hi guys, as you can see in this video this dude folds a triangle wave for a (theoretically) infinite amount of times. I'm looking forward to something like an op amp with comparators (I dunno) that does one fold only. Do you guys have any ideas? I'd like to adjust the folding level, so a full bridge rectifier won't work for that purpose.
 

Offline Simon

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Folding a waveform
« Reply #1 on: March 06, 2016, 01:19:21 pm »
Judjing by the noises in the background he's using some sort of digital device, some sort of off the shelf signal generator ?
 

Offline Nomsot

  • Contributor
  • !
  • Posts: 11
  • Country: us
Re: Folding a waveform
« Reply #2 on: March 06, 2016, 01:25:15 pm »
some sort of off the shelf signal generator ?
also interesting! what can you say? mm??
 

Offline onlooker

  • Frequent Contributor
  • **
  • Posts: 395
Re: Folding a waveform
« Reply #3 on: March 06, 2016, 01:45:14 pm »
For fold once, it is not much more than taking the AC component of the input triangle wave and, then, full-wave rectifying it. Though one may want to use perfect rectification to reduce the distortion. Adding some DC component/offset at the input, one will get asymmetric folding. 

I am also guessing "the noises in the background" is from a speaker by design and this is an audio setup.
« Last Edit: March 06, 2016, 02:15:51 pm by onlooker »
 

Offline D4rmondTopic starter

  • Newbie
  • Posts: 7
Re: Folding a waveform
« Reply #4 on: March 06, 2016, 02:49:00 pm »
The schem in the attachment is the actual circuit he built. I can see that there are two comparators either for positive and negative side. Then there's a voltage controlled amplifier at the end for adjusting gain losses. I can't understand why he used that flip flop and that "strange" switch near the op amp. What do you guys think about it? He's doing a kinda feedback controll with those two comparators and then the flip flop makes the waveform fold when needed.
 

Online MK14

  • Super Contributor
  • ***
  • Posts: 4539
  • Country: gb
Re: Folding a waveform
« Reply #5 on: March 06, 2016, 03:19:06 pm »
I can't understand why he used that flip flop and that "strange" switch near the op amp. What do you guys think about it?

Without properly analyzing the circuit. My quick guess, is that it is some kind of electronically controlled switch (similar to a relay). Such as a CMOS 4066 Analogue switch.

http://www.ti.com/lit/ds/symlink/cd4066b-q1.pdf
 

Offline D4rmondTopic starter

  • Newbie
  • Posts: 7
Re: Folding a waveform
« Reply #6 on: March 06, 2016, 04:26:47 pm »
Without properly analyzing the circuit. My quick guess, is that it is some kind of electronically controlled switch (similar to a relay). Such as a CMOS 4066 Analogue switch.
http://www.ti.com/lit/ds/symlink/cd4066b-q1.pdf

K you were right: I put it on Multisim and found out that the switch is something like (as you said) a cd4066. I have a bunch of those so I'm gonna make something similar. Thanks very much folks
 

Offline onlooker

  • Frequent Contributor
  • **
  • Posts: 395
Re: Folding a waveform
« Reply #7 on: March 06, 2016, 07:52:44 pm »
This is my take:

On the top there are 4 op-amps from left to right:

-- the 1st:  condition/convert the input to a square wave. 
-- the 2nd: switch the square wave from the 1st op-amp to an invert or non-invert output based on the flip-flop state.
-- the 3rd: a integrator to actually produce the (folded) triangle wave for outputting (Edited: to be precise, this just generates the ramp; while combined with the polarity switching from the 2nd op-amp, they are triangle generator).
-- the 4th: the output stage of the folded triangle wave.

The rest are the (mostly logic) feedback that switches the 2nd op-amp above based on comparing the triangle wave at the output of the 3rd op-amp with the the control voltage.  I am also not sure what are the 2 circles at the output of the lower right op-amp. Then, there are more details in this logic circuitry that need more understanding.

On the other hand, it looks like the effect can be easily achieved by controlling an switched integrator (triangle wave generator) with 2 incommensurate switch timings.

The 1st switching timing is the result of  comparing the triangle wave voltage with the control voltage (CV) that provide a base frequency of the triangle wave; while the 2nd timing is the input square wave with a fixed frequency.  When the 2 timings are not integer multiples (incommensurate), one would see one of the triangle is chopped short in time and amplitude at the input frequency.

What all these says is that the wave is not really folding; They are just the effect of two  incommensurate timings acting on a triangle wave generator that makes some triangles cut-short at a frequency the same as the input frequency.

In a loose sense, it can be understood as just a voltage controlled oscillator with the phase being reset at a lower and fixed frequency.

« Last Edit: March 07, 2016, 03:14:14 am by onlooker »
 

Offline D4rmondTopic starter

  • Newbie
  • Posts: 7
Re: Folding a waveform
« Reply #8 on: March 07, 2016, 01:27:36 pm »
-- the 1st:  condition/convert the input to a square wave. 
-- the 3rd: a integrator to actually produce the (folded) triangle wave for outputting (Edited: to be precise, this just generates the ramp; while combined with the polarity switching from the 2nd op-amp, they are triangle generator).
I don't think so because you can actually fold other types of waveforms such as a sine or a sawtooth wave. Those integrators (I think) are correlated to a some sort of filtering and nothing else. Maybe the integrator is used to compensate the noise when the flip flop controls the 4066
 

Offline onlooker

  • Frequent Contributor
  • **
  • Posts: 395
Re: Folding a waveform
« Reply #9 on: March 07, 2016, 02:08:19 pm »
In that case, please provide all the info you know, such as component values, any correction or notes about the schematics (the 2 circles?) and a video about the folding of sine waves, unless you want make this as a quiz.
 

Offline D4rmondTopic starter

  • Newbie
  • Posts: 7
Re: Folding a waveform
« Reply #10 on: March 08, 2016, 05:03:15 pm »
In that case, please provide all the info you know, such as component values, any correction or notes about the schematics (the 2 circles?) and a video about the folding of sine waves, unless you want make this as a quiz.
I don't know any of the values in the schem. This is just a guess, I know what the circuit does and I'm analyzing it with my knownledge about electronics. This is not a quiz, it's jus me asking for help ahah :-\
 

Offline onlooker

  • Frequent Contributor
  • **
  • Posts: 395
Re: Folding a waveform
« Reply #11 on: March 09, 2016, 01:38:20 pm »
Is folding sine wave also a part of your guess? or you can actually show some pics or videos about it. 

It will be  interesting to see the look of a sine wave folded 2 or 3 times. That can tell whether it is "real folding" (e.g. full wave rectifying that mirrors voltage at one or more voltage levels) or just "incommensurate phase resetting" as discussed.

The difference is one is mirroring  about voltage amplitudes/levels, the other is more like mirroring in the time axis.
« Last Edit: March 09, 2016, 02:01:37 pm by onlooker »
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21686
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Folding a waveform
« Reply #12 on: March 09, 2016, 04:14:22 pm »
Well, what does the process consist of?

If you amplify the signal a variable amount, and compare to a fixed threshold, and do some other processing from that (i.e., inverting the input and subtracting an offset), then you have to keep track of each offset, for each fold.

Which means you can't use one single stage, single state device to do it.  You need N states for N folds.

A comparison is an analog-to-digital conversion.  If a single converter is one bit, then.. it stands to reason, we need a lg(N) bit ADC to provide those N states, a register to hold them, and a DAC to spit out the quantized values.

The general solution would be:
Input --> Gain --> ADC --> DAC --> Mixer --> Switched inverter

the Gain output also goes to the Mixer, at the -input.

The mixer subtracts the DAC output from the amplified input, thus leaving sawtooth chunks: the residue of the ADC quantization.

The inverter either inverts or non-inverts the output, depending on the LSB of the ADC reading.  Thus, it alternates between rising and falling slopes.

The ADC-DAC pair simply have as many bits as are needed for N folds; if you use a generic 8 or 12 bit ADC, for instance, you can simply round the output (i.e., for N = 16, use the 4 MSBs).  For N != powers of 2, scale the input so the ADC only reads e.g. 0..9 instead of 0..15.

This gives a correct DC response, though it's a pretty shitty way to do it, because the propagation delay through the ADC-DAC will leave spikes on each transition, and the consistency between steps is limited by the linearity and matching of the ADC and DAC.



If you want a more analog method, an LM3914 is a neat little item.  It's a 10 bit unary ADC.  That is, the bit position (one-hot) or bit count (thermometer code) is the numerical result, rather than a binary number.  To use this, you could run a resistor from each output pin to an op-amp summer as a simple DAC (so Vout = Vin * Rfb/Rin * N, for N active bits), and you have to reconstruct the LSB ('sign bit' as it were!) by XORing every other bit together.  (A slightly simpler resistor-DAC style circuit could compute this as well.)

With 10 states, it could provide a maximum of 10 folds.



You could also build one by using a pair of window comparators, an up/down counting register (e.g., 74HC193?), and a DAC, all arranged in a feedback loop, so that the DAC output is subtracted from the input.  As the input goes up, it crosses the threshold, causing the register to tick up, which raises the DAC output, subtracting one additional step from the input, pushing it back within bounds.  You need to be careful that a DAC step is smaller than the comparator window (else it will perpetually chatter between steps!), and add logic to prevent the counter from over/underflowing (otherwise it'll tick off-scale and remain latched until the input reverses).  The mixed input signal then consists of a sawtooth fold rather than a triangle fold; you have to add additional add/subtract/invert stages to get that.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21686
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Folding a waveform
« Reply #13 on: March 09, 2016, 04:19:52 pm »
Still more:

You could do the "fuzzy logic" approach, where N amplifiers are biased at N evenly spaced voltage offsets, with alternate polarity gain each.  The gain is fixed (unless you have an N-ganged pot to vary all at once!), and quite high so each amplifer output is saturated (railed to VCC or GND) when it's out of range, and linear when in range.

With the offsets spaced evenly, for an input going 0..1V (say), the first amp starts at 0, second at VCC, third at 0, and so on; as the input rises, the first amp transitions linearly from 0 to VCC then saturates; as the first amp saturates, the second one comes out of saturation, then transitions linearly from VCC to 0, and saturates again; and so on.

Simply adding all the outputs together gives the triangle output.

A lot of work though, and the gain is fixed (you'd have to scale the input and output instead, which sucks because noise goes way up).

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf