How to calbrate a DC voltage?

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:

formatting link

FET is IRFM150.

Thanks for your help!

Reply to
DaveC
Loading thread data ...

What is the load?

What characteristic are you looking for and why?

Tim

--
Seven Transistor Labs 
Electrical Engineering Consultation 
 Click to see the full signature
Reply to
Tim Williams

Electromagnet.

? I want to ?levitate? a metal object by sensing its altitude and varying the strength of an overhead electromagnet. I?ve already got the micro handling altitude sense and putting out pwm relative to height (zero duty-cycle = on the table).

I know there?s other designs but I am doing this as a learning exercise and have already done half the design (micro&software).

Thanks.

Reply to
DaveC

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

Reply to
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 
 Click to see the full signature
Reply to
Tim Williams

it?s not the goal, it?s my journey. i?m taking a different route and learning on the way..

dave

Reply to
DaveC

On a sunny day (Fri, 03 Apr 2015 00:22:28 -0700) it happened DaveC wrote in :

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.

Reply to
Graf Itty

Room temperature magnetic levitation needs no electronics, just a little diamagnetic material (your fingers are sufficient).

See:

.
Reply to
Robert Baer

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:

formatting link

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

Reply to
Shaun

filter after the fet (else you end up cooking the fet), calibrate before pwm (in software).

--
umop apisdn
Reply to
Jasen Betts

What are you ultimately trying to do?

The drain current-vs-gate-voltage relationship of a mosfet is not very predictable nor is it stable.

--
John Larkin         Highland Technology, Inc 
picosecond timing   precision measurement  
 Click to see the full signature
Reply to
John Larkin

Why can't the trim be done in software? Or since it is in a feedback loop, is a trim even needed?

--

Rick
Reply to
rickman

How would this happen? After filtering, the input to the FET would be DC (with some ripple I'm guessing), whereas without filter it's PWM. Wouldn't the DC input be less likely to do damage to the FET?

What would cause damage to the FET if I filter before?

Thanks.

Reply to
DaveC

most mosfets aren't designed to dissipate power. but yeah, if you get a big enough mosfet It will work. not having any numbers to work with it's all generalities.

--
umop apisdn
Reply to
Jasen Betts

Lets assume you have a 12 volt supply and a 6 ohm electro- magnet for the following discussion, and that there must be 1 amp through the electromagnet for proper operation.

6 ohms at 12 volts would draw 2 amps - 1 amp too high.

PWM circuits turn the FET fully on and fully off. When fully on, the resistance between the drain and source is lowest. (When turned on only part way, the drain-source resistance will be higher.) With PWM the current required by your electromagnet to do the job will be applied in pulses, so you could provide twice the current needed for 1/2 the time. If the drain-source resistance was .1 ohm (when the FET is fully on), a bit less than .2 watts of power will be dissipated in the FET.

With filtered PWM making a voltage is used to control the FET, it won't be turned on and off - it will be turned on partly. But it still has to reduce the current applied to the electromagnet by 1/2. With the 12 volt supply and the 6 ohm electromagnet, the FET drain-source resistance must be 6 ohms. That means the FET must dissipate 6 watts.

That 6 watts will heat the FET MUCH more than the .2 watts of heat produced in the PWM case. That heat can cook the fet.

When varying the voltage applied to the gate of the fet causes the current between drain and source to vary, the fet is said to be in linear mode. When increasing the voltage between the gate and source results in no further increase in current between drain and source, the fet is in saturation. An fet in saturation will produce less heat than it would in the same circuit in linear mode.

Ed

Reply to
ehsjr

[...]

yeah, that's what I was trrying to say. Thanks.

--
umop apisdn
Reply to
Jasen Betts

Thanks Ed, a very good explanation.

And to Jason for trying. (c;

Reply to
DaveC

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.