cancel
Showing results for 
Search instead for 
Did you mean: 

what is the PWM output voltage that is required to rotate the BLDC motor(A2212/10T 1400kv)?

VTOL_Aviations
Associate II

I'm trying to rotate the BLDC using PWM(50% duty cyle, 2ms pwm time period). My timer initialization code:

static void MX_TIM2_Init(void)
{
 
  /* USER CODE BEGIN TIM2_Init 0 */
 
  /* USER CODE END TIM2_Init 0 */
 
  TIM_MasterConfigTypeDef sMasterConfig = {0};
  TIM_OC_InitTypeDef sConfigOC = {0};
 
  /* USER CODE BEGIN TIM2_Init 1 */
 
  /* USER CODE END TIM2_Init 1 */
  htim2.Instance = TIM2;
  htim2.Init.Prescaler = 63;    //Timer tick frequency is 250KHz
  htim2.Init.CounterMode = TIM_COUNTERMODE_UP;
  htim2.Init.Period =499;       //PWM_Frequency is 500Hz
  htim2.Init.ClockDivision = TIM_CLOCKDIVISION_DIV1;
  if (HAL_TIM_PWM_Init(&htim2) != HAL_OK)
  {
    Error_Handler();
  }
  sMasterConfig.MasterOutputTrigger = TIM_TRGO_RESET;
  sMasterConfig.MasterSlaveMode = TIM_MASTERSLAVEMODE_DISABLE;
  if (HAL_TIMEx_MasterConfigSynchronization(&htim2, &sMasterConfig) != HAL_OK)
  {
    Error_Handler();
  }
  sConfigOC.OCMode = TIM_OCMODE_PWM1;
  sConfigOC.Pulse = 249;          //Duty cycle - 50%
 
  sConfigOC.OCPolarity = TIM_OCPOLARITY_HIGH;
  sConfigOC.OCFastMode = TIM_OCFAST_DISABLE;
  if (HAL_TIM_PWM_ConfigChannel(&htim2, &sConfigOC, TIM_CHANNEL_2) != HAL_OK)
  {
    Error_Handler();
  }
  /* USER CODE BEGIN TIM2_Init 2 */
 
  /* USER CODE END TIM2_Init 2 */
  HAL_TIM_MspPostInit(&htim2);
 
}

I've checked the pwm output in logic analyzer. The desired duty cycle and time period are coming exactly. But when I measured the pwm voltage it was showing 0.80V. Is it sufficient to rotate the motor?

I've checked the pwm voltage in arduino(same motor, duty cycle and time period). The motor was rotating and the output voltage is 2.6V.

I'm attaching some more code for reference.

void SystemClock_Config(void)
{
  RCC_OscInitTypeDef RCC_OscInitStruct = {0};
  RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
 
  /**Configure the main internal regulator output voltage 
  */
  __HAL_RCC_PWR_CLK_ENABLE();
  __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
  /**Initializes the CPU, AHB and APB busses clocks 
  */
  RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI;
  RCC_OscInitStruct.HSIState = RCC_HSI_ON;
  RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
  RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
  if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
  {
    Error_Handler();
  }
  /**Initializes the CPU, AHB and APB busses clocks 
  */
  RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
                              |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
  RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_HSI;
  RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;
 
  if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK)
  {
    Error_Handler();
  }
}
int main(void)
{
 
 
  HAL_Init();
  SystemClock_Config();
  MX_GPIO_Init();
  MX_TIM2_Init();
  
	HAL_TIM_PWM_Start(&htim2,TIM_CHANNEL_2);
        while (1)
        {
        }
 
}

0690X000008B7QaQAK.png

8 REPLIES 8

Hi.

2ms period (500 Hz) and 50% duty cycle means pulse width =1ms.

With 1ms PW the motor speed will be zero. PW=1ms-> zero speed, PW=2ms->Max speed.

But i am not sure that ordinary commercial ESCs could be driven at 500 HZ.

Most ESCs are capable 3.3v input also 5v input without problems

Hi,

But i am not sure that ordinary commercial ESCs could be driven at 500 HZ.

Should it be greater than or less than 500Hz? Anyways I've tried with 1000Hz i.e. 1ms PWM time period and 100% duty cycle. It rotated. However, it was not working for other duty cycles. Why?

With 1ms PW the motor speed will be zero. PW=1ms-> zero speed, PW=2ms->Max speed.

How did you calculate that? please let me know.

-Aditya

"How did you calculate that? please let me know."

This is the standard specification for PWM driven servos and ESCs

As a consequence PWM freq can't be more than 500 HZ (duty cycle about 100%)

Old servos work with 50 HZ freq, just check the specs of servo.

For ESCs, max_freq <500Hz. and minimum freq is 50Hz or lower.

Typical freq of 300HZ for an ordinary ESC works ok.

Try 300 HZ freq (3.3ms period) . The pulse width is 1ms(30%duty cycle) for idle speed and 2ms(60% duty cycle) for full speed.

First of all read the specs of ESC. There are ESCs with different specifications than standard eg pulse width for idle =0% and pulse width for full speed 100%.

Sure. And thank you. I'll try those things that you've mentioned

I've tried with 300Hz, 30% and 60% duty cycle. The motor didn't rotate. My ESC controller is this: https://robu.in/product/30a-bldc-esc-electronic-speed-controller/ . Is there any useful information in it?

Hi

It seems that ESCs firmware may not support f > 50 HZ ..

This link contains useful info about this ESC. Take a look , especially at "Advice" tab

Thank you. Will look into it.