# My Favorite Modulator Only Needs Leftover Components

Modulators allow an analog signal to be converted to a single logic stream where the percentage that the signal is high (density) is proportional to the original analog signal—and you can build a good one with parts you probably already have.

I’ve spent a lot of my career building analog-to-digital converters (ADCs) from whatever bits of stuff I can find lying around. In many cases, someone has decided that an analog signal needs to be digitized but has neglected to include an ADC to do it. This is where modulators shine. They allow an analog signal to be converted to a single logic stream where the percentage that the signal is high (density) is proportional to the original analog signal.

An ADC in its simplest form is a comparator, a digital-to-analog converter (DAC), and some processing smarts (Fig. 1). The control can be discrete logic, programmable logic, or a CPU. I once built a temperature control system where the control logic was a grad student. It was a very efficient design, since you don’t pay grad students anything, but difficult to ship in volume.

1. With a comparator, a DAC, and some logic, it’s possible to determine the value of an analog input within the resolution of the DAC.

The processing algorithm can be as easy as simply incrementing the DAC until a correct value is obtained, or it can use a complicated predictive coding technique. The most common approach is to use a binary search, also known as a successive approximation register (SAR) technique, probably because it makes for a better acronym.

You can make an inexpensive DAC by putting a pulse-width modulation (PWM) signal into an RC filter to produce an analog value. Most engineers have done this, and it’s often called the poor man’s DAC. The output value is proportional to the logic’s voltage level and the PWM duty cycle (density):

VDAC = VLogic • Density            (1)

If the RC filter is set at a low enough frequency to remove ripples, a 5-V pulse-width modulator with a 40% density (duty cycle) produces a 2-V output. Figure 2 shows what you get when you substitute the ADC’s DAC with this poor man’s DAC.

2. Replacing the DAC with a poor man’s DAC will simplify and reduce the cost of this circuit.

For this design, the logic must produce the correct density to determine the analog input. There are many different methods to generate the density and control the feedback loop. The density value either can be measured or is already known by the control logic. With this density and the logic’s voltage level, the analog input voltage can be calculated with the previous derived equation.

The simplest feedback scheme I know is to drive the input of the DAC filter high when its output is less than the input value and conversely drive the input to the filter high when the filter output is greater than the input. This is called a self modulator (Fig. 3).

3. A single flip flop can be used as the control of a self-modulator.

It’s my favorite modulator topology! It’s extremely simple to construct, and it can be easily constructed with leftover components in your system. Find a comparator, a flip flop, and a couple of passives, and you have an analog-to-density modulator. Couple this with a counter to measure the density, and you have an ADC.

Limits And Features

One limitation, if you consider it a limitation, is that it doesn’t respond immediately to quick-changing input signals. If the input changes faster than the RC filter can slew, the filter can’t immediately respond. The RC values determine the maximum allowable input slew.

I don’t consider this a limitation. I consider it a feature. A circuit that does not respond to fast moving signals is rejecting them and can be considered a slow-pass filter; i.e., passing slow moving signals and rejecting fast moving signals. Figure 4 shows that the addition of a differential unity gain amplifier allows the generation of slow-pass and fast-pass outputs.

4. When you stop thinking of slew as always a bad thing, interesting circuits can be constructed—in this case, a slew limited filter.

The nice thing about rejecting or isolating impulses with slew instead of phase is that the filters don’t ring. The disadvantage is that they are nonlinear and standard filter theory is of no use. Slew rate filters are best designed with PSPICE with follow-up construction and bench testing.

Another limitation is that the common-mode performance of the comparator’s inputs limits the input range. Few comparators will function well with inputs close to or at their supply rails and even worse outside the power rails. If performance outside out a comparator’s common-mode range is needed, consider the variation shown in Figure 5.

5. The addition of a gain setting resister and an offset voltage allows the input range to be modified, even outside the rails of the comparator.

