MiniTrooper Drivetrain.drive Bug

Hello!

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… :rofl:

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.

THanks,
Michael

Ah and there is another configuration with problems:

  • Driving forward only at full speed e.g. Drivetrain.driveTurn(100, 0)
  • Then keeing the forward speed on, add a drive right turn e.g. Drivetrain.driveTurn(100, 60)
  • It will also keep driving straight and only turn very slightly
  • The same happens backwards and left

And one more piece of info: If I turn the acceleration setting to 0 then all is well.

Hi,

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.

1 Like

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

In Makecode the code then is very simple:

1 Like

1 Like

This might be a great solution!
Try to upload this code to RoboBoard X3: https://github.com/totemmaker/TotemArduinoBoards/blob/master/libraries/BLE/examples/BLE_uart/BLE_uart.ino

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.

Added guide to connect BBC micro:bit with Totem RoboBoard: https://docs.totemmaker.net/remote-control/microbit/

Check it out :wink:

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 :slight_smile: (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.

All the best,

Michael

1 Like