Mouse Emulation With an Analog Joystick and Arduino

another view of arduino joystick circuitMy latest mini-project has been hooking an analog joystick up to an Arduino to make my own joystick computer mouse…plus I have some news… my soldering iron

I got a soldering iron for Christmas! YAY! I desoldered an analog joystick from an old PlayStation 2 controller (see my Tear Down from a while back), and bought a joystick breakout board from SparkFun so I could fit the joystick into a breadboard. I originally made my own breakout board using a PCB etching kit, but it just got messy and I decided to save myself the hassle and just buy one.

This is the breakout board I was making for the joystick. It didn't come out too good.
This is the breakout board I was making for the joystick. It didn’t come out too good, as I drilled the holes too big and the solder ran through.

I practiced using my soldering iron quite a bit over the holidays and I feel like I’m finally getting the hang of it! I soldered the joystick along with some old headers from a furnace board without a hitch!

arduino joystick breakout with controller pad
This is the finished analog joystick soldered to the breakout board.

I then wired it up on the breadboard, along with my Arduino Micro (which can emulate a mouse and keyboard, unlike most of the other Arduino boards), an LED indicator light, a toggle switch, and two pushbuttons to act as right and left click mouse buttons. The toggle switch shuts the mouse on and off, and the LED indicates if it’s on or off. I tested it out on my laptop and my Raspberry Pi, and it works great! Certainly it’s more interesting to use a joystick than a regular mouse!

arduino joystick mouse final circuit
This is the finished circuit.

Check out the software on GitHub Gist here. I had some help from the Arduino website, as well as from Jeremy Blum’s excellent book Exploring Arduino.

Breadboard schematic of circuit.

3 thoughts on “Mouse Emulation With an Analog Joystick and Arduino

    • I don’t currently have a post on how to make breakout boards, but thanks for the idea. 😉

      It’s kind of challenging to make good quality homemade breakout boards if you have just basic supplies, and they’re becoming obsolete. I used a PCB etching kit from Radio Shack (which they apparently don’t carry anymore) that comes with a 3″ x 4″ copper sided board and some black rub-on stickers that you use for the traces. For the breakout for the joystick, I cut a 1″ square out of the board and drew out the traces in pencil and then added the black stickers. Since I didn’t have any etching solution, I immersed it into an eclectic mix of vinegar, salt, and hydrogen peroxide to dissolve the copper. For this specific breakout board, I ended up drilling the holes too big, which ruined it.

      It’s kind of obsolete to make your own breakout boards as they’re readily available cheaply. It’s also challenging to find the etching kits, and you can only make them one-sided (which was a challenge I had in designing the joystick breakout, as the traces had to be put uncomfortably close and I had to scratch bits of copper off). Making your own could be useful when you need a custom design or want to put a few components on the same board though. I might make a breakout for the toggleswitch I used for this project, as it was a pain to fit into the breadboard.

      More info here:


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s