Introduction: Atari Like USB Paddle Using Arduino Leonardo
This is an easy project. A paddle controller that can be used with any emulator that makes use of a mouse. In fact, you can say it is nothing more than a mouse with only horizontal movement.
Step 1: The Materials
You are going to need:
· An Arduino Leonardo Pro Micro or a normal Arduino Leonardo or Arduino Pro Micro. It must be one of these Arduinos, otherwise it is not going to work. I bought one from Ebay and it costed me 3.33€. Here is the link:
· A potentiometer of 10 Kohm, preferably with metallic axis, so it will be durable. You can search for them to Ebay too for prices less than a euro (or dollar).
· A normal push button.
· A general purpose PCB, optional. You can make the necessary connections straight to the Arduino.
· A project box of logical size. Imagine that you will holding it on your hand’s palm as a controller.
· Something that will resemble a paddle to be over the potentiometer axis that you will turn when playing. I found mine on an old radiocassete player (you can tell from its appearance. But, I later painted it silver). You can buy one again from the Ebay or an electronics shop.
· Some pieces of slim cable. It would be good to use red and black cables to know which goes where according to the picture.
When you are satisfied you have collected all the above it is time to assemble them.
Step 2: The Assembly
The connections are simple (also see the picture). I made the connections on a PCB, but you can solder them straight on the Arduino:
Solder two cables on the push button. One of them has to be soldered to the gnd pin of the Arduino (it doesn’t matter which of the two) and the other on Arduino pin 9.
If you hold the potentiometer, axis on the up side and pins toward you, then you have to solder a cable on the right pin (preferably red color), that is going to be soldered to Vcc pin on the Arduino. On the middle pin I soldered a blue cable which have to be soldered on the A0 pin on the Arduino. Finally, solder a black cable on the left pin of the potentiometer, the other end to be soldered to gnd pin on the Arduino.
Step 3: The Programming
Check your connections again and upload this program on the Arduino using the Arduino IDE. Make sure that from the menu “Tools” you selected as board the “Arduino Leonardo” or the "Arduino Pro Micro" and as port whichever port the Leonardo is (mine was COM 8 but it may be a different one for you.
Attachments
Step 4: Epilogue
That’s it!!! I have tested the spinner with MAME games Arcanoid and Super Breakout on a Pc, and with Kaboom! on the Stella emulator, also on the Pc. Oh, and into the program, changing the cspd variable affects the sensitivity of the paddle.
This is my first instructable and I know I may have made some mistakes. Feel free to ask me whatever question you might have.
4 Comments
5 months ago
Added the right mouse button which is needed in some games (e.g. No Second Prize on the Amiga).
Tip 3 years ago
I found using Lord_Vek's included sketch, to cause too much jitter on the mouse. To resolve this problem, I used Mathew Heironimus' Joystick library:
/* PingPong Controller
* By Salvador Rodriguez
* 08/05/2020
* based on the Joystick library by Matthew Heironimus
* And the work of Lord_Vek
* To be used on Leonardo or Pro Micro only
* This code is public domain.
*/
#include "Joystick.h"
Joystick_ Joystick(JOYSTICK_DEFAULT_REPORT_ID, JOYSTICK_TYPE_GAMEPAD, //sets control type to be recognized by OS as standard gamepad
5, 0, //Button Count, Hat switch count
//Define inputs on joystick, true or false
true, true, false, //Left X axis,Left Y axis,Left Z axis
false, false, false, //Right X axis, Right Y axis, Left Z axis
false, false, //Rudder, Throttle
false, false, false); //Accelerator, Brake, Steering
int yAxiscentered = (1023 / 2); //centers the Left Y axis if unused.
void setup()
//*sets the indicated pin number to digital, and activates the internal pull up resistor to avoid ghost readings from floating pins.
{
pinMode(4, INPUT_PULLUP);
pinMode(5, INPUT_PULLUP);
pinMode(6, INPUT_PULLUP);
pinMode(7, INPUT_PULLUP);
pinMode(8, INPUT_PULLUP);
//starts the Joystick.h library
Joystick.begin();
}
// inputs that will be used as digital buttons will be stored in an array. Constant pin number is the pin where the increasing count will start. It is recomended that you connect your buttons to the digital pins sequentially.
// in this example, 4,5,6,8
const int pinToButtonMap = 4;
//This array indicates the number of buttons, and sets the initial state of the buttons, 0 is not pressed, 1 is pressed.
int lastButtonState[5] = {0, 0, 0, 1, 0};
void loop()
{
// the FOR loop reads button pins, and sends either ON or OFF to corresponding button number.
for (int index = 0; index < 5; index++)
{
int currentButtonState = !digitalRead(index + pinToButtonMap);
if (currentButtonState != lastButtonState[index])
{
Joystick.setButton(index, currentButtonState);
lastButtonState[index] = currentButtonState;
}
//saves the input from the potentiometer as potValue
int potValue = (analogRead(A0));
//Optional,reverses the value of the potentiometer,and saves the result as integer "reversedPotValue."
//so potentiometer and recieved turn value match direction. Used in case GND and VCC cannot be physically reversed on potentiometer
int reversedPotValue = map(potValue, 0 , 1023 , 1023, 0);
//Value of the left X axis
Joystick.setXAxis(reversedPotValue);
//Sets the value of the left Y axis in the middle, as it will not be used in this build.
Joystick.setYAxis(yAxiscentered);
Joystick.sendState();
delay(10);
}
}
4 years ago
I remember those! Neat project. Thank you for sharing it :-)
4 years ago
This is a clever build! Thanks for sharing your project!