I've fixed a couple of running bugs with the data packet, and I've modified the NXTI2CDevice library to be compatible with Arduino 1.0.
The attached zip file has
1. a new Arduino sketch
2. a new Processing sketch
3. the modified NXTI2CDevice library
You'll still need the Procontroll library in Processing, though.
Greetings, everyone, and welcome to my first instructable!
Today we'll be covering a few major bases to get to the final goal: controlling an Arduino-based robot via a PS3 remote! By the end of this instructable, you'll be able to control the speeds of both NXT motors with the two analog sticks of a PS3 controller.
Here's the idea:
A PS3 communicates via bluetooth to the computer sending the value of its analog sticks to the Processing program. Processing then sends this information as a packet of data to the Arduino bot through the Xbee wireless modules. Lastly, the Arduino board "unpacks" this data packet and interprets it as the speed and direction to drive each motor.
Here are the three basic milestones that we'll cover:
-- using Arduino to control NXT Motors
-- interfacing the Programming Language Processing with a PS3 controller
-- Wireless communication between your computer and Arduino via Xbee modules
If you aren't quite comfortable with either Processing or Arduino's Programming languages--fear not! I've accompanied the project with my source code .
Here's what I'll assume:
-- you're mildly familiar with Arduino, and you can a user-created library to the IDE.
-- your computer has bluetooth-pairing capabilities
-- you can strip a few small wires and you have basic soldering skills.
Here's a few concepts that you'll learn about on the side:
(You don't need to know about these beforehand to get started on this project)
-- Xbee wireless communication
-- i2c communication (between the NXT motors and Arduino)
All right, Let's get started!
Lastly, feel free to check out the video for the final results of this project in action!
Step 1: Materials
For this instructable, you'll need quite a few things, but we're covering some major milestones in the process, and, heck, all of these parts can be reused for later projects!
I got the hard-to-find (nonLego) pieces from both Sparkfun.com and Mindsensors.com
-- two Mindstorms NXT Motors and two cables
-- Lego Technic Pieces to build your robot Chassis
-- Standard Arduino (I used the UNO. This actually allows me to skip adding pull-up resistors to the analog inputs)
-- 9V batter and 9V battery Clip to power the Arduino. ( We could power it off the motor battery, but I'll hold off on that to keep it simple.)
-- Battery Pack (or other power supply. I'm using a 7.2V NiMH pack)
-- I2C Host Cable with NXT Connector
-- Tape (Gaffer's Tape is probably the least messy, but any tape will do the job)
-- Multiplexer for NXT Motors (this piece gives us the ability to speak to the NXT motors lots of ugly wire snipping)
-- 2 XBee 1mW Wire Antennas (Xbee radios)
-- XBee Explorer USB connector
-- XBee Wireless Shield
-- header pins (longer header pins are a bit more user-friendly)
-- PS3 controller
-- mini USB cable for connecting the Xbee to your computer
-- USB cable to program the Arduino
A bundle of OpenSource Software:
-- The Arduino IDE
-- The NXT Library for speaking to the NXT i2c Motors
(Side note: This NXT Library is a great project all to itself! Check out the man Clinton Blackmore behind the accomplishment at http://robotclub.ab.ca/ )
-- The Processing Language Library called Pro Controll which will allow us to communicate with the PS3 controller.
Final Tools to get the job done:
-- Soldering Iron
-- Exacto knife (or any small-and-precise knife)
-- wire strippers for stripping very thin wire.