Arduino controlling position of L12 Firgelli Actuator

Hi,

Has anyone tried to interface an Arduino with a L12 Firgelli linear actuator?

firgelli.com/products.php

firgelli.com/pdf/L12_datasheet.pdf

I got the option with Controller “I”
Integrated controller with Industrial and RC servo interfaces

Anyone have an arduino code to control the exact position of the L12 actuator?

Thanks

Do you see the serial printing you are doing at all? if you do, the problem might come form the library you are using.

We recommend, writing a simpler version of your code just to test the library and make sure it works. The you can gradually add the functionality you need while constantly testing it works.

I’m not sure I entirely understand the desired result… Do you want to have the actuators turn on one at-a-time in the order you specified, or do you want to turn on the actuators in a staggered/cascading order? Can you give us more information about your application?

From your code, I see that as part of the setup() function, you wait 1 second, then give each motor a short 30 ms pulse at about 60% power, and stop. Then the main loop starts, where you spin up the first motor from stopped to 100% forward back down to stopped, then up to 100% backwards and back down to stopped. This sequence is repeated for the other two motors with only a 30 ms wait between motors.

There’s no delays in the the spin-forward-up-down-reverse-up-down-stop sequence itself, so it must be incredibly short (milliseconds) total. Perhaps you want to start by adding a delay(3) inside each of the for-loops?

Hello,

That’s right, you actually need to connect the two motors leads (red and black from the actuator) to M1A and M1B (ex: red to M1A and black to M1B). We need to do this because the two outputs (per motor) of the motor controller chip are actually independent of the main GND since it needs to inverse the voltage in the motor to make it move the opposite direction.

Sincerely,

Hi Behzad,

Once you verify and upload the code, the program should start running immediately. Could you post the code so we can take a look?

Sincerely,

Dear jarcand,

I am hoping this is not redundant; I am trying to actuate a few linear actuators IN A SEQUENTIAL manner.
I am using motor shield v2 and arduino mega 2560 with firgelli L12 -P.
I am using the following:

[code]

#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include “utility/Adafruit_PWMServoDriver.h”

Adafruit_MotorShield AFMS = Adafruit_MotorShield();

Adafruit_DCMotor *my1stMotor = AFMS.getMotor(1);
Adafruit_DCMotor *my2ndMotor = AFMS.getMotor(2);
Adafruit_DCMotor *my3rdMotor = AFMS.getMotor(3);

void setup() {
Serial.begin(9600);
Serial.println(“Adafruit Motorshield v2 - DC Motor test!”);

AFMS.begin(1000);

my1stMotor->setSpeed(150);
Serial.print(“Speed Set 1st Motor\n”);

my1stMotor->run(FORWARD);
Serial.print(“Turn On 1st Motor\n”);
delay(30);
my1stMotor->run(RELEASE);
Serial.print(“Turn Off 1st Motor\n”);

my2ndMotor->setSpeed(150);
Serial.print(“Speed Set 2nd Motor\n”);

my2ndMotor->run(FORWARD);
Serial.print(“Turn On 2nd Motor\n”);
delay(30);
my2ndMotor->run(RELEASE);
Serial.print(“Turn Off 2nd Motor\n”);

my3rdMotor->setSpeed(150);
Serial.print(“Speed Set 3rd Motor\n”);

my3rdMotor->run(FORWARD);
Serial.print(“Turn On 3rd Motor\n”);
delay(30);
my3rdMotor->run(RELEASE);
Serial.print(“Turn Off 3rd Motor\n”);

}

