What you need:

Environment: Linux

  • VESC Driver
  • VESC Tool 0.95 (I have no idea where to get it…)
  • BLDC Motor
  • USB to mini USB

Connect

  1. Plug USB to your Linux computer, then plus mini USB to the VESC driver

  2. Plug in 24V battery into VESC driver

  3. Plug the BLDC Motor to VESC driver

  4. Open VSEC Tool 0.95

  5. Click Connect

Motor Setup Wizard

Motor Type

Choose FOC (Field Oriented Control)

What is FOC?

Set Current Limits

Motor

  • Motor Current Max 20.00A
  • Motor Max Brake = -20.00A

Battery

  • Battery Current Max = 20.00A
  • Batter Max Regen = -5.00A

Set Voltage Limits

Use Batter Cutoff Calculator.

  • Lithium Ion (full at 4.2V/cell)
  • Cells : 6

Remember to click Apply then they will calculate the cutoff for you.

Sensor Mode

No Sensor

FOC Settings

  1. Click on the RL icon. Some noises will come out from the motor. Don’t unplug anything unless you see smoke.
  2. Hold the motor handle carefully. (Make sure nothing is in the way ) then Click on the λ\lambda or (入) icon. The motor will spin up.
  3. Then You will see all the red stuff are now green. Click Apply.

To Test whether it is set correctly

  1. Go to Data Analysis -> Realtime Data
  2. Click on the 4 green icons on the right side
  3. Click ↑ to spin the motor (the motor will spin up very quick. Be careful ! )

Firmware

Build

Install this

1
2
3
sudo add-apt-repository ppa:team-gcc-arm-embedded/ppa
sudo apt update
sudo apt install gcc-arm-embedded

Choose your version

Official way (For Latest VESC Tool)

1
git clone https://github.com/vedderb/bldc.git

Sam Shum’ Version (For VESC Tool 0.95)

1
git clone https://github.com/supercrazysam/bldc_custom.git

Build the bin

cd into the folder you just git cloned

1
$ make build/VESC_text.bin -j4

What’s the meaning of “make -j” without a number

if build failed: use this to clean and then build the bin file again.

1
$ make clean

Note the bin file must start with VESC_ and it MUST be a bin file.

Then go to VESC Tool, Firmware -> Custom File

Put the VESC_*.bin and burn it.

WHILE BURNING FIRMWARE, WAIT 30 SECS and DO NOT TOUCH ANYTHING.

It is totally normal that you have to reconnect and reconfig the motor again.

If the version doesnt support…

Install Latest VESC Tool (You will need an account for that)

If you cant open Latest VESC Tool, Install libgles2-mesa

Chanage the firmware program (Optional)

Open bldc_custom/applications/app_custom.c

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#include "ch.h" // ChibiOS
#include "hal.h" // ChibiOS HAL
#include "mc_interface.h" // Motor control functions
#include "hw.h" // Pin mapping on this hardware
#include "timeout.h" // To reset the timeout
static volatile bool stop_now = true;
static volatile bool is_running = false;
// Example thread
static THD_FUNCTION(example_thread, arg);
static THD_WORKING_AREA(example_thread_wa, 2048); // 2kb stack for this thread

/*
void app_example_init(void) {
// Start the example thread
chThdCreateStatic(example_thread_wa, sizeof(example_thread_wa),
NORMALPRIO, example_thread, NULL);
}*/

void app_custom_start(void) {
stop_now = false;

palSetPadMode(HW_UART_TX_PORT, HW_UART_TX_PIN, PAL_MODE_INPUT_PULLDOWN); //SET TX as input
palSetPadMode(HW_UART_RX_PORT, HW_UART_RX_PIN, PAL_MODE_INPUT_PULLDOWN); //SET RX as input

chThdCreateStatic(example_thread_wa, sizeof(example_thread_wa), NORMALPRIO, example_thread, NULL);
}

void app_custom_stop(void) {
stop_now = true;
while (is_running) {
chThdSleepMilliseconds(1);
}
}

static THD_FUNCTION(example_thread, arg)
{
(void)arg;

chRegSetThreadName("APP_EXAMPLE");
is_running = true;
for(;;) {

if (stop_now)
{
is_running = false;
return;
}
/////////////////////////////////////////////////////// Make Changes here:

//mc_interface_set_pid_speed(pot * 10000.0);
//mc_interface_release_motor();
if (palReadPad(HW_UART_TX_PORT, HW_UART_TX_PIN))
{
mc_interface_set_pid_speed(600.0);
}
else if (palReadPad(HW_UART_RX_PORT, HW_UART_RX_PIN))
{
mc_interface_set_pid_speed(-600.0);
}
else
{
mc_interface_release_motor();
}


chThdSleepMilliseconds(3);
timeout_reset();
///////////////////////////////////////////////////////

// Reset the timeout


}

}

Burn the firmware again, then go to general setting

App to Use -> Custom User App

Then Click ↓A in the right side to run your command.

Recommended Video

PolyU Robocon Internal Use: VESC Control Series https://b23.tv/Qvr3mj