Instructables

Request: How to wire a Firgelli L16P to an arduino

Hi, everybody.

If you followed my instructables you know I'm always building robots.  I'm trying to assemble a Stewart platform using Firgelli L16P linear actuators.  My problem is that I can't seem to get the Arduino PWM to talk to the firgelli RC servo interface.  I have...
- 12v running to controller pins 1 (-) and 2 (+)
- arduino PWM pin 3 to controller pin 3
- controller pin 1 to arduino GND (for common ground)

and I'm running a version of the servo sweep example sketch, modified to run on pin 3.
The actuator doesn't move.

I've tested the control board with the PC control software from Firgelli (works) and I've tested the arduino with a TowerPro SG5010 I had lying around (also works).

Notice the controller LED will NOT come on in this configuration, but once I remove the common ground the light turns on.

So what am I missing?

If i have the L12-P, LAC board, adafruit shield, and the arduino uno, is it possible to obtain functionality in my linear actuator without an external power source?

behzadjk10 months ago
Hello,
Hello all,

this might come along as a redundant, but i have not found a single piece of info regarding how to run and control this.
i connect the linear actuator to the arduino: red to +5V, black to GND and yellow to pin9. the actuator turns on and extends to full length. then...nothing!!!
please help me out. am i missing something?
then i went and bought a adafruit motor shield and now i am not sure how to connect it to arduino.i did connect it (i guess) and ran the "sweep" code but nothing!!!
please help me...it might well be a small issue but it for sure is quite urgent. i appreciate any help.
my L12 actuator is -P version, if that helps...
aggrav8d (author)  behzadjk10 months ago
the firgellis have DC motors in them. they come with a control board that receives a PWM signal and then moves the DC motor until the linear potentiometer in your firgelli matches the PWM signal.

If you ignore the potentiometer/control board and apply 5v/gnd all you will get is movement out to one end. keep power going and you will probably damage it. reverse the current and the actuator will go the other way.

The pot should have three lines: in, gnd, and signal. put the 3.3v line to the pot and to aref, gnd to gnd, and signal to A0. then you should be able to read the pot and adjust the current to the DC motor through the adafruit shield. Might need a PID, too. Does any of that make sense? I am writing in a bit of a hurry.
behzadjk aggrav8d10 months ago
Dear aggrav8d

Thank you for your kind response. I did not however quite understand: so I am not going to be able to run the actuator solely on the basis of JUST the Arduino Mega 2560?
Secondly, if not, how do I connect the ADAfruit to the Arduino Mega 2560? and I did not catch the part for the connections...as you definitely know there are 5 pins to the actuator: yellow, black, red, purple and orange...
Would you please advise?
Also, is there a sample code for the Firgelli L12 -P linear actuator, to run and control basic motion?

Many thanks,
aggrav8d (author)  behzadjk10 months ago
I haven't tried connecting without a control board. Without hardware to test I cannot give you a definite how-to answer. The Firgelli has five lines, yes. three for the pot and two for the motor. The documentation on the firgelli website should explain which one does what. I have not used firgelli in over two years. I'm sorry I can't help more. :(
behzadjk aggrav8d10 months ago
Dear Aggrav8d

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,
photo-modified.jpg
aggrav8d (author)  behzadjk9 months ago
The terminal block you've pointed to is the incoming power supply for the motors/steppers attached to M1-M4. Your firgelli red and black lines should go to M1 and then follow the Arduino Motor Shield v2 example code for a DC motor.

The other three wires are for the potentiometer - attach them to gnd, power (3.3v? 5v?), and A0, then use analogread(A0) to find out what the pot is doing and maybe a software PID to position yourself with accuracy.
behzadjk aggrav8d9 months ago
I have followed the first part of your comments, exactly as you mentioned, as i previously did. but no movement. is there a specific sequence that i am not following? here is the code:

*****************************************
#include <Wire.h>
#include <Adafruit_MotorShield.h>
#include "utility/Adafruit_PWMServoDriver.h"

// Create the motor shield object with the default I2C address
Adafruit_MotorShield AFMS = Adafruit_MotorShield();
// Or, create it with a different I2C address (say for stacking)
// Adafruit_MotorShield AFMS = Adafruit_MotorShield(0x61);

// Select which 'port' M1, M2, M3 or M4. In this case, M1
Adafruit_DCMotor *myMotor = AFMS.getMotor(1);
// You can also make another motor on port M2
//Adafruit_DCMotor *myOtherMotor = AFMS.getMotor(2);

