Forums

How to calbrate a DC voltage?

Started by DaveC April 3, 2015
I have a FET and a load and a micro outputting PWM.


I want to convert the PWM to DC (low-pass filtered?) which will control the 
current through the FET.

I also want to be able to calibrate the DC voltage such that for any given 
PWM duty-cycle I want to be able to adjust the resulting DC voltage plus or 
minus a yet-to-be-determined percentage. This will probably need to be done 
only once so a trim pot will be fine.

I’m guessing this calls for a “driver” transistor to drive the FET? Or 
an op-amp? Both?

Open to any suggestions.

Oh-so-helpful chicken scratch here:

http://i.imgur.com/ZXlsmtN.jpg

FET is IRFM150.

Thanks for your help!

What is the load?

What characteristic are you looking for and why?

Tim

-- 
Seven Transistor Labs
Electrical Engineering Consultation
Website: http://seventransistorlabs.com

"DaveC" <not@home.cow> wrote in message 
news:0001HW.1ACE4770000682DB110E6A3CF@news.eternal-september.org...
>I have a FET and a load and a micro outputting PWM. > > > I want to convert the PWM to DC (low-pass filtered?) which will control > the > current through the FET. > > I also want to be able to calibrate the DC voltage such that for any > given > PWM duty-cycle I want to be able to adjust the resulting DC voltage plus > or > minus a yet-to-be-determined percentage. This will probably need to be > done > only once so a trim pot will be fine. > > I&rsquo;m guessing this calls for a &ldquo;driver&rdquo; transistor to drive the > FET? Or > an op-amp? Both? > > Open to any suggestions. > > Oh-so-helpful chicken scratch here: > > http://i.imgur.com/ZXlsmtN.jpg > > FET is IRFM150. > > Thanks for your help! >
> What is the load?
Electromagnet.
> What characteristic are you looking for and why?
> Tim
? I want to &ldquo;levitate&rdquo; a metal object by sensing its altitude and varying the strength of an overhead electromagnet. I&rsquo;ve already got the micro handling altitude sense and putting out pwm relative to height (zero duty-cycle = on the table). I know there&rsquo;s other designs but I am doing this as a learning exercise and have already done half the design (micro&software). Thanks.
On 03/04/2015 06:42, DaveC wrote:
> Electromagnet.
Electromagnet load will take pwm just fine, no need to operate the driver transistor as linear device. The inductance of the electromagnet will ensure the average current is substantially ripple free if the pwm frequency is high enough. piglet
OK.  Then you still want a zener diode to protect the transistor in event 
of rapid turnoff -- a zener+diode (back to back) so the flyback is clamped 
at something above VCC, rather than at VCC (as just a diode would do --  
but that won't allow current to decay quickly!).

While a DAC is always better (and all of a single op-amp, better still 
;-) ), you can do PWM by filtering.

You want the filter cutoff frequency no lower than the dominant time 
constant of the system, and preferably 3-10 times higher.

The PWM frequency has to be above the cutoff frequency for the filter to 
do anything.  How much depends on the order of the filter, and how much 
attenuation you need, but for -40dB (a 1% ripple figure, probably not 
terrible?), a frequency ratio of 10, and a 4th or 5th order filter (two 
op-amps in Sallen-Key or MFB configuration, most likely), will do nicely.

In a control loop, you can often tolerate more ripple than usual (the 
system itself has some filtering value), so that maybe only -20dB, or 
even -10dB, is required.  In this case, a pretty gentle filter can be used 
with a reasonable frequency ratio (F_PWM / F_c), or a modest filter can be 
used with an even more modest frequency ratio.

Probably, a ratio around 3, and a 3rd order filter (just because it's easy 
enough to implement, and needs only one op-amp), would do just fine.

Finally, the clock frequency must be at least F_PWM * 2^Nbits for Nbits 
worth of desired accuracy.

Once you have your filtered PWM, run that into a current source.  Don't 
use a naked MOSFET.  At least use a source degeneration resistor, so that 
the transconductance (current out / voltage in) becomes stabilized. 
Getting rid of the offset (Vgs(th) varies all over the place) probably 
isn't a big deal, as long as you burn a few volts in the source resistor. 
Or use a BJT -- no big loss adding 0.5% of base current, and it's that 
much easier to design for (Vbe is smaller, so its tempco matters less).



