First experiment:
I used a Waveform Generator and set the VDD on 5V.
I plugged in the output of the Waveform to the six-wire ribbon at entrances 3&4 (GND and VDD respectively shown in the encoder's Data Sheet) it didn't work.
What did you expect to happen? Vdd and GND are there to supply 5 V DC to the electro-magnetic encoder.
The encoder consists of a magnetic disk, mounted on the motor shaft, that is magnetized around its circumference with alternating north and south poles that pass by two Hall-effect sensors as the motor shaft turns. These sensors produce square-wave TTL logic-level outputs on channels A and B. Because of the placement of the Hall sensors with respect to the alternating magnetic poles on the disk, the signals are in quadrature with each other. This means that as the motor shaft rotates the square waves from one channel are displaced by 90 degrees with respect to the square waves from the other channel. You can readily observe this by connecting the A and B outputs to two logic-level LED drivers, one LED for each channel, and turning the motor shaft by hand. Be sure to apply a well-regulated and filtered +5 V DC power supply output to pin 4 (Vdd) and pin 3 (GND). Polarity of power supply connections is important: positive to Vdd and negative to GND. Depending on which model encoder you have (you didn't say), there will be 64, 128, 256, or 512 pulses per revolution of the motor shaft.
You can also apply power to the motor to make the shaft turn. You do this by applying a constant-voltage DC power supply output to pins 1 and 2. The polarity marked for those two pins will result in clockwise rotation of the motor when viewed from the face of the motor case. Actual applied polarity depends on which way you want the motor shaft to rotate. Reversing the polarity will reverse the motor shaft direction. Depending on the specific motor you have (which you did not specify) the motor will require 6, 9, or 12 V DC to reach a no-load speed of 12,800 to 12,900 revolutions per minute. If the highest resolution encoder (512 pulses per revolution) is attached to a 12 V DC motor, the pulses from channels A and B will occur at (512) x (12,900) pulses per minute = 6,604,800 ppm = 110,080 pps. This should be easily observable on an oscilloscope connected to channel A or channel B. If you have a dual-channel oscilloscope, you can connect channel A to one channel and channel B to the other channel. This will allow you to observe the quadrature nature of the two waveforms. Other encoder resolutions will produce lower frequency pulses for the same motor speed.
You can determine which (maximum) voltage to apply to the motor by measuring the resistance between pins 1 and 2. The motor datasheet provides rated voltage versus motor resistance information: 15.2 Ω, 32.5 Ω, and 60 Ω for 6 V, 9 V, and 12 V motors respectively. Under some pulse-width-modulated driving conditions, the applied peak voltage may be greater than the rated steady-state DC voltage as long as (1) the maximum power dissipated in the motor and its internal temperature rise remain within limits specified on the datasheet and (2) the voltage does not cause electrical breakdown of the motor wire insulation. The latter parameter is not specified on the datasheet, but typically peak voltage for PWM is two to four times the steady-state DC voltage.
Driving the motor with a PWM circuit maximizes the torque available at low speeds and minimizes unnecessary power dissipation.
I am currently working on a project of building a setup that allows me to hold optic fibers, stretch them and contract with the help of the motors (two of them) and the control will be done from a computer.
Well, that's pretty vague and hard-hitting. How do you propose to control the tension in the fibers? AFAIK, fibers don't compress much, although they should contract after stretching if their elastic limit isn't exceeded. Will you be measuring optical properties of the fibers while stretching and contracting them, or is this just a simple fatigue test? Either way, you need some way to control the position of the motor-driven slide. You could use the optical encoder for this but there may be backlash problems associated with the lead screw when you reverse directions. Better, perhaps, would be to control tension in the fiber by measuring it with a load cell, perhaps attached via a cantilever to the fiber. Or you can make your own with piezo-resistive or traditional strain gauges. Many mechanical details missing that will probably affect how you control the motor. And why do you need
two motors?
Hop