Open happytm opened 4 years ago
From the schematic you provided your hoverboard is based on a gigadevice chip: https://www.gigadevice.com/microcontroller/gd32vf103cbt6/ The hoverboards i have are based on the stmf103. Most of the hoverboard hacks (and firmware) on the internet target stm32 .
That said the gd32 seems to be a clone of the st32: https://smdprutser.nl/blog/stm32f103-vs-gd32f103-round-1-solderability/ So if you can work out how to upload firmware onto you might have a chance with existing firmware. If you managed to do that, I'd say you'd also probably be able to port this library to the gd32.
The library doesn't yet support hall sensors but this is on the roadmap. I've added hall sensors support on one of my projects.
I'm not sure how you see the esp32 fitting in. My suggestion is to either forget about esp32 and try to use gd32 working (using this library or other firmware) or ditch your board and build/buy an alternative.
Something very close to what you need might be the janus controller. Talk to dgr on
https://community.simplefoc.com/
He's designed an esp32 board that uses this lib. It uses a magnetic encoder and might not have pins free for your hall sensor. You'd need two boards.
I've used the simplefoc board with a hoverboard motor.
https://simplefoc.com/shop
This is great for experimenting with but i would only recommend it with hoverboard motors if you have a current limiting power supply otherwise you'll likely blow the board!. The board recommends motors >10 ohms, but your motors will be ~1 ohm. I'd limit the current to <1A as the board has no mosfets. You are looking for a board with 10A+ continuous.
One final thing about hall sensors and esp32. The esp32 is 3.3v tolerant but the hall sensors on my hoverboard required 5v (otherwise they would sometimes trigger multiple times). I needed to do a voltage divider and a pullup resistor on each of the 3 hall sensors. Selecting the right resistors was harder than it sounds as they effect each other.
@owennewo Thank you for your detailed response. It seems like new efforts are made by yourself and dgr to make it work with these hoverboard motors with hall sensors. I will keep eye on couple of threads you and dgr started on forum.
The library doesn't yet support hall sensors but this is on the roadmap. I've added hall sensors support on one of my projects. I'm not sure how you see the esp32 fitting in. My suggestion is to either forget about esp32 and try to use gd32 working (using this library or other firmware) or ditch your board and build/buy an alternative.
My goal was to use existing hardware for motor driver and charging circuit to reduce cost as these board already have gd32 microcontoller, Battery charging circuit, Battery level indicator Led circuit, 3 half bridge drivers based on FD2103 chips and 6 high power mosfets per board.It also have MPU6050 chip for balancing but I do not need to use it as my project will have 2 extra pivot wheels. I am planning to use ESP32-CAM board to just send control commands to GD32 boards and stream live video. So basically ESP32-CAM would work as wifi bride. following is example link:
https://robotzero.one/pan-and-tilt-control-for-an-esp32-cam/
Instead of using Pan/Tilt mechanism in above example I wanted to use it as Reverse/Forward and Left/right direction for hover chair. I modified code from above project to control 2 servos and thereby control 2 hoverboard motors with original hoverboard firmware. The servos shafts are directly attached to driver boards to move whole driver board to engage IR switches on the board and thereby turning motors on and off. Following is a code I used:
#include <ArduinoWebsockets.h> // Install via zip file at https://github.com/gilmaimon/ArduinoWebsockets
#include <WiFi.h>
#include <ESPAsyncWebServer.h> // Install manually to arduino folder
#include <ESP32Servo.h>
int index_html_gz_len = 3863;
const uint8_t index_html_gz[] = {
0x1f,0x8b,0x08,0x08,0x27,0xcc,0x06,0x5f,0x00,0xff,0x69,0x6e,0x64,0x65,0x78,0x2e,0x68,0x74,0x6d,0x6c,0x2e,0x67,0x7a,0x00,0x95,0x58,0x7b,0x6f,0x1a,0x3b,0x16,0xff,0x3b,0x7c,0x0a,0x97,0x68,0x0b,0x6c,0x61,0x86,0x84,0xb4,0x9b,0x50,0xc8,0xd5,0xb6,0x89,0xd4,0x4a,0xad,0x5a,0x6d,0xb2,0xdb,0x44,0xab,0x55,0x64,0x66,0x0c,0xb8,0xf5,0xd8,0x73,0x6d,0x0f,0x8f,0xbd,0xcd,0x77,0xef,0x39,0x1e,0xcf,0x8b,0x90,0x28,0xe5,0x0f,0x98,0xb1,0xcf,0xef,0x3c,0x1f,0x3e,0x66,0xb2,0xb4,0x89,0x38,0x6f,0x4d,0x96,0x8c,0xc6,0xf0,0x93,0x30,0x4b,0x89,0xa4,0x09,0x9b,0x76,0x56,0x9c,0xad,0x53,0xa5,0x6d,0x87,0x14,0x9f,0x48,0x49,0xcb,0xa4,0x9d,0x76,0xd6,0x3c,0xb6,0xcb,0x69,0xcc,0x56,0x3c,0x62,0x03,0xf7,0xd2,0x2f,0x89,0xb8,0xe4,0x96,0x53,0x31,0x30,0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37,0x7d,0x52,0x7d,0x05,0xaf,0x9b,0x80,0x52,0xfb,0xd7,0xa5,0xa7,0xf7,0x69,0x5f,0x0b,0x35,0x13,0x2c,0x02,0x2d,0x1b,0x56,0x8d,0x91,0x7a,0xc5,0x0a,0xe3,0xf6,0x6a,0x0d,0xaa,0xbc,0x39,0x05,0xb5,0x8f,0xf0,0xeb,0x18,0x74,0x87,0x34,0x1a,0x82,0x32,0x05,0x8b,0x25,0x7a,0xb9,0xe0,0x10,0x65,0xda,0x20,0x2e,0x55,0xbc,0x16,0x07,0xaf,0xb2,0xf7,0xdd,0xb1,0x73,0x13,0xc0,0xa9,0x66,0xb4,0x00,0xa6,0xca,0x40,0xaa,0xa2,0xe2,0x73,0xbe,0x61,0xb1,0x07,0xea,0xdc,0xb3,0xc3,0xd2,0xc2,0xd4,0xbd,0xdc,0xb7,0x5a,0x87,0xc6,0x02,0x3a,0x71,0x81,0x77,0x19,0xe8,0xf9,0xec,0x49,0xb7,0x94,0xc6,0x31,0x97,0x8b,0x71,0xc1,0x25,0xa1,0x7a,0xc1,0xe5,0xce,0xeb,0x60,0x26,0x54,0xf4,0x63,0x60,0x2c,0xd5,0x76,0xff,0x16,0x93,0xf1,0xee,0x06,0x97,0x02,0x44,0xef,0x07,0xf9,0x3d,0x87,0x22,0x68,0xed,0xae,0xc2,0x84,0x27,0x0b,0xaf,0x74,0x91,0xf3,0x4e,0x50,0xc9,0x66,0xe3,0x1d,0x56,0x2b,0xa6,0x04,0x18,0x7b,0x0b,0xeb,0xf5,0xd4,0xc8,0x88,0x93,0x32,0x09,0xbd,0x26,0xe8,0xb5,0x53,0x48,0x2e,0x74,0xdb,0x24,0xcc,0x6b,0x17,0x1e,0x7c,0x93,0x99,0xa9,0x78,0x0b,0x3f,0x5c,0xa6,0x99,0x25,0x76,0x9b,0x42,0xb3,0xb1,0x6c,0x03,0x16,0x31,0xda,0x21,0x3c,0x9e,0x76,0xf2,0x27,0x50,0x11,0x1b,0x45,0xec,0xba,0x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,0xe6,0x0a,0x9f,0xfb,0xb9,0xe6,0x79,0x15,0x3d,0x8d,0x05,0x41,0x1e,0x79,0x89,0x82,0x9f,0x8d,0x4b,0xe0,0x00,0xf2,0xc0,0xe7,0xa1,0x12,0x05,0x27,0x22,0x14,0xae,0xfc,0x7d,0x45,0x1d,0x34,0x4b,0x7f,0x57,0x4f,0x07,0xdb,0xab,0x67,0x6b,0x9e,0x49,0x77,0x62,0x57,0x9a,0x74,0x19,0x56,0xb4,0x1b,0xdf,0xa0,0xf2,0x59,0x80,0x4d,0x99,0x4c,0xa7,0x90,0x4f,0x35,0x17,0x17,0x24,0xb5,0x29,0xef,0x06,0x02,0x09,0xd4,0xce,0x95,0xe6,0xbf,0xc3,0xff,0x05,0x91,0xe0,0x98,0x27,0x64,0x50,0x84,0xde,0x9f,0x0b,0x15,0xe4,0x76,0x3f,0xe4,0x16,0x20,0x3e,0x39,0x72,0xc8,0x3d,0x61,0xa0,0xee,0x63,0x22,0x9f,0x2b,0xe7,0x31,0xe6,0x75,0x5b,0xe1,0xc8,0xc2,0x8c,0x04,0x6b,0x8b,0xc6,0x53,0xb7,0xb4,0x2c,0x07,0xab,0x33,0x3f,0xdd,0x40,0xa7,0xda,0x71,0x22,0x44,0xa5,0xe6,0xc2,0x4a,0xd1,0xaa,0x6e,0x76,0x34,0xab,0x4a,0xa8,0x21,0xc3,0x97,0xdc,0x2e,0xfb,0x66,0x78,0x72,0xea,0xba,0x8e,0x2c,0x48,0x35,0xc3,0xf0,0x5f,0xb0,0x39,0xcd,0x84,0xed,0x16,0x83,0xdb,0x63,0x01,0x75,0x79,0x51,0xe7,0xe0,0x07,0x29,0xa7,0xec,0xe3,0x31,0xad,0x4a,0x7d,0x0f,0xee,0x89,0xc0,0x56,0x4d,0xa1,0xc0,0x3c,0x88,0xee,0x03,0x05,0x7e,0x4b,0xea,0x93,0xa2,0xca,0xa7,0xaa,0x1b,0x35,0xe3,0x82,0x9f,0xaa,0x31,0x35,0x43,0x53,0xb8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,0x1a,0x0f,0x77,0x89,0x86,0x1b,0x99,0xbf,0x96,0x4c,0x42,0x7f,0x17,0x0b,0xdd,0xdf,0x40,0xbf,0x00,0x02,0xc9,0x23,0x16,0x0d,0x12,0x00,0x00
};
const char* apssid = "Mover";
int apChannel = 7;
const char* ssid = "ssid";
const char* password = "password";
using namespace websockets;
WebsocketsServer WSserver;
AsyncWebServer webserver(80);
Servo leftServo;
int leftPos = 0; // variable to store left servo position
Servo rightServo;
int rightPos = 0; // variable to store right servo position
void setup() {
Serial.begin(115200);
// Lolin: 16 and 17
leftServo.attach(16); // attaches the servo on pin 16 to the servo object
leftServo.write(leftPos);
rightServo.attach(17);
rightServo.write(rightPos);
// Start WiFi Client
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
// Wait for connection
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.print("IP address: ");
Serial.println(WiFi.localIP());
// Start AP
WiFi.softAP(apssid); //(gateway, "<notused>", 7, 1, 0) for hidden SSID.
Serial.println("AP started");
Serial.println("IP address: " + WiFi.softAPIP().toString());
webserver.on("/", HTTP_GET, [](AsyncWebServerRequest * request) {
AsyncWebServerResponse *response = request->beginResponse_P(200, "text/html", index_html_gz, sizeof(index_html_gz));
response->addHeader("Content-Encoding", "gzip");
request->send(response);
});
webserver.begin();
WSserver.listen(8084);
}
void handle_message(WebsocketsMessage msg) {
Serial.print("Message Received from web browser: ");
Serial.println(msg.data());
int commaIndex = msg.data().indexOf(',');
int steerValue = msg.data().substring(0, commaIndex).toInt();
int driveValue = msg.data().substring(commaIndex + 1).toInt();
Serial.print("Left: ");
Serial.println(steerValue);
Serial.print("Right: ");
Serial.println(driveValue);
////////////////////// Forward Movements ///////////////////////////
if (steerValue < 15 && steerValue > -15 && driveValue < -25) // Staigth forward movement.
{
rightServo.write(100);
leftServo.write(80);
Serial.println("Straight Forward");
} else if (steerValue > 15 && driveValue < -25) // Right Forward movement.
{
rightServo.write(80);
leftServo.write(80);
Serial.println("Right Forward");
} else if (steerValue < -15 && driveValue < -25) // Left Forward movement.
{
rightServo.write(100);
leftServo.write(100);
Serial.println("Left Forward");
///////////////////// Reverse Movements ////////////////////////////
} else if (steerValue > -15 && steerValue < 15 && driveValue > 25) // Staigth Reverse movement.
{
rightServo.write(80);
leftServo.write(100);
Serial.println("Straight Reverse");
} else if (steerValue > 15 && driveValue > 25) // Right reverse movement.
{
rightServo.write(100);
leftServo.write(100);
Serial.println("Right Reverse");
} else if (steerValue < -15 && driveValue > 25) // Left Reverse movement.
{
rightServo.write(80);
leftServo.write(80);
Serial.println("Left Reverse");
} else {
rightServo.write(90);
leftServo.write(90);
Serial.println("Idle");
}
/*
panServo.write(steerValue + 0);
tiltServo.write(driveValue - 30);
*/
}
void loop() {
auto client = WSserver.accept();
client.onMessage(handle_message);
while (client.available()) {
client.poll();
}
}
Thank you.
So simplefoc supports some stm32 boards: https://docs.simplefoc.com/microcontrollers
If you can work out how to flash your gd32 i suspect you could start to build your own firmware around simplefoc. It would be quite challenging but a great way to learn.
Problems you may face include:
If this all sounds too complicated a slightly less difficult approach might be to buy a new hoverboard mainboard that is known to work with a hoverboard firmware. Last time i looked they were about $20 on ebay.
Finally are you sure there are no firmwares for gd32? E.g this claims to support it https://github.com/EmanuelFeru/hoverboard-firmware-hack-FOC
Thank you for your feedback. I think it is complicated to use existing drivers. The firmware you linked is for old style driver boards where there is one main board and 2 sideboards.
@happytm - is there anything we can do to help you on this issue. Otherwise I'll close.
BTW: I've been using hoverboard motors with the STM g-b431g-esc1 board and it works reasonably well. Not quite powerful enough but OK for my use case
Thankyou for your support.
It has been 1 year since last comment. I wanted to see if there is solution to upload SimpleFOC now on to above mentioned board.
There is a thread on our forum where users are uploading to hoverboard drivers, and user @Candas has also developed a driver for some GD chips. Please check our forum for details.
@runger1101001 Thank you for your pointer.
Hi,
Several firmware were created in the past for hoverboard split boards (one controller for each motor). RoboDurden has forked one of the firmwares and is collecting pictures/pinouts about the different board layouts (there are many as you can see) to adapt the firmware via define.h files. I am sure he would be interested in those diagrams. I would suggest connect with him on that repo and check if you layout is covered. Unfortunately the gd32F130C6T6 chips don't have much memory so this could be a problem.
I worked on implementing drivers for gd32F130 so simplefoc could be used on those boards. Robodurden's intention is to create a new/better firmware for splitboards using SimpleFOC. It is still work in progress.
From my side I am concentrating on SimpleFOC as it will be beneficial to all the controllers.
Hey @Candas1 ,
I have couple of hoverboards with GD32E230C8T6 (LAYOUT TYPE 2.7). I checked your repo but this layout isnot supported yet.It will be appreciated if you add support for Layout type 2.7 boards.
Thanks.
Read my answer, and talk to Robodurden....
Thanks @Candas1 .
So you talked to him here, he shared a binary, and you haven't provided feedback ? What do you expect ?
I could not upload .bin file to hoverboard and then I saw this option here for possibly using SimpleFoc. I am more comfortable with Arduino.
Thanks.
I would like to control 2 hoverboard motors for a custom wheelchair project using web interface . I already have simple web interface for ESP32 microcontroller which is simple joystick which output 2 variables for reverse/forward & steering values based on joystick position. I know there are lot of hoverboard firmware available on github but none of them are suitable for my hoverboard hardware. It uses Half bridge drivers based on IR2103/FD2103 chips . Following links describe my hardware:
Hoverboard:
https://www.ebay.com/itm/Bluetooth-Hoverboard-Self-Balancing-Electric-Scooter-LED-UL2272-CE-no-Bag-Sports/353089292564?ssPageName=STRK%3AMEBIDX%3AIT&var=622283901145&_trksid=p2057872.m2749.l2649%5D
Schematic:
2.Mainboards_hoverboard_schematic.pdf
https://aidilj.com/2015/01/sensored-bldc-motor-control-with-arduino/
Is it possible to use your code with some modification to control these motors?
Thanks.