Close
0%
0%

Arduino Robot With PS2 (PlayStation 2) Controller

In this tutorial I'll show you how to use a wireless Playstation 2 (PS2) controller and an Arduino Uno pilot a robotic tank.

Public Chat
Similar projects worth following
In this tutorial I'll show you how to use a wireless Playstation 2 (PS2) joystick to pilot a robotic tank. An Arduino Uno board was used at the core of this project. It receives commands from the wireless controller and sets the speed of the motors. Other development boards might also be used (NodeMCU, Firebeetle, etc.), and the principles presented in this tutorial can be applied on other models of robots and gadgets.

In this tutorial I'll show you how to use a wireless Playstation 2 (PS2) joystick to pilot a robotic tank. An Arduino Uno board was used at the core of this project. It receives commands from the wireless controller and sets the speed of the motors. Other development boards might also be used (NodeMCU, Firebeetle, etc.), and the principles presented in this tutorial can be applied on other models of robots and gadgets.

I've previously designed a Blynk controlled robotic tank. It connects to a Wi-Fi network and receives commands from Blynk server. A smartphone running Blynk app was used as a remote control, and different input methods were used: push buttons, sliding bars and even smartphone's accelerometer. You can find more about this project here: https://www.instructables.com/id/Wi-Fi-Controlled-Robot-Using-Wemos-D1-ESP8266-Ardu/

I've also made some experiments with voice commands. It might be usefull if you want to remotelly control a robot without using your hands, or if you want to made it accessible for someone with limited movements. One might think of a robotic voice controlled wheel chair, for instance. A DIY robotic kit was used, along with some of my favourite tools: Adafruit.io, IFTTT and Arduino IDE. Full instructions here:

https://www.instructables.com/id/Wi-Fi-Voice-Controlled-Robot-Using-Wemos-D1-ESP826/

You can use different kits or even desing your own robots using simple materials, without the need of using complex tools such as 3D printers and laser cutting machines. You can find an example on one of my previous tutorials:

https://www.instructables.com/id/WiDC-Wi-Fi-Controlled-FPV-Robot-with-Arduino-ESP82/

ino - 5.23 kB - 08/27/2019 at 22:24

Download

ino - 3.20 kB - 08/27/2019 at 22:24

Download

ino - 3.31 kB - 08/27/2019 at 22:24

Download

ino - 3.79 kB - 08/27/2019 at 22:24

