Multiple Linear Actuators Random Movement

Hello Team!

I am wondering if you might be able to help me with a little Arduino project I'm doing.

The Goal is to use an Arduino mega to control 16 small linear actuators, each with a 2 inch stroke. Here is the actuator I plan to use.

I'm thinking Arduino talks to relays which talk to the actuators.

Then create a 30 second loop that runs once when a button is pushed.
When the loop starts, all the actuators are completely retracted.
Then for the next 28 seconds, each of the actuators randomly extend or retract. They all go up an down randomly. Some go all the way up, some go part way, then stop then go back down, etc.

Then, for the last 2 seconds, all the actuators retract again and the show is over.

Can you suggest how I could write an Arduino script to make that happen?

I'll make a cool YouTube video of the project and share it - and the credit - with everyone :slightly_smiling_face:

Kindly,
Will

Think TWO relays per actuator. One to turn the power on and off and a second to reverse the polarity of the power. Or still two relays, by each SPDT.

1 Like

what determines how far they go up?

what causes them to retract?

You need to know the stall current of the actuator in order to choose a motor driver and power supply, and as typical, there is no useful information on the Amazon web site.

Apparently the actuators also lack limit switches, so they burn out if you try to drive them past the end stop.

No, the link says they open the DC circuit and wait for the reversal to go the other way. Don't know what is in them.

No, the link says

User comments disagree. Choose whatever you want to believe!

consider

// check multiple buttons and toggle LEDs

enum { Off = HIGH, On = LOW };

const byte PinBut     = A1;
const byte PinsLed [] = { 10, 11, 12, 13 };
#define N_Led   sizeof(PinsLed)

unsigned long msecLst;

#define MaxCnt  (10*10)
bool run;
int  cnt;

int  ledCnt [N_Led];

// -----------------------------------------------------------------------------
void
loop ()
{
    unsigned long msec = millis();

    if (LOW == digitalRead (PinBut))  {
        run = 1;
    }

    if (run && (msec - msecLst) > 100)  {
        msecLst = msec;
        if (MaxCnt <= ++cnt)  {
            run = cnt = 0;
            for (unsigned n = 0; n < sizeof(PinsLed); n++)  {
                digitalWrite (PinsLed [n], Off);
                ledCnt [n] = 0;
            }
        }

        else {
            for (unsigned n = 0; n < sizeof(PinsLed); n++)  {
                if (ledCnt [n])  {
                    if (0 == --ledCnt [n])
                        digitalWrite (PinsLed [n], Off);
                }
                else if (2 > random(20))  {             // turn on
                    digitalWrite (PinsLed [n], On);
                    ledCnt [n] = random (5, 15);        // duration
                }
            }
        }
    }
}

// -----------------------------------------------------------------------------
void
setup ()
{
    Serial.begin (9600);

    pinMode (PinBut, INPUT_PULLUP);

    for (unsigned n = 0; n < sizeof(PinsLed); n++)  {
        digitalWrite (PinsLed [n], Off);
        pinMode      (PinsLed [n], OUTPUT);
    }
}

In a perfect world, the max stroke of the linear actuator ("LI") would determine how far.

Say, for an LI with a max stroke of 2 inches. We could randomly choose 2 things. "Direction" and "Duration" tell the thing to go UP for 532ms. then at the end of the randomly chosen 532ms, there would be a 250ms Delay, then another randomly chosen Direction and Duration. IF the randomly chosen D&D would result in the LI being all the way up or all the way down, that'd be fine because we can use an LI that's protected from burning itself out.

Does that seem feasible?

The hardware issues are easy to solve by getting the right hardware.

For me, the problem is that my coding skills are elementary at best :slight_smile:

Then begin with one device and learn how to make it do what you want. Then two devices, etc.

Your coding and hardware skills will get a holiday if you look at some other actuators… (e.g.Firgelli)

These act the same as hobby servos, which make control a lot easier, Code and hardware a lot simpler.

1 Like

Maybe there's an actuator that'll act more like a stepper motor? Seems like that'd be way easier to manage.

Not easier. Look for the ones @lastchancename mentioned that have a servo controller build in, so you can control them with a standard 50 Hz 1-2 ms pulse straight outta the servo library.

You can get servo expander boards to handle many servos, be they real servos, continuous rotation servos or linear actuators what have a servo controller option.

a7

Do you need two inches travel? What load will be on the actuator?

Just thinking about making it cost less or as little as possible.

a7

Could probably get away with 1 inch. Going to be lifting a weight of 6 oz total.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.