0% found this document useful (0 votes)
58 views8 pages

Using Analog Joystick From 37 Sensors Kit

1. The document describes how to use an analog joystick module from a 37 Sensors kit with a microcontroller board. 2. It provides instructions on connecting the joystick module to the microcontroller board and writing code to read the analog X and Y position values and digital switch value from the joystick. 3. The code prints the X, Y, and switch values to the serial terminal when run, allowing the user to see how the values change as the joystick is moved or pressed.

Uploaded by

Stig Kalmo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views8 pages

Using Analog Joystick From 37 Sensors Kit

1. The document describes how to use an analog joystick module from a 37 Sensors kit with a microcontroller board. 2. It provides instructions on connecting the joystick module to the microcontroller board and writing code to read the analog X and Y position values and digital switch value from the joystick. 3. The code prints the X, Y, and switch values to the serial terminal when run, allowing the user to see how the values change as the joystick is moved or pressed.

Uploaded by

Stig Kalmo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

instructables

Using Analog Joystick From 37 Sensors Kit

by indestructable

So you went out and bought a kit of electrical sensors experimentation and education.
and modules for a good price called "37 Sensors" (
like this one here or others on Amazon), but can't find The module from the 37 Sensors Kit called "Analog
information on the modules to be able to use them? Joystick" is a joystick module like the one found on
This series of Instructables will help you out with all of many game controllers. The Analog Joystick module
the modules in the 37 Sensors Kit. There are other might be used in an embedded project for man-
kits that sell a different number of modules than 37, machine interfacing such as controlling a robot
such as a 20 module kit, and a 45 module kit. These actuator, drawing onto an LCD display, quad-copter
sensors/modules are also available from some online control, and playing computer games.
stores individually.
(Images and information used with permission from
These kits are excellent for STEM (Science, 37sensors.com)
Technology, Engineering, and Mathematics)

1. Analog Joystick from 37 Sensors Kit


Image used with permission.

Using Analog Joystick From 37 Sensors Kit: Page 1


Step 1: Analog Joystick Description

The Analog Joystick module is made from two output in that represents both the X and Y position of
potentiometers that are set at right angles to each the two potentiometers. There is a spring in each
other. One potentiometer registers movement in the X potentiometer that centers the potentiometer. Thus
direction, the other potentiometer registers movement the joystick stays in the middle position when it is not
in the Y direction. touched.

The module needs a ground and power connection to Pushing the knob down engages a momentary
whatever microcontroller you might be interfacing. switch. This Z direction signal isn't analog but instead
Voltage can be 5V or 3.3V as with the typical is a digital output. The Z output of the module can be
microcontroller. read by a digital input to the microcontroller.

The Analog Joystick provides a 0-5V (or 0-3.3V)

Step 2: Analog Joystick Specification

Voltage: 3.3V to 5.0V (No active components with function, voltage levels, pinout, and inactive/active
voltage limits, so using other voltages are possible.) states. Some modules have been found to have
incorrectly labeled pins and even poorly soldered
LED: none components.

X Potentiometer: 10 k ohm, return-to-center Button press (Z switch) is a bit difficult to do without


making a substantial change to the X and Y values
Y Potentiometer: 10 k ohm, return-to-center with the pots centered, and impossible with the pots
in some positions.
Z switch: momentary SPST, pulled to +Voltage on
some modules. Active low. Tactile. The unpopulated R5 on the module tested would be
the location for the pull-up resistor for the button. If
Main component datasheet: 252_Series needed, this can be populated with a 10kohm 0805
SMT resistor.
Size: 25mm X 35mm
If you are aware of any additional specifications for
There are a number of different sources for these this module or if you know of similar modules, please
modules. Not every module that looks similar to the leave a comment in the comment section.
ones here behaves exactly the same. Check the
specific module that you have for differences in

Using Analog Joystick From 37 Sensors Kit: Page 2


1

1. Pinouts

Download
http://www.instructables.com/ORIG/F54/QFAW/JJIUBH8D/F54QFAWJJIUBH8D.pdf

Step 3: Analog Joystick Experiment Supplies

Just to see the basics of how this module works, this experiment shows how to interface it to a simple-to-
understand microcontroller board. This microcontroller board is a $12.99 kit that can be assembled easily. There is
no need for a complicated development system as the 32-bit micro that is part of this board has all of the smarts
built in. The board shape even allows it to be used with Arduino Shields.

Code for other microcontroller platforms would likely be in a different language/syntax, but similar in form.

Here is the small list of components for this experiment:

