Control Shield Pin Usage

Because our use of the Uno's pins has been hacked, YMMV! This page describes the default kit and our hacks, but it ignores unused pin modes and explains very little. So, keep the Uno Pin Usage page handy as a reference!

Default

SparkFun's Joystick Shield uses the following pins, by default:

Set Pin Mode Usage
Analog A0 ADC0 Joystick (Vertical)
Analog A1 ADC1 Joystick (Horizontal)
       
Digital D2 INT0 Joystick (Select)
Digital D3 INT1 Button (Right)
Digital D4   Button (Top)
Digital D5   Button (Bottom)
Digital D6   Button (Left)
       
_ RESET   Button (Reset)

As Hacked

On a production version of the shield, we could locate and wire our controls in any desired manner. However, we're simply modifying an existing board, and existing pin usage may get in the way. So, we need to hack the wiring, moving some of the pin assignments around.

The current plan is to do this by means of cutting traces and adding jumpers. This will re-route signals (e.g., from circuit board holes to different device pins), allowing us to add or modify pin usage, as needed. While we're at it, we added debouncing capacitors to all of the switches except the bottom button.

The table below indicates these hacks in the change (C) column. Each Uno's pin usage may be added (A), modified (M), or unchanged (_):

Set Pin Mode Usage C
Analog A0 ADC0 Joystick (Vertical) _
Analog A1 ADC1 Joystick (Horizontal) _
Analog A2 ADC2 Potentiometer 0 A
Analog A3 ADC3 Potentiometer 1 A
Analog A4 ADC4 In Jack (Right) A
Analog A5 ADC5 In Jack (Left) A
         
Digital D2 INT0 Encoder (Select) A
Digital D3 INT1 Encoder (Pin A) A
Digital D4   Encoder (Pin B) A
Digital D5   Button (Bottom) _
Digital D6 AIN0 Potentiometer 0 A
Digital D7 AIN1 Potentiometer 1 A
Digital D8   Joystick (Select) M
Digital D9 PWM Out Jack (Right) A
Digital D10 PWM Out Jack (Left) A
Digital D11   Button (Top) M
Digital D12   Button (Right) M
Digital D13   Button (Left) M
         
_ RESET   Button (Reset) _

Discussion

The tables above are rather cryptic; let's see if we can unpack them a bit.

General

D9 & D10 can each be used to generate an analog (PWM) level or a digital signal. Rapidly varying digital signals can be interpreted as audio (e.g., beeps, tones, waveforms). This output (or stereo signals from the In Jack) is made available to a pair of ADCs, the analog comparator, and the Out Jack.

Assorted devices can be plugged into the Out Jack. Audio tones can be fed to headphones, speakers, and/or a host computer. Analog levels can be fed to a measuring device, servo motor, etc. Digital signals can be sent to digital circuits.

The remaining pins are only used for input. Pins A0-A6 measure voltages (e.g., potentiometer settings). Pins D6 & D7 are used for the analog comparator. The rest are used to detect buttons, encoder rotation and select, and joystick select.

Analog

The Uno's Analog In pins can each measure a DC voltage level.

  • The Joystick's Potentiometers provide these to A0 and A1.

  • Potentiometers 0 & 1 provide these to A2 and A3.

  • A4 and A5 can measure levels from the In Jack
    or PWM-generated voltages from D9 and D10.

Digital

  • D2 and D3 have individually vectored interrupts, which the
    encoder can use; the other switches can share a vector (and poll).

  • D5 and D6 (AINx) can compare two DC voltages.
    We provide these via Potentiometers 0 & 1.
    D5 can also be set up to count button presses.


This wiki page is maintained by Rich Morin, an independent consultant specializing in software design, development, and documentation. Please feel free to email comments, inquiries, suggestions, etc!

Topic revision: r3 - 13 Feb 2016, RichMorin
This site is powered by Foswiki Copyright © by the contributing authors. All material on this wiki is the property of the contributing authors.
Foswiki version v2.1.6, Release Foswiki-2.1.6, Plugin API version 2.4
Ideas, requests, problems regarding CFCL Wiki? Send us email