E4P-300-250 Optical Encoder Operation With Labview 8.x

E4P-300-250 Optical Encoder Operation With Labview 8.x

Keywords: Labview, E4P-300-250, Optical Encoder

The photo depicts the E4P-300-250 optical encoder which allows you to measure shaft velocity and shaft position. The big picture is to make the E4P-300-250 to work with the NI-USB-6211 DAQ and Labview 8.x. Solving this partially or completely is important because it will allow us to get physical world shaft velocity and position data for use in future experiments. This tutorial shows you how to hook up the E4P-300-250 to the NI-USB-6211 DAQ and take measurements using Labview 8.x. This process takes approximately 1 hour to complete.

Motivation and Audience

This tutorial's motivation is to make the E4P-300-250 to work with the NI-USB-6211 DAQ and Labview 8.x. Readers of this tutorial assumes the reader has the following background and interests:

The rest of the tutorial is presented as follows:

Parts List and Sources

US-based vendors to obtain material to complete this tutorial include; N4P-300-250 Optical Encoder, 4 wire connection cable, ~18AWG wire, wire strippers,Small flathead screwdriver, and the NI-USB-6211 DAQ.

To complete this tutorial, you'll need the following items (in table below, replace ??? with relevant information and add additional lines if necessary)

TABLE 1: Parts needed to build (fill in the blank)
N4P-300-250 Optical Encoder USDigitalN4P-300-250$19.951
4 Pin Micro Cable USDigitalCA-3286-1FT $10.50+$0.30 / FT1
Wire StrippersNANANA1
Small Flathead ScrewdriverNANANA1
Multifunction USB Bus-Powered DAQNational Instruments NI-USB-6211 DAQ$6991


This section gives step-by-step instructions along with photos to (fill in the blank). (If a circuit-building tutorial:) A schematic to construct (fill in the blank) is shown here (add graphic). (Add hyperlink to PDF of schematic) is the Acrobat file of the same schematic. You will need Adobe's free Acrobat reader to view it. Step 1

Step 1


Cut four (4) pieces ~18AWE to about three inches long each and strip about a half of an inch off of each side.



Step 2


Place one end of the wire into the hole of the connecter as seen in the picture below.



Step 3


Repeat Step 2 above for the other three wires, see picture below.  Make sure to remember which wire is connected to which port on the N4P-300-250.




See the picture below for the pin out of the E4P-300-250




Step 4


Attach “A channel” to Pin 1 (P0.0) by lousing the screw with a flathead screwdriver placing the wire inside and tightening the screw again.




Step 5


Repeat Step 4 above for “B channel” in Pin 2 (P0.1), “+5VDC power” in Pin 10 (+5V), and “Ground” in Pin 11 (DGND).



Step 6


Connect the other end of the cable to the E4P-300-250 to open end of the cable.




Step 7


Plug the NI-USB-6211 into your computer via the USB2.0 port.




Step 8


You have now hooked up the E4P-300-250 to the NI-USB-6211 which is now hooked to your computer running Labview 8.x.


Open Labview 8.x and create a Blank VI




Step 9


Under the  Measurement I/O in the Functions Palette pick NI-DAQmx then drag DAQ Assist to the Back Panel/Block Diagram.





Step 10


The Create New Express Task wizard should pop up automatically, if it does not double click on the blue DAQ Assistant block in the picture above.


Now click the following option Aquire Signals --) Counter Input --) Position --) Angular





Step 11


When it asked for which physical channel to use click Dev1 (USB-6211) --) ctr0 then click Finish




Step 12


A properties window will pop up. See picture below for the desired properties then click OK.




Step 13


An Error message and an Auto Loop Creation message will show up, click Yes for both messages.  Your screen should then look like the picture below







Step 14


Place a digital indicator on the Front Panel and connect it to the DAQ Assistant “data” port.  Please note that you need to have the digital indicator on the inside of the loop.





Step 15


Click the “Run” button at the top and turn the E4P-300-250’s shaft,  you will see the digital indicator number change.


Note: Please see the file E4P-300-250_Angle.vi for the Labview VI that was created from the above steps.

Final Words

This tutorial's objective was to make the E4P-300-250 to work with the NI-USB-6211 DAQ and Labview 8.x. Once the concepts were conveyed one is now able to use the E4P-300-250 Optical Encoder in a variety of sensing applications.

Click here to email me