Remote Raspberry Pi Robot (PS3 Controller) – Fablab NerveCentre

These instructions try to assume very little. Hopefully, if you can boot a Raspberry Pi and have an internet connection you should be able to complete this great little project.

Remote Raspberry Pi Robot

Basically, this is a project which will result in some specific areas which can be used in other projects.

The main outcomes will be:

Using a PS3 controller

Controlling DC motors

But along the way, you'll get a chance to look at some code and perform some often used linux commands in the terminal

Step 1: What you need

It's a bit of a list – but nothing is terribly expensive. I've also tried to keep the list to commonly used components that will be useful on any related project.

For example, this project could be adapted to control a garage door or to trigger some other project by incorporating a motion detector and/or camera.

So here's the list:

  • Raspberry Pi & SD Card with Raspbian installed
  • DC Motors (pictured are 2 different types – one set is geared)
  • L293D motor driver pcb (ChrisMason has described how to breadboard this chip if you don't want to buy the pcb)
  • Powered USB hub
  • 9V battery & holder
  • 5V power source
  • PS3 Controller
  • All the necessary cables/power supplies for the above
  • You'll also need to download the *.sh files (attached) to your /home/pi directory.
4-tidyup.sh294 bytes

Step 2: Wiring the motors

When I began doing bits and pieces with Arduino and Raspberry Pi, I didn't get why motors couldn't be connected directly to them. Here's the quick explanation…..

If you look at the specifications of a motor you'll get information about it's RPM, ampage, ratio etc. Also included will be a voltage span within which it can operate. For the majority of motors used by hobbyists and makers, this voltage span is likely to be 6V or greater.

For the motors I'm using in this project, I'll be using a 9V battery. Now, a 9V battery is too much to run the Raspberry Pi from. Also, hooking up the motors directly to the RPi means that the greedy little things will try to draw more current than the RPi (or indeed an Arduino) can provide.

This can result in damaging your hardware.

You can wire the motors, battery holder and wires to the L293D pcb as shown. The 9V battery will independently power the motors. The motors themselves are attached to terminals marked “MA” and “MB” on the board I have.

The other 3 pins (per side) are inputs 1 & 2 and an enabling terminal also. The enabling terminal could be regarded as a kind of handbrake, you have to enable the motor on the channel in order to drive it. The other 2 pins are switch controls which determine the direction the motor will spin.

Step 3: Connecting the motor driver pcb to the RPi

Apparently you shouldn't connect anything to the GPIO pins while the RPi is running so it's worth making sure to heed this advice or it could be expensive.

You can connect the wiring to the RPi as shown in the image.

Don't put the 9V battery in just yet. I've found that if the battery is left in, it will slowly drain. Given that setting up the RPi for this could take some time, we'll just leave it out until we're ready for testing.

Another solution to this is that you can add a simple switch to the battery holder.

Step 4: Getting the PS3 controller running on the Raspberry Pi

We now have the connections all made and so can move on to setting up the PS3 controller.

There are a good few tutorials on how to do this. The one I initially used is available here:

https://github.com/petrockblog/RetroPie-Setup/wiki…

For anyone who is a beginner at using the command line in linux going through all the commands and encountering some problems can be really frustrating. To help with that, I've started off with a completely clean install of Raspbian so that I can hopefully identify every issue you might encounter.

Remote Raspberry Pi Robot

The first thing you need to do is install some background programs and libraries. These are known as “dependencies”.

 

For more detail: Remote Raspberry Pi Robot (PS3 Controller) – Fablab NerveCentre


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top