Introduction: Arduino Xbox RC Car Hack (Maisto Rock Crawler)

In this project we are going to hack an RC Car (Maisto Rock Crawler) and replace it's stock circuit board with an Arduino Uno R3, Motor Shield, and XBee module. We will use another Arduino to collect and interpret data from an Xbox 360 controller; this Arduino will also have an XBee module, which will be sending instructions to its XBee pair (located on the Car).

Tools, Components, and Software - Look at Step 1

GitHub: https://github.com/WileTheCoyote/CSCI-4830/tree/m...

Step 1: Gather Materials & Disassemble RC Car

Components:

  • RC Car (We used: Maisto Rock Crawler)
  • Arduino Uno x2
  • Motor/Servo Shield (We used: Velleman VMA03)
  • USB Host shield (We used: Circuits@Home USB Host shield 2.0)
  • XBee RF Module (We used: XBee 802.15.4) x2
  • XBee host shield (We used: one Arduino Wireless SD shield & one Arduino XBee shield model) x2
  • XBee mini USB adaptor (i.e SparkFun XBee Explorer)
  • Microsoft Xbox 360 wireless Receiver
  • Xbox 360 Controller
  • 9V Battery Pack
  • Female/Male & Male/Male Connector cables

Tools:

  • Multimeter
  • Soldering Iron
  • Solder
  • Micro USB to USB cable
  • USB cable type A/B

Software:

  • XCTU (For programming XBees)
  • Arduino IDE

Disassembly usually consists of simply removing some screws and exposing the stock circuit board from the plastic body.

Step 2: Map Functionality of Circuit Board

Locate the wires that connect the circuit board to the motors/servos. For this 4-wheel-drive RC Car (Maisto Rock Crawler), it has 3 DC motors; two controlling throttle (one for the front axis and one for the back) and one controlling steering (on the front axis). For us we see that 4 wires lead to the front (one black and one red - for throttle, one purple and one gray - for steering). 2 Wires lead to the back (again one black and one red). Since all of our electrical components are still attached we can simply use the car's stock radio controller to test the voltages. With your hand on the throttle, probe the circuit board and record the voltages needed to operate the motors. Do the same for steering.

Circuit Board Map:

  • M1+ = Forward (2 Black Leads)
  • M1- = Backward (2 Red Leads)
  • M2+ = Left (Purple Lead)
  • M2- = Right (Grey Lead)
  • VCC = Power (Red Lead)
  • GND = Ground (Black Lead)
  • Ant = Antenna (Black Lead)
  • A,B,C = Radio Channels from controller (Black, Green and White Leads)

Voltages:

  • Forward = Approx. 9v
  • Backwards = Approx. 9v
  • Left = Approx. 6v
  • Right = Approx. 6v

Note - Most RC cars use a servo for steering instead of a DC motor (most servos have 3-wire leads)

Step 3: Cut and Splice Wires

With our car's stock circuit board mapped and voltages noted, cut the leads attaching the circuit board to each motor. It may help to immediately solder on a female head on one spliced end and a male head on the other (This way we can always re-assemble the motors/servo wires to the stock circuit board and restore is designed functionality).

Step 4: Attach a Motor Shield / Load Test to Arduino

Stack the motor shield to the Arduino; in our case the shield must accommodate at least 2 DC motors. Now we must test that our Motor Shield/Arduino assembly is behaving correctly (and with the right voltages). Load a test sketch to the Arduino; this program should turn each motor on for a few seconds. Use a multimeter to probe the motor joints on the shield; this should confirm that the shield is outputting the appropriate voltages. If the voltages are correct (in our case 9V for throttle and 6V for steering) then we can attach the RC Car leads to the assembly. If the test is successful we should see the car's wheels go forward/back and left/right.

Note - We attached a 9V external power source to the shield (Same voltage as the stock battery pack). If your using an Adafruit or Osepp Motor shield, the AFMotor library may prove useful in operating the shield. Our test sketch is called MotorTest.ino and can be found on the GitHub.

