Pulsing Solenoid

Hi everyone, Rookie team here. We are happy to say as of Saturday night we have a driving robot that can pick up balls and throw them. The way our intake and catapult mechanisms work, once the ball is picked up, the only way out is by our pneumatic catapult. Obviously we can open the solenoid to fire the catapult, but we really don’t want to use that for passing. We would prefer a way to quickly pulse the solenoid, so as to just tip the catapult up, dumping the ball out. Looking around in the forums found little, but I do think I came to the conclusion that this code would have to be put into the Periodic Tasks VI.

(TL;DR, I want to pulse a solenoid on and off)

I don’t have access to the robot at the moment to try this, but would this work? Is there a better way to do this? Am I just a crazy person? This code is in Periodic Tasks. The idea being that as long as the button is held down, the solenoid is turned on and off over and over again. Exact duration would change with experimenting.



I do not see anything wrong with this code. Although the solenoid might not even launch due to the short time given. I understand you just want to pulse it, but I’m not sure about the timing.

That’s going to rapid fire the solenoid on and off until the driver’s reaction time allows him/her to let go of the button.
I’d add code to fire only once per button press.

The second 10ms Wait isn’t necessary.

We did something similar once before. I’ll try to look up the solenoid reaction time.
I think I’d start with a longer period for the solenoid, so you start testing with it moving and proceed to slow it down until you reach the optimum time.
I seem to remember that it only starts twitching at around 6ms.

We’ve been playing around with solenoid pulsing this year and Mark is right about the reaction time- Switching on/off for our Festo VUVG solenoid is 7ms/19ms. My understanding of it was that in order for the solenoid to turn on, you would have to send it a signal for at least 7ms, then once you stop sending the signal, it would take an additional 19ms to completely close.

In order to make the code run only once per button click you’d need to use rising edge detection. I’d refer to this thread.

I’ll see if I can find some code to post.

Thanks all, definitely going to use the rising edge detection. I haven’t looked into it to far, but whatever it is, the code I posted did not work. Will figure it out tomorrow.

This code will execute only on the button press, this way your sequence doesn’t keep repeating.

Credit goes to Team 358’s website!