Connect with us

Using a microcontroller input as crude comparator (thresholdvariation effects)

Discussion in 'Electronic Design' started by Klaus Kragelund, Sep 3, 2012.

  1. 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
     
  2. Tim Williams

    Tim Williams Guest

    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
     
  3. 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)
    Yes, peak current mode
    Good point, just easier for the circuit implementation to shut off at each period by defined current level

    Thanks

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

    Regards

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

    Thanks

    Klaus
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-