void loop()
{

uint8_t i;

Serial.print(“tick”);

my1stMotor->setSpeed(150);

my1stMotor->run(FORWARD);

for (i=0; i<255; i++)
{
my1stMotor->setSpeed(i);
}

for (i=255; i!=0; i–)
{
my1stMotor->setSpeed(i);
}

Serial.print(“tock”);

my1stMotor->run(BACKWARD);

for (i=0; i<255; i++)
{
my1stMotor->setSpeed(i);
}

for (i=255; i!=0; i–)
{
my1stMotor->setSpeed(i);
}

Serial.print(“tech”);
delay(30);
my1stMotor->run(RELEASE);

delay(1000);

Serial.print(“tick”);

my2ndMotor->setSpeed(150);

my2ndMotor->run(FORWARD);

for (i=0; i<255; i++)
{
my2ndMotor->setSpeed(i);
}

for (i=255; i!=0; i–)
{
my2ndMotor->setSpeed(i);
}

Serial.print(“tock”);

my2ndMotor->run(BACKWARD);

for (i=0; i<255; i++)
{
my2ndMotor->setSpeed(i);
}

for (i=255; i!=0; i–)
{
my2ndMotor->setSpeed(i);
}

Serial.print(“tech”);
delay(30);
my2ndMotor->run(RELEASE);

delay(1000);

Serial.print(“tick”);

my2ndMotor->setSpeed(150);

my3rdMotor->run(FORWARD);

for (i=0; i<255; i++)
{
my3rdMotor->setSpeed(i);
}

for (i=255; i!=0; i–)
{
my3rdMotor->setSpeed(i);
}

Serial.print(“tock”);

my3rdMotor->run(BACKWARD);

for (i=0; i<255; i++)
{
my3rdMotor->setSpeed(i);
}

for (i=255; i!=0; i–)
{
my3rdMotor->setSpeed(i);
}

Serial.print(“tech”);
delay(30);
my3rdMotor->run(RELEASE);

delay(1000);

}[/code]

