BT San Technology

10 August 2026

STM32G4 for measurement and control: ADC, timers and signal synchronisation

2 min read · Automation

Illustration: a motor behind a clear guard, a current sensor, a microcontroller board and an oscilloscope showing three traces
AI-generated illustration

What matters about the G4 is its mixed-signal and timer capability in the variant you choose. For measurement work tied to a control signal, the timing of each sample matters more than how fast you can read averaged values on Serial. Starting with a simulated signal lets you learn triggering and timing checks without involving a power circuit.

What this covers and the order of experiments

  1. Plan which event triggers the ADC and which reference time you need to record.
  2. Check the sampling time, the signal source and the ADC limits in the chip's documentation.
  3. Use a timer and DMA where appropriate, to reduce waiting and CPU load.
  4. Check the waveform with a measuring instrument and compare it with the values the firmware recorded, instead of trusting the code alone.

Exercise and practical example

Exercise: simulate reading a low-voltage waveform that stays within the input range, then compare a blocking read in a loop with timer-triggered sampling.

Limits and what else to check

This exercise is not a guide to building an inverter or controlling a high-power motor. Power devices, protection circuits and safety need their own design.

Manufacturer documents worth reading

  • STM32G4
  • STM32CubeMX

References

  1. STM32G4 (accessed 2026-11-21)
  2. STM32CubeMX (accessed 2026-11-21)

Add us on LINE

Scan with the LINE app on your phone

QR code to add LINE @Bankoos

LINE ID: @Bankoos

Open LINE on this computer