Hello guys, I am new to the arduino community. I am working on a project that uses 2 12V linear actuators and 4 limit switches, but I am not sure what I would need and how to connect a 12V AC supply to the actuators and arduino together.
For the process of the project, I want to press a button and the 1st actuator to retract first, when it hits a limit switch, it will stop at the switch and activate the 2nd actuator to extract. When the 2nd actuator hits another limit switch, it will stop and complete the first process. For the second process, I press another button to retract the 2nd actuator, when it hits a switch, it stops and activate the 1st actuator to extract.
I would like 2 limit switches for each actuator to control the position, but only 1 actuator moving at a time. What I have right now are 2 actuators, power supply, limit switch, and I am not sure if I needed a 4-channel relay. Can someone please tell me what would I need for this project?
Hello
build your hardware with motors, relays and limit switches and simulate an Arduino with a few buttons and LEDs and check the inputs, outputs and times that should be processed by the Arduino.
Most probably you need a H-bridge to extract and retract an actuator. Such bridges are powered by 12V DC or more. Please give a link to the actuator data sheet.
Let me see if I can make it more clear of how I want the process work:
There are 2 linear actuators,4 limit switches, and 2 buttons. #1 and #2 limit switch are for A actuator, #3 and #4 switches are for B actuator.
Step1: press first button > A actuator will retract and hit switch #1 and stop > once it hits switch #1 it will activate B actuator to extract and hit switch #3 and stop.
Step2: press second button > B actuator will retract and hit switch #4 and stop > once it hits switch #4 it will activate A actuator to extract and hit switch #2 and stop.
I am also getting confuse on how to write the code when pressing a button once that will run Step 1, and press different button that will run Step 2.
Think deeper. All the items you mentioned can be considered steps, or 'states', in your process:
All at rest, no switches active, waiting for button press to start actuator A retracting
starting A retracting
waiting for A to hit S2.
stopping A, starting B to extend
waiting for B to hit S3
stopping B
waiting for second button press to reverse all the above
This state machine tutorial illustrates some things which will be useful to you to build your sketch. There are others on the site as well. Don't forget to look at switch/case on the IDE reference page.
Make loop() contain only the switch. Every state waits for one or more specific conditions that tell when it's time to do something and advance to another state.
E.g. in idle state (0) read the pushbutton and, if pressed, start expanding and advance to expanding state (1). Having names for the states makes the code better readable.
Hi,
Make ALL your limit switches Normally Closed connections, the actuator hitting the limit will then make it go open.
This is a form of fail safe if you have broken or intermittent connections form the controller to limit switch.