Hi everyone,
I am working on a project where I need something to move back and forth very rapidly. Lets call each movement a stroke.Think about how a sewing machine needle moves up and down really fast. A stroke is defined by the time that it starts moving to the time that it returns to the original position (essentially the period of a square wave). The faster the better. Ideal is 200 strokes per second, but if I could get above 100 I would be happy. Currently I can get to about 55. Length of movement is currently 0.35 inches with this solenoid. That could be changed to longer or slightly shorter if needed.
Currently I am using an arduino as the controller and a solid state relay to trigger the solenoid. I also have a proximity sensor rated at a much higher frequency than this. The SSR and prox. are nowhere near bottle necking. I have a spring to return the solenoid to the top of the stroke. I can change everything about the spring (rate, length, diameter). I can also adjust where the prox. is and where it is triggered by the flange of the solenoid.
PWM with the arduino didnt work at all since the only thing you can adjust is duty cycle.
The code that seems to work the best is below. The ontime is used to allow the solenoid to reach the bottom of the stroke. This is adjustable and, depending on the mechanical setup, can be completely eliminated. Between 4 and 5ms seems to be the sweet spot right now. I don't necessarily need the proximity sensor, but it was a convenient way to trigger the solenoid to cycle again without messing with the off time delay.
#define ontime 5
#define SSR 9
#define PROX 2
int PROXSTATUS;
void setup() {
// put your setup code here, to run once:
pinMode(PROX, INPUT);
pinMode(SSR, OUTPUT);
}
void loop() {
PROXSTATUS = digitalRead(PROX);
if(PROXSTATUS == 1){
digitalWrite(SSR, HIGH);
delay(ontime);
digitalWrite(SSR, LOW);
}
else{
digitalWrite(SSR, LOW);
}
}
I'm thinking I might need to switch to some sort of mechanical system that changes the output of a motor to linear motion to get the speed I am looking for. Similar to a crank and piston in an engine.