Note that, unless you've implemented linearizing controls (to account for 
the inverse-sqrt-of-cubes or whatever transfer function the solenoid 
effectively responds as -- in terms of force vs. distance at a given 
current), your loop gain and time constant will vary immensely with 
position.  It might be pretty easy to stabilize the loop around a local 
point (exactly some position), but give it a bump and it starts 
oscillating, or becomes chaotic, or just drops it entirely.  Or if you 
want it to pick up an object from your hand, same idea (a positional step 
response).

Tim

-- 
Seven Transistor Labs
Electrical Engineering Consultation
Website: http://seventransistorlabs.com

"DaveC" <not@home.cow> wrote in message 
news:0001HW.1ACE5FC3000C364C110E6A3CF@news.eternal-september.org...
>> What is the load? > > Electromagnet. >> What characteristic are you looking for and why? > >> Tim > > ? I want to &ldquo;levitate&rdquo; a metal object by sensing its altitude and > varying > the strength of an overhead electromagnet. I&rsquo;ve already got the micro > handling altitude sense and putting out pwm relative to height (zero > duty-cycle = on the table). > > I know there&rsquo;s other designs but I am doing this as a learning > exercise and > have already done half the design (micro&software). > > Thanks. >
DaveC wrote:
>> What is the load? > > Electromagnet. >> What characteristic are you looking for and why? > >> Tim > > ? I want to &ldquo;levitate&rdquo; a metal object by sensing its altitude and varying > the strength of an overhead electromagnet. I&rsquo;ve already got the micro > handling altitude sense and putting out pwm relative to height (zero > duty-cycle = on the table). > > I know there&rsquo;s other designs but I am doing this as a learning exercise and > have already done half the design (micro&software). > > Thanks. >
Room temperature magnetic levitation needs no electronics, just a little diamagnetic material (your fingers are sufficient). See: <http://www.instructables.com/id/Diamagnetic-Levitation-Experiment/> .
> > Room temperature magnetic levitation needs no electronics, just a > little diamagnetic material (your fingers are sufficient). > > See:<http://www.instructables.com/id/Diamagnetic-Levitation-Experiment/>
it&rsquo;s not the goal, it&rsquo;s my journey. i&rsquo;m taking a different route and learning on the way.. dave
On a sunny day (Fri, 03 Apr 2015 00:22:28 -0700) it happened DaveC
<not@home.cow> wrote in
<0001HW.1ACE77340011B4FA110E6A3CF@news.eternal-september.org>:

>> > Room temperature magnetic levitation needs no electronics, just a >> little diamagnetic material (your fingers are sufficient). >> >> See:<http://www.instructables.com/id/Diamagnetic-Levitation-Experiment/> > >it&rsquo;s not the goal, it&rsquo;s my journey. i&rsquo;m taking a different route and >learning on the way.. > >dave
Yep, we are all learning. I found I could not lift myself up by the hairs, but I can lift others up by theirs. So I must be something special.

"DaveC"  wrote in message 
news:0001HW.1ACE4770000682DB110E6A3CF@news.eternal-september.org...

I have a FET and a load and a micro outputting PWM.


I want to convert the PWM to DC (low-pass filtered?) which will control the
current through the FET.

I also want to be able to calibrate the DC voltage such that for any given
PWM duty-cycle I want to be able to adjust the resulting DC voltage plus or
minus a yet-to-be-determined percentage. This will probably need to be done
only once so a trim pot will be fine.

I&rsquo;m guessing this calls for a &ldquo;driver&rdquo; transistor to drive the FET? Or
an op-amp? Both?

Open to any suggestions.

Oh-so-helpful chicken scratch here:

http://i.imgur.com/ZXlsmtN.jpg

FET is IRFM150.

Thanks for your help!

The filtered DC voltage from a PWM source can easily me calculated.  If you 
know the Duty Cycle and the voltage used to produce the PWM signal, it's 
simple math.

Shaun


On Thursday, April 2, 2015 at 11:39:30 PM UTC-7, Tim Williams wrote:

> Once you have your filtered PWM, run that into a current source. Don't > use a naked MOSFET. At least use a source degeneration resistor
It makes sense to use a source resistor, but why is the PWM to be filtered beforehand? Just feed the PWM signal direct to the gate, and the diode-snubbed magnet coil from Vcc to the drain. The MOSFET and source-to-ground resistor IS a current source, and the PWM signal modulates it just fine...