InputShield


 

 

There’s been all this talk about open source hardware, and I typically pull out my Blackberry Curve and explain it to people this way:

 

“See this Blackberry? It’s really more or less like most other devices- it’s got a battery, motherboard, screen, USB connection, and buttons…what if you just had a battery, motherboard, screen, buttons and a USB connection? You could make any gadget you want!”

 

Well here are the buttons! Convenient in a gaming format, when I started playing with these, it was eerily reminiscent of PlayStation joystick controls. Even vibrates with a rumble pack! Wanna make your own Arduino Game Boy? Arduino Genesis? Now you can. That’s why the InputShield is your friend. Check out what Matt made

 

The InputShield provides a joy stick, two buttons, and vibration motor packed into a shield that fits squarely on top of an Arduino. The InputShield also provides two gaming modes, Mode A and Mode B allowing two InputShields to run on one Arduino at the same time.

Here the the InputShield Base module sitting on top of an Arduino:


Here is how to use the InputShield’s Mode A and Mode B. Two InputShields are mounted to one Arduino using a Triple Wide ExtenderShield. The TouchShield Slide functions as the gaming display interface in the Open PSP Kit found in the shop.

 

Typical Applications

 

Functional Description


The InputShield provides the Arduino access to a dual axis joystick, 3 buttons, and vibration motor for force feedback. There is an A/B Mode selection switch that changes the occupied pins on the Arduino, and tri-states output on the unused pins. This mode selection allows two InputShields to be mounted on a single Arduino via an ExtenderShield, preventing the clobbering of the signals.

Pin Description

 


Joystick & Buttons A, B, & 3


The InputShield has two primary buttons: “A” and “B” Button 3 is the Joystick when it is pushed down. The buttons typically output +5V to the respective output. When the button is pushed, it outputs a low (0V) signal to the respective output pins. The Joystick output will provide varying analog voltage between 0-5 VDC depending on the rotation angle (lateral or vertical). Read these values on your Arduino by executing the following code,


unsigned int joyLatValue;
unsigned int joyVertValue;
joyLatValue = analogRead(0);
joyVertValue = analogRead(0);
 

 

AB Mode Control


The InputShield has two operating modes: “Mode A” and “Mode B” (see table Pin Description). These Modes are controlled by a switch located in the middle of the shield, identified by the red circle in the figure below.


Vibration Motor


A small vibration motor is attached to the bottom of the Shield. The vibration motor will vibrate when Pin 7 (Mode A) or Pin 11 (Mode B) is grounded.


Pin Pass Through


Unused Arduino pins can be accessed through the right angle connector (J1). Shown below, J1 also provides access to all the button and Joystick outputs of the InputShield. The signal list is provided in the table below.






 

Example Code InputShield Library using the Antipasto Arduino IDE

 

//*********************************************
// Example: ReadInputShield
//
// Description: Prints the InputShield's state
// to the PC's terminal
//
// Christopher Ladden @ www.liquidware.org
//*********************************************
#include <InputShield.h>
InputShield input = InputShield(0);
void setup()
{
/* Start hardware serial */
Serial.begin(9600);
}
//*********************************************
// Print the InputShield's state to the PC
void loop()
{
Serial.print("Lat: ");
Serial.print(input.getJoyLat());
Serial.print("Vert: ");
Serial.print(input.getJoyVert());
Serial.print("Button A: ");
Serial.print(input.getButtonA());
Serial.print("Button B: ");
Serial.print(input.getButtonB());
Serial.print("Button Joy: ");
Serial.print(input.getButtonJoy());
Serial.print("\n");
delay(50);
}

 

 

Specifications

 

 

Media

 

Video of the InputShield in Action