Introduction: PS3&Arduino&Motors Detailed Tutorial

In this Instructable, I will teach you how to connect the wires from these mess properly, so you can control at least 4 stepper motors and 2 servo motor through wireless ps3 controller and the Arduinos. I will post picture for each step so you can follow very easily. I hope you enjoy this and leave feedbacks or suggestions if you have any problems or questions.

Step 1: Prepare for the Materials

Everything starts from the draft. In order to follow through this project, you need the following components:

-2 Arduinos(If you just have one Arduino, you can simplify the sketch but control only 2 stepper and servo)

-1 PS3 controller

-Couple of jumper wires

-1 small breadboard (if you have a big breadboard that's also fine)

-2 1K ohm resistors attached to the breadboard

-1 Bluetooth dongle (I bought the KINIV0 dongle from amazon, it works perfectly)

-1 BLUE Arduino USB Host shield (I also bought that from amazon)

-1 blue USB wire (It's usually arrived with Arduino)

-1 or 2 black power supply cable (9-12 volts. More maximum current the better)

-4 stepper motors (each one needs 6 square tip wires and a green driver)

-2 servo motors (remember, read is +5v, black is ground, orange is signal)

-a powerful variable voltage power supply (You need this because the black power cable can only supply 1A current, and it's still not enough for 4 stepper motors. If you don't have it, just use the powersave sketch and two black power supply cables instead)

Step 2: Test the Communication Between Arduino and PS3 Controller

To start the process, first you just need to simply plug both Bluetooth dongle and USB host shield into one of the Arduino. Then download the USB host shield 2.0 library from the website(actually it's easier to download it by opening the Arduino IDE, then click sketch - include library - manage libraries, and you will find all the libraries you may want to download there), then copy and paste it into your Arduino library holder. Start a new sketch, and click file - examples - USB host shield 2.0 library - Bluetooth - PS3BT. From the sketch change Serial.begin(115200) to Serial.begin(9600), then add "//" before the line of PS3BT PS3(&Btd); and delete the "//" in //PS3BT PS3(&Btd, 0x00, 0x15, 0x83, 0x3D, 0x0A, 0x57); Remember that before you upload this, open this library folder and find a document named settings. Open that document by notebook and find this line below:

/* Set this to 1 to activate serial debugging */
#define ENABLE_UHS_DEBUGGING 0

Change that last number into one then it's done. Now plug that blue wire into your computer and Arduino, then upload your new enhanced sketch. (If you are confuse about anything , go to

and watch the video, that guy has a good taste of music but doesn't like talking too much).

As the video demonstrated, there are some procedures you need to follow through after you upload the sketch:

1. Open the serial monitor and check if the Bluetooth adapter is connected perfectly.

2. Remove the dongle and plug in the lead of ps3 cable, then wait for a few moment to settle its address.

3. Remove the ps3 lead and plug in the USB dongle again to settle its connection.

4. Click the PS3 wireless button and enjoy the sea of data flowing through the monitor screen as you play with PS3 joysticks.

Step 3: Test the Basic I2C Communication Between 2 Arduinos

I2C is a kind of communication system that can be used between 2 Arduinos (There are also two other systems which are Serial and SPI). To establish the system, you need:

- 2 Arduinos

- 1 breadboard

- 2 1k ohm resistors

- jumper wires

To begin, plug the one end of both resistors to the same row of the breadboard (let's call this rowA), then plug the another end of the two resistors to the two different rows (rowB and rowC). Following by this, use the jumper wires to connect both 5v pins of the Arduinos to the same row which also connects to the one end of both resistors(connect them to rowA). Then connect both A5 pins to rowB, and both A4 pins to rowC. At last, use one jumper wire to connect the GND pins of both Arduinos together. Now choose the Arduino with shield and dongo as your master device, and another Arduino as your slave device. You need to apply different sketch to each Arduino, so the master can send the data to his slave.

Now apply the master sketch to master Arduino, the slave sketch to slave Arduino.(I posted these two sketches in this Instructable) Finally, open the serial monitor in slave device and check the data flow. After making sure all is correct, unplug the blue usb wire and keep the circuit.

Step 4: Establish the Communication Between Ps3 and Motors

Now it's time to set up the final transmission, but firstly you need to connect all the motors in space. Follow through the instruction below:

1. Use a wire to connect rowA to another empty row (I call this rowD), so you can have more wires to be connected to +5v.

2. Connect all the red wires of servo motors to rowD, and all the orange wires to the pin6, pin7 of master Arduino, then connect all the black wires to any ground (you can use an jumper wire to connect an Arduino ground pin to an empty row on the breadboard to create more ground pin)

3. Connect the In1, ln2, ln3, ln4 pins of stepper motors to the either 2,3,4,5, pins or A0,A1,A2,A3 pins of two Arduinos until the four stepper motors are all connected properly.(The order of the pin connection is important)

4. Connect all the +5v wires of stepper motors to an empty row(rowE), then connect all the ground wires of stepper motors to two empty rows(rowF and rowG) evenly. Use a jumper wire to connect rowF and rowG, and use another wire to connect them both to ground.

5. Connect the rowF and rowG to negative powerful power supply, the rowE to positive powerful power supply. (If you don't have a powerful supply, don't commit suicide just yet. I also post the powersave sketch for two Arduinos to control 2/4 stepper and 2 servo without using powerful power supply but 2 normal black power cables)

6. Upload the two complete final sketches I posted to two Arduinos (master sketch to master Arduino, slave sketch to slave arduino), then turn on all the power and ps3 wireless mode.

The so called save power mode is nothing but add a function to L1 button of PS3 controller. You can still use it if you have a powerful power supply. Though for these who doesn't have it, here is how you reconstruct the circuit:

(It starts after the original step 4)

5. Unplug the jumper wire which was connected to +5v slave Arduino pin then plug it in again to connect the

+5v slave Arduino pin to rowE.

6.Plug the second black power cable into slave Arduino, power them both on, upload the sketch, turn on the ps3 wireless mode by clicking the center button on the PS3 controller.