G340 REV-7 Manual

Thank you for purchasing the G340 drive. The G340 DC servo drive is warranted to be free of manufacturing defects for 1 year from the date of purchase. Also anyone who is dissatisfied with it or is unable to make it work will be cheerfully refunded the purchase price if the G340 is returned within 15 days of the purchase date.


If you are not familiar with DC servo drives please do the following setup instructions with the motor on the bench before mounting it on the mechanism it will eventually run. This will allow you to get a baseline motor behavior of what to expect.

Before you start, you must have a suitable encoder mounted and properly aligned on the motor. Follow the manufacturer’s instructions on mounting and aligning the encoder if the motor doesn’t already come with one.

Next you must have a DC power supply suitable for the motor. Do not use a power supply voltage more than 5 volts in excess of the motors rated voltage. The power supply current rating must equal the maximum current you expect to run the motor at.

Finally have a STEP and DIRECTION pulse source available.

Before going on, turn the current LIMIT trimpot a quarter to half of full scale. Turn the GAIN trimpot fully off and turn the DAMP trimpot to a quarter of full scale. The trimpots are single-turn, do not over-torque them with a screwdriver.


The STEP PULSE MULTIPLIER and the INPUT OPTION settings are jumpered internally. It is necessary to remove the cover of the drive to change these settings from their default values. Please follow the steps below on how to remove and replace the cover to avoid damaging the drive:


1) Remove the two 2-56 phillips-head screws on the bottom of the drive.
2) Gently lift the back of the cover upward until the LED clears the rectangular hole
3) Slide the cover backwards while still lifting until it clears the drive.


1) Make sure the LED is vertical relative to the drive printed circuit board.
2) Slide the cover forward over the drive while lifting the back of the cover.
3) When the cover is fully forward, look to see the LED is aligned with the hole.
4) Gently press the cover down, making sure the LED moves into the hole.
5) Replace the screws on the bottom of the drive.

It is recommended to use small needle-nose pliers or tweezers to move the jumpers on the internal headers.



The G340 has a built in STEP PULSE MULTIPLIER. This circuit puts out 1, 2, 5, or 10 pulses for every input STEP pulse. All motor moves will be in these increments. For example, if X10 is selected, then the motor will move 10 encoder counts for every STEP pulse sent to the G340. Move the jumper on the MULTIPLIER HEADER to select the desired multiplier. Do not operate the drive without a jumper.


The INPUT OPTION HEADER allows the STEP and DIRECTION opto-isolators to be configured as either common ground or common +5VDC.

If the G340 inputs are driven by a source that has only ground available, such as a PC parallel port, move the 4 jumpers on the header so that it looks like the COMMON GROUND setting. Connect the input driver ground to TERM 12 on the main connector.

If the G340 inputs are driven by open collector transistors or standard TTL gates, move the 4 jumpers on the header so that it looks like the COMMON +5VDC setting.


IMPORTANT: When first testing the G320, connect ERR/RES (term. 5) to ENC+ (term. 7).
Please follow the next steps in the sequence they are given.


The encoder must be at minimum a 25 line-count digital quadrature encoder and must operate on a single +5VDC power supply. If the encoder supply current is more than 50 mA, use an external +5VDC supply. It may have an INDEX output, which will not be used. If it has differential outputs, use only the “+” phase outputs. IMPORTANT: Connect a 470-ohm resistor from TERM. 6 to TERM. 7 if an external power supply is used for the encoder.

(TERM. 6) ENC- Connect the encoder power supply ground to this terminal.
(TERM. 7) ENC+ Connect the encoder +5VDC to this terminal
(TERM. 8) PHASE A Connect the encoder phase “A” to this terminal
(TERM. 9) PHASE B Connect the encoder phase “B” to this terminal

To determine the optimal encoder line count, please follow the instructions below.