By bringing the input into the negative input of the comparator through a resistor and then setting the positive input to a selectable offset voltage, the comparator’s input now functions in a desirable space between the rails. Equation 2 defines the input as a function of density, logic level voltage, resister values, and offset:

The equation shows that setting the ratio of the two resistors sets the gain or attenuation of the input. Setting RIn > ROut allows signals to be measured outside the rails of the comparator. Setting RIn < ROut amplifies the input signal, allowing the whole modulator range to be used for smaller signals. The offset voltage allows the adjustment of the center of the range, which can be set with either a DAC or the resistor divider.

What if you don’t have a spare comparator, or maybe you just want to show off? It’s possible to build a modulator with only a flip flop (Fig. 6). This circuit exploits the fact that the flip flop’s D input has a well-defined logic level threshold voltage. If you’re lucky, it’s maybe half the supply voltage.

6. Using the threshold of the flip flop’s input as the modulator’s compare point, this has to be the simplest analog-to-density modulator possible.

By feeding back the inverted output, negative feedback and modulation is achieved. It has the same range as the precious circuit, but the offset variable is replaced with the logic threshold value. Is it a very good modulator? You have to remember that it’s made with a single flip flop!

Conclusion

Just because you don’t have an ADC doesn’t mean you can’t digitize analog signals. The technique I’ve described here is the backbone of mixed-signal design. I define “mixed signal” as the cheapest analog you can get away with and fixing it up in the digital domain.

Since mixed signal is mostly digital, it will follow most digital design constraints, use most digital design tools, take mostly digital logic space, and follow a mostly digital price curve. It is a technique that will help you design cost-effective circuitry, and it’s necessary to understand to remain a competitive designer. Once mastered, it will open new dimensions to your designs.

To quote Elbert Hubbard, “Fences are for those who can not fly.” Time to fly!

DAVE VAN ESS is an application engineer, MTS, with Cypress Semiconductor. He has a BSEE from the University of Calif., Berkeley.

kitapbigi (not verified)
on Apr 6, 2013

There is another way to achieve derivative inputs that is much less susceptible to noise. Differentiators are very susceptible to noise. The method: split the input signal feeding one part into an integrator and the other via a buffer. Combine the two in a differential amp. The rate signal is the difference between the real time (buffer input) and the slow integrator. This method is very stable in noisy environments compared to a true differentiator (in the analog world). Years ago, EDN printed an article on PID complete with op amp schematics and all component values. evim şahane

dubturbo
on May 17, 2013

Hi there, I want to subscribe for this webpage to obtain most recent updates, therefore where can i do it please help out.

music making software q1w2e3r4t5

josefclare (not verified)
on Apr 25, 2013

Wow! This can be one particular of the most helpful blogs We've ever arrive across on this subject. Basically Fantastic. I'm also a specialist in this topic so I can understand your hard work.
sell my annuity

annabelleslessor
on May 8, 2013

Field of analog and digital is that many developed and compared to each other. These are things that can not be avoided to date. Cloud Phone System

ReynaMoon
on May 11, 2013

Everyone seems to be turning into the digital field. You can find many types of applications and circuits that can be used and assessed with analog systems. Company registration

AnthurMoon
on May 11, 2013

Modulator is used for mixing several waves required. Usually there are a few components that must exist within the tool. This component is very important. fatsalmoncharters.com

on May 15, 2013

It looks simple but it's not that simple too. They are already mastering it so long. So they can make it so easy.
custom wheels

andyyu
on May 16, 2013

This is all very new to me and this article really opened my eyes.Thanks for sharing with us your wisdom.
www.qcwatches.com

##### Commentaries and Blogs
###### A 5G wireless cell phone is in your future.
Posted 5 days ago
in Communiqué
###### \$45 Million Dollar Bank Heist Fades Into Obscurity
Posted 5 days ago
in alt.embedded
###### LinkedIn. Is it trustworthy? Is it safe?
Posted 1 week ago
in London Calling
##### Forums

Lead Bending: "There’s more to it than just
making the heatsink fit!"