Maker Pro
Maker Pro

Using a microcontroller input as crude comparator (thresholdvariation effects)

  • Thread starter Klaus Kragelund
  • Start date
K

Klaus Kragelund

Hi

I am working on a current mode controlled SMPS. I have a sawtooth voltage ramp (measured current in a sense resistor) and I would like use a digital input pin of a micrcontroller to turn off the PWM that controls the ramp. The ramp moves from 0 to 100mV in 10us.

I do not have a free comparator on the micro, so I thought of using the digital input threshold as the fast level detect, and an outer loop measuring the current for slow current control. The ramp is offset shifted to just below the threshold since I have a low voltage swing

But, does the typical digital input have a threshold that moves due to external factors fast, appart from supply voltage? (I only need the positive threshold)

Thanks

Klaus
 
T

Tim Williams

Doubtful. Most uCs have hysteresis on the input pins, and many don't
guarantee the magnitude of it. In most applications, input pin hysteresis
is on the order of 200mV, which would screw up your plan pretty quickly
(unless you want to amplify it, or use a CT).

You're effectively depending on the input pin's linear range, which may be
just as slow as anything else available, in other words not as fast as you
had hoped.

Is this a peak current mode control, most likely boost/flyback? If you
can get access to the full current waveform (the triangle, not the
sawtooth), average mode control is better -- it's not chaotic.

Tim

--
Deep Friar: a very philosophical monk.
Website: http://webpages.charter.net/dawill/tmoranwms

Hi

I am working on a current mode controlled SMPS. I have a sawtooth voltage
ramp (measured current in a sense resistor) and I would like use a digital
input pin of a micrcontroller to turn off the PWM that controls the ramp.
The ramp moves from 0 to 100mV in 10us.

I do not have a free comparator on the micro, so I thought of using the
digital input threshold as the fast level detect, and an outer loop
measuring the current for slow current control. The ramp is offset shifted
to just below the threshold since I have a low voltage swing

But, does the typical digital input have a threshold that moves due to
external factors fast, appart from supply voltage? (I only need the
positive threshold)

Thanks

Klaus
 
K

Klaus Kragelund

Doubtful. Most uCs have hysteresis on the input pins, and many don't

guarantee the magnitude of it. In most applications, input pin hysteresis

is on the order of 200mV, which would screw up your plan pretty quickly

I am only using the positive level, so the hysteresis does not come into play (its reset, since the input goes to zero at the end of the ramp)
You're effectively depending on the input pin's linear range, which may be

just as slow as anything else available, in other words not as fast as you

had hoped.



Is this a peak current mode control, most likely boost/flyback?

Yes, peak current mode
If you

can get access to the full current waveform (the triangle, not the

sawtooth), average mode control is better -- it's not chaotic.

Good point, just easier for the circuit implementation to shut off at each period by defined current level

Thanks

Klaus
 
K

Klaus Kragelund

On a sunny day (Mon, 3 Sep 2012 04:24:25 -0700 (PDT)) it happened Klaus


<[email protected]>:














That is difficult to answer,

and it likely differs from micro to micro.

Some time ago I bought a bunch of unijunction transistors on ebay...

make great level triggers (percentage of supply),

but in any case I would spend the money on a small real comparator or opamp

if it is critical, or just add an 8 pin PIC with comparator..

Maybe 555 timer's comparator?

Could do that, was just playing around to see if I could save a package from the design

Regards

Klaus
 
K

Klaus Kragelund

PS

why mot use the Vbe of some Si transistor?

they make excellent ramp peak detectors.

You know exactly the temp drift, and that really is not much to worry about in most cases.

2 resisisters and 1 transisiter

Yes, that's another option. I just wondered about the cheapish solution with the microcontroller input :)

Thanks

Klaus
 
Top