Black Lives Matter - Action and Equality. ... Adafruit is part of the Stop Hate for Profit campaign. Adafruit is open and shipping.
0

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.


We are angry, frustrated, and in pain because of the violence and murder of Black people by the police because of racism. We are in the fight AGAINST RACISM. George Floyd was murdered, his life stolen. The Adafruit teams have specific actions we’ve done, are doing, and will do together as a company and culture. We are asking the Adafruit community to get involved and share what you are doing. The Adafruit teams will not settle for a hash tag, a Tweet, or an icon change. We will work on real change, and that requires real action and real work together. That is what we will do each day, each month, each year – we will hold ourselves accountable and publish our collective efforts, partnerships, activism, donations, openly and publicly. Our blog and social media platforms will be utilized in actionable ways. Join us and the anti-racist efforts working to end police brutality, reform the criminal justice system, and dismantle the many other forms of systemic racism at work in this country, read more @ adafruit.com/blacklivesmatter

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.

Join 20,000+ makers on Adafruit’s Discord channels and be part of the community! http://adafru.it/discord

Have an amazing project to share? The Electronics Show and Tell is every Wednesday at 7pm ET! To join, head over to YouTube and check out the show’s live chat – we’ll post the link there.

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

Follow Adafruit on Instagram for top secret new products, behinds the scenes and more https://www.instagram.com/adafruit/

CircuitPython – The easiest way to program microcontrollers – CircuitPython.org


Maker Business — To make it through a tough business cycle, layoffs should be a last resort

Wearables — Look beyond buttons

Electronics — The Glitchy Switch

Python for Microcontrollers — Python on Microcontrollers: CircuitPython on Wio Terminal, 6.0.0 Alpha 1 and more! #Python #Adafruit #CircuitPython @circuitpython @micropython @ThePSF

Adafruit IoT Monthly — Repurposed Smart Home Displays, Open-Source 5G Networks, and more!

Microsoft MakeCode — Black Girls Code Virtual Camps

EYE on NPI — Maxim’s Himalaya uSLIC Step-Down Power Module #EyeOnNPI @maximintegrated @digikey

New Products – Adafruit Industries – Makers, hackers, artists, designers and engineers! — New Products 7/1/20 featuring Adafruit H3LIS331 Ultra High Range Triple-Axis Accelerometer – STEMMA QT / Qwiic!

Get the only spam-free daily newsletter about wearables, running a "maker business", electronic tips and more! Subscribe at AdafruitDaily.com !



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.