I’ve just finished a new project for the MiniTrooper. I’ve had big problems with the PS3 controllers. Sometimes they would connect sometimes not and I never got to the bottom of it…
In any case I’ve now decided to use a micro:bit with a gamepad accessory and use the BLE function to drive the MiniTrooper. A few days and a few gray hairs later I’ve managed to get it going… I will not do another bluetooth project in a hurry…
There is one problem left though, in some configurations the Drivetrain.driveTurn command does not work as expected. Generally it works as advertised but when a forward and left command is issued at the same time e.g. Drivetrain.driveTurn(100, -60) then the MiniTrooper will not turn and only slowly drive forward (until the command is changed) when eveything is nromal again. The same happends when a back and right command is given e.g. Drivetrain.driveTurn(-100, 60).
For all other situations it works fine. Any ideas why? I tried to find the implementation of the function but no luck.
just been testing at the moment and also spotted that motors do not update properly if DC.setAccelerationTime(500) is used.
Seems there is a bug with motor acceleration. Looking into what may cause this.
Also, TotemLibrary BLE control only supports ESP32 based boards (like M5Stack).
micro:bit uses nRF51, nRF52 chips and historically haven’t had proper Bluetooth implementation in Arduino. Also, separate Arduino cores exists (based on Adafruit and sandeepmistry).
It may be possible to add this functionality to TotemLibrary, but it depends on micro:bit board version you have and what application/environment are you using to program it?
I’m using the V2 micro:bit and MakeCode to program it. The existing BLE library seems to work, for me it was just difficult to work out all the settings that were needed to make the devices talk to each other (I know very little about Bluetooth and Arduino/C programming is also not my strong point). Also parts of the documentation are missing and some guesses and a lot of internet trawling was required to get it working in the end. I can share the details if you need.
The MakeCode library for the micro:bit does implement a BLE UART service that is modelled on the Nordic implementation. The full specification is here; Bluetooth Developer Studio - Profile Report
Micro:bit should be able to connect X3 and send data.
Inside onWrite() function you will receive some values and be able to call Drivetrain.driveTurn() from there.
Think I had micro:bit somewhere lygin around. Will do a proper guide later.
Great stuff, thanks for writing the article. My solution is similar but strangely I never got the ‘no pairing’ option to work for me… But your example work fine so I must have been doing something wrong (I only got it to work with pairing first). In any case it all works great and with the micro:bit joystick the MiniTroopers are much easier to steer.