Draw-Wire Sensor Guide: Difference between revisions

From Phidgets Support
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 2: Line 2:
__TOC__
__TOC__
[[Category:IntroGuide]]
[[Category:IntroGuide]]
[[Image:Drawwire_intro.jpg|400px|link=https://cdn.phidgets.com/docs/images/7/73/Drawwire_intro.jpg|thumb|<center>Draw-wire encoder ([https://www.phidgets.com/?prodid=1260 ENC4118_0])</center>]]
==What Is a Draw-Wire Sensor?==
==What Is a Draw-Wire Sensor?==
[[Image:Drawwire_intro.jpg|400px|link=https://cdn.phidgets.com/docs/images/7/73/Drawwire_intro.jpg|thumb|<center>Draw-wire encoder ([https://www.phidgets.com/?prodid=1260 ENC4118_0])</center>]]
Draw-wire sensors provide an accurate and cost-effective method of measuring an object's linear position and/or speed.
Draw-wire sensors provide an accurate and cost-effective method of measuring an object's linear position and/or speed.




As the draw-wire is pulled from the housing, a digital signal is generated which provides precise information about the length of the extended draw-wire.
As the draw-wire is pulled from the housing, a digital signal is generated which provides precise information about the length of the extended draw-wire.
 
<br><br>
===Example - Length Measurement===
===Example - Length Measurement===
[[File:drawwire_example.webm|600px|center]]
[[File:drawwire_example.webm|600px|center]]
Line 14: Line 14:
<br><br>
<br><br>
==Which Draw-Wire Sensor Should I Use?==
==Which Draw-Wire Sensor Should I Use?==
'''TODO: UPDATE THIS SECTION WHEN INDEX CHANNEL GUIDE IS AVAILABLE'''
Phidgets Inc. currently offers two types of draw-wire sensors:<br><br>
Phidgets Inc. currently offers two types of draw-wire sensors:<br><br>
{| style="margin:auto;width:85%;"
{| style="margin:auto;width:85%;"
Line 29: Line 27:




[[Image:Enc1000_drawwire_connected.jpg|600px|link=https://wwwdev.int.phidgets.com/docs/images/7/77/Enc1000_drawwire_connected.jpg|center]]
[[Image:Enc1000_drawwire_connected.jpg|600px|link=https://cdn.phidgets.com/docs/images/7/77/Enc1000_drawwire_connected.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 draw-wire sensor 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 draw-wire sensor 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 draw-wire sensors.
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 draw-wire sensors.


===Converting Encoder Count to Length===
===Converting Encoder Count to Length===
'''TODO: UPDATE THIS SECTION WHEN SPECS HAVE BEEN UPDATED'''
[[Image:Drawwire_resolution.png|400px|link=https://cdn.phidgets.com/docs/images/f/f2/Drawwire_resolution.png|thumb|<center>Resolution Specification for the [https://www.phidgets.com/?prodid=1260#Tab_Specifications ENC4118_0]</center>]]
[[Image:Drawwire_resolution.png|400px|link=https://wwwdev.int.phidgets.com/docs/images/f/f2/Drawwire_resolution.png|thumb|<center>Resolution Specification for the [https://www.phidgets.com/?prodid=1260#Tab_Specifications ENC4118_0]</center>]]
To convert from encoder pulses to length, use the '''resolution''' specification that is provided on the product page of your draw-wire sensor.  
To convert from encoder pulses to length, use the '''resolution''' specification that is provided on the product page of your draw-wire sensor.  


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>
==Installation and Mounting==
==Installation and Mounting==
M5 mounting holes are available on the back of the housing and on the end of the draw wire. For more information, view the mechanical drawings for your product which can be found on the product page under the ''Specifications'' tab.
M5 mounting holes are available on the back of the housing and on the end of the draw wire. For more information, view the mechanical drawings for your product which can be found on the product page under the ''Specifications'' tab.
Line 214: Line 212:
File:ENC4119_0_MountingHoles.jpg | link=/images/0/0b/ENC4119_0_MountingHoles.jpg
File:ENC4119_0_MountingHoles.jpg | link=/images/0/0b/ENC4119_0_MountingHoles.jpg
</gallery>
</gallery>
==Related Links/Guides==
* Linear Potentiometers
* Linear Encoders

Latest revision as of 22:24, 26 January 2024

Draw-wire encoder (ENC4118_0)

What Is a Draw-Wire Sensor?

Draw-wire sensors provide an accurate and cost-effective method of measuring an object's linear position and/or speed.


As the draw-wire is pulled from the housing, a digital signal is generated which provides precise information about the length of the extended draw-wire.

Example - Length Measurement

The ENC4118 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 Draw-Wire Sensor Should I Use?

Phidgets Inc. currently offers two types of draw-wire sensors:

Product ID Draw-Wire Length Resolution Max Pull Speed Max Wire Load Index Signal
ENC4118_0 1m 10µm 300mm/s 500g Yes ENC4118 0.jpg
ENC4119_0 3m 20µm 300mm/s 500g Yes ENC4119 0.jpg

How Do I Get Data From My Draw-Wire Sensor?

All draw-wire sensors sold by Phidgets Inc. connect directly to our encoder interfaces.


Enc1000 drawwire connected.jpg


For new designs, we recommend using the Quadrature Encoder Phidget - ENC1001_0. The Quadrature Encoder Phidget will monitor the output of the draw-wire sensor 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 draw-wire sensors.

Converting Encoder Count to Length

Resolution Specification for the ENC4118_0

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


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 = 10E-6 #The ENC4118_0 has a resolution of 10um/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 = 10E-6; //The ENC4118_0 has a resolution of 10um/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 = 10E-6; //The ENC4118_0 has a resolution of 10um/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 = 10E-6; //The ENC4118_0 has a resolution of 10um/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 draw-wire sensor, 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 = 10E-6 #The ENC4118_0 has a resolution of 10um/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()

Installation and Mounting

M5 mounting holes are available on the back of the housing and on the end of the draw wire. For more information, view the mechanical drawings for your product which can be found on the product page under the Specifications tab.