jazz-2 / STM32-Internal_Temperature-DMA

NUCLEO-STM32F446RE: Internal Temperature Sensor, Vrefint, ADC, DMA, Timer, PWM

Home Page:https://github.com/jazz-2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Internal temperature reading using Nucleo-64 STM32F446RE

github.com/jazz-2

Rise in CPU temperature starts the DC motor and LED

TempSensorPWMMotor

Average of temperatures from a given number of samples

temperatureSamples

Circuit

circuitPhoto


Description

This project contains reading data from internal Temperature Sensor Channel and Vrefint Channel using ADC and DMA. It controls a DC motor and LED using PWM.

If the temperature exceeds a certain threshold, the PWM duty cycle will be increased/decreased, consequently increasing/decreasing LED brightness and DC motor speed.

Electronic elements:
  • transistor BJT NPN BD135
  • resistor 1 kΩ
  • a Schottky diode was used as a flyback diode.
  • capacitor 1000 µF
    • The capacitor was added to improve the smoothness of DC motor work and to boost performance at low PWM_DutyCycle.
    • In my case, instead of a capacitor, the Timer/PWM frequency (known as Update_event) can be reduced from 1000 Hz to, for example 100 Hz. Update_event = TIM_CLK/((PSC + 1)*(ARR + 1)*(RCR + 1))

You can find Temperature calculations in stm32f4xx_it.c file.

About

NUCLEO-STM32F446RE: Internal Temperature Sensor, Vrefint, ADC, DMA, Timer, PWM

https://github.com/jazz-2


Languages

Language:C 99.6%Language:Assembly 0.4%