Potentiometer Feedback Linear Actuator with Arduino

In this example we’ll demonstrate how to use an Arduino to read the signal from Firgelli's Feedback Rod Actuator and convert this into a distance measurement of how far the rod has been extended. This tutorial builds on principles discussed in the tutorial “Motor Driver Speed Control with an Arduino”, we advise reviewing that tutorial before continuing.

Note: This tutorial assumes prior knowledge with basic electronic principles, Arduino hardware and software. If this is your first time using Arduino we suggest learning the basics from one of the many great beginner tutorials available through Google and YouTube searches. Please be aware that we do not have the resources to provide technical support for custom applications and will not debug, edit, provide code or wiring diagrams outside these publicly available tutorials.

Components

Wiring

Hardware and software overview for reading position

Assemble the circuit as above and upload the code below. You will need to modify line 16 of the code to your specific stroke length, it is currently set for a 6 inch feedback rod actuator. 

This program will initially extend and fully retract the actuator to find the minimum and maximum analog sensor reading from the potentiometer (line 27 and 28 of the code). This is necessary because despite the range of the potentiometer readings being [0, 1023], in practice this range may be reduced due to the gear ratio inside the actuator preventing the potentiometer fully rotating to its limit.

Following this initial calibration sequence the actuator will continuously extend and retract outputting a stream of data displaying the current extended length of the linear actuator (in units of inches). 

Code

https://gist.github.com/Will-Firgelli/8c78092ca850aa8a50ae36842b97150f

Using an external potentiometer to control postion

The above example has demonstrated how readings can be taken from the Feedback Rod Actuator, but say we want to move the actuator to a specific position, how do we do this? The following section goes over such a situation by using an external potentiometer as the user input for the desired setpoint position of the actuator. In practice you can modify this example to take user input from whatever form you want. 

Wiring

Hardware and software overview for position control

The wiring is almost the exact same as the first part of this tutorial, only now an external potentiometer has been connected to analog pin A1. 

The program, below, moves to the position set by a user via the external potentiometer. In line 18 of the code a buffer variable is set, this is utilized later in lines 36 and 39. The buffer vairable gives a range around the desired setpoint position where the actuator will stop moving, this is required as of the two potentiometers have a tendency to fluatate by +/-2 units. As such if the buffer was not included the actuators would violently vibrate around the setpoint position. To see this in action set the buffer in line 18 to zero (do not allow actuators to vibrate for a long time as it can cause damage).

Code

https://gist.github.com/Will-Firgelli/41ec87433f0aaa1abc33e79168076b3b

Share this article

Featured Products

Firgelli Automations Classic Rod Linear Actuators

Classic Rod Linear Actuators

In Stock
$109.99 USD
Firgelli Automations Premium Linear Actuator

Premium Linear Actuators

In Stock
$129.99 USD
Firgelli Automations TVL-170 Rear Mount Pop-Up TV Lift

TVL-170 Rear Mount Pop-Up TV Lift

In Stock
On Sale From $500.00 USD

Need Help Finding the Right Actuator?

We precision engineer and manufacture our products so you get direct manufacturers pricing. We offer same day shipping and knowledgeable customer support.

Give us a call or email us and we'll be happy to help you find the best actuator for your project.