NerdKits - electronics education for a digital generation

You are not logged in. [log in]

NEW: Learning electronics? Ask your questions on the new Electronics Questions & Answers site hosted by CircuitLab.

Sensors, Actuators, and Robotics » Varying Solenoid Force

May 24, 2012
by mcgroover
mcgroover's Avatar

Hi all,

I was wondering what the best way to control force from a solenoid would be. I have a 12V solenoid and would like to have it put out varying forces from 0 to its maximum. Would the best way be to just vary the voltage applied to the solenoid or is there a reason to do pulse width modulation?

I have looked at all the nerdkits video tutorials but is there one in particular that anyone would recommend for a similar application?

Thanks in advance for your advice.

May 25, 2012
by 6ofhalfdozen
6ofhalfdozen's Avatar

Hiya mcgroover!

I would imagine either way would work, but it really depends on your solenoid. I have worked with a few that are "all or nothing" solenoids and some that are more variable (1/2power = 1/2 open, 1/3 power ~= 1/4 open). I guess that isn't much help, but you are on the right track. If you have a specific solenoid in mind, you can try to read up on it (it might say in the data sheet), you can test it yourself, or see if anyone else has used the model of solenoid.

May 25, 2012
by mcgroover
mcgroover's Avatar

Hi 6-etc,

Thanks for your reply. Yeah I am planning to vary the voltage over the terminals of the solenoid to feel if there is a difference by hand, but I don't have a good way of measuring the force. The solenoid I bought from McMaster-Carr does not have a datasheet online, but I wonder if they could email one to me....

The other conceptual issue that I am trying to figure out is that it is a 12V solenoid and is rated as 800mA. Hence, if I use a mosfet, do I just put 12V Vds (since the one in the nerdkits saturates at 800mA by chance anyway?) As this is by chance it may work for me anyway, but I am not sure it is helping me understand the workings of a MOSFET.

May 25, 2012
by Ralphxyz
Ralphxyz's Avatar

mcgroover said:

but I don't have a good way of measuring the force.

Are you actually thinking about "measuring the force" of the solenoid (which would actually be easiest to do by measuring the current drawn) or to do you want to do as 6ofhalfdozen (our resident Borg) says and do 1/4, 1/3, 1/2, 3/4 and full? This would be the effective opening of the solenoid it probable would take as much solenoid "force" to get to 1/4 open as full open the current would vary depending on the driving voltage.

What is the solenoid you have? "we" (the collective we) have been pretty good at tracking down obscure datasheets.

Ralph

May 25, 2012
by mcgroover
mcgroover's Avatar

Hi Ralph,

The solenoid I have is here:

http://www.mcmaster.com/#electric-actuators/=hp1lug

and the model is 69905K481.

When you talk about the "opening of the solenoid" are you referring to the movement of the cylinder inside?

Thanks!

May 26, 2012
by Ralphxyz
Ralphxyz's Avatar

When you talk about the "opening of the solenoid" are you referring to the movement of the cylinder inside?

Essentially yes, the stroke would vary the opening. Well there is a fixed orifice but varying the stroke would limit the amount of water/air whatever to be released.

What are you trying to do where you need to be this particular?

The easiest method is to have multiple solenoids with different orifices instead of trying to do everything with one solenoid.

Ralph

May 27, 2012
by mcgroover
mcgroover's Avatar

Well I am trying to give a body a constant acceleration (after the static friction has been overcome). The solenoid I have has a metal slug in it so there won't be any air or water involved.

I do like your tip of just measuring the current drawn. I would assume that would be a pretty good indicator of relative force, given that the metal slug starts in the same spot every time. I just need to buy a multimeter!

Why would multiple solenoids be easier?

I have come to the conclusion that PWM is probably the best way, as I was thinking of varying the voltage using a MOSFET, but it seems to me that a MOSFET is really most useful as a binary off/on, rather than controlling the voltage.

Thanks!

May 28, 2012
by Ralphxyz
Ralphxyz's Avatar

The solenoid I have has a metal slug in it so there won't be any air or water involved.

and then:

Why would multiple solenoids be easier?

In this case, moving a metal slug, having different size slugs would obviously require/exert different "force" which is what you are trying to vary.

If you look at MOSFET speed controlers you might get some ideas.

You will probable use PWM one way or the other.

