Hoverboard main board with simpleFOC

This is how I started, maybe it helps.
Now it’s on hold since I have been working on the gd32 drivers and sfoc.

1 Like

In the meantime I worked on a thumb throttle input.
Coding was easy, but finding the right analog pin and soldering the connector was not. :sweat_smile:

short Video

Nice, I runs smooth
Still sounds like field weakening to me :joy:

Definitely worth a try. :+1:
I wonder if there are smaller Wire and Serial libraries, too.

You’re using the adafruit MP6050 lib in your project. Is that the smallest?
I could install them all and test them one_by_one. But they had to be much smaller than the tinyMP6050.

I didn’t pay attention to be honest.
I thought when only using adafruit librairies, some of the functions would be reused and probably reduce the size. But I had no motor control back then, so the size was ok.

Ah, I was wondering which sideboard had motor FETs…
You wanted to use them with external driver boards. :bulb:

My idea is that all those boards are something in common:

  • splitboards : single motor control + leds + IMU + optical sensors + remote
  • sideboards : Leds + IMU + optical sensors + remote
    So a sideboard is a splitboard without motor control.
    But a sideboard could be controlling a splitboards with I2Ccommander

My splitboard doesn’t run with commander. Unless it can receive commands with SerialComm?
It’s basically a switch/case list and should also work with i2c-data.
Even worse, my sideboards have GD32F130C6 MCU with only 32k flash. It’s unlikely that it is able to drive a motor with sFOC.

Even some splitboards have those chips…
But those probably don’t do FOC.

Now that I have my thumb throttle input working, I’d like to try Blutooth-remote control.
But I don’t have any sender- device.
Can you recommend something? I wouldn’t like to use an Android App.

You can just use your MacBook/Laptop?

Or else ESP32s have BT built-in, as do Nordic based boards like the Nano 33 BLE / Sense.

I even created a web app that works on mobile lol

Although it’s using the firmware’s specific binary protocol, it can send Ibus frames through bluetooth that you could pick up with a library.

But this app was used only for testing, there is a risk if you get a call or notification while you are controlling the motors.

I can’t imagine myself running behind my electrified lawn mower with a Laptop or Chromium-compatible smartphone :wink: Even worse on a Longboard
Unless the mobile App makes use of the IMU? But AFAIK it shows two joysticks on the screen…

I figured, a Wii RemotePlus would be an option, if I can bind it with the bluetooth module of the hoverboard?

I think you need to investigate based on your needs then.

It was a short investigation. :sob:
I tried to compile an i2c scanner to find the address of the BT-module. But soon figured out, Wire.h will never fit in the remaining flash.

I tried to figure out how to use qfplib and stumbled on a nano-float library based on the qfplib.
But I couldn’t figure out how to use it?
Why isn’t either of it part of the arduino-universe?

This aims to wrap the qfplib math functions so it replaces the gcc built-in math functions, and derives the functions missing in qfplib.

I think it still requires to add the wrap option to the compiler and the include should be added in each source file.

That would be easier for you to test the same way I did here

That means you have to replace atan2 by the qfplib function even in the libraries.

1 Like

That sounds like a lot of work, but it could probably be done by a batch-file.
It would be helpful, every time the original library gets updated.

I’ll see, if my notepad++ editor can do that for me

//edit
I take it, you were using the full qfplib with all options? There was a confusing compiler-options list. I don’t know how to make it happen.

The way I did it in that commit, I didn’t need any compiler option, because I directly use the qfplib functions.

Today I tried to flash the other hoverboard controller with an GD32F103RCT6 MCU.
It connects nicely under ST-link utility in any connection mode I choose (normal, hotplug, under reset) I can also erase chip.
But under Arduino IDE it doesn’t work. It tries to connect under reset, but then fails to upload.
I tried to hold the NRST pin to GND, but then I got the message, that it’s held under reset.
There’s also no “connecting” message, like with ESP32, so I’d know, when to release the reset. I tried it several times…
Funny enough, I can see it has flashed something when I use ST-Link utility again.

I could flash the other STM32 chip just fine under arduinoIDE.
Is it a problem with the GD32?