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

4.OLED display photosensitive value

OLED Display Photosensitive Value

OLED Display Photosensitive Value1. Software and Hardware2. Basic Principles2.1 Hardware Schematic2.2 Control Principle1. Resolution2. Sampling Rate3. Voltage Reference4. Sampling Range3. Project Configuration3.1 Description3.2 Pin Configuration4. Main Functions5. Experimental Phenomenon

1. Software and Hardware

  • KEIL

  • MSPM0G3507 Development Board

  • 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 (24)

Physical Connection

未命名的设计 (37)

2.2 Control Principle

ADC (analog to digital converter) is a device used to convert analog signals (such as voltage) into digital signals. Analog signals change continuously, while digital signals are discrete binary numbers. ADC converts analog signals into digital data through sampling and quantization so that processors or microcontrollers can perform subsequent processing. According to their conversion principles, they are mainly divided into three types: successive approximation type, dual-slope integration type, and voltage-frequency conversion type.

MSPM0G3507 uses a successive approximation (SAR) ADC, which is a common ADC working principle. Its basic idea is to gradually approach the digital representation of the input signal by comparing the magnitude relationship between the analog signal and the reference voltage. In successive approximation ADCs, the input signal and reference voltage are compared through a differential amplifier to produce a differential voltage. Then, this differential voltage is input to a successive approximation digital quantizer, which gradually compares it with a series of reference voltages. At each approximation stage, the quantizer compares the input signal with an intermediate voltage point and selects a higher or lower reference voltage as the reference for the next approximation stage based on the comparison result. This process continues until the quantizer finally approaches a digital output value.

A/D conversion of various channels can be configured in single, sequence conversion modes.

Single Conversion Mode: After each ADC conversion, the ADC automatically stops and stores the result in the ADC data register.

Repeated Single Conversion Mode: When the ADC completes one conversion, it automatically starts another conversion, continuously performing conversions until stopped by external trigger or software trigger.

Multi-channel Sequential Single Conversion Mode: Used to sequentially convert multiple input channels. In this mode, the ADC performs single sampling and conversion on multiple channels according to the configured channel acquisition sequence.

Multi-channel Sequential Repeated Conversion Mode: Used to sequentially and repeatedly convert multiple input channels. In this mode, the ADC repeatedly samples and converts multiple channels according to the configured channel acquisition sequence.

This case uses ADC to collect the voltage of the photosensitive resistor pin and then calculates the resistance value of the photosensitive resistor.

ADC Basic Parameters

1. Resolution

  • Resolution represents the precision of the ADC converter output, usually measured in bits (bit), such as 8-bit, 10-bit, 12-bit, etc. The higher the resolution, the more discrete digital values the ADC can represent, thus providing higher precision.

2. Sampling Rate

  • Sampling rate (also called conversion rate) represents the rate at which the ADC samples analog input signals, usually expressed in samples per second (SPS). It indicates how many analog-to-digital conversions the ADC can perform per second.
  • MSPM0G3507 has a sampling rate of 4Msps (4 million samples per second), suitable for high-frequency signal acquisition and real-time data processing.

3. Voltage Reference

  • The voltage reference of an ADC is a reference voltage used to compare with analog input signals to ultimately achieve analog-to-digital signal conversion. The accuracy and stability of the voltage reference are crucial to the conversion accuracy of the ADC.

  • MSPM0G3507

    Supports three voltage reference configurations:

    • Internal configurable reference voltage: dedicated ADC reference voltages (VREF) of 1.4V and 2.5V.
    • MCU power supply voltage (VDD) as reference voltage.
    • External reference voltage provided through VREF+ and VREF- pins. If no voltage reference is configured, the MCU's power supply voltage (VDD) is used as the reference voltage by default.

4. Sampling Range

  • Sampling range represents the voltage range of analog input signals that the ADC can collect, usually closely related to the reference voltage settings. The range is as follows: VREF- ≤ ADC ≤ VREF+

    • VREF-: Set negative terminal of reference voltage, usually 0V.
    • VREF+: Set positive terminal of reference voltage, determined according to software configuration.

These parameters together determine the performance of the ADC, including its precision, response speed, and input voltage range.

MSPM0G3507 uses a 12-bit successive approximation ADC with 17 multiplexed channels that can be converted. 17 external channels all correspond to certain pins of the microcontroller. These pins are not fixed. For details, please refer to the pin diagram or data sheet.

 

3. Project Configuration

3.1 Description

You can refer to the basic tutorial to complete the development environment setup.

3.2 Pin Configuration

Add ADC peripheral configuration using sconfig tool as follows

image-20251028211738223

We select sequence conversion for conversion mode, configure sampling mode as automatic sampling, configure trigger sampling method as software trigger, conversion data format as unsigned binary, and data right-aligned

image-20251028211856922

Here we select all memory control blocks

image-20251028212101667

Pin configuration is as follows

image-20251028212220725

Add serial port configuration to print calculated values

image-20251028212314822

4. Main Functions

Function: Get_ADC_Value

Function Prototypevoid Get_ADC_Value()
Function DescriptionGet ADC sampling value and process sensor data
Input ParametersNone
Output ParametersNone

 

5. Experimental Phenomenon

Connect the car wires, connect the OLED module, after burning the program to MSPM0, connect the Type-C to the car, open the serial port assistant. The configuration and experimental phenomenon are as follows: cover the left and right photosensitive resistors of the car, and the resistance values of the photosensitive resistors displayed on the OLED and serial port will change.

VL: Voltage value of photosensitive resistor (left) converted through ADC

RL: Voltage value of photosensitive resistor (right) converted through ADC

RL: Resistance value of photosensitive resistor (left)

RR: Resistance value of photosensitive resistor (right)

image-20251028213511546

image-20251103191458074

Motor PID control
Infrared avoid sensor

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
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文