1.) Determine motors no load RPM
2.) Calculate rated RPM as 80% of no load RPM
3.) Divide (#2) by 60 to get revolutions per second
4.) Determine the CNC program’s maximum step pulse frequency (in Hz)
5.) Divide (#4) by (#3), which will give you the maximum counts per revolution
6.) Divide (#5) by 4, which will give you the max line count
7.) Pick the first standard line count below (#6)

An example of using that formula with a 45kHz step pulse frequency and a maximum motor RPM of 3000:

(45kHz / 40) / 4 = 281.25



Keep the power supply leads short and use the largest wire gauge that will fit in the terminals. If the lead length is more than 18” use a 1000 uF capacitor across the G340 power supply terminals. Make sure your power supply can provide the peak current the motor may draw. The power supply voltage must be between 18 VDC and 80 VDC. The actual voltage should not be more than 5 volts higher than the motor’s rated voltage.

(TERM. 1) POWER GROUND Connect the power supply ground to this terminal.
(TERM. 2) +18 TO 80 VDC Connect the power supply “+” to this terminal


At this point the encoder should be tested for functionality. If you wish to monitor the POSITION ERROR test point with a voltmeter or oscilloscope, then remove the cover of the drive now. If you have a choice, pick the oscilloscope.

The POSITION ERROR test point shows the difference between the command position and the actual motor position. When both are the same, the voltage will be +5VDC. For every count the motor is clockwise of the command position, the voltage will decrease by 0.04 volts. When it drops to 0.4 volts, the protection circuit takes over and resets the drive for 3 seconds. While reset, the FAULT light is on.

For counter-clockwise position errors the voltage will increase by 0.04 volts for every count until it reaches 9.6 volts when again the protection circuit takes over as before.

VOLTMETER MONITORING: Place the red lead on the test point and the black lead on the large blue capacitor lead (GND) furthest from the main connector. Turn on the power supply. The FAULT light should be on for 3 seconds and then turn off. The voltmeter should read +5VDC. Turn the motor shaft clockwise VERY slowly. The voltmeter reading should decrease 0.04 volts for every encoder count. When the reading reaches 0.4 volts, the red light will turn on and the voltage will jump back to +5VDC. After 3 seconds the light will turn off. You may turn the motor shaft counter-clockwise as well. The voltage will increase then by 0.04 volts per count until it reaches 9.6 volts and trips the protection circuit.

OSCILLOSCPE MONITORING: Set the scope to 2 volts / cm vertical and about 1 millisecond per cm horizontal. Zero the trace to the bottom line on the screen. DC couple the input. Place the probe on the test point and the ground clip to the blue capacitor ground lead. Follow the steps in VOLTMETER TESTING above.


The control input group is the standard step motor drive STEP, DIRECTION and +5VDC lines. The STEP and DIRECTION signal drivers must be TTL compatible and have edge transition times of 100 ns or faster. The +5VDC is the opto-isolator common anode line and must be returned to the pulse source +5VDC supply.

(TERM. 10) DIR Connect the DIRECTION line to this terminal.
(TERM. 11) STEP Connect the STEP line to this terminal.
(TERM. 12) +5VDC Connect this terminal to the controller +5VDC power supply


You may wish to test the functionality of these inputs. If you used an oscilloscope in the previous section, leave it connected to the test point. If you used a voltmeter, then remove it from the drive.

Set the STEP pulse generator to about 40 pulses per second and set the DIRECTION output to clockwise (logical “1”). Turn on the power supply. After the power-on reset period of 5 seconds the FAULT light will turn off.

If you are using an oscilloscope, then the test point voltage will begin to increase until 3 seconds later it trips the protection circuit at 9.6 volts. The FAULT light will turn on for 5 seconds and voltage will snap back to +5VDC. After the FAULT turns off, the sequence will repeat again.

If you are not using an oscilloscope, just see if the FAULT light turns on and off every three seconds.


Make sure the power is off and the STEP pulse source is set to zero pulses per second. Check to see if the trimpot settings are set according to the instructions on page 2. You may wish to secure the motor so it can’t jump off the bench.

(TERM. 3) ARM- Connect the BLACK motor lead to this terminal.
(TERM. 4) ARM+ Connect the RED motor lead to this terminal.


Turn on the power supply. The FAULT light should turn off after 3 seconds. If everything is correct you should hear the motor “singing”. This is normal. The motor is dithering or bouncing between adjacent encoder counts. The integral term in a PID loop has infinite DC gain over time and will amplify even the smallest position error. Because encoder feedback can only occur on count edges, the loop is “blind” until it encounters an encoder count edge. It then reverses the motor direction until another edge is found, then the process repeats.

If the motor jumps slightly and the FAULT light immediately turns back on, then either the motor is wired backwards or the trimpots are misadjusted. Check the trimpot settings. If they seem right then switch the motor leads and try again. If it still doesn’t work and you followed all the previous steps, call me at the number at the end of this document.

Now turn on your STEP pulse source and ramp the speed up to see if the motor turns. It should turn clockwise with a logical “1” on the DIRECTION input.

The optimum way to tune the servo is to induce an impulse load on the motor while watching an oscilloscope to see how the motor behaves in response, then adjusting the PID co-efficient for optimal behavior.

In all cases the motor must return to the command position, what matters is how it does it. The manner in which the motor returns to its command position is called damping. At one extreme, called over damped response, the motor returns to position after a long, drawn out delay. At the other extreme, called under damped response, the motor returns to its position too rapidly, overshoots, returns and undershoots and so on until it finally settles at its command position. This is also called ringing; when extreme, the over/undershoot builds in amplitude until the motor enters violent oscillation. Between the two extremes is the optimal response called critical damping. Here the motor rapidly returns to its position with little or no overshoot in the minimal amount of time.


GAIN and DAMPING settings generally track each other. If you increase GAIN (greater stiffness), then increased DAMPING is needed as well to restore critical damping. Be careful, increasing GAIN without increasing DAMPING may cause the motor to break out into violent oscillation.

The higher GAIN is set, the noisier the motor will be when stopped. This is because higher gain causes more vigorous dithering between encoder counts at rest. There is a trade-off between high gain (high stiffness) one hand and excessive dithering (noise and motor heating) on the other. Use judgment here.

To see how your servo is compensated it is first necessary to induce a disturbance. The easiest way is to switch the DIRECTION input while commanding a constant speed via the STEP input. The abrupt direction change puts just the momentary load needed on the motor while you watch how it responds.

If you are using an oscilloscope, use channel 1 on the test point and channel 2 on the DIRECTION input. Set the trigger to “normal”, trigger source to channel 2 and trigger edge to “+”. You should see a single sweep for every clockwise change in direction.

Slowly increase STEP speed until you get a picture similar to one of the three above, and then do the following:

1) OVERDAMPED: Decrease DAMPING or increase GAIN
2) CRITICALLY DAMPED: Do nothing; you’re there
3) UNDERDAMPED: Decrease GAIN or increase DAMPING


