Encoder position measurement [STM32 Nucleo]
The STM32 timer has a function to count up and down using encoder 2-phase output pulses as input. This section explains how to use this function to measure the amount of motor rotation from the reference position by up-down counting the pulses from the rotary encoder. Purpose: To measure the amount of rotational position by […]
Encoder speed measurement [STM32 Nucleo]
The STM32 timer has the ability to measure external pulses. Encoders are often used as sensors to detect the position and speed of actuators such as robots, etc. This section introduces a method to measure pulses that vary with rotation speed from encoders. Purpose: To count encoder pulses pulled up and input to CH1 of […]
Let's sound a piezoelectric buzzer and speaker [STM32 Nucleo]
Let's connect a piezoelectric buzzer and speaker to an STM32 MCU (Nucleo board) and play them. This time, I used an inexpensive piezoelectric buzzer (model: LF-MB12B06). This is an application of a peripheral timer. For details, see Timer/Counter [Details of STM32's High Functional and General Purpose Timer]. Table of contents1 Piezoelectric buzzer specifications2 Circuit of […]
PWM dimming of LEDs with MCU [STM32 Nucleo]
How can we use the digital output of MCU to dim LEDs? I will explain the magic trick of using the digital output of MCU to control the brightness continuously in an analog manner, as if dimming were a magic trick. Colum For example, if an analog VR is added to the input and the […]
Variable pulse application [Pulse control with STM32].
This application controls arbitrary frequency pulses with STM32 MCU. In this example, the frequency changes when a pushbutton switch is held down, but it can be applied in many other ways. Setting SpecificationPins used: PB8 Alternate output (Timer output) PC13 Input (Pushbotton SW)Peripheral used: TIM4_CH3 Count CLK1kHz Colum This application uses a combination of switch […]
PWM pulse application [PWM output of STM32]
This is an application program that sets the timer of the STM32 MCU to PWM output. You can see the frequency and pulse duty ratio change depending on the setting value. Setting specification:Pin used: PB8 Alternate output (Timer output)Peripheral used:TIM4_CH3 Counter CLK 1kHz
Fixed pulse application [Pulse output of STM32]
This application program uses the timer of the STM32 MCU to generate a fixed frequency pulse only when an input switch is pressed. Setting Specification:Pin used:PB8 Alternate output(Timer output)Peripheral used:TIM4_CH3 Counter CLK 1kHz
Timer/Counter[STM32 Timers Details]
Timer counters on MCUs have a wide range of applications, such as counting the number of input pulses given externally, calculating input pulse frequency, outputting arbitrary frequency pulses, outputting PWM pulses, and measuring time with timer counter combinations other than pulses. The timer/counter peripheral of the STM32 has so many functions that it is difficult […]