Hi all. I want to simply take a 0-5V analog signal and step it up to a 0-12V output. It is to run a 12V solenoid with variable duty cycle, low current. Is there a simple breakout board that will do this? I tried the Spark Fun TSH82 for example but it’s so complicated I can’t seem to get it working. Thanks!
A few more details please. You would not normally use a variable analog signal to drive a solenoid. This is usually ON or OFF. Not variable. The time it is ON and OFF however can be variable but keep in mind this is relatively slow. Could be an operate time of 10mSec or more, release time similar.
Hi Bob, it is connected to the duty cycle and the actuation force. E.g. take a 6V solenoid, it can do 6V continuous (100% duty cycle), but it can also take 12V for short durations (e.g. 30sec). I want to hit it with 12V to boost the actuation force (<1sec), then electronically drop it back to 6V for the continuous holding. Hence the desire to use PWM or similar for duty control.
That is easy.
Get yourself a very handy little breakout board Core CE04538. It has a Mosfet and all the required bits. Easy to connect.
Connect high side of solenoid to 12V
Connect low side of solenoid to Mosfet Drain (“D” on board)
Connect Mosfet Source (“S” on board) to common ground
Connect PWM source (Arduino etc) to Mosfet Gate (“G” on board)
Connect a Diode, preferably a schotky diode, across solenoid. Cathode to High (+12V) side. This diode must have the forward current capability at least equal to the solenoid 12V operating current. This diode MUST be fitted or your other electronics including the Mosfet will last about 2 operations if you are lucky.
That’s it. Apply the PWM signal to the “G” connection. 100% duty cycle for full on, reducing to 50% duty cycle for an average of 6V for hold in. Up to you in your coding.
There is a circuit for that Freetronics board on Core website on product page.
Couldn’t be easier.
Another option could be to use a motor driver with current limiting, You can power the motor driver with 12V for that EMF kick, but the current limiting will make sure the solenoid doesn’t overheat.
How much is “low current”? Do you have a link to a solenoid datasheet we can take a look at?
Thanks Bob, that’s super helpful. I just checked, maximum current draw will be 915mA. I take it this will therefore be sufficient for the diode? Schottky Diode | Sparkfun COM-10926 | Core Electronics Australia
Also, that breakout lists up to 60V. Could I do the same thing with a different solenoid, with 48V as a 100% PWM and 12V as a 25% PWM? (In this case I’d need a bigger diode)
Thanks James. Datasheet attached. Per my last post expecting about 1A. A small breakout would be ideal rather than any large motor controller, as I have to control 6 solenoids in this application. More than 6 PWM signals are available.
3tubular_0.5x1_pull.pdf (276.7 KB)
Re Diode. I would go bigger. The 1A rating is a bit borderline. I would also go for a higher voltage like 100V. A typical device for this application is the MBR20100CT. This is actually two 100V 10A Schottky diodes in the one package with a common cathode. Commonly used in motor speed controllers with both diodes connected in parallel to give 20A capability. With your application if you stick to that 12V solenoid and being common cathode you could use one diode for each solenoid. Connect the cathodes to the high side of the solenoids which would be the 12V supply and connect the anodes to the low (Mosfet) side of each individual solenoid. Core have this Code CE07844 or Jaycar ZR1039.
With this sort of application the voltages and currents can me many times what you would expect so it is a good thing where bigger is better.
Attached a simple circuit
I would not go too far. No more than 24V. I would even be a bit wary of that. If you do you will have to upgrade quite a long way. As I said the generated voltages and currents of an inductor (solenoid) could be anything and are dependent on several factors like switching time etc. Also the diode will take a finite time to switch and for this very short time any voltage generated across the solenoid will be ADDED to the supply so with a 48V supply this voltage even for a very short time could go to 150 or 200V or more. If you don’t believe the volts are added try drawing a diagram with a battery representing the reverse voltage generated by the inductor. You will see that it ADDS to the supply.
Hi Bob, thanks for both replies. Ok I have ordered all those components will give it a go! On the PWM line what do you think the current draw will be for the control signal. Very small?
There is a very small capacitor from Gate to Ground which is actually a short circuit at switch on for a very short time. The 1k series resistor in the Gate circuit on that board limits the current to 5mA @ 5V for this time. The average current is minuscule.
By the way if using a stand alone Mosfet this (or similar) current limiting protection resistor should always be used. The 10k resistor from Gate to ground is to make sure this cap is discharged if the driving device does not discharge it (mostly always does) or the Mosfet will never turn off or will stay on for a very long time.
Thanks Bob. Parts received today. Quick wire up and things don’t seem to be working as expected. 3.3V into the gate G on the CE04538 breakout isn’t pulling the drain to 0V. I have wired up exactly according to your drawing, and also checked the Freetronics website. Everything looks correct. I’m using the MBR20100CT diode, with cathode to positive side of solenoid and anode to negative side of solenoid. I have triple checked everything, can’t seem to find the problem. Running the multimeter over all points it just looks correct if there was 0V into the gate, but there is 3.3V applied. Anything obvious, or just try another board and generally chase it?
Should mention too, everything is running common ground from one source.
Haha… luckily I ordered 2 of the breakouts. The second seems to work find in the same circuit. I’ll test some more but maybe a dodgy board.
That was the first thing I was going to suggest.
Can you try 5V to the gate. I have always expressed concern about driving this sort of thing with 3.3V as you could see if you had time to go back through all my posts. In the pasts it would appear that just because some units work at 3.3V all units are OK under these conditions. Unfortunately I have found over the last 50 years that with electronic component tolerances and Murphy’s law this is not always the case.
The Data sheet for that Mosfet provides graphs for 5V and 10V gate voltage so I assume it is classed as a “Logic Level” Mosfet ie; 5V.
Having said that the Freetronics web page for that device here
states operation at both 3.3V and 5V.
Doubly check grounds and make sure the 3.3V ground is connected to source. Try with 5V and if that is OK you may have cot caught with tolerances and Murphy’s law as I mentioned above.
I have one of those somewhere and if I get a bit of time will try mine at 3.3V and see what happens.
I tend not to use 3.3V devices so I have never had this problem. I have always thought it to be a bit flaky for experimental purposes as if you have a few little voltage drops here and there it does not take too much to eat up most of 3.3V where 5V leaves just that bit more head room for reliability. But that’s just me.
Thanks Bob. 5V also doesn’t work on that part. But the second part everything works fine. Strange!
Sounds like you have a faulty device. Would not be the first time tat has happened.
All OK now ???
Yes all sorted and working now, thanks! The only problem is that controlling the solenoid with a PWM signal, when the PWM is <100%, the solenoid is very noisy due to the on-off switching. It is enough to cause the plunger to oscillate a very small amount and “buzz” against the end-stop. We looked into how to tackle this. We could either try to filter the output with an RC circuit, but minimising ripple would sacrifice the time constant which isn’t ideal, we want the target voltage level to be reached very quickly (<1ms rise time with a PWM frequency of about 1kHz).
The other option is to run 2x of those mosfet breakouts, one at say 24V and one at 12V, and quickly switch the 24V one off and then switch the 12V one on after. The delay between switching the 24V off and the 12V on could not be more than 1ms or the solenoid latches, we checked it. Do you think this can provide a safe and reliable solution, or is there risk of hurting something this way?
Any thoughts appreciated!
You mentioned 1mSec a couple of times. I don’t know anything about your particular relay but a typical operate time for an average relay like the Omron LY series is 10mSec and the same for the release time. As a solenoid operates in a similar manner I would expect this time to be somewhere close. A data sheet should tell you.
I have never thought of operating a solenoid with PWM but I suppose it should work. The native Arduino PWM is a bit over 400Hz which is a period time of a bit over 2mSec which is quite slow. This is because the majority of applications for this type of thing is motor speed control and any good size motor will not handle any faster than this due to the large inductance of the windings. The Buzz and vibration would probably be pretty normal at this frequency. You could probably improve this by using a higher frequency but there will be a limit depending on the inductance of the solenoid. As you are only switching one coil (as against several to rotate a motor) you may be able to go fairly high. You only need to go high enough to stop the chatter or get out of audible range. This upper frequency could be easily established by driving the Mosfet with a function generator if you have access to one of these.
The circuit I supplied is usually called a “low side” switch and if you think carefully you should see that it would not be as simple as it sounds. You can’t put it into the “high” side as without special pump circuits you could never turn the Mosfet on. You may be able to arrange “high side” mosfet switches but you would need 2 power supplies and would be a bit messier.
Just why are you trying to do it this way. Would it not be easier to use a solenoid that will fulfil your initial requirement in the first place instead of overdriving a smaller one by 100% then reverting to design voltage to keep it there.
Just looked up that link you provided earlier. There are a couple of graphs referring to operate time.
If you are keen to go down the 2 power supply path the following circuit will work.
The 24V and 12V can be swapped out for 12V and 6V if needed with no other change.
Here I have used 1 low side switch to activate the solenoid and a high side switch to inject 24V. The 12V supply is always on and the 24V switched on when needed and will take priority when on as the upper diode will be reversed biased and the 12V will take no part in operation. When the 24V is switched off the 12V is already there and will take over with no delay so that part of operation is solved.
In operation you would probably turn on the 24V, switch the solenoid then after predetermined delay turn the 24V off. I think that is what you want to do.
The Pololu-2814 is a P channel high side switch sold by Core (that is their stock code) and full info is on their web page. It is fitted or has provision for a slide switch. If fitted it must be in the “OFF” position for your application. If not fitted leave it off.
Signal voltage 5V or 3.3V. I am not a big fan of 3.3V for switching Mosfets and much prefer 5V. Most of these devices state “Logic Level” which implies 5V. Some say they work OK at 3.3V but it is interesting to note that data figures are given for 5V and 10V with no mention of 3.3V. That is not saying that 3.3V devices do not exist but of the general range on offer to us mere mortals they seem to be pretty rare. I personally like to turn these hard on to closer emulate a switch as they are designed to be. If not ON fully the resistance will be higher so if a bit of serious current is involved they will get pretty hot and could become unreliable (cumulative damage) or fail prematurely. The high side switch might be OK at 3.3V as it is actually turning on a transistor but once again this has to be fully on to switch the Mosfet and if there is not enough base current this will not happen.
I find it easier and more reliable to stay with 5V.