Don’t confuse the POSITION ERROR with the motor or machine position. The signal is actually the differential position error between the command speed and the motor speed. As noted above, sending clockwise STEP pulses moves the POSITION ERROR voltage more positive while turning the motor clockwise moves the POSITION ERROR voltage more negative.

When the motor encoder counts match the number of STEP pulses being sent one for one, the POSITION ERROR voltage stays at +5VDC. If the motor gets ahead of the STEP pulses such as during very rapid deceleration, the voltage will decrease by 0.04 volts for every encoder count the motor is ahead of the STEP pulses sent. The PID algorithm will force the motor to match the STEP input over time and restore the POSITION ERROR voltage back to +5 VDC.


The current LIMIT trimpot sets maximum current the motor is permitted to have. It is adjustable from 0 amps to 20 amps. Normally the LIMIT trimpot is set to maximum (20 amps) unless you want to limit motor torque to a lower value.

Motor speed and position is unaffected by the current LIMIT setting unless the torque demand due to load exceeds this setting, then the motor position will fall behind the command position because of insufficient torque.


The FAULT indicator is on while the drive is in power-on reset, the DISABLE input is held “low” or if the protection circuit is tripped due to a fault condition. All power MOSFETs are turned off and all internal counters are reset. The FAULT condition lasts for 3 seconds, and then self-resets to try again. If the protection circuit tripped it and the cause is not cleared, then it will immediately re-enter the FAULT state again and repeat the cycle.

