"God carved learn programming" DIY Arduino (38) - joystick-axis joystick module

Paragraph 37 and reference sensor module, widely circulated on the Internet, in fact, compatible with Arduino sensor module must be more than 37 species. Since I am on hand accumulated a number of sensors and modules, in accordance with the practice makes perfect (be sure to DIY) concept, learning and communication for the purpose of preparing here one by one to try to do hands-on experiments, whether successful or not, will be recorded --- little progress or can not handle the problem, hoping to initiate. 

 

[] Arduino series of experiments, the sensor module 108 kinds (information + + graphics + Simulation Code)

Experiment thirty-eight: joystick XY biaxially module rocker keys (PS2 game joystick HM)

 

Rocker potentiometer

Mounting the two high-precision potentiometers 10K and a key switch, power 0.015W, the maximum operating voltage of 100V AC, the vertical position can be automatically reset for controlling the keyboard or the like, can freely control the direction and directly monitor the operating conditions of the machine.

A, MECHANICAL CHARACTERISTIC mechanical properties

1, Operating force of lever rocker for power: 120 ± 70 gf

2, Operating angle operating angle: 26 ° Max

Two, ELECTRICAL CHARACTERISTIC electrical characteristics

1, Rating power rated power: 0.0125W

2, Maximum operating voltage maximum operating voltage: AC 50V DC 5V

3, Voltage divider error partial pressure error: 44% -56%

4, Insulation resistance Insulation resistance:? 100M 1 Minute at DC 250V

5, Dielectric voltage withstand voltage: 1 Minute at AC 250V

Three, SWITCH CHARACTERISTICS switch Specifications

1, Operating force switch pressing force: 740 ± 300gf

2, Contact resistance Contact Resistance: 100mΩ Max

3, Rating power rated power: DC12V 50mA

Four, ENDURANCE CHARACTERISTIC endurance characteristics

1, Rotational life Rotational Life: 2000,000 cycles Min

2, Push operating life switch pressing life: 1,000,000 cycles Min

It works
rocker potentiometer used in the current regulating circuit as a direct current, the current through potentiometer slide arm rocker, this time due to anodization leads to an abnormal increase in the resistance value. In this case, it is recommended to connect the terminal resistor connected to the negative electrode, positive electrode connected to the slide arm. If the DC current directly through joystick potentiometer, the potentiometer will anode rocker oxidative damage, so that the impedance of the rocker potentiometer becomes large, the negative terminal is preferably connected to the current sheet in contact with the carbon film the anode is connected to the terminal with the brush (joystick potentiometer contact plate). Joystick potentiometer as a variable resistor, for adjusting the voltage divider is recommended to use, while the load resistor RL joystick potentiometer joystick potentiometer not less than 10 times the nominal resistance of RT. In the voltage regulator for regulating the output voltage, so the design joystick potentiometer output voltage increases to be adjusted at full clockwise, counterclockwise when adjusting the output voltage of the section is reduced; rocker potential adjustable constant current charger used to adjust the size of the charging current is off, the design of the rocker clockwise potentiometer adjustment when full, current increases. IC holder, FIG printed circuit board design, in case using the IC socket, special attention must be placed in the positioning groove base IC correct orientation, and note the respective IC pin is correct.

XY biaxially rocker key module
consists of two slide rheostat and a key composition, when the toggle rocker, slide rheostat resistance to change, corresponding to the X / Y voltage also changes, and hard press roll the rod will trigger button is pressed, a corresponding signal SW goes low.

Rocker double potentiometer Sign: usually the same specifications two potentiometers mounted on the same structure of a potentiometer rocker shaft, the adjustment shaft, the sliding contact of potentiometer two asynchronous rotation. This structure is called asynchronous dual coaxial linkage potentiometer.

Another precision switch button

X and Y axes, a button
2.54mm pin interface, easy wiring, versatility
PCB size (mm): 24X32

Works
module Ad Hoc Road analog outputs and a digital output interface, the output values correspond to (X, Y) biaxial offset, which is an analog quantity; indicates whether the user presses a key on the Z axis, of type digital switch. Integrated power module indicator displays the operating state; coordinate identifier clear and concise, accurate positioning. To make it easier to fit the standard interface extension board or the like, in the design of the X, Y-axis circuit are drawn separately to the control input of the joystick module values of x, y, and to achieve a certain function at a particular value.

Pin Description

Name Description

GND Ground

5V 5V power supply

SW button (digital)

VRX X axis (analog)

VRY Y-axis (analog)

Module Performance

1. Input voltage range: DC 3.3V to 5V.

2. Output signal: analog output module Ad Hoc Road and a digital output interface, the output values ​​correspond to (X, Y) biaxial offset, which is an analog quantity; button indicating whether the user presses the Z-axis, type which a digital switch.

3. The controller can be programmed Arduino sensor expansion board inserted, complete with a remote interactive ad creative.

4 is a cross rocker bidirectional 10K resistor, with the joystick in different directions, it varies the resistance of the tap. This 5V supply module, the original state X, Y read voltage is about 2.5V, when the direction of the arrow with the press, the read voltage value increases, up to 5V; direction opposite to the arrow is pressed, reduced read voltage value , a minimum of 0V.

Some applications

Wiring

GND, VCC (+ 5V) both need to say.

VRx, VRy (X, Y-axis) of the analog input signal, connected to the analog IO port A0 ~ A7. 

VRx, VRy values: from 0 to 1023 represent the left and right ~, ~ Next. 512 median value.

SW (Z-axis) is a digital input signal, is connected to the digital port, and enable pull-up resistor. 

SW is the value of: 1 representatives pressed, press 0 for.

Experiments here VRx pick A0, VRy then A1, SW connected D6

/ * 

[] Arduino series of experiments, the sensor module 108 kinds (information + + graphics + Simulation Code) 

experiments thirty-eight: joystick XY biaxially module rocker keys (PS2 game joystick HM) 

* / 

 

int value = 0; 

 

void Setup ( ) 

{ 

 the pinMode (. 6, INPUT_PULLUP); 

 Serial.begin (9600); 

} 

 

void Loop () 

{ 

 value = analogRead (A0); 

 Serial.print ( "X-:"); 

 Serial.print (value, DEC); 

 

 value = analogRead (A1); 

 Serial.print ( "| the Y:"); 

 Serial.print (value, DEC); 

 

 value = digitalRead (. 6); 

 Serial.print ( "| the Z:"); 

 Serial.println (value, DEC ); 

 Delay (1000); 

}

  The initial state

/ * 

[] Arduino series of experiments, the sensor module 108 kinds (information + + graphics + Simulation Code) 

experiments thirty-eight: joystick XY biaxially module rocker keys (PS2 game joystick HM) bis 

* / 

 

int JoyStick_X = A0; 

int = JoyStick_Y A1; 

int JoyStick_Z = . 6 ; 

 

void Setup () 

{ 

  the pinMode (JoyStick_Z, the INPUT); 

  Serial.begin ( 9600 ); 

} 

void Loop () 

{ 

  int X, Y, Z; 

  X = analogRead (JoyStick_X); 

  Y = analogRead (JoyStick_Y); 

  Z = digitalRead (JoyStick_Z); 

  Serial.print (X, DEC); 

  Serial.print (",");

  Serial.print(y ,DEC);

  Serial.print(",");

  Serial.println(z ,DEC);

  delay(500);

}

 

 

Guess you like

Origin www.cnblogs.com/eagler8/p/11613616.html