Linear actuator one button

I am looking to use a linear actuator as part of a Halloween project. The linear actuator will push sweets/candy from a hopper down some drain pipe to the monsters below.

Ideally the linear actuator will be:

Controlled by one button i have some light up, old arcade style buttons and when pressed the actuator will extend fully and then fully retract automatically)

&

Have a time delay after every use.

I have seen many examples of actuators using a two button system, can anyone help with a one button solution?

Regards
Matthew

Explain exactly what is to occur.


Always show us a good schematic of your proposed circuit.
Show us a good image of your ‘actual’ wiring.
Give links to components.

Hey brother love, I like the cut of your jib. Gimme a hot minute to dig up what you need. You'll need a relay board, a linear actuator is just a motor that spins in one direction until it hits its internal limit switch then stops, then all you have to do is reverse the direction after some time delay.
...Ok, I found the chest (my avatar pic) motor controller using a linear actuator. It's an Arduino that receives chars from another Arduino and does the deed.
Replace the char stuff with your button press. Any questions, shoot. I always gots time for fellow Halloweiners. Key thing to know though is precisely how long your actuator takes to reach its full travel distance. There's a comment in the code that follows to that effect.







char rxChar;
boolean newData = false;
char trashChar = ';';

const int forwards = 7;
const int backwards = 6; 
const int readyLed = LED_BUILTIN;

void setup() {
  pinMode(forwards, OUTPUT);//set relay as an output
  pinMode(backwards, OUTPUT);//set relay as an output
  pinMode(readyLed, OUTPUT);
  digitalWrite(readyLed, LOW);
  Serial.begin(115200);
}

void loop() {
  recvOneChar();
  showNewData();
  switch (rxChar) {

    /************  full open-hold(some duration)-close functions  ******/
    case ('b'):
      normalLong();
      break;
    case ('o'):
      normal();
      break;
    case ('p'):
      halfShort();
      break;
    case ('u'):
      halfMilli();
      break;
    case ('v'):
      quarterShort();
      break;
    case ('w'):
      quarterMilli();
      break;
    case ('x'):
      eightShort();
      break;
    case ('y'):
      eightTiny();
      break;
    case ('z'):
      eightTease();
      break;
    /************ end full functions  ***********************************/

    /************ core functions/discrete operations ********************/
    case ('s'):
      stopAct();
      break;
    case ('h'):
      holdAct();
      break;
    case ('f'):
      fullExtend();
      break;
    case ('e'):
      extend();
      break;
    case ('a'):
      halfE();
      break;
    case ('t'):
      quarterE();
      break;
    case ('c'):
      fullRetract();
      break;
    case ('r'):
      retract();
      break;
    case ('l'):
      halfR();
    case ('d'):
      quarterR();
      break;
    case ('k'):
      holdLong();
      break;
    
  }
  /******************** end discrete operations  ************************/
  /******************** end switch/case *********************************/
  digitalWrite(readyLed, LOW);
    rxChar = trashChar;

  
}
/******************** end void loop(){} *******************************/
void recvOneChar() {
  if (Serial.available() > 0) {
    rxChar = Serial.read();
    newData = true;
  }
}

void showNewData() {
  if (newData == true) {
    newData = false;
  }
}

/**************************   COMBINED FUNCTIONS  *********************/
void normalLong() { // 1 minute
  extend();
  holdLong();
  retract();
}

void normal() { // hold 30 sec
  extend();
  holdAct();
  retract();
}

void halfShort() { // hold 3 sec
  halfE();
  stopAct();
  halfR();
}

void halfMilli() { // hold 1.6
  halfE();
  milliStop();
  halfR();
}

void quarterShort() { // hold 3
  quarterE();
  stopAct();
  quarterR();
}

void quarterMilli() { // hold 1.6
  quarterE();
  milliStop();
  quarterR();
}

void eightShort() {  // hold 3
  eightOpen();
  stopAct();
  eightClose();
}

void eightTiny() {  // hold 1.6
  eightOpen();
  milliStop();
  eightClose();
}

void eightTease() { // hold 0.8
  eightOpen();
  microStop();
  eightClose();
}

/**************************   DISCRETE FUNCTIONS   *******************************
      Activate the relay one direction, they must be different to move the motor
              this particular actuator takes 20 seconds each way */

