Project

General

Profile

4.5.3. Joystick control

General information

Controller accepts an input from an analog joystick with voltage in 0-3 V range. Voltage in the equilibrium (central) position and voltage in minimum and maximum position can be set to any value from the working range, if the following condition holds: minimum position < central position < maximum position. Controller uses digital representation of joystick input values: 0 V corresponds to a value of 0 and 3 V corresponds to a value of 10000.

To stop movement in the central position a DeadZone option is available, which is counted from the central position and measured in percent. Any joystick position inside deadzone leads to the stopping of the movement by the controller. A larger than deadzone deviation of the stick starts controller movement with the speed which is calculated from the deviation. One can reverse the joystick with a reverse flag which can be useful to keep "right joystick offset means movement to the right" correspondence for any physical orientation of the joystick and the stage.

Movement speed has an exponential dependence on joystick deviation from the center. This enables one to reach high precision through small joystick shifts and high speed through large ones. Nonlinearity parameter can be varied. If the nonlinearity parameter is zero, then the motor speed will linearly depend on joystick position.

The following graph shows dependence of movement speed on joystick position for the following settings:

Central deviation 4500
Minimum deviation 500
Maximum deviation 9500
Dead zone 10%
Maximum movement speed 100

An example of motion speed dependence on joystick deviation.

Sometimes exponential joystick response which combines high accuracy and high speed is not enough. That's why controller supports maximum speed table. User can switch between these speeds using "right"/"left" buttons. In case of right key press maximum speed is changed from Max speed[i] to Max speed[i+1]. In case of left key press maximum speed is changed from Max speed[i+1] to Max speed[i]. Controller starts with i=0. There are 10 values in the speed array. If both integer and fractional parts of Max speed[x] are equal to zero then it isn't possible to switch to this speed from Max speed[x-1]. This is made so that a user can limit speed array size. An attempt to get out of array bounds will also lead to nothing.

Controller has contact debouncing on control buttons. For keypress to register button press should last longer than 3 ms.

If joystick sits within dead zone for more than 5 seconds it will be logically considered to be out of deadzone only when it has been physically out of deadzone for more than 100 ms. This allows user to release joystick and to be confident that even occasional noise on joystick output won't lead to unnecessary motor motion. While joystick is within Dead zone the controller can receive any commands from computer including motion commands, home position calibration commands, etc. If during command execution joystick is brought of Dead zone the motion command is canceled and motor is switched to joystick control. This allows the user to turn on joystick control mode and use it only when necessary.

Everything that is related to movement under the control of controller commands is also applicable to joystick movement. This includes acceleration, maximum speed limit, windings poweroff delay, magnetic brake, backlash compensation, etc. For example, if you suddenly release joystick handle and let it return into the deadzone, then, if corresponding modes are on, controller will gradually slow the motor, make a backlash compensation motion, stop the motor, fix the motor shaft with the magnetic brake, smoothly reduce current and switch off windings power.

"Left"\"right" button connection is described in Left-right buttons control.
MaxSpeed[i] and DeadZone parameter change is described in Settings of external control devices.

Connection diagram

IMPORTANT. Analog inputs for joystick connection are designed for a range of 0-3V. Be careful and do not exceed voltage for joystick contacts.

Controller board

A contact for joystick control is located on the BPC connector.


Connection of joystick to the controller board via BPC connector

One-axis and two-axis systems

Joystick connector is available only in two-axis system. A connection diagram is shown below.


Connection of joystick to the two-axis system via D-SUB 9 pin connector

Multi-axis system

In the multi-axis system joystick pins are located on the external DB-25 connector


Connection of joystick to the DB-25 connector of multi-axis system

mc4xbb is the module board of multi-axis system