HELP code to control STEPPER MOTOR AND RELAY (automated tube cutter)

Hi, I want to make a automated tube cutter but I`m having difficulties to do the arduino code.

The idea is to have a stepper motor to feed the cutter machine that will be controlled by a relay connected to the arduino.

The cutter machine is controlled by a pneumatic system and is currently controlled by a switch and I want it to be automatic.

I have already built the CIRCUIT SCHEMATICS as ATTACHED (The arduino is with a prototype shield and the LED connected to the relay represents the cutter machine).


1: Start the loop when the button from the prototype shield is pushed.

2: Run the stepper motor for a chosen number of steps, speed and acceleration. (the acceleration is to prevent the tube from slipping).

3: Stop the stepper motor.

4: Trigger the relay so that the cutter machine can cut the tube.

5: Stay with the relay triggered until the tube is completely cut (approximately 1 second)

6: repeat this loop until the prototype button is pushed again.

OBS: on the circuit schematics that you can see attached the pins are connected as follow:

pin 2: direction
pin 3: steps
pin 10: relay
pin 11: button from prototype shield
pin 12: green LED from prototype shield (will not be used)
pin 13: red LED from prototype shield (will not be used)

Thanks in advance!

I think that you want the Gigs and Collaborations forum. Bring your wallet.


I posted there as I was in doubt where to post.


I posted there as I was in doubt where to post.

You mean you crossposted there. Crossposting is NOT looked on favorably here.