/*************************   OPENING FUNCTIONS  *********************************/
void fullExtend() {
  digitalWrite(backwards, HIGH);
  digitalWrite(forwards, LOW);
  digitalWrite(readyLed, HIGH);
  delay(22000);
}
void extend() {
  digitalWrite(backwards, HIGH);
  digitalWrite(forwards, LOW);
  digitalWrite(readyLed, HIGH);
  delay(20000);
}
void halfE() {
  digitalWrite(backwards, HIGH);
  digitalWrite(forwards, LOW);
  digitalWrite(readyLed, HIGH);
  delay(10000);
}
void quarterE() {
  digitalWrite(backwards, HIGH);
  digitalWrite(forwards, LOW);
  digitalWrite(readyLed, HIGH);
  delay(5000);
}
void eightOpen() {
  digitalWrite(backwards, HIGH);
  digitalWrite(forwards, LOW);
  digitalWrite(readyLed, HIGH);
  delay(2500);
}


/**************************    CLOSING FUNCTIONS  *************************************/
void fullRetract() {
  digitalWrite(backwards, LOW);
  digitalWrite(forwards, HIGH);
  digitalWrite(readyLed, HIGH);
  delay(22000);
}
void retract() {
  digitalWrite(backwards, LOW);
  digitalWrite(forwards, HIGH);
  digitalWrite(readyLed, HIGH);
  delay(20000);
}
void halfR() {
  digitalWrite(backwards, LOW);
  digitalWrite(forwards, HIGH);
  digitalWrite(readyLed, HIGH);
  delay(10500);
}
void quarterR() {
  digitalWrite(backwards, LOW);
  digitalWrite(forwards, HIGH);
  digitalWrite(readyLed, HIGH);
  delay(5500);
}
void eightClose() {
  digitalWrite(backwards, LOW);
  digitalWrite(forwards, HIGH);
  digitalWrite(readyLed, HIGH);
  delay(2500);
}

/********************************   STOP/HOLD FUNCTIONS  ********************************/
void stopAct() {
  digitalWrite(forwards, HIGH);
  digitalWrite(backwards, HIGH);//Deactivate both relays to brake the motor
  digitalWrite(readyLed, HIGH);
  delay(3000);
}
void milliStop() {
  digitalWrite(forwards, HIGH);
  digitalWrite(backwards, HIGH);//Deactivate both relays to brake the motor
  digitalWrite(readyLed, HIGH);
  delay(1600);
}
void microStop() {
  digitalWrite(forwards, HIGH);
  digitalWrite(backwards, HIGH);//Deactivate both relays to brake the motor
  digitalWrite(readyLed, HIGH);
  delay(800);
}
void holdAct() {
  digitalWrite(forwards, HIGH);
  digitalWrite(backwards, HIGH);//Deactivate both relays to brake the motor
  digitalWrite(readyLed, HIGH);
  delay(30000);
}
void holdLong() {
  digitalWrite(forwards, HIGH);
  digitalWrite(backwards, HIGH);//Deactivate both relays to brake the motor
  digitalWrite(readyLed, HIGH);
  delay(60000);
}

For those about to build, I salute you! :vulcan_salute:

You need to use an actuator that can give you the signals for fully extended and fully retracted. Your Arduino has no way of watching the movement.

No components old wiring diagram yet still trying to work out if this is feasible. As a one button operation.

Halloweens the best time or year and a great excuse to build some fun stuff. Thanks for the advice, ill mock it up next month and let you know how it goes. Thanks!

Paul, thanks yes i am just looking at actuators now. Most have a safety switch that will prevent over extension that could be used if i can get the feedback

No problem! I've got a linear actuator awaiting install in a hope chest myself, another chest for defeating the dragon one of four ways.
Oh, credit where it's due: the serial handler isn't mine at all, it's @Robin2 's. I shamelessly plug his method here because it kept me out of therapy when things were going really tough one build and I couldn't figure out why.
The stuff you'll need is really the end functions and the setup. A relay shield and trial and error to get the travel distance you want based on time worked really well for me. I tried to avoid the absolute extreme end points though (my basic open close was 20000 milliseconds, not 22000, to prevent overdriving anything).

Now that I'm rereading your original post though, I'm not totally sure what I understand your vision but I'd like to add that mechanically, it sounds an awful lot like a windshield wiper motor build. Linear actuators are great and all, but they're slow, just so you know.
PM me if you want to know more about that in terms of Halloween builds.

Why not post links to one or some of those then, and perhaps someone could advise on the mod from 2 buttons to 1.

One button, two relays will do the trick.

Your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advice on) your project :wink: See About the Installation & Troubleshooting category.

Have a look at Fitgelli linear actuators.
A bit pricey, but easy to control.
No limits needed, even easier if you use the models with RC servo control.

Or if the displacement isn’t very far, you could use an RC servo - cheap & simple.

The bellow link displays what i am trying to achieve.

The difference being i would like it to operate from a button not a voice or phone as in this example.

(Time stamp 1:50min)