Linear Encoder Guide: Difference between revisions

From Phidgets Support
No edit summary
 
(14 intermediate revisions by 2 users not shown)
Line 2: Line 2:
__TOC__
__TOC__
[[Category:IntroGuide]]
[[Category:IntroGuide]]
[[Image:Linearenc_intro.jpg|400px|link=https://cdn.phidgets.com/docs/images/1/12/Linearenc_intro.jpg|thumb|<center>Linear encoder ([https://www.phidgets.com/?prodid=1106 ENC4110_0])</center>]]
==What Is a Linear Encoder?==
==What Is a Linear Encoder?==
[[Image:Linearenc_intro.jpg|400px|link=https://cdn.phidgets.com/docs/images/1/12/Linearenc_intro.jpg|thumb|<center>Linear encoder ([https://www.phidgets.com/?prodid=1106 ENC4110_0])</center>]]
Linear encoders provide an extremely accurate, repeatable, and cost-effective method of measuring an object's linear position and/or speed.
Linear encoders provide an extremely accurate, repeatable, and cost-effective method of measuring an object's linear position and/or speed.


Line 10: Line 10:


===Example - Length Measurement===
===Example - Length Measurement===
[[File:Linearencoder_example2.webm|800px|center]]
[[File:Linearencoder_example.webm|800px|center]]
<center>''The [https://www.phidgets.com/?prodid=1106 ENC4110] is used with an [https://www.phidgets.com/?prodid=959 Quadrature Encoder Phidget] and a [https://www.phidgets.com/?tier=2&catid=64&pcid=57 VINT Hub Phidget] (offscreen) to measure length. The results are displayed on a [https://www.phidgets.com/?prodid=963 Graphic LCD Phidget]</center>
<center>''The [https://www.phidgets.com/?prodid=1106 ENC4110] is used with an [https://www.phidgets.com/?prodid=959 Quadrature Encoder Phidget] and a [https://www.phidgets.com/?tier=2&catid=64&pcid=57 VINT Hub Phidget] (offscreen) to measure length. The results are displayed on a [https://www.phidgets.com/?prodid=963 Graphic LCD Phidget]</center>
<br><br>
<br><br>
==Which Linear Encoder Should I Use?==
==Which Linear Encoder Should I Use?==
'''TODO: Update with index channel guide when it is available'''
Phidgets Inc. currently offers eight types of linear encoders:<br><br>
Phidgets Inc. currently offers eight types of linear encoders:<br><br>
{| style="margin:auto;width:85%;"
{| style="margin:auto;width:85%;"
Line 21: Line 19:
! Product ID !! !! Travel !! Resolution !! Max Pull Speed !! Index Signal
! Product ID !! !! Travel !! Resolution !! Max Pull Speed !! Index Signal
|-
|-
| [https://www.phidgets.com/?prodid=1106 ENC4110_0] [https://www.phidgets.com/?prodid=1107 ENC4111_0] [https://www.phidgets.com/?prodid=1108 ENC4112_0] [https://www.phidgets.com/?prodid=1109 ENC4113_0] [https://www.phidgets.com/?prodid=1110 ENC4114_0] || || 300mm - 1400mm || 5µm || 1m/s || Yes ||[[Image:ENC4110_0.jpg|200px|link=https://wwwdev.int.phidgets.com/docs/images/8/84/ENC4118_0.jpg]]  
| [https://www.phidgets.com/?prodid=1106 ENC4110_0] [https://www.phidgets.com/?prodid=1107 ENC4111_0] [https://www.phidgets.com/?prodid=1108 ENC4112_0] [https://www.phidgets.com/?prodid=1109 ENC4113_0] [https://www.phidgets.com/?prodid=1110 ENC4114_0] || || 300mm - 1400mm || 5µm || 1m/s || Yes ||[[Image:ENC4110_0.jpg|200px|link=https://cdn.phidgets.com/docs/images/9/98/ENC4110_0.jpg]]  
|-
|-
| [https://www.phidgets.com/?prodid=1111 ENC4115_0] [https://www.phidgets.com/?prodid=1112 ENC4116_0] [https://www.phidgets.com/?prodid=1113 ENC4117_0] || || 1400mm - 2000mm || 5µm || 1m/s || Yes ||[[Image:ENC4117_0.jpg|200px|link=https://wwwdev.int.phidgets.com/docs/images/7/73/ENC4119_0.jpg]]
| [https://www.phidgets.com/?prodid=1111 ENC4115_0] [https://www.phidgets.com/?prodid=1112 ENC4116_0] [https://www.phidgets.com/?prodid=1113 ENC4117_0] || || 1400mm - 2000mm || 5µm || 1m/s || Yes ||[[Image:ENC4117_0.jpg|200px|link=https://cdn.phidgets.com/docs/images/d/d1/ENC4117_0.jpg]]
|}
|}
==How Do I Get Data From My Linear Encoder?==
==How Do I Get Data From My Linear Encoder?==
Line 29: Line 27:




[[Image:Linearenc_enc1000.jpg|600px|link=https://wwwdev.int.phidgets.com/docs/images/0/03/Linearenc_enc1000.jpg|center]]
[[Image:Linearenc_enc1000.jpg|600px|link=https://cdn.phidgets.com/docs/images/0/03/Linearenc_enc1000.jpg|center]]




For new designs, we recommend using the [https://www.phidgets.com/?prodid=959 Quadrature Encoder Phidget - ENC1000_0] (pictured above). The Quadrature Encoder Phidget will monitor the output of the linear encoder and update your software with an easy-to-use encoder count value.
For new designs, we recommend using the [https://www.phidgets.com/?prodid=1332 Quadrature Encoder Phidget - ENC1001_0]. The Quadrature Encoder Phidget will monitor the output of the linear encoder and update your software with an easy-to-use encoder count value.




There are also encoder interfaces built into many of our [https://wwwdev.int.phidgets.com/?tier=1&catid=71&pcid=15 Motor Controllers]. If your project includes a motor controller, the onboard encoder interface is a great option for our linear encoders.
There are also encoder interfaces built into many of our [https://www.phidgets.com/?tier=1&catid=71&pcid=15 Motor Controllers]. If your project includes a motor controller, the onboard encoder interface is a great option for our linear encoders.


===Converting Encoder Count to Length===
===Converting Encoder Count to Length===
'''TODO: Update when resolution has been updated'''
[[Image:Encoder_resolution.png|400px|link=https://cdn.phidgets.com/docs/images/b/b3/Encoder_resolution.png|thumb|<center>Resolution Specification for the [https://www.phidgets.com/?prodid=1106#Tab_Specifications ENC4110_0]</center>]]
[[Image:Encoder_resolution.png|400px|link=https://wwwdev.int.phidgets.com/docs/images/b/b3/Encoder_resolution.png|thumb|<center>Resolution Specification for the [https://www.phidgets.com/?prodid=1106#Tab_Specifications ENC4110_0]</center>]]
To convert from encoder pulses to length, use the '''resolution''' specification that is provided on the product page of your linear encoder.  
To convert from encoder pulses to length, use the '''resolution''' specification that is provided on the product page of your linear encoder.  


Line 46: Line 43:
<br><br><br>
<br><br><br>
====Example Code====
====Example Code====
The code below is derived from the [https://wwwdev.int.phidgets.com/?view=code_samples Phidget Code Sample Generator]. It shows how to convert position data from an encoder interface into a length measurement.
The code below is derived from the [https://www.phidgets.com/?view=code_samples Phidget Code Sample Generator]. It shows how to convert position data from an encoder interface into a length measurement.




Line 205: Line 202:
main()
main()
</syntaxhighlight>
</syntaxhighlight>
==Mounting and Installation==
==Mounting and Installation==
<center>{{#ev:youtube|yvS5ArYScUk|||||rel=0}}</center>
===Additional Hardware===
===Additional Hardware===
====ENC4110_0 - ENC4114_0====
====ENC4110_0 - ENC4114_0====
[[File:Linearencoder_additionalparts_2.png|400px|link=https://wwwdev.int.phidgets.com/docs/images/d/d5/Linearencoder_additionalparts_2.png|thumb|<center>Additional hardware that is packaged linear encoders from 300mm to 1100mm </center>]]
[[File:Linearencoder_additionalparts_2.png|400px|link=https://cdn.phidgets.com/docs/images/d/d5/Linearencoder_additionalparts_2.png|thumb|<center>Additional hardware that is packaged linear encoders from 300mm to 1100mm </center>]]
These linear encoders come with the following hardware:
These linear encoders come with the following hardware:
# 1x Flat carriage mounting plate
# 1x Flat carriage mounting plate
Line 220: Line 219:
# 4x Metal shims
# 4x Metal shims
====ENC4115_0 - ENC4117_0====
====ENC4115_0 - ENC4117_0====
[[File:Linearencoders_additionalparts_long.png|400px|link=https://wwwdev.int.phidgets.com/docs/images/0/03/Linearencoders_additionalparts_long.png|thumb|<center>Additional hardware that is packaged linear encoders from 1400mm to 2000mm</center>]]
[[File:Linearencoders_additionalparts_long.png|400px|link=https://cdn.phidgets.com/docs/images/0/03/Linearencoders_additionalparts_long.png|thumb|<center>Additional hardware that is packaged linear encoders from 1400mm to 2000mm</center>]]
These linear encoders come with the following hardware:
These linear encoders come with the following hardware:
# 1x Flat carriage mounting plate
# 1x Flat carriage mounting plate
Line 246: Line 245:
File:Linearencoder_300_mount_4.jpg|link=/images/b/b1/Linearencoder_300_mount_4.jpg
File:Linearencoder_300_mount_4.jpg|link=/images/b/b1/Linearencoder_300_mount_4.jpg
</gallery>
</gallery>
====ENC4115_0 - ENC4117_0====
====ENC4115_0 - ENC4117_0====
<gallery mode="packed">
<gallery mode="packed">
Line 253: Line 253:
File:Linearencoder_2000_mount_4.jpeg | link=/images/f/f0/Linearencoder_2000_mount_4.jpeg
File:Linearencoder_2000_mount_4.jpeg | link=/images/f/f0/Linearencoder_2000_mount_4.jpeg
</gallery>
</gallery>
===Carriage Mounting Plates===
===Carriage Mounting Plates===
These linear encoders come with two different mounting plates for the carriage. Use the bolts to attach the carriages (washers may be required). The plate can then be attached to the moving part of your system, which should is expected to be self-supporting (don not load the carriage). The carriages can also be connected to eachother using the bolts (nuts not included).
These linear encoders come with two different mounting plates for the carriage. Use the bolts to attach the carriages (washers may be required). The plate can then be attached to the moving part of your system, which should is expected to be self-supporting (don not load the carriage). The carriages can also be connected to eachother using the bolts (nuts not included).
Line 268: Line 269:
File:Linearencoder_cablemount.jpeg|link=/images/7/71/Linearencoder_cablemount.jpeg
File:Linearencoder_cablemount.jpeg|link=/images/7/71/Linearencoder_cablemount.jpeg
</gallery>
</gallery>
==Related Links/Guides==
* Draw-Wire Sensors
* Linear Potentiometers

Latest revision as of 21:39, 18 November 2024

Linear encoder (ENC4110_0)

What Is a Linear Encoder?

Linear encoders provide an extremely accurate, repeatable, and cost-effective method of measuring an object's linear position and/or speed.


As the slider moves along the rail, a digital signal is generated which provides precise information about the position of the slider.

Example - Length Measurement

The ENC4110 is used with an Quadrature Encoder Phidget and a VINT Hub Phidget (offscreen) to measure length. The results are displayed on a Graphic LCD Phidget



Which Linear Encoder Should I Use?

Phidgets Inc. currently offers eight types of linear encoders:

Product ID Travel Resolution Max Pull Speed Index Signal
ENC4110_0 ENC4111_0 ENC4112_0 ENC4113_0 ENC4114_0 300mm - 1400mm 5µm 1m/s Yes ENC4110 0.jpg
ENC4115_0 ENC4116_0 ENC4117_0 1400mm - 2000mm 5µm 1m/s Yes ENC4117 0.jpg

How Do I Get Data From My Linear Encoder?

All linear encoders sold by Phidgets Inc. connect directly to our encoder interfaces.


Linearenc enc1000.jpg


For new designs, we recommend using the Quadrature Encoder Phidget - ENC1001_0. The Quadrature Encoder Phidget will monitor the output of the linear encoder and update your software with an easy-to-use encoder count value.


There are also encoder interfaces built into many of our Motor Controllers. If your project includes a motor controller, the onboard encoder interface is a great option for our linear encoders.

Converting Encoder Count to Length

Resolution Specification for the ENC4110_0

To convert from encoder pulses to length, use the resolution specification that is provided on the product page of your linear encoder.


This value can be found on the Specifications tab and is presented as micrometers per pulse. For more information, review the example code below.


Example Code

The code below is derived from the Phidget Code Sample Generator. It shows how to convert position data from an encoder interface into a length measurement.


Click on your preferred programming language to view the code example.

from Phidget22.Phidget import *
from Phidget22.Devices.Encoder import *
import time

def onPositionChange(self, positionChange, timeChange, indexTriggered):
	resolution = 5E-6 #The ENC4110_0 has a resolution of 5um/pulse, replace with your product's resolution
	meters = self.getPosition() * resolution
	print("Length: " + str(round(meters, 3)) + " m")

def main():
	encoder0 = Encoder()

	encoder0.setOnPositionChangeHandler(onPositionChange)

	encoder0.openWaitForAttachment(5000)

	time.sleep(5)

	encoder0.close()

main()
import com.phidget22.*;
import java.lang.InterruptedException;

public class Java_Example {

    public static void main(String[] args) throws Exception {
        Encoder encoder0 = new Encoder();

        encoder0.addPositionChangeListener(new EncoderPositionChangeListener() {
            public void onPositionChange(EncoderPositionChangeEvent e) {
                try {
                    Encoder evChannel = (Encoder) e.getSource();
                    double resolution = 5E-6; //The ENC4110_0 has a resolution of 5um/pulse, replace with your product's resolution
                    double meters = evChannel.getPosition() * resolution;
                    System.out.println("Length: " + Math.round(meters * 1000.0) / 1000.0 + " m");
                } catch (PhidgetException ex) {
                    ex.printStackTrace();
                    System.out.println("PhidgetException " + ex.getErrorCode() + " (" + ex.getDescription() + "): " + ex.getDetail());
                }
            }
        });

        encoder0.open(5000);

        Thread.sleep(5000);

        encoder0.close();
    }
}
using System;
using Phidget22;

namespace ConsoleApplication
{
	class Program
	{

		private static void Encoder0_PositionChange(object sender, Phidget22.Events.EncoderPositionChangeEventArgs e)
		{
			Phidget22.Encoder evChannel = (Phidget22.Encoder)sender;
			double resolution = 5E-6; //The ENC4110_0 has a resolution of 5um/pulse, replace with your product's resolution
			double meters = evChannel.Position * resolution;
			Console.WriteLine("Length: " + Math.Round(meters, 3) + " m ");
		}

		static void Main(string[] args)
		{
			Encoder encoder0 = new Encoder();

			encoder0.PositionChange += Encoder0_PositionChange;

			encoder0.Open(5000);

			System.Threading.Thread.Sleep(10000);

			encoder0.Close();
		}
	}
}
#include <phidget22.h>
#include <stdio.h>
/* Determine if we are on Windows of Unix */
#ifdef WIN32
#include <windows.h>
#else
#include <unistd.h>
#define Sleep(x) usleep((x) * 1000)
#endif

static void CCONV onPositionChange(PhidgetEncoderHandle ch, void * ctx, int positionChange, double timeChange, int indexTriggered) {
	int64_t position;
	double resolution = 5E-6; //The ENC4110_0 has a resolution of 5um/pulse, replace with your product's resolution
	PhidgetEncoder_getPosition(ch, &position);
	double meters = resolution * position;
	printf("Length: %.3f\n m", meters);
	printf("----------\n");
}

int main() {
	PhidgetEncoderHandle encoder0;

	PhidgetEncoder_create(&encoder0);

	PhidgetEncoder_setOnPositionChangeHandler(encoder0, onPositionChange, NULL);

	Phidget_openWaitForAttachment((PhidgetHandle)encoder0, 5000);

	Sleep(5000);

	Phidget_close((PhidgetHandle)encoder0);

	PhidgetEncoder_delete(&encoder0);
}

Speed Calculations

If you are interested in calculating the speed of your linear encoder, a simple Python example is provided below.

In order to implement more accurate speed calculations, review the Encoder Velocity: A Common Miscalculation guide for more information.

from Phidget22.Phidget import *
from Phidget22.Devices.Encoder import *
import time

def onPositionChange(self, positionChange, timeChange, indexTriggered):
    resolution = 5E-6 #The ENC4110_0 has a resolution of 5um/pulse, replace with your product's resolution
    speed = (positionChange * resolution) / (timeChange/1000.0)
    print("Speed: " + str(round(speed, 3)) + " m/s")

def main():
    encoder0 = Encoder()

    encoder0.setOnPositionChangeHandler(onPositionChange)

    encoder0.openWaitForAttachment(5000)

    time.sleep(5000)

    encoder0.close()

main()

Mounting and Installation

Additional Hardware

ENC4110_0 - ENC4114_0

Additional hardware that is packaged linear encoders from 300mm to 1100mm

These linear encoders come with the following hardware:

  1. 1x Flat carriage mounting plate
  2. 1x Right-angle carriage mounting plate
  3. Phidget encoder cable to DB9 adapter
  4. 1x Debris shield
  5. Mounting screws and washers.
    1. M5 Screws (2x 40mm, 2x 30mm, 4x 20mm)
    2. M4 Screws (4x 20mm, 5x 12mm)
  6. 3x Cable mounts
  7. 4x Metal shims

ENC4115_0 - ENC4117_0

Additional hardware that is packaged linear encoders from 1400mm to 2000mm

These linear encoders come with the following hardware:

  1. 1x Flat carriage mounting plate
  2. 1x Right-angle carriage mounting plate
  3. Phidget encoder cable to DB9 adapter
  4. 1x Debris shield
  5. Mounting screws and washers.
    1. M5 Screws (6x 20mm, 2x 16mm)
    2. M4 Screws (2x 30mm, 4x 20mm, 4x 16mm, 9x 12mm)
  6. 1x Small mounting plate
  7. 3x Cable mounts

Mounting Linear Encoders to a Surface

All of our linear encoders have mounting holes on either end that allow them to be mounted perpendicular or parallel to a surface.


When mounting a linear encoder to a surface, ensure it lies completely flat and parallel to the moving part it will be measuring. Any small misalignment can cause inaccuracy in the measurement and strain on the mechanical parts.


Depending on your model, metal shims or a small mounting plate will be provided to ensure accurate alignment.

ENC4110_0 - ENC4114_0

ENC4115_0 - ENC4117_0

Carriage Mounting Plates

These linear encoders come with two different mounting plates for the carriage. Use the bolts to attach the carriages (washers may be required). The plate can then be attached to the moving part of your system, which should is expected to be self-supporting (don not load the carriage). The carriages can also be connected to eachother using the bolts (nuts not included).

Debris Shield and Cable Mounts

The debris shield does an excellent job of protecting the linear encoders from liquid, dust and debris. The cable mounts can be used to secure any slack in the cables.