This project shows how control the GoPiGo with a PS3 Dualshock 3 controller.
The PS3 controller can be used to control the GoPiGO with a bluetooth adapter. You have to pair the PS3 with the GoPiGo first and you’ll have your own cool RC car.
You can try out this example to see how to control the GoPiGo with a PS3 adapter and adapt it into projects of your own.
Hardware needed:
- A fully assembled GoPiGo
- A decent battery pack providing atleast 9V (recommended 12V battery pack of 8AA cells )
- Wifi Adapter for connecting and controlling the GoPiGo
- A bluetooth adapter for connecting the PS3 controller
- A PS3 Dualshock 3 controller
Connecting the Bluetooth Adapter and the PS3 controller:
- Connect the bluetooth adapter to any of the USB ports
- Connect the PS3 controller to the Raspberry Pi with a USB Mini A/B cable
Setting up the GoPiGo
Make sure that the GoPiGo is set up properly and you have the updated software and firmware. If you are not sure about this, follow the guide here.
If the GoPiGo is properly set up, connect to the GoPiGo via SSH or VNC and open terminal.
Running the example:
- Go to the PS3 Control folder:
cd Desktop/GoPiGo/Software/Python/Examples/PS3 Control/
- Make sixpair executable and run it .This will pair the PS3 controller to the Bluetooth adapter.
sudo chomod +x sixpair sudo ./sixpair
Disconnect the USB cable which was connected to the PS3 controller.
- Press the PS button on the PS3 controller and a couple of random buttons on the controller. The light on the Bluetooth adapter should become solid green from the blinking green earlier.
- Start the PS3controller example :
sudo python ps3_gpg_example.py
To control the GoPiGo from the Ps3 controller:
- Use the Up,Down,Left,Right buttons to control the motion of the GoPiGo.
- Use L2 to increse the speed.
- Use R2 to decrease the speed.
- Use the left joystick to control the servo position.
You can easily adapt this example to any project which can make use of a PS3 controller with the GoPiGo.
Have a question? Go check out our support page here or post it on the forums here.