Motor Control
-
Timer1 for motor control (20kHz)Motor Control/BLDC 모터 제어 2025. 12. 2. 06:54
Timer1_Center Aligned mode1 (up counting)In Mode 1, the timer counter starts from zero and increments until it reaches the auto-reload value (ARR). When the counter matches the compare value (CCR), the output state is toggled. Fclk = 170MHzFpwm = 20kHzARR+1 = 4250 Generate a 20kHz switching frequency using TIM1 center-aligned mode. For center-aligned mode, the actual PWM frequency is ※ 참고자료Par..
-
Uart DMAMotor Control/BLDC 모터 제어 2025. 12. 2. 03:21
Setup the RCC and timer value. Usart with DMA will be used to reduce the CPU loads. ProsUsing DMA with UART2 allows long data transmissions to run in the background without blocking the CPU.UART DMA provides stable and reliable streaming, which is ideal for continuous debug logs and telemetry.Because UART has no strict timing requirements, DMA works smoothly and consistently without communica..
-
Hardware setup for BLDC FOC control with AS5600Motor Control/BLDC 모터 제어 2025. 12. 2. 02:57
Figure is the hardware setup for BLDC foc control. Main components areB-G431-ESC1BLDC motor: MAD 5005 280kV (discontinued)AS5600 magnetic sensor communicates through I2C to B-G431-ESC1Power supply: 12V 3ADevelopment software: STM32CubeIDE, Teraterm, Visual Studio Code
-
위치 센서 (AS5600)Motor Control/BLDC 모터 제어 2025. 12. 1. 02:11
AS5600의 현재 각도, 속도 연산static PositionSensor_t sensor; static 연산에 주의할 것. static으로 선언되어서 main()에서 PositionSensor_t sensor를 불러 올 수 없음. PositionSensor_t *PositionSensor_GetHandle(void) 함수를 main()에서 이용해야 함. static → internal linkage (only visible inside its own .c file)extern → external linkage (visible to other files) position_sensor.c #include "position_sensor.h"#include #include #define CPR_12BIT..
-
5. 유저 코드 작성 (Final Application Development)Motor Control/ST MCSDK 6.4.1 2025. 8. 12. 05:40
MC SDK의 소프트웨어 아키텍처는 아래 그림과 같다. 최적화를 위해서는 코드에 대해서 상세한 지식이 있어야겠지만, 우선은 ST에서 만들어진 코드를 Application 영역에서 잘 이용하기로 한다. SDK는 user interface 라이브러리, Motor control Cockpit, Motor control library로 구성되어 있다. 각각의 블럭은 Application 영역에서 가져다 사용할 수 있다. MC Cockpit은 3가지 영역으로 구성되어 있다. MC API는 User application을 작성하기 위한 시작점이다. MC Interface는 기본 function set을 작성할 수 있고, MC Tuning은 모터 제어를 튜닝할 수 있는 function으로 구성되어 있다. MC ..
-
4. 프로젝트 구성 (Project Configuration, CubeMX & IDE) 및 파라메터 튜닝Motor Control/ST MCSDK 6.4.1 2025. 8. 12. 05:38
Open loop으로 모터를 구동하기 위해서는 시간별 토크와 속도 값을 설정해주어야 한다.정렬 단계 (alignment): 아래 그림에서 녹색 박스는 ramp up 전에 회전자를 정렬하는 단계이다. 회전자를 정렬하기 위해서 Id가 상수 값으로 설정된다. 이때 속도는 0, 토크는 0 (Iq = 0)이다. 동작 시간은 1초로 설정되어 있는데, 시간은 모터의 구조에 따른다. 무게가 무거운 경우 더 많은 시간이 필요하다. Id의 마지막 ramp valu는 부하에 따른 모터의 nominal 전류의 0.5 ~ 1배로 설정한다. 램프업 단계: 컨트롤러는 전기 주파수를 0에서 특정 값으로 올린다. 토크 Iq는 고정된 값으로 설정된다. 속도는 시간에 따라서 선형적으로 증가한다. 속도의 마지막 값은 어플리케이션 최대 속도..
-
3. 시스템 구성 (System Configuration with MC Workbench)Motor Control/ST MCSDK 6.4.1 2025. 8. 12. 05:37
모터가 다르기 때문에 모터 블록을 클리한 후에 아래와 같이 MAD 5005 모터와 유사하게 변경하였다. 파라메터 박스 오른쪽 상단의 버튼을 클릭하면 파라메터 값을 변경이 가능하다. 변경 후에는 파라메터 오른쪽 상단에 X 표시가 되어 있다. Inertia와 Friction 값은 default 값을 이용하였다. Save 이후에, Generate the project를 실행하면 관련 코드가 C > Users > Users Name > .st_workbench > projects에 생성된다. 아래와 같이 FOC 코드와 6 step 코드가 생성되었다. FOC > STM32CubeIDE 폴터에서 .project 파일을 클릭하면 STM32CubeIDE에 해당 프로젝트가 생성된다. FOC 폴더를 클릭 후 build..
-
2. 모터 특성 파라메터 (Motor Characterization)Motor Control/ST MCSDK 6.4.1 2025. 8. 12. 05:36
모터 특성 파라메터를 확인하기 위해서는 모터 업체에서 발행한 데이터 시트를 확인하면 된다. 데이터 시트에는 내부 저항이 0.104ohm. 그런데 저렴한 테스터로 확인하니 1.4Ω 과 0.04mH. 고가의 장비만큼 정확하지 않겠지만 일단 적어본다. 아래 링크로 가면 모터 스펙이 있다. http://madcomponents.co/index.php/mad5005-280kv/ 역기전력은 손으로 모터를 돌려서 정확도는 떨어지겠지만, 일단 아래와 같이 측정되었다. 참고자료의 유투브 처럼하려면 모터를 돌릴 수 있는 커플링을 새로 설계해서 모터를 다른 모터로 돌려줘야한다. 위의 표를 이용해서 MC Workbench의 FOC Wizard에서 Motor 파라메터 값을 변경해준다. ※ 참고자료: 1. https://..