Skip to content

Instantly share code, notes, and snippets.

@makevoid
Last active October 25, 2017 03:44
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save makevoid/36da9aa49a575c4bab9bd83adae5a590 to your computer and use it in GitHub Desktop.
Save makevoid/36da9aa49a575c4bab9bd83adae5a590 to your computer and use it in GitHub Desktop.
VESC 6 - 8S5P - Single Motor 6374 190KV - FOC - default settings

Single motor 6374 190KV FOC Vesc config (via auto detection) 10S8P li-ion w/ BMS (1y low usage)

I followed the wizard and used the default FOC detection settings, I just modified the current limits (motor/battery) + PPM settings obviously. I haven't changed (played with) any custom FOC setting yet as the default one seem to be good enough.

DATA

Rider Weight ~100kg

Top Speed: 40 km/h (23 mph) when fully charged

Vesc Max Temp: ~60 deg C

Efficiency / Max Range: TODO

Conservative Settings (initial/test settings)

# Motor

Motor Current Max         60 A
Motor Current Max Brake  -60 A
Absolute Maximum Current 150 A
Slow ABS Current Limit    true


# Battery

Battery Current Max        40 A 
Battery Current Max Regen -20 A

Current Settings

not tested yet but my guess is I can go over 90A motor max

# Motor

Motor Current Max          90 A
Motor Current Max Brake   -65 A
Absolute Maximum Current  150 A
Slow ABS Current Limit    true


# Battery

Battery Current Max        45 A 
Battery Current Max Regen -30 A

Pics

VESC Tool configs screenshots

FOC

