The new Raspberry Pi B Model B+ is here - Pick one up in the store and check our detailed guide!

April 23, 2012 AT 10:51 am

Weekend Project: Arduino + Xbee + PS2 controller = 20 channel universal project controller!

Last weekend I threw together my 20 channel wireless controller using the SMDuino, an XBee 2.5 and a PS2 controller and wanted to share the details.

The purpose of this project was to eliminate the need to use a wired interface to the Playstation controller in order to control your projects. Due to its size, the SMDuino fits neatly into one of the “arms” of the controller replacing the existing motor. With Bill Porter’s awesome PS2 library, an added battery, charging jack, reset button and Xbee, the Playstation controller can now be used as a universal 20 channel controller for a variety of projects.

Related

“D is for Diode” – Circuit Playground Episode 4 is out now! CLICK HERE TO WATCH!

Have an amazing project to share? Join the SHOW-AND-TELL every Wednesday night at 7:30pm ET on Google+ Hangouts.

Join us every Wednesday night at 8pm ET for Ask an Engineer!

Learn resistor values with Mho’s Resistance or get the best electronics calculator for engineers “Circuit Playground”Adafruit’s Apps!



7 Comments

  1. adafruit_support

    Nice work! I’ve used wireless PS2 controllers with Bill Porter’s library for a number of remote-control projects. But the range is limited – especially through walls. What kind of range do you get with the XBee 2.5′s?

  2. Thanks! I haven’t done a specific range test using the high-gain antenna, but the spec sheet says I sound expect 400ft outside and 133 indoor. I took it outside yesterday to drive the tank, and hit at least 300ft.

  3. Can you post a schematic with the ps2 headers labeled? I’m just plugging the four wires randomly into pins 3 through 6 and have not found the correct combination.

  4. woops I found the pin labels in the code but it still will not work. I have the correct baud rate and even put in level shifting resistors but all i get from the terminal is “yy yy yy yy yy”.

  5. Make sure that you are using the “Debug” code as it transmits data as ASCII characters rather then as a byte stream. A byte stream would appear as random characters, or no characters at all when view in the terminal. Alternatively you can use a program like RealTerm (WIN) or CoolTerm(MAC) to look at the raw HEX coming in.

    Also, make sure you are powering the PS2 controller at 3.3v. I have heard that they can run at 5V, but I wouldn’t try it.

    Good luck!

  6. Thanks for the tips! Your Debug code is not compiling for me:

    SMDuino_PS2_Control_Debug.cpp: In function ‘void loop()’:
    SMDuino_PS2_Control_Debug.cpp:69:52: error: no matching function for call to ‘HardwareSerial::print(int, int&, int, int, int)’
    /usr/share/arduino/hardware/arduino/cores/arduino/Print.h:44:10: note: candidates are: void Print::print(const String&)
    /usr/share/arduino/hardware/arduino/cores/arduino/Print.h:45:10: note: void Print::print(const char*)
    /usr/share/arduino/hardware/arduino/cores/arduino/Print.h:46:10: note: void Print::print(char, int)
    /usr/share/arduino/hardware/arduino/cores/arduino/Print.h:47:10: note: void Print::print(unsigned char, int)
    /usr/share/arduino/hardware/arduino/cores/arduino/Print.h:48:10: note: void Print::print(int, int)
    /usr/share/arduino/hardware/arduino/cores/arduino/Print.h:49:10: note: void Print::print(unsigned int, int)
    /usr/share/arduino/hardware/arduino/cores/arduino/Print.h:50:10: note: void Print::print(long int, int)
    /usr/share/arduino/hardware/arduino/cores/arduino/Print.h:51:10: note: void Print::print(long unsigned int, int)
    /usr/share/arduino/hardware/arduino/cores/arduino/Print.h:52:10: note: void Print::print(double, int)
    SMDuino_PS2_Control_Debug.cpp:69:53: error: expected ‘;’ before ‘)’ token

  7. Fixed! Thanks for the heads up. I had left out “map(” in the battery % conversion line at the bottom of loop(). Let me know if you get it running!

Sorry, the comment form is closed at this time.