void setup() {
  Serial.begin(9600);           // set up Serial library at 9600 bps
  Serial.println("Adafruit Motorshield v2 - DC Motor test!");

  AFMS.begin();  // create with the default frequency 1.6KHz
  //AFMS.begin(1000);  // OR with a different frequency, say 1KHz
 
  // Set the speed to start, from 0 (off) to 255 (max speed)
  myMotor->setSpeed(150);
  myMotor->run(FORWARD);
  // turn on motor
  myMotor->run(RELEASE);
}

void loop() {
  uint8_t i;
 
  Serial.print("tick");

  myMotor->run(FORWARD);
  for (i=0; i<255; i++) {
    myMotor->setSpeed(i); 
    delay(10);
  }
  for (i=255; i!=0; i--) {
    myMotor->setSpeed(i); 
    delay(10);
  }
 
  Serial.print("tock");

  myMotor->run(BACKWARD);
  for (i=0; i<255; i++) {
    myMotor->setSpeed(i); 
    delay(10);
  }
  for (i=255; i!=0; i--) {
    myMotor->setSpeed(i); 
    delay(10);
  }

  Serial.print("tech");
  myMotor->run(RELEASE);
  delay(1000);
}

*****************************************

for the second part, the purple shows the signal pin, which i believe goes into A0 (as you suggested) but the yellow and orange will apparently go to +5 and GND. thank you.
photo-modified.jpg
aggrav8d (author)  behzadjk9 months ago
I don't see anything wrong with your code. Send me a pic of your wiring exactly as it is now, please.
behzadjk aggrav8d9 months ago
here it is:
Thank you.
photo (1) - modified.jpg
aggrav8d (author)  behzadjk9 months ago
Where do you think the power for the motor is coming from? The Arduino? That's 5v *maybe* 0.3a.

You need to supply 12v power to M/GND. There's two power sources: one from the arduino (for logic) and one to the shield (for motor power). It's possible in theory to have one power supply for both. If you do that there's a chance the motor draws too much power (for example if it stalls) and then there isn't enough for the logic and your Arduino will reset mid-job. Whoops.
behzadjk aggrav8d9 months ago
i guessed may be the power is not enough, but this is what the Adafruit was suggesting!
what would the proper setup would be then? or if this is correct, am i missing another power supply? please advise. how do i supply the 12V power to the 5 pin terminal?
aggrav8d (author)  behzadjk9 months ago
Did you read my last comment all the way through? 12v goes into M, is controlled by the shield, and sent at the right time to M1. it comes back from the motor, through the shield, and back out to GND. Hook your Firgelli red/black to M1, your 12v PS to M/GND, then run your code again.
behzadjk aggrav8d9 months ago
Is this the setup you were pointing out? (Please see attached picture)

I connected this way but now the Power LED is not steady green but just blinking green. I am worried that I might have fried the Adafruit!!
Would you correct me if i am wrong?
photo (2) - modified.jpg
aggrav8d (author)  behzadjk9 months ago
It looks like you've done it right. The light should be steady green. it's might be that putting 12v into the M1 pin before has now damaged the board. You can always take the shield off and test the arduino separately. You can also remove the jumper next to the M/GND and see if that makes a difference. Don't do these things while the power is connected!
behzadjk aggrav8d9 months ago
Dear aggrav8d,

Sorry for the delay.

Here is what has happened: The Adafruit got smoking, even with heat sinks...!!! so I had to throw it away. Then I tested Arduino and that was fried too...the system was not recognizing the USB connection anymore, so that one also off the grid...

NOW: i have got a Pololu Dual VNH 5019 motor driver shield for Arduino, which can handle and provide higher current: 12A and up to 30A. I have also got another Arduino and have connected the two. i was wondering if you could guide me through how i should connect the power from the power supply to the shield and form the shield to the actuator.

Also there is a demo code for the pololu driver that is supposed to turn the motor indicator LED on even when no motor connected, but i run the code and it does not turn the LED on. Please advise!

Attached is a picture of the setup...thank you.
Dual Pololu Driver + Arduino.JPG
aggrav8d (author)  behzadjk9 months ago
I have never worked with this sheild. Sorry.
behzadjk aggrav8d9 months ago
Dear Sir,

But I just tested the motor, and it works fine when connected directly to the power supply. Both back and forth, when switching the wires. What could other possibilities be? i run the demo code from Driver, compile and upload...but nothing! the demo code is supposed to run the motor back and forth...

Regards,
Behzad.
behzadjk aggrav8d9 months ago
Dear aggrav8d,

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!
photo.JPG
aggrav8d (author)  behzadjk9 months ago
Could it be the L12P motor is dead?
behzadjk aggrav8d9 months ago
Dear Sir,

