Hi Arduino Community,
I have a project involving two linear actuators and an Arduino Uno:
The 18" actuator is raising/lowering a monitor on a cable/pulley. The 6" actuator is raising/lowering a smaller/lighter secret compartment in the cabinet I'm building - also on a cable/pulley.
They are powered using a 10A 12v power supply. Power is distributed using simple power distribution board, and a 5v 8-channel relay module. I would include the links but I can only include two as a new user.
I'm using a wiring technique detailed by the site where I got the 18" stroke actuator where you use two SPDT relays instead of one DPDT relay. The power and ground are wired to the NO/NC terminals of one relay, and then those terminals are also connected to the corresponding terminals on the second relay. This mirrors the double-pole attribute.
In the code below, I trigger the actuator using a button. When the button is pressed, a signal is sent to the relay providing current to the actuator, then a delay is set (I will ultimately use millis() once I get everything working). Once the delay is done, I signal the relay to stop the flow of current to the actuator.
My challenge is this:
The 6" actuator works fine. The 18" actuator also works fine when it's lowering the monitor. When the 18" actuator raises the monitor, however, it will sometimes make a small movement at the beginning of each second of the delay, and then not move for the remainder of the second. E.g. if they delay is set for 6000 milliseconds, it will move a total of six times - once at the top of each second of the delay - rather than smooth continuous motion for the 6 seconds.
I assume this has to do with the amount of current being supplied to the actuator, but the power supply provides 10A, and the max draw of the 18" actuator is 4A. I assume other components I'm using wouldn't provide enough resistance, or dilute the current enough to drop it below 4A, so I'm totally at a loss. Could someone please help? I've tried to include a simple schematic detailing the wiring of the 18" actuator as well as the code I'm using to test it. Thanks in advance.
int k7_signal = 11;
int k8_signal = 12;
int button = 8;
bool extended = false;
void setup() {
// put your setup code here, to run once:
pinMode(button, INPUT_PULLUP);
pinMode(k7_signal, OUTPUT);
pinMode(k8_signal, OUTPUT);
digitalWrite(k7_signal, LOW);
digitalWrite(k8_signal, LOW);
}
void loop() {
// put your main code here, to run repeatedly:
if(digitalRead(button) == LOW){
if(extended == false){
digitalWrite(k7_signal, LOW);
digitalWrite(k8_signal, HIGH);
delay(6000);
digitalWrite(k7_signal, LOW);
digitalWrite(k8_signal, LOW);
extended = true;
}else{
digitalWrite(k7_signal, HIGH);
digitalWrite(k8_signal, LOW);
delay(6000);
digitalWrite(k7_signal, LOW);
digitalWrite(k8_signal, LOW);
extended = false;
}
}
}