Last active
November 7, 2025 18:40
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | |
| } | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
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!