yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
MSPM0 Smart Robot Car📖
1.Quick Start Guide
  • 1. Assembly Videos
  • 2. Quick Start Videos
  • 3. Battery charging
  • 4. Notes
2.Introduction to the MSPM0 Car
  • 1.About MSPM0
  • 2.Development board interface description
3.Development environment setup and usage
  • 1.CCS Theia development
  • 2.MDK Arm development
  • 3.Uniflash burning
  • 4.External crystal oscillator configuration
  • 5.Project Migration
4.MSPM0 basic course
  • 1. LED light control (GPIO)
  • 2. Buzzer Control (GPIO)
  • 3. Button Control (EXTI)
  • 4. Serial Port (UART)
  • 5. Voltage Detection (ADC)
  • 6. Temperature Detection (ADC)
  • 7. Independent Watchdog (WWDG)
  • 8. Window Watchdog (WWDG)
  • 9. Timer (TIM)
  • 10. Breathing LED (PWM)
  • 11. I2C Communication (I2C)
  • 12. External Flash (SPI)
  • 13. Internal Flash (Flash)
  • 14. DMA
  • 15. FreeRTOS
5.Sensor basic course
  • 1.Servo control
  • 2.Ultrasonic servo PTZ basic use
  • 3.Motor PID control
  • 4.OLED display photosensitive value
  • 5.Infrared avoid sensor
  • 6.1 Infrared line tracking sensor-8 channel infrared tracking sensor module
  • 6.2 Infrared line tracking sensor-4 channel infrared tracking sensor module
  • 7.Infrared remote control
  • 8.Ultrasonic ranging
  • 9.RGB light drive
  • 10.MPU6050 raw data acquisition
  • 11.MPU6050 data fusion
  • 12.K210 vision recognition module
  • 13.K230 vision recognition module
6.Smart car course
  • 1.1 Car line tracking-8 channel infrared tracking sensor module
  • 1.2 Car line tracking-4 channel infrared tracking sensor module
  • 2.1 Drawing a circle-8 channel infrared tracking sensor module
  • 2.2 Drawing a circle-4 channel infrared tracking sensor module
  • 3.Ultrasonic following
  • 4.Ultrasonic avoid
  • 5.Ultrasonic avoid(Servo PTZ)
  • 6.Infrared sensor avoid
  • 7.Light following
  • 8.Gyroscope calibration straight-line walk
  • 9.Infrared remote control
  • 10.Autonomous driving car
7.Vision application course
  • 1.K210 autonomous driving
  • 2.K210 color tracking
  • 3.K210 handwritten digit action
  • 4.K210 color response
  • 5.K210 road sign indication action
  • 6.K210 following machine code
  • 7.K210 QR code command
  • 8.K230 vision line tracking
  • 9.K230 color tracking
  • 10.K230 machine code tracking
  • 11.K230 QR code command
  • 12.K230 autonomous avoid
  • 13.K230 license plate tracking
  • 14.K230 face tracking
  • 15.K230 gaze direction tracking
  • 16.K230 palm tracking
  • 17.K230 target tracking
  • 18.K230 human body tracking
  • 19.K230 OCR character recognition
8.Extended application course (Sold separately)
  • 1.Voice interaction module communication
  • 2.Voice interaction control
  • 3.K230 road sign indication action(Voice)
  • 4.K230 color response(Voice)
  • 5.K230 gesture control(Voice)
  • 6.K230 rock-paper-scissors(Voice)
  • 7.8-channel grayscale color line tracking
  • 8.Bluetooth remote control
  • 9.K210 Scenario-based autonomous driving
  • 10.K230 Scenario-based autonomous driving
Download
  • Code
  • SCH
  • 3D Model File
  • MSPM0 Data Sheet
  • Voice firmware
  • Hardware interface manual
Download ZIP

Welcome to MSPM0 Smart Robot Car repository

1.Servo control

Servo Control

Servo Control1. Software and Hardware2. Basic Principles2.1 Hardware Schematic2.2 Physical Connection Diagram2.3 Control Principle3. Project Experience3.1 Opening the Project4. Main Functions4.1 User Functions5. Experimental Phenomenon

