Shop OBEX P1 Docs P2 Docs Learn Events
FET as a digital pot — Parallax Forums

FET as a digital pot

SapphireSapphire Posts: 496
edited 2014-08-08 10:53 in General Discussion
I'm working on a project to control a fairly high voltage solenoid with the goal of using a FET as a variable resistance to control the current. Today this is done with a 2W multi-turn pot, but that is inconvenient for making adjustments to the current. The current needs to be controlled to regulate the solenoid pull.

So I came up with the following sketch of what I want to do. But I don't have a lot of FET experience, and was hoping to get some advice from the forum members on this design. I wish to use a digital pot to control the FET in its linear region, over a range of about 10-200 ohms. If the FET, solenoid or switch need to move, that's okay, they are all just in series. I started out this way thinking I needed to have the source at ground so the gate is properly driven. Is this correct? Any suggestion on what type of FET/JFET/MOSFET should be used?

The SPST switch (actually a relay but shown as a switch for simplicity) can be open or closed at any time by a separate process.

Any suggestions or comments appreciated!

attachment.php?attachmentid=110218&d=1407462260
782 x 557 - 16K

Comments

  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-08-07 19:35
    I assume you mean to use a MOSFET, not the JFET shown in your schematic; but whatever the case, I would not recommend that approach. Operating a transitor in its linear region will generate a lot of heat. Moreover, adjusting the gate voltage in this way will not produce a smooth, linear current response. The best way to do this would be to PWM the gate of a MOSFET. Since the load is inductive, the current will remain steady, proportional to the PWM duty cycle.

    -Phil
  • SapphireSapphire Posts: 496
    edited 2014-08-07 19:52
    Phil,

    Thanks. I should have mentioned that the duty cycle is very low, the solenoid is on for only 10 seconds every few minutes via the switch, which is not controlled by the BS2. I can take care of the heat dissipation. Since we are already using a BS2 for other functions, continuous PWM isn't really an option (although I will keep that in mind for when we upgrade processors).

    Why would the output be non-linear based on the gate voltage if I keep within the linear range of the FET? This is something I don't fully understand.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2014-08-07 21:40
    The word "linear" means two different things here. "...in its linear region" means that the current, as a function of gate voltage is a continuous function, until either the transistor saturates or it shuts off completely. In this region it will dissipate heat at the rate of VDS * IDS. "Linear" as I used it in post #2 would mean that the current vs. gate voltage curve is a straight line. It is not; in fact it is highly non-linear and, moreover, temperature-sensitive.

    If you must operate the solenoid in analog fashion, this is the circuit to use:

    attachment.php?attachmentid=110224&d=1407472797

    Here, the solenoid current is monitored by the transistor's emitter resistor (R), whose voltage is fed back to the op amp. The voltage on the pot's wiper (V) will range from 0V to 5V * R2 / (R1 + R2). The current in the solenoid, therefore, will equal V / R.

    -Phil
    380 x 333 - 2K
  • SapphireSapphire Posts: 496
    edited 2014-08-07 22:02
    Thank you again Phil. This is very informative. I understand your circuit and will give it a try. I appreciate you taking the time to draw it and explain it so well.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2014-08-07 23:20
    Sapphire wrote: »
    I'm working on a project to control a fairly high voltage solenoid with the goal of using a FET as a variable resistance to control the current. Today this is done with a 2W multi-turn pot, but that is inconvenient for making adjustments to the current. The current needs to be controlled to regulate the solenoid pull.

    So I came up with the following sketch of what I want to do. But I don't have a lot of FET experience, and was hoping to get some advice from the forum members on this design. I wish to use a digital pot to control the FET in its linear region, over a range of about 10-200 ohms. If the FET, solenoid or switch need to move, that's okay, they are all just in series. I started out this way thinking I needed to have the source at ground so the gate is properly driven. Is this correct? Any suggestion on what type of FET/JFET/MOSFET should be used?

    The SPST switch (actually a relay but shown as a switch for simplicity) can be open or closed at any time by a separate process.

    Any suggestions or comments appreciated!

    As Phil rightly mentioned, this should be done with PWM, even if you could control it in a linear fashion it will get very hot, a lot hot, even in a few seconds. How about using the digital pot to control the PWM of a 555 timer instead? This will be very efficient and you will only need a very small MOSFET as I get by quite nicely with dual MOSFETs in SO8 driving large solenoids.

    Here's a schematic of a PWM 555 I grabbed from the net although I would completely ignore the MOSFET they used but otherwise it's similar.
  • Mark_TMark_T Posts: 1,981
    edited 2014-08-08 05:11
    I have a feeling modern power MOSFETs are heavily optimized for switching, not for use as linear devices.

    Perhaps older devices are better behaved for analog use? Just a thought - I used 2SJ48 &
    2SK133 Hitachi MOSFETs in an audio amplifier I built in the '80's.

    Either way the on-resistance of any FET isn't easy to control without feedback as the threshold voltage is
    very variable between devices.

    However for low voltage circuits BJTs are often more convenient since an emitter follower only drops 0.7V,
    a source-follower would be more like 2 to 4V.

    Anyway here we really have a requirement for current control, not resistance control, and a programmable
    current-sink circuit is the correct approach.

    As for PWM, this totally depends on whether the solenoid core is laminated or not. If its laminated you
    can PWM and not get significant heating in the core. Solid core and PWM risks overheating the core with
    iron-losses - however higher frequency PWM should mean less current/flux ripple so the losses may go down to
    something acceptable - perhaps some experimentation needed. However always worth thinking of a solid-cored
    solenoid as a transformer with a shorted secondary.

    This is the reason mains AC solenoids are typically of laminated construction.
  • mklrobomklrobo Posts: 420
    edited 2014-08-08 07:37
    :nerd: An Optocoupler is my favorite for controlling things like this. You get isolation/protection for your
    stamp.
  • SapphireSapphire Posts: 496
    edited 2014-08-08 08:09
    The solenoid core is solid, not laminated. And I would like to get isolation from the stamp controller, as there are a lot of noisy devices besides the solenoid on the 68v supply. Opto-isolation would be great, but I could not find any opto-FETs that had the current capability, at least in my original linear region design. So that's out, and it's either PWM with a FET or Phil's feedback BJT, which I really like but the isolation would have to be outside the loop and I'm not sure I can run the digital pot isolated since it needs a Vdd and Vss connection, unless I pull that from the 68v side. It is a DS1844. And, just to complicate things further the one stamp has to control 4 solenoids, each with its own 68v supply! I can tie all 4 grounds together, but would prefer not to.
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2014-08-08 08:54
    Sapphire wrote: »
    The solenoid core is solid, not laminated. And I would like to get isolation from the stamp controller, as there are a lot of noisy devices besides the solenoid on the 68v supply. Opto-isolation would be great, but I could not find any opto-FETs that had the current capability, at least in my original linear region design. So that's out, and it's either PWM with a FET or Phil's feedback BJT, which I really like but the isolation would have to be outside the loop and I'm not sure I can run the digital pot isolated since it needs a Vdd and Vss connection, unless I pull that from the 68v side. It is a DS1844. And, just to complicate things further the one stamp has to control 4 solenoids, each with its own 68v supply! I can tie all 4 grounds together, but would prefer not to.

    Sure sounds like a job for the Propeller rather than the Stamp if you want to control the current in each solenoid easily. With 4 PWM outputs you could easily just drive the gate of a MOSFET directly for absolute minimum parts. If you persist with the Stamp you will need PWM drivers and digital pots for each solenoid, and that's way more complicated. I definitely would not recommend the analog approach unless you had big heatsinks as they will get hot very quickly when you try to control the current in that awkward fashion. In fact even if you really wanted or needed to use the Stamp you could still plonk a Prop chip down simply for PWM control of 4 solenoids (or more) and talk to the Prop with a simple serial command over one I/O line for all 4 solenoids.

    Optos aren't designed to drive the solenoids directly and as long as you observe good grounding practices you should need them either.
  • Tracy AllenTracy Allen Posts: 6,664
    edited 2014-08-08 10:16
    Expanding on Phil's circuit, you could provide PWM from the Stamp, stored on a capacitor, thus.

    solenoidV68.png


    The Stamp PWM command is meant for this approach. It charges up the capacitor C1 to the desired steady voltage, and then the PWM command becomes an input so that C1 holds that voltage until you reset it or refresh it.

    PWM 0, 61, 255 ' applies 24% PWM at Vin for 290ms, then holds
    The capacitor is charged to 24% of 5V (=1.2V), and that through feedback holds 1.2V across R2=8Ω, and that gives 150mA in the solenoid.

    Quantitatively you are asking for solenoid currents between 0.15A and 0.36A. (That is based on 180Ω for the solenoid in combination with the original series resistance values from 10 to 200 ohms, and 68V supply). The resulting power levels in Q1 and R2 are manageable, and you said also it would be low duty cycle.
    657 x 337 - 18K
  • SapphireSapphire Posts: 496
    edited 2014-08-08 10:53
    Tracy,

    I've done PWM with the Stamp just like you showed for a simple A/D converter! You're right on the currents, and I calculated a 5W BJT too. Duty cycle is very low.

    Peter,

    Prop may be a option, and will consider that as well. The device already has a BS2 in it with spare pins, so that was my starting point.
Sign In or Register to comment.