Pneumatic Testing Rig for my Job

Morning everyone!

Long story short, I was chosen to build a rig to test the life of a spring at my work. Exciting, I know. So far the rig consists of an air operated pneumatic piston, an air solenoid ( http://www.amazon.com/gp/product/B008IGHNUI?psc=1&redirect=true&ref_=od_aui_detailpages00 ) a regulator and few other parts.

What I need the controller to do is activate the solenoid about 30 reps per minute. The solenoid is normally closed so it just needs a current to open, when I loses current it closes. When the solenoid opens the piston extends and compresses the testing spring, when the solenoid closes it closes the piston and releases the spring. In addition to that, I need the arduino to count how many cycles it performs. This count can be done either when the piston hits a micro switch or hopefully the arduino can internally count how many times it sends off current to the solenoid. I’m hoping it can count 100,000 cycles. I already have an Arduino Uno and LCD with backpack. One of my main questions is how
to power the solenoid since it requires 12v. I was looking into 5v coil relays built for the arduino.

I don’t even have the slightest clue how to write code, my coworker does but he’s swamped with work and my deadlines coming up. You have no reason to help me and im not asking anyone here to write
codes for me or anything like that. I’m just asking for a little guidance, Maybe a parts list and example codes. Thank you all in advance.

That Amazon page doesn't seem to link to a datasheet. I don't feel inclined to look deeper. The simple answer is a relay will be good for this. However most relays require too much current to be driven directly from an Arduino pin. A "reed relay" can work directly from the Arduino pin and it's likely to be able to switch the current which this valve requires.

You need to start with running the Blink sketch on your Arduino to prove it's working and accepting code updates. Then switch to the Blink Without Delay sketch to understand how to do timed outputs without using the blocking delay() function.

You should then write down what the sketch needs to do with as much detail as possible: - engage solenoide - wait for up to 2 seconds - if the switch is not triggered, stop and sound an alarm - when the switch is triggered (within the 2 seconds) release the solenoid. Add one to the counter and update the display

You will need to use long int for the counter, as normal integers can't count past 32,767.

When you have made a start on the code, post it here with [ code ] tags. Nobody here wants to write code for you but they will usually point out problems and make changes to code that you've started.