Firgelli L12 Linear Actuator Control with Arduino Uno

Hello,

I am very new to using Arduino Uno, and I am using it because I was given a project where I have to figure out how to expand and contract a balloon to specific measurements using a linear actuator connected to a syringe. The Arduino code tells the linear actuator to push and pull back on the syringe which pumps air into and out of the balloon.

That being said, I am a bit worried on what is the biggest angle I can tell the linear actuator to go to. Currently I have it at 300 degrees. Is that too big? Is there a capacity to the linear actuator I should know about so it doesn't burn out?

Also, I need to track how many cycles have passed and the amount of time each stroke takes. Is there a code that I need to implement or do I use something else to do this??

Here's the code I have so far:

#include <Servo.h>
int servoPin = 9;
Servo servo;
int angle = 0; // servo position in degrees
void setup ()
{
servo.attach(servoPin);
}
void loop ()
{

{
// scan from 0 to desired degrees
for (angle = 0; angle < 300; angle++)

{
servo.write(angle);
}
delay(15);
}
// now scan back from desired to 0 degrees
for (angle = 300; angle > -160; angle--)
{
servo.write(angle);
delay(15);
}
}

Thank you.

  • Ally

The datasheet suggests that the linear actuator's control is smart enough to not break when given an out-of-range value...

I'd be inclined to use writeMicroseconds() - you know that the range is 1000us to 2000us full scale, it saves a step of calculation, Also, it makes things a little more reasonable, since you're not using "degrees" as a unit to control a linear actuator (which seems sort of silly)

Thank you for the advice.

So do you mean that I would put writeMicroseconds() instead of servo.write(angle)? isn't 2000 microseconds only .002 seconds? that seems awfully short for the linear actuator to move a certain distance.

servo.writeMicroseconds() - yeah

The argument is the length of the pulse that it will send periodically (I think every 20ms? Something like that), which is how it tells the servo what position to move to. The servo library continues sending that pulse every 20ms (or w/e, see above) until you tell it otherwise. The circuitry in the servo looks at that pulse, and it's current position, and decides which direction (if any) to move in - it doesn't mean the servo moves to a location within that time.

Passing an angle to servo.write() does the same thing - after converting the angle to a number of microseconds that will get that angle on a normal servo.