#### Do you have a question? Post it now! No Registration Necessary

**posted on**

April 3, 2015, 3:58 am

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!

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!

Re: How to calbrate a DC voltage?

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.

Re: How to calbrate a DC voltage?

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

Re: How to calbrate a DC voltage?

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

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

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 beused 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

Seven Transistor Labs

Electrical Engineering Consultation

We've slightly trimmed the long signature. Click to see the full one.

Re: How to calbrate a DC voltage?

"DaveC" wrote in message

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!

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

Re: How to calbrate a DC voltage?

On 4/4/2015 12:57 PM, DaveC wrote:

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

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

Re: How to calbrate a DC voltage?

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

John Larkin Highland Technology, Inc

picosecond timing precision measurement

We've slightly trimmed the long signature. Click to see the full one.

#### Site Timeline

- » House coded; Arizona Microchip component.
- — Next thread in » Electronic Components

- » Re: What kind of spectrogram is this, anyway... ?
- — Previous thread in » Electronic Components

- » Motorola RCA 24718140 24712879
- — Newest thread in » Electronic Components

- » Ping James Arthur
- — The site's Newest Thread. Posted in » Electronics Design

- » lenovo laptop x230 kuciste
- — The site's Last Updated Thread. Posted in » Electronics (Croatian)