HOW TO MAKE A WIRELESS PS2 REMOTE CONTROLLED ROBOT

 

 

 

#1>RAN1104: Building a Manual Play station Remote Controlled Robot

Rhino Robot Control Board is our most powerful, versatile and most easy to use robot control board. This tutorial series is intended for giving the idea of versatility and use of this board in many types of robots.

We also hereby assume that you have gone through Rhino Board Manual, Quick C IDE user manual and Quick C IDE library reference. It’s not necessary for you to understand everything written in those documents but you should have an overview so that you can use them as reference for some part in this document.

PlayStation controller is actually a Video Game controller remote for Sony’s PlayStation 2 and PlayStation 3 gaming consoles. The wireless variant of this controller is used widely for manual robot control. There are many reasons for this, first is its cheap and easily available, second is it has 16 buttons and 4 analog inputs which means a great control over robots and connected accessories. We will be using the same remote for our application. The bad part is these remote controls don’t come with easily usable pin outs. They have a connector for PlayStation compatible connector. So you will either need to buy a ready made modified controller or you will need to buy a controller and modify it yourself. Also note that Wired PlayStation game pad can also be used with this board provided that all connections are correct.

All files required for this tutorial could be downloaded from here : Tutorial

This tutorial covers

  • Accessing all buttons and Joysticks of Remote Controller
  • Making a Wireless PlayStation Remote Controlled Robot
  • Making a Wireless PlayStation Remote Controlled Robot with Pan-Tilt and preprogrammed functions


#2>Required Resources:

* We highly recommend above parts as the application note is specifically build using all of above items. It’s not necessary that you use the same items listed above. You can also use any similar/higher configuration items. However you may need to make some changes to the code to make necessary adjustments.

#3>Resources used for in this tutorial:

 



General purpose robot chassis with 4 300 RPM
motors and 4 cm width wheels



Inside view



With Pan-Tilt and PS2
Wireless Receiver




PS2 Wireless Controller
(Modified)


We have chosen a general purpose chassis with 4 motors. An 11.1V 1500mAh battery is mounted inside with cable ties. Rhino Board is mounted on top and Battery and motor connections are made to the board. A modified PlayStation Wireless Remote is used.



#4>PlayStation Transmitter

There are in total 16 accessible buttons on transmitter. 4 is digital keypad on left side which is called UP, DOWN, LEFT and RIGHT. Other 4 buttons are on right side which are named A, X, D and O. 4 buttons are on top called L1 and L2 on left side and R1 and R2 on right side. There are 2 buttons in center for Start and Select and 2 more when you press joystick which are called JL and JR.

Apart from these there are 2 Joysticks which are 2 axis ones. So both joysticks will give total of 4 analog outputs which ranges from 0 to 255. When they are in normal position (center position) they give value 127 or 128.

#5>PlayStation Receiver

The wireless PlayStation remote has a receiver which will be connected to Rhino board. The connection should be done on the LCD connector. Its obvious that LCD will not work if PSx receiver is connected. PS2 Receiver used here has following pinouts.

Pin Number Wire Colour Pin Description
1 Black Ground for power supply and signal
2 VCC +5V input
3 Red Clock
4 Orange Attention
5 Yellow Command
6 Green Data


Detailed working of protocol is out of the scope of this document but you can search on the internet for the same.

The main thing to understand is the receiver is continuously communicating with Rhino Board and the transmitter. Rhino Board should continuously send commands for polling data from receiver. This is done through function PSXPOLL(); . This function updates input data to all PSx variables like LJOYX, LJOYY, RJOYX, RJOYY, PSX_L1, PSX_ST etc.


#6>CODE


#6.1>Code 1 : Accessing PSx Joysticks and Buttons

  • Open 16 – PSx to UART Demo program in sample codes folder.
  • Library used : UART, PSX

  • The code is simple for accessing PSX input and displays it on UART. You can use a terminal software to see data coming on UART. You can download the software here : Terminal

  • Once you set parameters (COM Port to your Rhino Port, see while programming and baudrate to 115200) and click connect data will start coming to the screen through UART. If your PC is getting slow while showing data you can disable HEX and DECIMAL view to save resources in Super Terminal.

  • While you are getting values continuously on your screen you may press different buttons and move joysticks to see the inputs to Rhino.

  • Make sure you click Disconnect after testing because until the port is open you will not be able to program Rhino.

#6.2>Code 2 : Making a Wireless PlayStation Remote Controlled Robot with or without Pan Tilt

  • Open 017 – PSx controlled robot with pan tilt program in sample codes folder.

  • Library used : PSX, Servo

  • Using the above code this code uses the input from PSx to control motors and servos. Speeds of motors are controlled from input from analog joysticks. There are also some formulas written for calculations. This ensures that motor will get minimum PWM to make the robot moving. Generally at low PWM motors don’t start to avoid this formulas are written.

  • You can also see that some functions like SERVO[0], SERVOSPEED[], SERVOMAX[], SERVOMIN[] are used. These are for pan tilt servos. There are 2 servos used in this example one for Panning and one for Tilting. Pan servo is controlled through D and O buttons while Tilt servo is controlled by A and X button. You can also see that we have also utilized start button to move both servos to center position.

  • This code can also be used without servos for normal remote controlled robot.

 

 

You may also like...