Download

  • 1
    Tools and Materials

    The following tools were used in this project:

    • Solder iron and wire (link / link). The DC motors already came with wires soldered to its terminals... But it will eventually break and you might have to resolder it. So consider having a good solder iron and wire neaby.
    • EVA foam sheet (or other non-conductive material). The robot chassis I used in this project is made of aluminum, and circuit boards are installed on this metal parts. I used a layer of foam sheet between the boards and the metal plate to avoid possible short-circuits.
    • Double sided tape. It was used for glueing the foam sheets to the circuit boards, and for the installation of the H-Bridge modue.
    • Scissors, for cutting some foam sheet rectangles.

    I used the following hardware parts for my project:

    • Arduino Uno based dev board (link / link / link / link). It's used as the main controller of the robot. It is really easy to use and program with Arduino IDE, great for beginner on electronics and programming.
    • L298N dual channel H-bridge module (link / link / link / link). This module allows the 3.3V signals from the Wemos (or an Arduino) to be amplified to the 12V needed for the motors.
    • DIY Robot Chassis Tank (link). This awesome kit has with everything you need to built a tank: two DC motors, gears, tracks, bolts, nuts, etc. It already comes with the tools need for assembling the chassis, which is great for beginners!
    • PS2 Wireless Remote Control (link). This videogame controller can send comands wirelessly to a receiver, which can be interfaced with an microcontrollert using serial communication.
    • 18650 3.7V batteries (x3) (link / link). I used to power the whole circuit. This tank uses 12V motors. I used three 3.7V batteries in series for powering them.
    • 3S 18650 battery holder (link / link / link). It can hold three 18650 batteries in serie, and can be easilly be attached to the back of the tank.
    • 18650 battery charger (link / link). Your batteries will eventually run out of power. When that happens, a battery charger will come to your rescue.
    • Jumpers (link / link). I used 6 male-female jumpers for signals between the h-bridge an the Wemos, and 2 male-male jumpers for 5V and Gnd. You might need more if you plan to add some sensors.
    • Type-B USB cable. You'll need this for uploading your code. Most of the boards already come with its own cable.

    The links above are only a suggestion of where you can find the items used in this tutorial (and maybe support my future tutorials). Feel free to search for them elsewhere and buy at your favorite local or online store.

  • 2
    Assembling the Robot

    The first part of this project was the assembly of the robot structure.

    In previous projects I developed the structure of my own robot, using easily accessible materials (without the need for complex tools, 3D printers or laser cutting machines). You can find this project in the link below:

    https://hackaday.io/project/25694-widc-wi-fi-controlled-fpv-robot

    Later I decided to give a chance for a robotic kit obtained from an online store. You can find a link to the robot chassis at the following link: http://bit.ly/2ycI8fP. If you're looking for a kit, I think it's a good option! I used it in two other tutorials, as you can see on the links bellow:

    https://hackaday.io/project/159910-wi-fi-controlled-robot-using-blynk-app

    https://hackaday.io/project/160864-wi-fi-voice-controlled-robot-with-google-assistant

    At first it seemed that the assembly would be complex or that I would run into problems like the lack of parts (given the amount of parts that make up the kit). But this kit really surprised me! All the pieces seem to me of good quality, and several spare parts accompanied the kit. Thus, a screw lost underneath the workbench won't make it impossible to carry out your project, which I found to be excellent (especially after losing a couple of screws).

    Another positive point is that all the tools needed to mount the robot are included in the kit (a couple of Allen wrenches and the screwdriver). I believe this makes the kit excellent for starters who doesn't have lots of tools!

    As a negative aspect I would highlight the lack of documentation. The robot's assembly manual (a spreadsheet file in Chinese) is not extremely user friendly, and there isn't a lot of tutorials online for that tank. And so I decided to document the process of assembling my robot in the video above! Another point of attention concerns the material of the robot structure. The base is entirely made of aluminum, which can cause some short circuit if the pins of the printed circuit boards touch the frame.

    There are other online kits that you can use. You can even maker your own structure, as I described bellow.

  • 3
    Wiring Up the Circuit

    A power pack made of three 18650 batteries was installed on the back of the robot. It provides 11.1V (3 x 3.7V) to the robot. That's enough to power the 12V DC motors.

    A L298N dual channel H-bridge was used for the control of the motors. It receives some 5V signals of the Arduino board, and provide higher voltages for the motors. It also allow the motors to run in both directions, depenting on the combination of those input signals.

    Each device was connected according to the schematics.

    Follows a list of the pins you'll need to connect:

    Arduino Uno inputs/outputs:

    • Digital pin 3 => H-Bridge ENA pin
    • Digital pin 5 => H-Bridge IN1 pin
    • Digital pin 4 => H-Bridge IN2 pin
    • Digital pin 8 => H-Bridge IN3 pin
    • Digital pin 7 => H-Bridge IN4 pin
    • Digital pin 6 => H-Bridge ENB pin
    • 5V pin => H-Bridge 5V pin
    • Gnd pin => H-bridge Gnd pin
    • Digital pin 10 => PS2 receiver pin 6
    • Digital pin 11 => PS2 receiver pin 2
    • Digital pin 12 => PS2 receiver pin 1
    • Digital pin 13 => PS2 receiver pin 7
    • 3.3V pin => PS2 receiver pin 5
    • Gnd pin => PS2 receiver pin 4

    H-Bridge inputs/outputs:

    • ENA pin => Arduino digital pin 3
    • IN1 pin => Arduino digital pin 5
    • IN2 pin => Arduino digital pin 4
    • IN3 pin => Arduino digital pin 8
    • IN4 pin => Arduino digital pin 7
    • ENB pin => Arduino digital pin 6
    • 5V pin => Arduino 5V pin
    • Gnd pin => Arduino Gnd pin
    • Gnd pin => Battery pack negative wire
    • 12V pin => Battery pack positive wire
    • OUT1 => Right motor negative wire
    • OUT2 => Right motor positive wire
    • OUT3 => Left motor positive wire
    • OUT4 => Left motor negative wire

    PS2 receiver:

    • Pin 1 (data) => Arduino digital pin 12
    • Pin 2 (command) => Arduino digital pin 11
    • Pin 4 (ground) => Arduino Gnd pin
    • Pin 5 (power) => Arduino 3.3V pin
    • Pin 6 (attention) => Arduino digital pin 10
    • Pin 7 (clock) => Arduino digital pin 13

View all 10 instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates