Your shopping cart is empty!
Yes! The PS2 has an Arduino shield now! The Cytron PS2 Shield is designed to be compatible with SONY PS2 wired and wireless types. Previously I have written an article on G15 cube servo motor on Mobile Robot, controlled using SKPS or SKPSW, but you need to do some wiring.
Since Cytron has launched the shield for PS2, I decided to upgrade the tutorial. With this shield, minimum wiring is needed. Furthermore, the G15 team is producing proper wheel and extension cables. BTW, if you have any questions or inquiries, please do post in our technical forum as we seldom check the comment on the tutorial site.
Cytron PS2 shield is designed with the idea to offer users the fun of using the SONY PS2 dual shock controller on Arduino, ready with a library and example sketches. It is truly plug-and-play with Arduino UNO, Mega, or Duemilanove. It uses UART for data communication with Arduino main board. Please visit the product page for the User’s Manual and example sketch + library. UART is common and yet famous standard serial communication, quite a number of shield use UART for communication, to allow more UART shields to be stacked on the Arduino main board, we designed the PS2 shield with the option to use software UART (softserial on Arduino). So user can still stack another shield that uses UART together with the PS2 shield. In this article, I will be using G15-shield which is using hardware UART.
Previously I am using CD/DVD as the mobile robot wheel, which I admit, is not nice. Cytron is launching the wheel for G15, which is yet to be launched, what I get is an engineering sample. Do keep an eye on Cytron's website and Facebook fan page.
Here is the material I am using:
- Arduino UNO (Duemilanove and Mega is compatible)
- G15, Cube Servo, 2 units
- 18650 rechargeable Li-ion battery x 3 units
- Aluminum Robot chassis, I am just using the base.
- Some screws and PCB spacers as castor to mount Arduino main board.
The G15 wheel is being designed to be snap, and fit to G15 with the Interconnect.
To mount the G15 and wheel to the aluminum chassis some drilling is needed. I measure the G15’s external joint at the bottom of aluminum chassis and drill two extra holes. Use proper M3 screws and nuts to mount it.
Now insert the G15 with wheel into the external joint. You will get a robot base like this. Not to forget the G15 will be at the bottom of the chassis.
As for the castor, try to get a 60mm (6 cm) M5 bolt and round nuts.
You still need to drill an M3 hole for battery holder mounting. You can also mount it using double-sided tape.
You can use the DC Jack Converter to connect the wires from the battery holder to Arduino.
Anyway, I am using a modified DC jack as I have one.
The aluminum chassis comes with ready screw holes to mount Arduino UNO or Duemilanove. Use PCB stands/spacers to mount the Arduino main board as shown.
Now, stack the G15 shield onto the Arduino UNO and choose D9 for EN2_SEL, using the jumper, which is the control pin for G15 communication.
If your G15 is new, we need to set the desired ID. Connect only 1 G15 to the G15 shield. Let's connect the left G15 first and configure it with ID 1. Download the examples and library from the G15 product page here. Extract it and copy the folder and place it in C:\Users\XXXX\Documents\Arduino\libraries\
Open Arduino IDE and load the example from File->Examples->G15->SetID:
Modify the DesiredID to 0×01 as shown.
#define DesiredID 0×01
Compile and load into Arduino UNO, if the update ID is successful, the LED on G15 will blink 1-second rate (slow), else (blink at a fast rate) it is failed and check the connection and power.
Disconnect the left G15 from the shield, and connect the right G15 only to the shield (not both, only 1). Modify the Sketch, change the ID to 0×02, and load into the Arduino.
Good, now the ID is set correctly with the left being 1 and the right being 2.
Good!, you are going close. Connect both the G15 motors together, and connect them to the G15 shield. I am using a G15 extension cable, again, it is an engineering sample, I do not know when it will be launched, so you just have to do the wire yourself.
Now we want to add in PS2 shield. Since G15-shield is using Hardware UART to communicate with G15, PS2 shield cannot use the hardware UART, we will need to choose software UART or softserial. I choose D2 for RX and D3 for TX, using the jumpers on the shield. The baud rate jumper to 9600. Stack it onto G15 shield.
You will get a mobile robot:
We need to download the library for PS2-shield here: PS2-shield examples and library
from the product page here. Extract it and copy the folder and place it in C:\Users\XXXX\Documents\Arduino\libraries\
To understand more about the library, feel free to visit the wiki page here.
Now, download the example sketch for this tutorial here and open it using Arduino IDE. If you are new to Arduino, please visit our Getting Started with Arduino – UNO. Compile the example sketch and load it into Arduino UNO using a USB cable.
Plug the PS2 dual shock controller connector into the PS2 shield, connect the power from the battery and you should be able to control your mobile robot right away.
This is just a simple example, do feel free to modify it and share with us the result. Just post a photo or video on our Facebook fan page, and we will be happy.
Not to forget, the wireless PS2 is also compatible with Shield-PS2, try it out too.