Step 5: Program Two RF Modules (XBee's) to Communicate

We used two XBee 802.15.4 modules.

Configuration steps can be found at: https://learn.sparkfun.com/tutorials/exploring-xb...

Step 6: Attach One XBee to Your Arduino and One to Your Computer

We will need to use an XBee host shield to house the XBee on our Arduino/Motor shield assembly. In our case we had from bottom to top: Arduino, Motor Shield, XBee Shield. To connect to the computer we will need an XBee mini USB adapter; this uses a USB to serial converter that allows you to translate data between your computer and XBee.

Step 7: Control RC Car From Your Computer

With one XBee connected to our assembly and one connected to the computer (via the mini usb adapter) we can now test that the XBees are communicating correctly. This test sketch (loaded to the Arduino) should turn on the forward throttle when the Arduino XBee reads an "f" in it's serial terminal, backward when a "b" is read, and off when an "o" is read. We can directly access our XBee's serial terminal with it plugged into the computer. First you must open XCTU and in the upper left hand corner click the "Discover Radio Devices" icon. Once selected and added, you should see it on the left hand side of the program. Click on the device and its info should appear on the right. We can now click the terminal icon (upper right hand corner) to "Switch to Console Working Mode". Now click "Open" to open the serial connection to the radio module; this allows us to now add and send a single packet of information (in our case "f", "b", and "o").

Note - Most XBee shields have a switch (or jumper pins). This switch determines how the XBee's serial communication connects to the serial communication between the microcontroller and the USB-to-serial chip on the Arduino board. You must turn this to "USB" mode while loading sketches to the Arduino and to "MICRO" mode when you want the Arduino to receive data through the XBee module.

If your using the Arduino Wireless SD Shield the schematic and configuration can be found here: https://www.arduino.cc/en/Main/ArduinoWirelessShi...

Note - The test sketch we used (on GitHub) is called XBeeComputerTest.ino

Step 8: Test the USB Shield and Connect to Xbox 360 Controller

Now that we have our XBees communicating we can move to interpreting input from an Xbox controller. To do this we will need to grab our second Arduino and attach the USB host shield. Find your Microsoft Wireless Receiver and plug it into the USB host shield. The receiver should blink green when it's button is pressed.

We used a very handy library made by Kristian Lauszus. The library enables you easy use of many usb devices (i.e. Xbox, PS3, and Wii remotes). The library and its easy-to-follow installation steps can be found on Lauszus' GitHub. You will want to load the XBOXRECV.ino test sketch to make sure everything is working correctly. Once loaded you should be able to simply turn on your Xbox 360 Remote (you will see a single green light on the controller come on; indicating that it's connected). The test program simply prints to the serial monitor when buttons are pressed and the location of the right and left hat (joysticks). You can open the Serial Monitor in the upper right hand corner of the Arduino IDE.

Library: https://github.com/felis/USB_Host_Shield_2.0.

Test Sketch: https://github.com/felis/USB_Host_Shield_2.0/blob...

Note - You must set your baud rate in the serial monitor to the baud rate used in the test program

Step 9: Move XBee to Our 2nd Arduino

With our Arduino successfully reading input from our Xbox 360 remote and our XBees communicating correctly, we can move away from computer control; We want to move the XBee on the mini USB adaptor (attached to the computer) to our second Arduino (we will do this via a second XBee shield). This 2nd Arduino will work as our "Xbox Arduino" assembly, while our old assembly will be the "Motor Arduino". The Xbox Arduino should now consist of an Arduino Uno, our USB host shield (attached to the Microsoft Wireless Receiver), and our 2nd XBee shield.

Step 10: Write Our Final Two Sketches

Now we can work on our final two sketches. The first will run on our Xbox Arduino; detecting relevant events on our Xbox remote and writing appropriate instructional bytes to the serial terminal. These bytes will then be picked up by our Motor Arduino (via our XBee) and interpret their instructions. The Motor Arduino sketch will be very similar to the XBeeComputerTest, but now we must include all of the desired RC Car functionality. We used the RT/LT buttons for forward and backward, and the left joystick for steering.

Our sketches are named: XboxFinal.ino and MotorsFinal.ino

Comments

About This Instructable

5,850views

155favorites

License:

More by WileTheCoyote:Arduino Xbox RC Car Hack (Maisto Rock Crawler)
Add instructable to: