Hey folks! I really enjoy throwing a controller at someone who’s never driven a robot before and letting them drive an antweight as a minibot in a beetle fight (See: feeding Fatal Deviant to Zephyrus at the last Pub Beetles), or during an antweight rumble or open arena time. I get comments like “oh no, it’s awakened something in me, now I have to build a robot”, or maybe just an evil robo-bloodlust grin. Unfortunately my usual (heavily modified and some would say extremely cursed) pistol grip controller is perhaps the least intuitive thing possible for a newbie.
It turns out however that Google Stadia controllers are now £13 on ebay, and will speak to a BLE compatible microcontroller, so I picked one up. I couldn’t find a decent existing Arduino sketch to do the job, so I slapped together a quick sketch that lets me drop in a Seeed Xiao ESP32C3 in place of my regular Flysky receiver. Now I can throw the hopefully more familiar Stadia controller at the prospective driver instead.
My robots use IBUS for comms with the receiver, so it may not be totally applicable to most folks, but should be easy enough to follow and a good starting point if you want to have it instead treat some pins as normal PWM outputs. If you ask really nicely I’ll update it with PWM support (after champs!)
The code is here, please let me know if you have any questions or find it useful!
I have previously used PS3 wireless controllers, they use Bluetooth Classic, which isn’t available on a lot of newer mcu modules, plus they are a chore to bind - binding can’t be done wirelessly, it needs to be done via a usb cable.
What is the binding process for the Stadia controller?
Having said that, perhaps Stadia controllers are less ubiquitous than PS3 controllers are (/ were , they are history now)
Yeah, the PS3 controllers seem like a pain, and squinting at the difference between bluetooth classic and BLE is what lead me down this path!
The binding process is super easy. I hard code the MAC address of the controller in the sketch (not required, it’ll bind to anything, but that seems like a bad idea in case more than one person has a controller in range). Then you turn the ESP on, and turn the controller on by holding the Stadia logo button and Y for a couple of seconds. They’ll ping each other and connect, and it seems to Just Work. I haven’t had it fail since I gave the ESP its own dedicated vreg inside the bot - usually I run my receiver off the linear reg on the drive board, but it’s only rated for 100mA and the ESP reboots when it tries to ping the controller.
I settled on the Stadia controller mostly because it’s the cheapest decent BLE controller available (ie not an aliexpress cheapie with stick drift out of the box), aside from maybe an absolutely thrashed xbox one controller - I’ve had my fill of stripping those and and ultrasonic cleaning all the dorito slime out. Right now there’s still plenty of Stadia controllers out there, and of course they’ve had little to no use, so it’s probably a good time to stock up and buy a couple more.
The only real downside is there’s no UI for mixing and trimming, but if you’re already in deep enough that you’re putting an ESP32 in your robot that shouldn’t be much of a barrier, and they’re cheap enough to have one per bot.
Yeah mixing is easy enough to implement in firmware, trimming is more complicated and totally necessary if you want to run a servo.
I still like the idea of the Stadia controller, if I ever get back to my meltybrain project I will probably pick one up and run it on the Seeedstudio ESP32 modules, they are super small.
hello! nice seing more ppl experimenting with the esp, last years i was using espnow with 3dprinted controllers, this year we moved to bluepad too, the code is currently wip, but we use it to run n20 directly to motor drivers (like drv8833) git is a mess at the moment because i’m running some major updates but on the dev build there is currently setting mode that enables motor reverse, servo end point and if you have triple driver change a n20 to behave like a servo providing a potentiometer is connected
the only issue i’m having with bluepad is disconnecting not stored controllers, while you can prevent new connection it looks like for the current bluepad disconnecting ble’s might be hard on the arduino build
if you have any request for a specific board i can add it (currently i have nothing that connects to something like a bbb esc in place of the drv8833) let me know the pinouts and motor protocols!
cheapest controller for the c3 is the terios t3 binded by holding X + home, but doesn’t have nice readings for the sticks, is the stadia good in that department? what binding profile are you using?
Hi Paolo! Interesting project, rolling it all together into one stack is certainly a more efficient way to do things, especially at the antweight scale. I need a whole separate voltage regulator just to run the ESP32 in my antweight, which means if you include the linear reg on the main drive board there’s a total of four! (Five if you count the linear reg on the Seeed Xiao…)
The stadia controller has been really reliable so far. I haven’t noticed any weirdness with the sticks - the values don’t have any noticeable noise, and they’re either linear or have a sensible curve applied. I avoid any binding weirdness by hard-coding the MAC address into the sketch and forcing the controller to re-pair every time the ESP32 is rebooted, which isn’t ideal if you’re trying to run a fleet of bots with different controllers, but it should be possible to have the ESP save the MAC of the first controller paired to the onboard flash. Works great if you only have one controller!
conrtroller usually auto enter pair mode, the "pairing” long presses or button press is just to pair to new devices so with bluepad32 you actually don’t have to repair every time
what i changed is that i don’t have the mac stored in flash but in EEPROM and it stores first bind like the malenki, same procedure if you leave it on one minute without the controller it clears the eeprom mac and enters biding again
i’m only having issues disconneting pads from bluepad (because you can avoid binding to wrong mac but apparently the controller still see it as connected so it doesn’t search for new board) but once connected i use th bp32.enablenewbluetoothconnetion(false) to prevent “stealing” other remotes worked nice yesterday at pub event with 8 loanbots witj bluepad32