But I just tested the motor, and it works fine when connected directly to the power supply. Both back and forth, when switching the wires. What could other possibilities be?

Regards,
Behzad.
TomCruz9 months ago
my L-16P did not extend nor retract when i supplied it with 9v battery but i hear that the motor inside is properly working..what do you think is the problem?? i tested it so many times in my projects but this is the first time i encounter this problem..
is there a firgelli service center where i can consult other concerns dealing with this??
aggrav8d (author)  TomCruz9 months ago
they are fragile. In the past I have unscrewed the inside moving part of the actuator in such a way that the motor no longer pushes and pulls. I got it to work again by twisting the shaft until it reconnected. I cannot guarantee this will work. It is probably better to call Firgelli.
TomCruz10 months ago
can i hack firgelli L16P with 100mm stroke length and make it 50mm??
i have an idea if i cut the screw of the 100mm and make it 50mm is that possible?? any comments??
aggrav8d (author)  TomCruz10 months ago
That's silly. Just use half the stroke length in software.
abaranuelo1 year ago
sir, can I control the position of firgelli L16P by only using a potentiometer and arduino?? thanks for the help>>
aggrav8d (author)  abaranuelo1 year ago
sorry, I'm not sure. You'll have to test it and post your results here so everyone else can benefit from your experience.
aggrav8d (author) 2 years ago
So it turns out the problem was pin 3 on my arduino, which appears to be dead. when I tried on another pin everything was fine. Bah!
jpf56z aggrav8d2 years ago

hey, i am using a l16p,Firgelli Linear actuator and wired it up the same as you did. I am trying to make it sweep out all at once and retract all at once. However it sweeps out in increments and also retracts in increments. It's not all in one motion. Any ideas what this could be?
aggrav8d (author)  jpf56z2 years ago
Can you please throw a video on youtube so I can see what you mean? Thanks.
jpf56z aggrav8d2 years ago
I am reading on the comments below and do you believe that my problems could be that i am using the servo library to control the actuator? Would posting my code also work? But i will also be posting up a youtube video so that you can also see.
aggrav8d (author)  jpf56z2 years ago
The more information you can provide, the better. Use Pastebin for your code. I might copy your code & video link to my blog, if that's ok with you.
jpf56z aggrav8d2 years ago
Yeah that's fine with me. Im sure it something with my code im just not sure what it can be i used the sweep example sketch and there is movement. I modified the code so that it simply extends and then retracts.
You have a delay between the 150 and 30 move, but not between the 30 and150 move. I suspect that upsets the electronics.
aggrav8d (author)  steveastrouk2 years ago
This seems like the mostly likely cause. The travel time from fully extended to fully retracted is about 5 seconds. If you only had one write in there it would probably move smoothly all the way.

http://www.marginallyclever.com/2011/10/controlling-your-arduino-through-the-serial-monitor/

The code in the link above will make it easy for you to type commands that can be followed by the arduino. Try to connect it to your servo.write and then you can make it go where you want and see how long it takes to respond.

Let me know if that helps.
jpf56z aggrav8d2 years ago
So I finally figured out what the problem was. The speed potentiometer on the LAC board was turned counterclockwise to the slowest speed. After turning the potentiometer clockwise to a faster speed, the issue was resolved. The actuator moves much faster and smoother now.

Than you for the help aggrav8d and steveastrouk.
jpf56z aggrav8d2 years ago
This is the youtube video demonstrating how the actuator extends and retracts in increment.

http://www.youtube.com/watch?v=1Wtb4oZuYog

The code is the following:

http://pastebin.com/JgeVa9E7

Hope this helps and you can help me out. Thanks
You didn't say it explicitly but I think you're trying to use the arduino servo library, which is wrong. This Firgelli controller board is going to handle the servo output for you, you just need to feed it 0-3.3V (analog) or 3.3V, 1kHz PWM (digital). The arduino servo library is meant for connecting directly to a servo.

I think the very last section ("Control Modes") of this PDF will help you:
http://www.firgelli.com/pdf/LAC_datasheet.pdf
So I think your wiring is correct, just try an analogWrite(pin,value) on pin 3:

analogWrite(3,255); // fully extended
analogWrite(3,0); // fully retracted
analogWrite(3,100); // partially extended
BUT arduino is 5V and firgelli is expecting 3.3, so analogWrite(3,168) is full open
aggrav8d (author)  brittohalloran2 years ago
The linear control board is 5v.
Got an oscilloscope ?