1. Analog Joystick from 37 Sensors Kit. (This experiment's source: CircuitGizmos) Kits also
available at Amazon and online in many places.
2. Jumper Wires, female to female "DuPont" style. (This experiment's source: CircuitGizmos)
Jumpers of this type are also available online.
3. Microcontroller Board. (This experiment's source: CircuitGizmos for the $12.99 kit. An assembled
board of a more capable but similar device is also available.)
4. Power supply. The board accepts 7-10VDC through barrel jack or 5V/3.3V through the connector.
5. USB serial Interface. A USB connection to a PC and 3.3V level connection for ground, transmit,
and receive for the board.

A PC with a serial terminal application is used to communicate with the board. One such free and useful program
is Beagle Term.

With all of this, you can perform an experiment to test the Analog Joystick.

Using Analog Joystick From 37 Sensors Kit: Page 3


Step 4: Analog Joystick Experiment Hookup

The assembled microcontroller board is attached to the Analog Joystick as follows:

1. Ground connection on the module = ground on the microcontroller board


2. +Voltageconnection on the module = 3.3V on the microcontroller board
3. Switch connection on the module = uM6 (microcontroller pin 6) on the microcontroller board
4. X connection on the module = uM4 (microcontroller pin 4) on the microcontroller board
5. Y connection on the module = uM5 (microcontroller pin 5) on the microcontroller board

Connect the USB serial interface to the PC (USB end) and to the serial signal connection of the microcontroller
board (near the green power LED). The ground connections between the serial interface and the board connect
together, and the transmit signal of one goes to the receive signal of the other.

Power up the microcontroller board. I used a 12VDC supply that worked just fine.

Start Beagle Term on the PC and connect to the serial port number that is appropriate for the USB serial interface.
Bitrate needs to be 38400, 8N1 with no flow control. Tap the enter key and you should get a ">" prompt.

Using Analog Joystick From 37 Sensors Kit: Page 4


Step 5: Analog Joystick Experiment Code

With the PC connected to a powered microcontroller board, Beagle Term is the window into what is happening on
that board. You can enter program code, see the printed results of that code, and even interact by typing
information into a running program.

Typing EDIT at the ">" prompt will connect you to the built-in editor. It is in this editor that you will enter the
program code. You can save the code that you type in with a Control-Q keystroke. You can save and immediately
run the code that is in the editor with Control-W.

Control keys for the program EDIT function. (Function keys don't work right in Beagle Term)

Control-U - Move to line home


Control-U Control-U - Move to start of the program
Control-K - Move to the line end
Control-K Control-K - Move to end of the program
Control-P - Page up
Control-L - Page down
Control-] - Delete
Control-N - Insert
Control-Q - Save the code
Control-W - Run the code
Control-R - Find
Control-G - Repeat find
Control-T - Mark text
Control-Y - Paste text
ESC - Exit from editor abandoning changes.

Enter this experiment's code in the editor:

SETPIN 6, DIN, PULLUP


SETPIN 4, AIN
SETPIN 5, AIN

DO
PAUSE 200
S = PIN(6)
X = PIN(4)
Y = PIN(5)
PRINT S, X, Y
LOOP

This code sets the signal lines to analog inputs for X and Y and a digital input for the switch. The digital input is
configured with an internal pull-up resistor.

The loop code then reads those inputs and prints them out to the console every 1/5th of a second.

If you run this code you will see the output sent to Beagle Term. That output will change as you move the joystick
around. The switch output will change when you depress the joystick knob.

Using Analog Joystick From 37 Sensors Kit: Page 5


Step 6: Analog Joystick Experiment Results

The S variable is digital, so the PRINT statement will display either a 1 for unpressed or a 0 for pressed.

The X and Y variables are analog and will display values from 0V to 3.3V.

With the joystick not moved from the center position, both X and Y are at around 1.65V.

Step 7: Analog Joystick Summary/Feedback

Using Analog Joystick From 37 Sensors Kit: Page 6


Most of the Analog Joysticks found in 37 Sensors Analog Temperature Sensor
Kits are very similar to the one described here.
Ball Switch
If you have any additional information on the
specifications or behavior of this type of module, Bi-color LED
please comment here and I'll include the relevant
information. If you know of a module that is similar, Button
but perhaps available singly or in a different kit of
modules, please mention that. Character LCD

The comments area would also be a good place to Flame


include small sample code for other microcontroller
platforms if you have experimented with this module. Hall-effect Switch

Thanks for reading and contributing to this Humidity and Temperature


collection of 37 Sensor Instructables!
IR Receiver
Analog Hall-Effect
IR Transmitter
Analog Joystick

Keypad RGB LED

LASER Rotary Encoder

Light Cup Servo

Liquid Shock and Impulse

Mercury Switch Single Relay

Microphone Speaker

Multicolor Flashing LED Temperature 18B20

Obstacle Avoidance Temperature Threshold

Photo Interrupter Touch Sensor

Photoresistor Tracking

Piezo Driver or Annunciator Ultrasonic Distance

Pulse

Reed Switch

Using Analog Joystick From 37 Sensors Kit: Page 7


Thanks again :)

Using Analog Joystick From 37 Sensors Kit: Page 8

You might also like