This tutorial demonstrates: controlling a servo connected to the S1 interface on the development board through timer interrupt simulated PWM.

The first tutorial in this chapter will be more detailed than subsequent tutorials, with the purpose of demonstrating the complete process from creating a new project to achieving the final effect

1. Software and Hardware

  • KEIL

  • MSPM0G3507 Development Board

  • 180° Servo

  • Type-C data cable or DAP-Link

    For programming download or simulation to the development board

2. Basic Principles

2.1 Hardware Schematic

upscalemedia-transformed (19)

image-20251107115445884

2.2 Physical Connection Diagram

未命名的设计 (28)

Note: For servo wiring, refer to the servo wire colors. This experiment requires connecting 5V and the choose jumper cap

If using our 20k/25kg servo, you need to connect VM and choose to ensure proper operation.

ServoDevelopment Board
VCC(Red)5V
SIG(Yellow)S1/S2
GND(Brown)GND

2.3 Control Principle

Control the servo rotation angle by changing the duty cycle of the PWM signal

  • PWM (Pulse Width Modulation)

PWM is the abbreviation for Pulse Width Modulation, a technique that controls levels by adjusting the pulse width of signals.

Period: The duration of one complete PWM waveform;

Duty Cycle: The ratio of high-level duration to the total period time;

Frequency: The reciprocal of the period is called frequency, i.e., the number of PWM cycles generated per second;

  • PWM Servo

Set the PWM control signal period to 20ms, i.e., 50Hz frequency; the high-level time of the pulse determines the servo rotation angle

image-20231016153546154

 

Common angles and corresponding high-level pulse widths

Servo (180°)High-level Pulse Width (us)
0°500
45°1000
90°1500
135°2000
180°2500
  • Basic Timer

Using the TimerA timer interrupt function on the MSPM0G3507 development board

PWM Servo (Schematic Name)Control PinFunction
S1PA28Simulated PWM output to control S1 servo
S2PA7Simulated PWM output to control S2

3. Project Experience

Use the project files we provide to directly experience the corresponding functions of the development board.

Later tutorials will not provide this content to avoid repetition. You can refer to 【3. Development Environment Setup and Usage: 5. Project Porting】 for operations

3.1 Opening the Project

  • Project File Location

    Project file path: Under the corresponding course folder in the 【Program Source Code Summary】 folder

image-20251011122010206

  • Opening the Project File

    Copy the project file to the msp_sdk directory under an English path, use KEIL5 to open the project file, and select the .project file when opening

image-20251011122629108

 

  • Pin Configuration

    image-20251105183516437

    image-20251105183337863

    image-20251105183444811

     

4. Main Functions

Mainly introduces the functional code written by users. For detailed code, you can open the project files we provide and view the source code in the Bsp folder.

4.1 User Functions

Function: servo_init

Function Prototypevoid servo_init(void)
Function DescriptionInitialize timer simulated PWM signal output
Input ParametersNone
Output ParametersNone

Function: Set_Servo270_Angle

Function Prototypevoid Set_Servo270_Angle(unsigned int angle)
Function DescriptionControl 270-degree servo rotation
Input Parametersangle: rotation angle
Output ParametersNone

Function: Set_Servo_Angle

Function Prototypevoid Set_Servo_Angle(unsigned int angle)
Function DescriptionControl 180-degree servo rotation
Input Parametersangle: rotation angle
Output ParametersNone

Function: get_servo

Function Prototypevoid get_servo ()
Function DescriptionControl servo to rotate from 0° then sequentially 0°,90°,180°,90°,0° back and forth
Input ParametersNone
Output ParametersNone

5. Experimental Phenomenon

After successfully downloading the program, press the RESET button on the development board and observe the phenomenon!

xxxxxxxxxx
For program download, refer to 【3. Development Environment Setup and Usage: 3. Uniflash burning】

Phenomenon:

S1 Interface Servo: Rotates cyclically from 0°→ 90° →180° → 90° → 0°.

The provided project only controls the S1 interface servo. To control other servos, you can modify the interface function parameters yourself
FreeRTOS
Ultrasonic servo PTZ basic use

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文