It seems that Brian Starkey has been busy with their robots. Using one of the best RP2040 based boards, the Pimoroni Inventor 2040 W they've built a Bluetooth controlled robot that uses a PlayStation 4 controller. Best of all, they've shared the code so that anyone can build their own robot.
@Raspberry_Pi #PicoW Bluetooth + PS4 controller + @pimoroni Inventor 2040 W + @CannonFodder chassis == Fun 😊Code: https://t.co/lXXGcRhl7g pic.twitter.com/2nT1Z9DNRLMay 16, 2023
Starkey's hardware choice was Pimoroni's Inventor 2040 W, a board that we reviewed upon its release. The robot chassis is a Tiny4WD from Coretec Robotics (aka Brian Corteil / CannonFodder) sporting a transparent neon yellow acrylic frame.
The software side of the project is what caught our attention. Bluetooth on the Raspberry Pi Pico W (which Inventor 2040 W is based upon) is still only viable for use with the C language, and so Starkey has written the robot project code using C, and has helpfully provided a Github repository full of information on how to download, build and flash the UF2 file to your own Inventor 2040 W. To simplify the process of connecting a Sony PlayStation 4 controller, Starkey has provided hard coded MAC address values from lines 59 to 66 in /src/bt_hid.c. Replace the corresponding line with your MAC address, flash the code to the Inventor 2040 W, set your controller to pairing mode and you are good to go. Starkey states that "This is a pretty crude project which brings up a Sony DualShock 4 (PS4) controller on Pico-W." but in our eyes, if it works, it works.
Bluetooth support was added via SDK 1.5.0 and brings a Bluetooth API via BTstack. It provides Bluetooth LE, Bluetooth Classic, Sub Band Coding and Bluetooth Network Encapsulation Protocol. For now Bluetooth support is limited to both C and C++. MicroPython Bluetooth support is being worked on but as yet there is no official release date.
All of the code, and instructions can be found in Starkey's picow_ds4 Github repository. To use it you will need to install the C SDK toolchain, of which there is now a one-click installer for Windows.