Introduction: Arduino Joystick Breadboard With LCD Output

Picture of Arduino Joystick Breadboard With LCD Output

Want to be able to control a couple of servos with a thumb-joystick? But don't know where to start?

I don't have servos, but I can put you on the right track on how to do stuff when you move the thumbstick around.

This instructable will teach you how to output the direction of the thumbstick to a 16x2 LCD screen.

What you do after that is only limited by your imagination!

Have fun!

Step 1: Materials

Picture of Materials

1x Arduino (Any type, I'm using an uno)
1x Breadboard (Sparkfun / Maplin )
1x 16x2 LCD Screen compatible with Arduino (Sparkfun / Maplin )
1x Thumbstick (I salvaged mine from a broken games controller) (Sparkfun )
1x Breakaway pins
4x Bell Wire/Jumpers (Sparkfun / Maplin )
1x Wire Stripper
1x Wire snips
1x Flat snip (For the breakaway pins)

Step 2: Mount the LCD Screen and Thumbstick

Picture of Mount the LCD Screen and Thumbstick

Take your flat snips and your breakaway pins, and cut a row of 16 (My LCD doesn't have a back light so I used 14 instead).

If you've salvaged your LCD screen from a printer like I did, it may already have a ribbon cable attached if so just use your wire strippers to expose some of the wire and press it into the pins.

The pins I got the wire fits in snugly, you MIGHT have to solder them (Not covered in this instructable), once you've got all the wires into the pins connect the LCD screen to the breadboard pins 1 through to 16 (14 if you don't have a back light)

If you've bought your LCD screen from sparkfun or maplins, be sure to buy some header pins as well and then you can solder those straight onto the LCD screen then plug it directly into the breadboard.

Again, take your breakaway pins and flat snips and cut off a further 6 pins for the joystick.
This time you will have to solder on some wires (I did), the thumb stick from sparkfun might clip into the jumpers you can purchase from there.

Once you've got the pins connected to the wires for the thumb stick, then connect it to the breadboard on pins 25 to 30.

Step 3: Wiring Up the LCD Screen and Thumb Stick

Picture of Wiring Up the LCD Screen and Thumb Stick

Time to wire everything up!

We'll start with the LCD screen since it has the most pins.

Connect pins 1,3 and 5 to the Arduino's GND. (Doesn't matter which one)
Connect pin 2 to the Arduino's +5v
Connect pin 4 to the Arduino's Digital Pin 12
Connect pin 6 to the Arduino's Digital Pin 11
Connect pin 11 to the Arduino's Digital Pin 10
Connect pin 12 to the Arduino's Digital Pin 9
Connect pin 13 to the Arduino's Digital Pin 8
Connect pin 14 to the Arduino's Digital Pin 7

Now let's move onto the thumb stick, I've colour coded all 6 pins on the thumb stick, each direction is Red, White and Black, they represent +5v, Analog signal and ground respectably.

Hook up the black wires into the ground rail, and the red wires into the +5v power rail, connect one white wire into analog in 0 and the other into analog in 1

Step 4: Connect & Code

Picture of Connect & Code

Now we're going into the final stages of this instructable.

Connect the Arduino to your PC/Laptop and download the attached pde code file and upload it to you're Arduino, in case the download doesn't work, I've posted it here as well.

/*
JoystickLCD by Dominion-Network
Outputs the direction of the thumb stick to the LCD Screen

This example code is in the public domain.
*/
//Include the LCD Library.
#include <LiquidCrystal.h>
//Declare the LCD object and define pins.
/*

LiquidCrystal lcd(12,11,10,9,8,7);

void setup() {
//Start the LCD object.
lcd.begin(16, 2);
//Start with a clear LCD screen.
lcd.clear();
}

void loop() {
lcd.setCursor(0, 0);
if(analogRead(0) == 513){
lcd.print("STOPPED");
} else if(analogRead(0) < 513) {
lcd.print("REVERSE");
} else if(analogRead(0) > 513) {
lcd.print("FORWARD");
}
lcd.setCursor(0, 1);
if(analogRead(1) == 513){
lcd.print("STOPPED");
} else if(analogRead(1) < 513) {
lcd.print("LEFT ");
} else if(analogRead(1) > 513) {
lcd.print("RIGHT");
}
}

Step 5: Test It Out & Conclusion

Picture of Test It Out & Conclusion

Once you've successfully uploaded the code, you should notice the writing on your LCD screen "STOPPED" (See main picture) in this case, this is when the joystick is untouched.

Now just move your joystick around and you should notice the text on screen changing, it'll either say "LEFT, RIGHT, FORWARD, REVERSE" as well as "STOPPED"

Now that you've successfully finished this instructable here's a few idea's on how to expand on this.

If you have servos wire them in and connect them to servo brackets, then you've got some nice movement, for maybe a web cam, or a laser pointer, maybe even an airsoft turret, but be warned, once you've let got of the thumb stick, it'll reset it's position.

Thank you for reading my instructable, any questions or feedback are greatly welcomed and I will try to answer all of your questions if you have any.

Happy hacking!

Comments

jerrymonkey123 made it! (author)2015-08-16

YA,I did it!

compsfreak17 (author)2012-04-12

I got that same exact lcd from the same printer.

lukegw (author)2011-07-04

Cool instructable, quite detailed and good clear photos!

Would love to see what else you make from it.

Jordan arduino (author)lukegw2011-07-07

im on my wii im using local internet

Jordan arduino (author)2011-07-07

i dont know what to say

About This Instructable

22,547views

107favorites

License:

Bio: I've always taken stuff apart, almost always put it back together... I enjoy tinkering around with pretty much anything.
More by Dominion-Network:Ultrasonic Range Finder with an ATtiny85 (With Shield)LM355Z Temperature Sensor8 LED Chaser with 74HC595 8 Bit Shift Register
Add instructable to: