Shop OBEX P1 Docs P2 Docs Learn Events
Propeller Current Control Question: 0 - 300 mA /12 VDC??? — Parallax Forums

Propeller Current Control Question: 0 - 300 mA /12 VDC???

idbruceidbruce Posts: 6,197
edited 2012-12-06 05:31 in Propeller 1
Hello Everyone

My present project includes a 12 VDC solenoid that requires a variable current of 0 - 300 mA. I would like to optically isolate the solenoid circuit from the Propeller chip. I was contemplating using a 4N25 optocoupler in conjunction with a NPN transistor to control the solenoid.

With this type of circuit, is it possible to obtain the needed current control by simply setting up a counter to single ended NCO/PWM?

Thanks in advance.

Bruce

Comments

  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-05-23 07:28
    There is no need to isolate the solenoid at all, just run it straight from a baby MOSFET rather than a BJT that's all. The trouble with the counter's NCO mode is that it's way too high a frequency to use so therefore you will have to use software controlled PWM. But don't worry, there are plenty of objects that handle PWM and the solenoid will probably work fine running at a few hundred Hz.

    I'm running much larger 24V solenoids directly from a PuppySolo module, the one with the tiny cheap dual 8-pin SMD MOSFETs. The reason that others have such problems is probably more to do with layout and wiring and possibly insufficient power-supply filtering but you only need the basics here. Just don't try to feed the return of the solenoids through the Prop's ground.
  • idbruceidbruce Posts: 6,197
    edited 2012-05-23 07:36
    Peter

    This project will be using a Propeller Proto Board, so I would need a through hole MOSFET. Do you have a compatible MOSFET in mind?

    Thanks for the response Peter.

    Bruce
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2012-05-23 08:31
    How about something in a TO-251 package like this one here, the NTD4960N. It's rated at 9A continuous at 30V and is logic level compatible. Going a bit further I found the IRLU8113 which is once again a TO-251 but it's Rdson is only 6mohm and they are cheap too. None of the ones that are in smaller packs like a TO92 are much chop due to their very small die size.
  • idbruceidbruce Posts: 6,197
    edited 2012-05-23 08:33
    Thanks Peter
  • Mark_TMark_T Posts: 1,981
    edited 2012-05-23 15:37
    Neither the NTD4960N or the IRLU8113 are rated for less than 4.5V gate drive, so I'd suggest pick the one with lowest Vth max. Alternatively is it possible to find surface mount MOSFETs that are speced for <= 3.3V gate drive - http://uk.farnell.com/stmicroelectronics/sts6nf20v/mosfet-n-so-8/dp/9935762

    Might just be easier to use a bipolar switching transistor. If you need that opto isolator use it to drive a nice super-beta switching transistor - I've used STX724's before, 30V 3A and TO92 package...
  • jmgjmg Posts: 15,173
    edited 2012-05-23 16:51
    idbruce wrote: »
    Hello Everyone

    My present project includes a 12 VDC solenoid that requires a variable current of 0 - 300 mA. I would like to optically isolate the solenoid circuit from the Propeller chip.

    Do you want linear operation, Simple PWM, or Current regulated PWM ?
    (300mA.& 12V is in the realm of Linear)

    If you are looking for best force control (which 0-300mA suggests) then Current feedback, removes the 12V and Thermal effects of the Solenoid coil as error sources.
  • idbruceidbruce Posts: 6,197
    edited 2012-05-24 02:32
    This is what I want to control: http://content2.smcetech.com/pdf/PVQ.pdf, part # PVQ31-6G-16-01N-F. I am looking for a solution with good overall control and Propeller pin protection.
  • jmgjmg Posts: 15,173
    edited 2012-05-24 03:20
    idbruce wrote: »
    This is what I want to control: http://content2.smcetech.com/pdf/PVQ.pdf, part # PVQ31-6G-16-01N-F. I am looking for a solution with good overall control and Propeller pin protection.

    Interesting parts.
    For those, I'd avoid PWM, as that may disturb the linear control, and use linear current regulation, and something like a TO220 to TO247 package power device.

    Simplest current control from a Prop, is a R-RC Divider DAC to give say 0..300mV, and an OpAmp + Logic Level MOSFET, with a Source sense resistor.
    eg 1 Ohm will give 300mA at 300mV - Op(+i) goes to 0..300mV DAC, and Op(-i) goes to Source sense and Op(op) drives the Fet gate.
    The DAC LPF gives natural pin protection.

    Or you could use a Voltage Follower regulator like a LT3080, but it is more costly than a OpAmp+Mosfet. (or even Power NPN)
  • idbruceidbruce Posts: 6,197
    edited 2012-05-24 04:14
    Thanks jmg

    It looks as though I will have to do quite a bit more research to get a better grip on this. I was hoping that it was going to be something simple such as quickly switching the current on and off.

    Perhaps I will call SMC and ask them for additional suggestions.

    Bruce
  • jmgjmg Posts: 15,173
    edited 2012-05-24 04:38
    idbruce wrote: »
    Thanks jmg

    It looks as though I will have to do quite a bit more research to get a better grip on this. I was hoping that it was going to be something simple such as quickly switching the current on and off.

    What's simpler than a couple of resistors, an OpAmp, and a TO220 'something' ? :)

    You need quite good precision if you are driving a Linear Valve like this, and do not want to add to the error bands.

    They do not even specify the Coil resistance, so saturated drive is out. (plus doing that has poor temperature behavior)
  • idbruceidbruce Posts: 6,197
    edited 2012-05-24 05:57
    What's simpler than a couple of resistors, an OpAmp, and a TO220 'something' ? :smile:

    I imagine it is very simple, once you know how to do it correctly, such as theory, selecting the proper components, etc... Like I said, I will have to do quite a bit more research, because I have never used an OpAmp before.


    NOTE TO SELF: Additional reference here http://arduino.cc/forum/index.php?topic=61792.0
  • jmgjmg Posts: 15,173
    edited 2012-05-24 14:53
    idbruce wrote: »
    I imagine it is very simple, once you know how to do it correctly, such as theory, selecting the proper components, etc... Like I said, I will have to do quite a bit more research, because I have never used an OpAmp before.

    Here is an example circuit, it is a common design. Q1 can be NPN or Logic level MOSFET
    http://www.uchobby.com/wp-content/uploads/2008/02/opamptransistorsink.gif

    Or, look at the LT3080 data sheet.
  • idbruceidbruce Posts: 6,197
    edited 2012-12-04 05:41
    While researching solenoid valves this morning, I vaguely remembered this thread, so I looked it up. Amazingly enough, it actually applies to the application that I am working on now, only 6 months later from when this thread started. What are the odds?

    One of them "DUH" moments :)

    Although not previously mentioned in this thread, this solenoid will control the air flow to the micro grinder that will be used for my CNC PCB Drilling Machine (which can be seen below), for the primary purpose of controlling spindle speed.

    This project has been in the works for well over two years and I am now on the third unfinished design of my PCB Drilling Machine :) However this design is completely different than the previous two designs, and it should be much easier to build as compared to the other designs, without having the proper equipment for machining. If only I had a lathe :(

    Well anyway, I am now working on the Z axis for the new machine, if I can get passed this point, I think the rest should be pretty easy. All I can say is that I have been doing a lot of research into old threads lately, and WOW, that valve sure has a nice price tag :(

    Bruce
    577 x 572 - 37K
  • Mark_TMark_T Posts: 1,981
    edited 2012-12-04 09:06
    The specs don't mention PWM - its likely the yoke is plain iron (rather than laminated) so PWM will just transfer heat to the yoke via eddy-current
    losses - in other words you'll have an induction heater rather than a proportional solenoid!

    However the fix is relatively easy I believe - add a "proper" inductor in series that's rated for your PWM frequency and smooths the current enough.
    For instance a 30mH inductor at 20kHz will reduce ripple to about 10mA. Also you can enclose the PWM side of things and reduce possible EMI
    from the cable to the solenoid.

    [edit: freewheeling diode essential, preferably schottky]
  • idbruceidbruce Posts: 6,197
    edited 2012-12-04 13:57
    @Mark_T

    Yea, the datasheet does not really include any suggestions for driving this solenoid, but the charts seem rather informative. I still have not called the manufacturer for suggestions, but I am now thinking more along the lines of a LM317 and a digital pot. However, I could be completely wrong about this :)
  • idbruceidbruce Posts: 6,197
    edited 2012-12-05 10:15
    Just making a post for future reference, although I am not sure it is applicable, because I have not thoroughly studied the document.
    http://patft.uspto.gov/netacgi/nph-Parser?Sect1=PTO2&Sect2=HITOFF&p=1&u=%2Fnetahtml%2FPTO%2Fsearch-adv.htm&r=1&f=G&l=50&d=PALL&S1=04737882&OS=PN/04737882&RS=PN/04737882
  • Duane C. JohnsonDuane C. Johnson Posts: 955
    edited 2012-12-05 15:23
    Hi Bruce;

    While it wasn't my project I was consulted on the control of an analog driven solenoid valve. In this case it controlled water flow through a heat sink for parts testing. Essentially it was part of a temperature control scheme.

    We used PWM to control the current through the solenoid. As I recall it was running at about 1KHz. (It's been about 20 years so maybe it was 5KHz to 10KHz??). Anyway, this worked very well. We did it with both the expensive "Store bought" linear valve and a cheap standard valve and both worked nicely.

    The standard valves come in 2 basic flavors:
    1. Poppet valves. These have positive pneumatic feedback which greatly increase the hysteresis. These are completely unsuitable for use in the linear region.
    2. Needle valves. These have no positive pneumatic feedback. OK, they may have some friction though. And not completely linear. But they were quite repeatable.

    To be fair our system was not open loop, it was closed loop and used feedback from a temperature sensor to control the current through the solenoid through PWM.
    You might want to use a tachometer circuit to sense your tiny turbine's speed.
    or
    A shunt resister to measure the average current as jmg suggests.

    Even in open loop you could use a small lookup table to convert desired speed vs. PWM % for the cheap valves.

    I have not seen the solenoids get hot due to Eddy currents caused by PWM operation. Sure, it must be there to some extent, but was insignificant compared to the expected resistive losses. The temperature rise was the same as when driven with a DC supply.

    The basic circuit looks exactly the same as a "Buck" converter. In this case the inductor is the solenoid and the load is the winding resistance. As Mark_T says the freewheeling diode is required.

    PWM is a much better choice than a linear regulator as I would think no heat sink would be required.
    The linear pass transistor would be required to dissipate at least (12V / 2) * (0.3A / 2) = 0.9W thermal.

    Duane J
  • idbruceidbruce Posts: 6,197
    edited 2012-12-05 16:01
    @Duane

    As you can imagine, I do not want to guess at a solution, especilly when a $100 valve is at risk, so I have been doing quite a bit of research. According to the documentation that I have found, pertaining to proportional solenoid valves, some people have had very good results with PWM control, and others have had a little better than mediocre results. Even though I do not want to guess at a solution, I am sure it will take a little experimentation to find the right solution.

    It is nice to have a wide array of input on this subject from some very knowledgable people.

    Thanks for your input Duane.

    Bruce
  • MJBMJB Posts: 1,235
    edited 2012-12-06 05:08
    Hi Bruce,
    just posted something similar here http://forums.parallax.com/showthread.php?143961-quot-Forth-of-the-Forth-quot-Challenge-(in-December)&p=1147561&viewfull=1#post1147561
    with a schema, and some code a few posts before.
    OF course the bipolar transistors can be replaced by matching FETs.
  • idbruceidbruce Posts: 6,197
    edited 2012-12-06 05:31
    @MJB

    Thanks... I appreciate your input and schematic.

    Bruce
Sign In or Register to comment.