Hey guys, in this video, we are going to make an amazing compact joystick using Arduino. We can use this joystick to control our DIY Robots or connect it to your computer and play games with it! Awesome right? So let’s get started!
USB Joystick using Arduino Video Tutorial
Too lazy to read? Here is a complete video tutorial where I explain everything in detail.
Let’s Look at USB Joystick using Arduino and Its Components
First, let me talk a little bit about this USB joystick using Arduino! What it contains and what it can do! The main part of this board is this thumb joystick. This can be used to read horizontal movement, vertical movement, a button press, or a combination of these 3 actions.
Then we have 4 buttons here which can be used for 4 different custom actions or a combination of 4 buttons. Then we have these pots here. Well, I put it there so that I can use it in future projects like for controlling the position of the camera or something.
Well, that’s not all, do you see this Arduino board over here? It’s not just an ordinary Arduino Nano!
This is an Arduino Nano RP 2040. This tiny little board has an onboard accelerometer, gyroscope, RGB LED, and even a microphone. You can even incorporate machine learning with TinyML, TensorFlow Lite, or Edge Impulse and perform some voice command actions.
This Arduino Board can act as HID (Human Interface Device), as a keyboard or mouse, and send keystrokes through the USB port like a real keyboard. We will be making use of this functionality to make a controller that we can use to control robots and play games on your PC.
USB Joystick Circuit
I’ve always been interested in electronics and technology and making my own PCBs for my projects. I used Altium Designer to draw the circuit and design the PCB. If you are a DIY electronic enthusiast, this is gonna be really useful for you! Altium is an Amazing PCB Designer using which you can design and create your own PCBs for your hobby projects or industrial use. You can download the free trial version from the description down below.
There is something called Altium 365 that comes free with Altium Subscription. With Altium 365, you can design, share, manufacture, and do everything related to your project in the same space without any extra effort. You can also share your designs, and ideas and easily collaborate with your teammates or even clients with Secure Centralized Cloud Storage. So make sure you check it out!
Here we have an Arduino Nano RP 2040 which is the brain of this project.
Here is our joystick, but this might not be familiar to you guys. This is a raw joystick module, it consists of 2 potentiometers and a switch. These are the pins of the first potentiometer, the second potentiometer, and here is the switch! The output of the first pot is connected to analog pin A2 and the second pot is connected to A3 and the switch is connected to D6.
Then we have 4 push buttons connected to 4 digital pins of Arduino – D2, D3, D4, and D5. We will be assigning different key combinations to all these switches while coding. Then we have two potentiometers right here. The output of these pots is connected to two analog pins A0 and A1.
Then we have indicator LEDs at various points. There are two ways to power this board. One is to use an external power source and the other is to use the voltage from the USB port. If you are powering it through Vin, you can provide a DC voltage between 7 to 32 volt, which will be fed to the 7805 voltage regulator. The output of the 7805 is 5V and this 5V is fed to a voltage divider circuit which will convert it to 3.3V.
You can easily switch between the two voltage sources using this header right here. The reason why we are converting to 3.3V is, that the operating voltage of Arduino Nano RP 2040 is 3.3V. Providing a voltage greater than 3.3V will fry the chip.
Once the circuit was finished and tested, I designed a compact...Read more »