Definately you need a Multi Meter, you can get one from the Nerdkit Store (it's nice to support these guys and the support is great).

Ralph

May 29, 2012
by Ralphxyz
Ralphxyz's Avatar

I am really intrigued by why you want to/need to vary a solenoid "force".

So I finally looked at your reference link. That is not a very friendly specsheet.

Any way the "solenoid" you have 69905K481 has these specs.

Sealed Linear Solenoid Continuous, 
Push, 
1" Stroke, 
80 oz Force, 
12 VDC

So with a 1" stroke and 80 oz (designed) force what exactly are you trying to do?

Ralph

May 30, 2012
by mcgroover
mcgroover's Avatar

Well, I don't think the stroke is too important, but I was hoping to apply different forces on an object to demonstrate different accelerations. I guess the stroke length could come in handy if I want to take advantage of a lever and magnify the force. I think one of the problems of the solenoid is that the force increases the further the slug moves into the housing.

May 30, 2012
by mcgroover
mcgroover's Avatar

I am having trouble with the Pulse Width Modulation of this solenoid. I have connected the PB2 pin to the middle pin of a MOSFET and 9V (and the two wires of the solenoid) across the other 2 pins of the MOSFET. I have written this code which I would expect would output no force in the solenoid, but it appears to be outputting its full force. I thought by setting OCR1A as 512 and OCR1B as 0 it would essentially make a pulse width modulation of 0 width? (Also all OCR1B values up to 512 do the same thing). Any ideas?

include <stdlib.h>

include <math.h>

include <avr/io.h>

include <avr/interrupt.h>

include <avr/pgmspace.h>

include <inttypes.h>

include "../libnerdkits/delay.h"

include "../libnerdkits/lcd.h"

include "../libnerdkits/uart.h"

void pwm_init() {

OCR1A = 512;

TCCR1A = (1<<COM1B1) | (1<<WGM11) | (1<<WGM10);

TCCR1B = (1<<WGM13) | (1<<WGM12) | (1<<CS10);

}

int main() {

pwm_init();

DDRB |= (1<<PB2); // set PB2

OCR1B = 0;

return 0;

}

May 30, 2012
by pcbolt
pcbolt's Avatar

mcgroover -

I don't see your "while(1){}" loop, but I'm guessing you left it out to show the pertinent points of your code. The only thing that comes to mind is to use the ICR1 register to store the TOP value. You'd have to switch to WGM mode 14 (no 1<<WGM10). It's odd that OCR1A stores the TOP value for channel B.

May 31, 2012
by Ralphxyz
Ralphxyz's Avatar

mcgroover,do you have a flyback diode between the solenoid leads?

You might need one.

Ralph

June 03, 2012
by mcgroover
mcgroover's Avatar

Hi,

Ralph - Well, I am using a LED supplied in the nerdkit as a flyback diode. I am still unsure at the point of how to work out if it can handle the voltages when I disconnect the solenoid, but everything still seems to work at this point!

Pcbolt - I originally did have setting OCR1B in a while loop, but I got the same result. Is this the only thing needed in the while loop?

Also, I am not sure what I am doing wrong with my MOSFET. I had it set up correctly then had to take it apart. When I put it back together, I put 9V across the MOSFET - The red wire from the battery terminal on the source (left leg when looking at the flat side of the top) and the black wire on the drain (the right leg). When I did this the MOSFET heated up a lot and started smoking. I only have to assume that I have it the wrong way around, but I can't understand why that would be?

Thanks guys!

June 03, 2012
by mcgroover
mcgroover's Avatar

I should mention I am using a 2N7000 MOSFET supplied in the nerdkit.

June 04, 2012
by pcbolt
pcbolt's Avatar

mcgroover -

Actually you don't need anything inside the "while(1)" loop...it just keeps the program running. There is another fellow on here trying something very similar to what you are trying. Look for recent entries from "chaosatom" to see if his code and setup can help.

June 04, 2012
by mcgroover
mcgroover's Avatar

Hi pcbolt,

Yep, I saw that thread and was going to post in it if I continued to have trouble :)

Any idea about what I am doing wrong with my MOSFET?

Thanks.

June 04, 2012
by pcbolt
pcbolt's Avatar

mcgroover -

I think the source pin should be connected to ground and drain goes to positive. As it was once explained to me for an N-type MOSFET, "source" means source of electrons (negative charges) which come from the rail which is "most negative". You should have a "pull down" resistor on the gate pin to pull it to ground when the MCU pin is low (100 to 1k ohm should do). Once the MCU pin goes high, the 2N7000 should start to conduct.

June 04, 2012
by mcgroover
mcgroover's Avatar

Ah ok, thanks. I must have just mistakenly put it together last time which ended up being the right way!

Post a Reply

Please log in to post a reply.

Did you know that you can impress a loved one with a digitally-controlled Valentine's Day Card with randomly twinkling LEDs? Learn more...