Skip to content

Instantly share code, notes, and snippets.

@dansteingart
Last active November 7, 2025 18:40
Show Gist options
  • Select an option

  • Save dansteingart/9347074 to your computer and use it in GitHub Desktop.

Select an option

Save dansteingart/9347074 to your computer and use it in GitHub Desktop.
Arduino Code to Control an Figrelli L-12 Series (R or I Type) Linear Actuator via PWM/Serial Command
int incomingByte = 0; // for incoming serial data
int pin = 7; //White Cable Goes Here, Red to 5V, Black to GND
void setup() {
//Serial
pinMode(pin,OUTPUT);
Serial.begin(9600); // set up Serial library at 9600 bps
}
int reads[10];
int counter = 0;
int gofast = 0;
void loop() {
if (Serial.available() > 2)
{
while (Serial.available() > 0)
{
incomingByte = Serial.read();
reads[counter] = incomingByte - 48; //yay ascii -> char(i)-48 = i
counter++;
}
gofast = 100*reads[0] +10*reads[1]+reads[2]; //an idiot's byte shifter
Serial.println(gofast);
counter = 0;
}
delayMicroseconds(1000+gofast);
digitalWrite(pin,LOW);
delayMicroseconds(50);
digitalWrite(pin,HIGH);
}
@dansteingart
Copy link
Author

Arduino example code for this Figrelli Part: L12 Series

It should work with the R and I models. (only tested with R thus far)

All Figrelli says about this is here:

_PWM Mode:_ This mode allows control of the actuator using a single digital output pin from an external microcontroller. The desired actuator position is encoded as the duty cycle of a 5 Volt 1 kHz square wave
on actuator lead 2, where the % duty cycle sets the actuator position to the same % of full stroke extension. The waveform must be 0V to +5V in order to access the full stroke range of the actuator

Off the shelf arduino analogWrite() sort of works on Pins 9 and 10, and not at all on pins 5 and 6. The issue is the pulse required: it wants a square wave pulse between 1 and 2 ms, and the various PWM modes don't quite do it (e.g. 500 Hz mode works, but only between 128 and 230).

Here we can specify the duty cycle in microseconds to anything between 0 and 999, where 0 is fully retracted and 999 is fully extended. On my L12 unit 999 is over limit, I can only go to 990. The Arduino expects three characters, so 50 => 050, etc. Steps seem workable to ~5 ms increments.

Enjoy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment