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.
Adafruit publishes a wide range of writing and video content, including interviews and reporting on the maker market and the wider technology world. Our standards page is intended as a guide to best practices that Adafruit uses, as well as an outline of the ethical standards Adafruit aspires to. While Adafruit is not an independent journalistic institution, Adafruit strives to be a fair, informative, and positive voice within the community – check it out here: adafruit.com/editorialstandards
Stop breadboarding and soldering – start making immediately! Adafruit’s Circuit Playground is jam-packed with LEDs, sensors, buttons, alligator clip pads and more. Build projects with Circuit Playground in a few minutes with the drag-and-drop MakeCode programming site, learn computer science using the CS Discoveries class on code.org, jump into CircuitPython to learn Python and hardware together, TinyGO, or even use the Arduino IDE. Circuit Playground Express is the newest and best Circuit Playground board, with support for CircuitPython, MakeCode, and Arduino. It has a powerful processor, 10 NeoPixels, mini speaker, InfraRed receive and transmit, two buttons, a switch, 14 alligator clip pads, and lots of sensors: capacitive touch, IR proximity, temperature, light, motion and sound. A whole wide world of electronics and coding is waiting for you, and it fits in the palm of your hand.
Have an amazing project to share? The Electronics Show and Tell is every Wednesday at 7:30pm ET! To join, head over to YouTube and check out the show’s live chat and our Discord!
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?
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.
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.
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”.
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.
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?
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.
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.
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”.
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!
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
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!