Showing posts with label tutorials. Show all posts
Showing posts with label tutorials. Show all posts

Saturday, December 31, 2016

Making a Custom PC Gamepad with Arduino



What: Making a simple gamepad from an Arduino that you can use on the computer

Why: I wrote another article earlier this year about using the RXTX java library involving basic communication with a computer and finally got a free weekend to make an even better project using that same tech. Furthermore, a Twitch streamer by the handle 'Rudeism' has become well known for using a 'Makey Makey' microcontroller in video games, and it should be noted that he inspired me to finally get working on my own fun game controller.

Required: 
- Arduino, Arduino IDE
- Switches, buttons, and/or joysticks
- Computer
- Java
- RXTX Java Library
- Code available on my Github

Notes: For this tutorial, I am using an old analog computer joystick. It used a gameport adapter, but I have since cut it off so I can get at the wires directly. The important take away is that I have wired the outputs from the potentiometers of the joystick directly into the analog input pins of the Arduino. Further, the buttons from the joystick are also wired directly into the digital input pins. The program files available for this tutorial assume only two axes and two buttons. If you want to make a more complicated gamepad, I encourage you to do so; the concept is the same. 

I am using an Arduino Uno R3. The Uno does not have native HID support which is why we need the Java program on the computer. The joystick I am using an old InterAct Raider Pro Digital that I found while thrifting. This tutorial does not require flashing the Uno’s core firmware.

Brief: The basic idea is that the Arduino will receive the inputs (either digital or analog) from a button or joystick you have and send it over the serial connection to your PC. The PC will then parse that input into something actionable. Using the Java ‘Robot’ class, your Java application will move the mouse, click a button, or enter a keystroke. Here is an abstract diagram for how it should work:



Steps:

1. Connect your switches, buttons, and potentiometers to the Arduino


[x-axis potentiometer signal] -> [analogPin0]
[y-axis potentiometer signal] -> [analogPin1]
[trigger button] -> [digitalPin3]
[thumb button] -> [digitalPin4]
[GND] -> [GND]
[5v] -> [5v]

2. Upload the Arduino sketch
     View my sketch example video HERE.

3. Run the Java application
     That's it! Your potentiometer inputs now drive your mouse, the trigger button is a left click, and the thumb button is a right click.

Troubleshooting:

-If you need more help with the RXTX library specifically, please refer to my previous article on using the library HERE.

-If you have questions about the process or this project in particular, post a comment and I'll try to help you out.

More process photos:
(Testing direct connections)

(Connections soldered and labeled)

(Ready for game testing)

Thursday, December 8, 2016

More Basic Computer Tutorials Uploaded

I've added a few additional "How to Do Stuff" videos to my Youtube channel today. The videos cover the following topics:
  1. How to use snipping tool to save photos
  2. How to install apps on mac that were not downloaded from app store
  3. How to exit and enter fullscreen mode on a mac
Check them out HERE!

Saturday, December 3, 2016

"How to Do Stuff" Channel is Live on Youtube

I finally got around to making my tutorial videos and as of this post, I have uploaded eight videos. Currently, I have three main platforms for the tutorials (Mac, Windows, IPhone), but plan on expanding to more general playlists such as "MS Word, Internet, and Recording."

My goal for the videos are that they all follow a few simple guidelines:

  1. They are under a minute long. Too many tutorial videos on Youtube spend minutes talking about "why they wanted to make the video" instead of actually getting to the content.
  2. They are informative. The videos should empower the viewer to do things they didn't know how to previously do on the given platform.
  3. They are accessible to everyone. You shouldn't need experience with computers or technology in order to accomplish any of the tasks I demonstrate in the videos.
Check out my channel HERE!

If you have a request for a video, let me know in the comments or send me a message.