{
"MCConfiguration": {
"foc_duty_dowmramp_ki": "200",
"motor_quality_construction": "0",
"foc_openloop_rpm": "400",
"foc_duty_dowmramp_kp": "10",
"sensor_mode": "0",
"l_watt_max": "15000",
"s_pid_min_erpm": "900",
"foc_current_ki": "50",
"hall_table_0": "-1",
"hall_table_1": "1",
"motor_quality_magnets": "0",
"hall_table_2": "3",
"m_bldc_f_sw_max": "40000",
"hall_table_3": "2",
"l_min_duty": "0.005",
"hall_table_4": "5",
"cc_min_current": "0.1",
"foc_f_sw": "20000",
"hall_table_5": "6",
"foc_current_kp": "0.03",
"hall_table_6": "4",
"m_drv8301_oc_adj": "16",
"l_erpm_start": "0.8",
"hall_table_7": "-1",
"l_in_current_max": "60",
"sl_phase_advance_at_br": "0.8",
"foc_sl_erpm": "2500",
"m_invert_direction": "0",
"l_battery_cut_end": "8",
"foc_observer_gain": "9e+7",
"motor_brand": "Unnamed",
"foc_sl_openloop_hyst": "0.1",
"l_max_duty": "0.95",
"l_abs_current_max": "130",
"l_battery_cut_start": "10",
"p_pid_ang_div": "1",
"foc_encoder_inverted": "0",
"m_current_backoff_gain": "0.5",
"motor_weight": "0",
"foc_sl_openloop_time": "0.1",
"l_max_erpm_fbrake": "300",
"foc_dt_us": "0.08",
"foc_sat_comp": "0",
"l_max_vin": "57",
"motor_quality_description": "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">
<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">
p, li { white-space: pre-wrap; }
</style></head><body style=\" font-family:'Sans Serif'; font-size:11pt; font-weight:400; font-style:normal;\">
<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">Some comments about the motor quality. Images can be added as well.</p></body></html>",
"l_max_erpm_fbrake_cc": "1500",
"m_duty_ramp_step": "0.02",
"foc_motor_l": "7e-6",
"foc_sample_v0_v7": "1",
"foc_sensor_mode": "0",
"foc_motor_r": "0.015",
"l_current_min": "-60",
"motor_quality_bearings": "0",
"motor_type": "0",
"motor_model": "Not Specified",
"cc_ramp_step_max": "0.04",
"motor_description": "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">
<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">
p, li { white-space: pre-wrap; }
</style></head><body style=\" font-family:'Sans Serif'; font-size:11pt; font-weight:400; font-style:normal;\">
<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\">A motor description can be edited here.</p></body></html>",
"cc_gain": "0.0046",
"l_min_erpm": "-100000",
"foc_observer_gain_slow": "0.2",
"sl_bemf_coupling_k": "600",
"comm_mode": "0",
"m_encoder_counts": "8192",
"motor_poles": "14",
"pwm_mode": "1",
"p_pid_kd": "0.0004",
"l_max_erpm": "100000",
"foc_sl_d_current_duty": "0",
"foc_hall_table_0": "-1",
"foc_hall_table_1": "-1",
"l_min_vin": "8",
"l_current_max": "60",
"p_pid_ki": "0",
"cc_startup_boost_duty": "0.01",
"foc_hall_table_2": "-1",
"l_temp_motor_end": "100",
"sl_cycle_int_rpm_br": "80000",
"foc_hall_table_3": "-1",
"foc_hall_table_4": "-1",
"foc_hall_table_5": "-1",
"foc_hall_table_6": "-1",
"m_drv8301_oc_mode": "0",
"l_temp_motor_start": "80",
"foc_hall_table_7": "-1",
"l_slow_abs_current": "1",
"p_pid_kp": "0.03",
"foc_motor_flux_linkage": "0.00245",
"foc_sl_d_current_factor": "0",
"sl_min_erpm": "150",
"foc_encoder_offset": "180",
"m_sensor_port_mode": "0",
"m_fault_stop_time_ms": "3000",
"sl_min_erpm_cycle_int_limit": "1100",
"foc_encoder_ratio": "7",
"l_temp_fet_start": "80",
"sl_cycle_int_limit": "62",
"motor_sensor_type": "0",
"foc_temp_comp_base_temp": "25",
"m_dc_f_sw": "35000",
"s_pid_kd": "0.0001",
"s_pid_allow_braking": "1",
"foc_pll_ki": "40000",
"l_watt_min": "-15000",
"s_pid_ki": "0.004",
"foc_temp_comp": "0",
"motor_loss_torque": "0.03",
"foc_pll_kp": "2000",
"s_pid_kp": "0.004",
"m_bldc_f_sw_min": "3000",
"l_temp_fet_end": "100",
"sl_max_fullbreak_current_dir_change": "10",
"l_in_current_min": "-20",
"hall_sl_erpm": "2000"
}
}
<?xml version="1.0" encoding="UTF-8"?>
<MCConfiguration>
<foc_duty_dowmramp_ki>200</foc_duty_dowmramp_ki>
<motor_quality_construction>0</motor_quality_construction>
<foc_openloop_rpm>400</foc_openloop_rpm>
<foc_duty_dowmramp_kp>10</foc_duty_dowmramp_kp>
<sensor_mode>0</sensor_mode>
<l_watt_max>15000</l_watt_max>
<s_pid_min_erpm>900</s_pid_min_erpm>
<foc_current_ki>50</foc_current_ki>
<hall_table_0>-1</hall_table_0>
<hall_table_1>1</hall_table_1>
<motor_quality_magnets>0</motor_quality_magnets>
<hall_table_2>3</hall_table_2>
<m_bldc_f_sw_max>40000</m_bldc_f_sw_max>
<hall_table_3>2</hall_table_3>
<l_min_duty>0.005</l_min_duty>
<hall_table_4>5</hall_table_4>
<cc_min_current>0.1</cc_min_current>
<foc_f_sw>20000</foc_f_sw>
<hall_table_5>6</hall_table_5>
<foc_current_kp>0.03</foc_current_kp>
<hall_table_6>4</hall_table_6>
<m_drv8301_oc_adj>16</m_drv8301_oc_adj>
<l_erpm_start>0.8</l_erpm_start>
<hall_table_7>-1</hall_table_7>
<l_in_current_max>60</l_in_current_max>
<sl_phase_advance_at_br>0.8</sl_phase_advance_at_br>
<foc_sl_erpm>2500</foc_sl_erpm>
<m_invert_direction>0</m_invert_direction>
<l_battery_cut_end>8</l_battery_cut_end>
<foc_observer_gain>9e+7</foc_observer_gain>
<motor_brand>Unnamed</motor_brand>
<foc_sl_openloop_hyst>0.1</foc_sl_openloop_hyst>
<l_max_duty>0.95</l_max_duty>
<l_abs_current_max>130</l_abs_current_max>
<l_battery_cut_start>10</l_battery_cut_start>
<p_pid_ang_div>1</p_pid_ang_div>
<foc_encoder_inverted>0</foc_encoder_inverted>
<m_current_backoff_gain>0.5</m_current_backoff_gain>
<motor_weight>0</motor_weight>
<foc_sl_openloop_time>0.1</foc_sl_openloop_time>
<l_max_erpm_fbrake>300</l_max_erpm_fbrake>
<foc_dt_us>0.08</foc_dt_us>
<foc_sat_comp>0</foc_sat_comp>
<l_max_vin>57</l_max_vin>
<motor_quality_description>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Some comments about the motor quality. Images can be added as well.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</motor_quality_description>
<l_max_erpm_fbrake_cc>1500</l_max_erpm_fbrake_cc>
<m_duty_ramp_step>0.02</m_duty_ramp_step>
<foc_motor_l>7e-6</foc_motor_l>
<foc_sample_v0_v7>1</foc_sample_v0_v7>
<foc_sensor_mode>0</foc_sensor_mode>
<foc_motor_r>0.015</foc_motor_r>
<l_current_min>-60</l_current_min>
<motor_quality_bearings>0</motor_quality_bearings>
<motor_type>0</motor_type>
<motor_model>Not Specified</motor_model>
<cc_ramp_step_max>0.04</cc_ramp_step_max>
<motor_description>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;A motor description can be edited here.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</motor_description>
<cc_gain>0.0046</cc_gain>
<l_min_erpm>-100000</l_min_erpm>
<foc_observer_gain_slow>0.2</foc_observer_gain_slow>
<sl_bemf_coupling_k>600</sl_bemf_coupling_k>
<comm_mode>0</comm_mode>
<m_encoder_counts>8192</m_encoder_counts>
<motor_poles>14</motor_poles>
<pwm_mode>1</pwm_mode>
<p_pid_kd>0.0004</p_pid_kd>
<l_max_erpm>100000</l_max_erpm>
<foc_sl_d_current_duty>0</foc_sl_d_current_duty>
<foc_hall_table_0>-1</foc_hall_table_0>
<foc_hall_table_1>-1</foc_hall_table_1>
<l_min_vin>8</l_min_vin>
<l_current_max>60</l_current_max>
<p_pid_ki>0</p_pid_ki>
<cc_startup_boost_duty>0.01</cc_startup_boost_duty>
<foc_hall_table_2>-1</foc_hall_table_2>
<l_temp_motor_end>100</l_temp_motor_end>
<sl_cycle_int_rpm_br>80000</sl_cycle_int_rpm_br>
<foc_hall_table_3>-1</foc_hall_table_3>
<foc_hall_table_4>-1</foc_hall_table_4>
<foc_hall_table_5>-1</foc_hall_table_5>
<foc_hall_table_6>-1</foc_hall_table_6>
<m_drv8301_oc_mode>0</m_drv8301_oc_mode>
<l_temp_motor_start>80</l_temp_motor_start>
<foc_hall_table_7>-1</foc_hall_table_7>
<l_slow_abs_current>1</l_slow_abs_current>
<p_pid_kp>0.03</p_pid_kp>
<foc_motor_flux_linkage>0.00245</foc_motor_flux_linkage>
<foc_sl_d_current_factor>0</foc_sl_d_current_factor>
<sl_min_erpm>150</sl_min_erpm>
<foc_encoder_offset>180</foc_encoder_offset>
<m_sensor_port_mode>0</m_sensor_port_mode>
<m_fault_stop_time_ms>3000</m_fault_stop_time_ms>
<sl_min_erpm_cycle_int_limit>1100</sl_min_erpm_cycle_int_limit>
<foc_encoder_ratio>7</foc_encoder_ratio>
<l_temp_fet_start>80</l_temp_fet_start>
<sl_cycle_int_limit>62</sl_cycle_int_limit>
<motor_sensor_type>0</motor_sensor_type>
<foc_temp_comp_base_temp>25</foc_temp_comp_base_temp>
<m_dc_f_sw>35000</m_dc_f_sw>
<s_pid_kd>0.0001</s_pid_kd>
<s_pid_allow_braking>1</s_pid_allow_braking>
<foc_pll_ki>40000</foc_pll_ki>
<l_watt_min>-15000</l_watt_min>
<s_pid_ki>0.004</s_pid_ki>
<foc_temp_comp>0</foc_temp_comp>
<motor_loss_torque>0.03</motor_loss_torque>
<foc_pll_kp>2000</foc_pll_kp>
<s_pid_kp>0.004</s_pid_kp>
<m_bldc_f_sw_min>3000</m_bldc_f_sw_min>
<l_temp_fet_end>100</l_temp_fet_end>
<sl_max_fullbreak_current_dir_change>10</sl_max_fullbreak_current_dir_change>
<l_in_current_min>-20</l_in_current_min>
<hall_sl_erpm>2000</hall_sl_erpm>
</MCConfiguration>
<?xml version="1.0" encoding="UTF-8"?>
<MCConfiguration>
<l_min_vin>8</l_min_vin>
<foc_encoder_inverted>0</foc_encoder_inverted>
<foc_sl_openloop_time>0.1</foc_sl_openloop_time>
<foc_observer_gain_slow>0.3</foc_observer_gain_slow>
<m_sensor_port_mode>0</m_sensor_port_mode>
<l_max_erpm_fbrake_cc>1500</l_max_erpm_fbrake_cc>
<l_min_erpm>-100000</l_min_erpm>
<s_pid_kd>0.0001</s_pid_kd>
<m_drv8301_oc_adj>16</m_drv8301_oc_adj>
<l_in_current_max>45</l_in_current_max>
<foc_sensor_mode>0</foc_sensor_mode>
<s_pid_allow_braking>1</s_pid_allow_braking>
<motor_quality_bearings>0</motor_quality_bearings>
<motor_quality_description>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;Some comments about the motor quality. Images can be added as well.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</motor_quality_description>
<s_pid_ki>0.004</s_pid_ki>
<foc_encoder_offset>180</foc_encoder_offset>
<cc_startup_boost_duty>0.01</cc_startup_boost_duty>
<motor_description>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Sans Serif'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;A motor description can be edited here.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</motor_description>
<motor_type>2</motor_type>
<l_temp_fet_end>100</l_temp_fet_end>
<sensor_mode>0</sensor_mode>
<s_pid_kp>0.004</s_pid_kp>
<foc_sl_d_current_duty>0</foc_sl_d_current_duty>
<sl_cycle_int_limit>62</sl_cycle_int_limit>
<foc_temp_comp>0</foc_temp_comp>
<l_max_erpm>100000</l_max_erpm>
<s_pid_min_erpm>900</s_pid_min_erpm>
<m_dc_f_sw>35000</m_dc_f_sw>
<foc_current_ki>12.56</foc_current_ki>
<foc_sl_erpm>2500</foc_sl_erpm>
<cc_ramp_step_max>0.04</cc_ramp_step_max>
<m_duty_ramp_step>0.02</m_duty_ramp_step>
<m_drv8301_oc_mode>0</m_drv8301_oc_mode>
<foc_sample_v0_v7>1</foc_sample_v0_v7>
<motor_brand>Unnamed</motor_brand>
<cc_min_current>0.1</cc_min_current>
<foc_current_kp>0.0078</foc_current_kp>
<foc_motor_flux_linkage>0.003917</foc_motor_flux_linkage>
<foc_f_sw>20000</foc_f_sw>
<sl_max_fullbreak_current_dir_change>10</sl_max_fullbreak_current_dir_change>
<m_encoder_counts>8192</m_encoder_counts>
<motor_sensor_type>0</motor_sensor_type>
<l_battery_cut_start>24.8</l_battery_cut_start>
<p_pid_ang_div>1</p_pid_ang_div>
<foc_motor_l>7.8e-6</foc_motor_l>
<foc_hall_table_0>255</foc_hall_table_0>
<foc_motor_r>0.0126</foc_motor_r>
<foc_hall_table_1>255</foc_hall_table_1>
<foc_encoder_ratio>7</foc_encoder_ratio>
<foc_hall_table_2>255</foc_hall_table_2>
<l_temp_motor_end>100</l_temp_motor_end>
<foc_hall_table_3>255</foc_hall_table_3>
<motor_loss_torque>0.03</motor_loss_torque>
<foc_pll_ki>40000</foc_pll_ki>
<foc_hall_table_4>255</foc_hall_table_4>
<l_watt_min>-15000</l_watt_min>
<foc_hall_table_5>255</foc_hall_table_5>
<foc_hall_table_6>255</foc_hall_table_6>
<m_fault_stop_time_ms>1000</m_fault_stop_time_ms>
<foc_hall_table_7>255</foc_hall_table_7>
<motor_model>Not Specified</motor_model>
<m_invert_direction>0</m_invert_direction>
<foc_sl_d_current_factor>0</foc_sl_d_current_factor>
<foc_pll_kp>2000</foc_pll_kp>
<m_bldc_f_sw_min>3000</m_bldc_f_sw_min>
<motor_poles>14</motor_poles>
<foc_duty_dowmramp_ki>200</foc_duty_dowmramp_ki>
<cc_gain>0.0046</cc_gain>
<l_min_duty>0.005</l_min_duty>
<foc_dt_us>0.08</foc_dt_us>
<l_temp_fet_start>80</l_temp_fet_start>
<sl_phase_advance_at_br>0.8</sl_phase_advance_at_br>
<l_max_vin>57</l_max_vin>
<motor_quality_magnets>0</motor_quality_magnets>
<foc_temp_comp_base_temp>25</foc_temp_comp_base_temp>
<l_watt_max>15000</l_watt_max>
<foc_duty_dowmramp_kp>10</foc_duty_dowmramp_kp>
<sl_min_erpm_cycle_int_limit>1100</sl_min_erpm_cycle_int_limit>
<l_current_min>-65</l_current_min>
<m_bldc_f_sw_max>40000</m_bldc_f_sw_max>
<sl_min_erpm>150</sl_min_erpm>
<hall_sl_erpm>2000</hall_sl_erpm>
<l_battery_cut_end>23.2</l_battery_cut_end>
<foc_observer_gain>6.518e+7</foc_observer_gain>
<motor_quality_construction>0</motor_quality_construction>
<l_erpm_start>0.8</l_erpm_start>
<l_abs_current_max>150</l_abs_current_max>
<l_max_duty>0.95</l_max_duty>
<m_current_backoff_gain>0.5</m_current_backoff_gain>
<l_in_current_min>-40</l_in_current_min>
<pwm_mode>1</pwm_mode>
<p_pid_kd>0.0004</p_pid_kd>
<sl_bemf_coupling_k>600</sl_bemf_coupling_k>
<l_max_erpm_fbrake>300</l_max_erpm_fbrake>
<hall_table_0>-1</hall_table_0>
<hall_table_1>1</hall_table_1>
<p_pid_ki>0</p_pid_ki>
<hall_table_2>3</hall_table_2>
<l_temp_motor_start>80</l_temp_motor_start>
<foc_openloop_rpm>400</foc_openloop_rpm>
<hall_table_3>2</hall_table_3>
<comm_mode>0</comm_mode>
<l_slow_abs_current>1</l_slow_abs_current>
<l_current_max>90</l_current_max>
<hall_table_4>5</hall_table_4>
<motor_weight>0</motor_weight>
<hall_table_5>6</hall_table_5>
<sl_cycle_int_rpm_br>80000</sl_cycle_int_rpm_br>
<hall_table_6>4</hall_table_6>
<hall_table_7>-1</hall_table_7>
<p_pid_kp>0.03</p_pid_kp>
<foc_sat_comp>0</foc_sat_comp>
<foc_sl_openloop_hyst>0.1</foc_sl_openloop_hyst>
</MCConfiguration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment