Chagrin:
Another option is to use a relay board; a board with four relays would be quite cheap and let you avoid messing around with most of the soldering and transistors and diodes and stuff. Yourduino.com has a nice tutorial on using these relay boards.
I believe the relay will be the simplest option and allow me to hook all my components without fear of messing them up from an incorrectly set up circuit. I found a promising looking relay below, rated up to 30V DC/10 A.
https://www.amazon.com/SainSmart-101-70-101-4-Channel-Relay-Module/dp/B0057OC5O8
So, if I were to hook that relay up to a single 12V DC power source, would it be sufficient enough to supply power to the two solenoid valves rated at 12V DC? They are going to be activating at different times, per my code that I will post below. I'm assuming one channel will be sufficient for the air cylinder and rotary actuator.
int VALVE1 = 3; //First output valve for air cylinder
int VALVE2 = 6; //Second output valve for air cylinder
int VALVE3 = 9; //First output valve for rotary actuator
int VALVE4 = 11; //Second output valve for rotary actuator
int E_COUNTER = 13; //Pin output to control digital counter for number of cylcles completed.
// the setup function runs once when you press reset or power the board
void setup() {
// initialize all pins as an output.
pinMode(VALVE1, OUTPUT);
pinMode(VALVE2, OUTPUT);
pinMode(VALVE3, OUTPUT);
pinMode(VALVE4, OUTPUT);
pinMode(E_COUNTER, OUTPUT);
digitalWrite(VALVE1, LOW); // Ensure the air cylinder does not activate immediately when rig is powered up
digitalWrite(VALVE2, LOW); // Ensure the air cylinder does not activate immediately when rig is powered up
digitalWrite(VALVE3, LOW); // Ensure the rotary actuator does not activiate immediately when rig is powered up
digitalWrite(VALVE4, LOW); // Ensure the rotary actuator does not activiate immediately when rig is powered up
digitalWrite(E_COUNTER, LOW); //Ensure the counter does not accidentally count an extra cycle upon start up
delay(2000); // wait for 2 seconds prior to start
}
// the loop function runs over and over again forever
void loop() {
digitalWrite(VALVE3, HIGH); // Activate rotary actuator to open the handle from the door.
delay(1000); // wait 1 second to allow handle to be released from latch
digitalWrite(VALVE1, HIGH); // Activate air cylinder to push the now unlocked door open to full width.
delay(1000); // Allow door to be opened far enough before controlling rotary actuator again
digitalWrite(VALVE3, LOW); // Stop supplying air to this valve.
digitalWrite(VALVE4, HIGH); // Supply air to this valve to return the rotary actuator to its original position, allowing the handle to re-engage with the latch when door closes.
delay(2000); // Allow door to settle against the door stop
digitalWrite(VALVE1, LOW); // Stop supplying air to this valve.
digitalWrite(VALVE2, HIGH); // Supply air to this valve to retract the cylinder. The door closer will handle closing the door on its own.
digitalWrite(E_COUNTER, HIGH); // Send signal to the counter to add one tick to the current total number of cycles.
delay(200); // Gives time for controller to process signal
digitalWrite(E_COUNTER, LOW); // Send signal to the counter to add one tick to the current total number of cycles.
delay(3000); // Allows door to close completely and prepare for next cycle.
}
I am also going to connect a battery powered digital counter to the relay so that it may receive signals from the Arduino. Those batteries will provide 3V to the counter only, and the two wires coming out of it could go to the relay. Will connecting this counter to the relay interfere with it's operation? Or would that need to be connected via breadboard directly to the Arduino instead?