There are two conditions that will trip the protection circuit. One condition is if a short-circuit occurs and current exceeds 20 amps. The other condition is if the POSITION ERROR exceeds +/- 120 counts causing a break of the servo-lock. This condition can have several causes:

1) The loop settings are severely under-damped and the motor breaks out into oscillation.
2) Excessive motor load due to acceleration or workload.
3) The speed command in excess of what the motor can deliver.
4) The current LIMIT is set too low.
5) The power supply current is insufficient for the demand.
6) The power supply voltage is below 18 VDC.
7) The motor is wired backwards, is broken or disconnected.
8) Encoder failure.


The G340 will turn the motor in the CW direction when the DIRECTION input is “high” (logical “1”, or +5VDC). If instead CCW is preferred, then:

1) Reverse the motor “+” and “-“ leads (term. 3 with term. 4)
2) Reverse the encoder “channel A” and “channel B” leads (term. 8 with term. 9)


Very small motors have low inductance relative to their operating current. Consequently ripple current due to pulse-width modulation can quickly overheat and destroy these motors. If the G340 will be used with these motors, then an external low pass filter must be used to attenuate ripple current to tolerable levels.

A suggested filter consists of two 150 micro Henry inductors in series with each motor lead and a 2 microfarad, low inductance film capacitor across the motor leads. The inductors must be rated for the anticipated peak motor current.

This filter is also need if ironless-armature or “pancake” motors are used. These motors have very low inductance as well and will overheat if driven directly by the G340.


This terminal functions as an ERROR output and as a RESET input. Because this terminal functions as both an input and an output, some detailed description is necessary.

When first testing the G340, ERR/RES (term. 5) was connected to ENC+ (term. 7). It can be left that way if it is not necessary to read the state of the ERROR output. Otherwise, the following details are important.

The ERROR output is latched in the “ERROR” state (term. 5 = “0”) by the power-on reset circuitry in the G340. It will stay in this state indefinitely until it is cleared by applying +5V to this terminal for at least 1 second.

The voltage on this terminal is +5VDC when the G340 is functioning normally. The voltage on this terminal goes to 0VDC whenever the FAULT indicator is lit. This output can be used to signal your controller that an error has occurred.

Normally when the G340 is first powered up, it will be necessary to push the momentary switch to START for 5 seconds. This will clear the power-on reset condition and extinguish the FAULT LED. The motor will then be enabled and the drive will begin to operate. If at anytime after that a condition occurs that causes the G340 to “fault out”, such as not being able to complete a step command, the ERR/RES terminal will go to “0”, signaling the computer an error has occurred. This will require the operator to correct the problem that caused the fault and then push the switch to “START” for 5 seconds to re-enable the G340.

At anytime the operator can push the switch to the “STOP” position to immediately halt the G340 drive. Anytime the G340 is in the “FAULT” state (FAULT LED lit), all switching action stops and the motor freewheels and is unpowered. This will light the “FAULT” light.


Power Supply: 18 to 80 VDC
Motor Current: 0 to 20 Amps
Lock Range: +/- 128 count following error
Feedback: Quadrature TTL Encoder
Feedback Resolution: X4 Encoder Line Count
Switching Frequency: 25 kHz
Current Limit: 0 to 20 Amp, Trimpot Adjustable
Analog PID: Damping and Gain Trimpots
Step Pulse Frequency: 0 to 250 kHz
Step Pulse “0” Time: 0.5 Microseconds Min.
Step Pulse “1” Time: 3.5 Microseconds Min.
Multiplier Settings: X1, X2, X4, X5 and X10
Size: 2.5" X 2.5” X 0.825"
Weight: 3.6 oz
Encoder Supply: +5VDC, 50mA max

Categories: Motor Control Manuals DC Servo Drives Legacy Manuals