I am not sure where to put the delays (or not sure if putting delay is conventional when trying to make sequence of motions!?
any help would be appreciated very much! This does not seem to be so difficult but I am not getting the kind of motion I want:

Initially I am hoping to get a sequential movement of three actuators within (lets say) half a second delay. Then I was hoping to get this type of sequence:

1st 2nd 1st 3rd 1st 2nd 1st 3rd …

It is worth saying that I do realize the actuators move all the way to the fully extended length and I am hoping to, at some point, control that distance but I am thinking this is not an issue at this point as I believe for position control I need to use the potentiometer feedback.

Regards,
Karim.

OK sir, this is the new setup i have with: Firgelli L12 -P actuator + Arduino Mega 2560 + Pololu VNH Motor Drive

I have the made the connections as seen in the picture. I got the blue LED (i believe this is the motor indicator LED) working which happens when i supply the Vin and Gnd with the red and black from the power supply.

But when i connect the M1A and Gnd to motor, nothing happens! I run the demo code which should run the motor back and forth but nothing!

COULD it be because i am only connecting the red of the motor to one of M1A or M1B and not both?

COULD it be due to less current going into the motor that it is not moving? I am saying this because I tested the motor connecting it directly to power supply and it works perfectly.

Would you please advise? I appreciate your help!

Dear Jeffrey,

Thank you. I did according to what you suggested, but the motor is not doing anything! why is this the case?
When I run the code on Arduino IDE is it not just uploading and then verifying? should i not be expecting movements right after?

Regards,
Behzad.

Here it is:


[code]#include “DualVNH5019MotorShield.h”

DualVNH5019MotorShield md;

void stopIfFault()
{
if (md.getM1Fault())
{
Serial.println(“M1 fault”);
while(1);
}
if (md.getM2Fault())
{
Serial.println(“M2 fault”);
while(1);
}
}

void setup()
{
Serial.begin(115200);
Serial.println(“Dual VNH5019 Motor Shield”);
md.init();
}

void loop()
{
for (int i = 0; i <= 400; i++)
{
md.setM1Speed(i);
stopIfFault();
if (i%200 == 100)
{
Serial.print("M1 current: ");
Serial.println(md.getM1CurrentMilliamps());
}
delay(2);
}

for (int i = 400; i >= -400; i–)
{
md.setM1Speed(i);
stopIfFault();
if (i%200 == 100)
{
Serial.print("M1 current: ");
Serial.println(md.getM1CurrentMilliamps());
}
delay(2);
}

for (int i = -400; i <= 0; i++)
{
md.setM1Speed(i);
stopIfFault();
if (i%200 == 100)
{
Serial.print("M1 current: ");
Serial.println(md.getM1CurrentMilliamps());
}
delay(2);
}

for (int i = 0; i <= 400; i++)
{
md.setM2Speed(i);
stopIfFault();
if (i%200 == 100)
{
Serial.print("M2 current: ");
Serial.println(md.getM2CurrentMilliamps());
}
delay(2);
}

for (int i = 400; i >= -400; i–)
{
md.setM2Speed(i);
stopIfFault();
if (i%200 == 100)
{
Serial.print("M2 current: ");
Serial.println(md.getM2CurrentMilliamps());
}
delay(2);
}

for (int i = -400; i <= 0; i++)
{
md.setM2Speed(i);
stopIfFault();
if (i%200 == 100)
{
Serial.print("M2 current: ");
Serial.println(md.getM2CurrentMilliamps());
}
delay(2);
}
}[/code]


It seems right!
Thank you. I appreciate your help…this is driving me crazy!!!
Behzad.

Hello,
this is my setup: Arduino Mega 2560 + Adafruit v.2 + L 12 Firgelli -P Linear Actuator

(Picture Attached below this message for your attention)

I can only power up the actuator via the terminal block (shown with a RED arrow). How could I make it move back and forth?
Many Thanks in Advance,

Hello,
this is my setup: Arduino Mega 2560 + Adafruit v.2 + L 12 Firgelli -P Linear Actuator

(Picture Attached below this message for your attention)

I can only power up the actuator via the terminal block (shown with a RED arrow). How could I make it move back and forth?
Many Thanks in Advance,

I have got a similar Problem. I am trying to use L12-30-100-6-R lineal servos controlled with an Arduino Mega 2560 and powering them with an external battery of 6V. The fact is that I can not manage to make them move. I just want to make them move back and forth. Maybe the Arduino program is not right…
The program I want to use is this one:

#include <Servo.h> 

Servo servo;  // create servo object to control a servo 

void setup() { 
 servo.attach(46);  // attaches the servo on pin 46 to the servo object 
 Serial.begin(9600);
} 

void loop() {  
 servo.write(180);  // sets the servo position according to the scaled value 
 delay(3000); // waits for the servo to get there 
 servo.write(0);  // sets the servo position according to the scaled value 
 delay(3000);
}

Does anyone have an idea of what could be happening? Thanks in advance

If I recall correctly, the Firgelli actuators don’t like it when the signal jumps from one position to another. Can you try running the Sweep example that’s provided in the File -> Examples -> Servo menu to see if that one works? If not, can you upload a picture of your setup that goes with your code that shows all the connections, power supply, etc?

Hope this helps,

Hi badboi,

The Firgelli type I actuators are very versatile - you can interface it with the Arduino in several ways. One option is to treat it like a regular R/C servo, connecting the white wire to a digital output, the red to your power source and the black to the power source ground (and also connected to the Arduino ground). Send a timed pulse between 1000 and 2000us (1 and 2ms) sets the position. Alternatively, you can use Analog or PWM modes etc.

Hope this helps,

It seems you chose the -P version of the actuator with position feedback. This means the L12 operates at a normal DC linear actuator where you can control speed and position via a DC motor controller. It also has a built-in linear potentiometer to get the position. To position the actuator, you need to know the current position and the desired position, the calculate which direction to turn the motor and at what speed. You need to constantly perform these calculations until you are close to the desired position, then if the actuator is within a certain range of the desired destination, stop the actuator. This all needs to be coded. The option most people choose is the -R or -I where you can control it like a normal RC servo (the one disadvantage is that there’s no position feedback).

It’s all up to the code you are using. You need to read the manual for the motor shield and ensure you have the connections correct, then create code. It’s likely that the sample code is only for moving a DC gear motor and does not include feedback; this part you will need to implement yourself. If you are having issues with the code itself, we encourage you to create a thread on the Arduino forum where there are many users who can help you troubleshoot line by line.