Tuesday, June 11, 2019

LM35 Temperature sensor with STM32

LM35 is an integrated-circuit temperature device with an output voltage linearly proportional to the centigrade temperature. As LM35 is not calibrated in Kelvin, user does not require to subtract large constant voltage from the output to obtain convenient centigrade scaling.

Features of LM35

  • Calibrate directly in celcius
  • 0.5°C Ensured Accuracy ( at 25°C)
  • Rated for full -55°C to 150°C Range
  • Suitable for Remote Applications
  • Operates from 4V to 30V
  • Less than 60μA current drain
  • Low Self-Heating, 0.08°C in Still Air
  • Non-Linearity Only ±¼°C Typical
  • Low-Impedance Output, 0.1 Ω for 1-mA Load

Applications

  • Power Supplies
  • Battery Management
  • HVAC
  • Appliances
[/vc_message]
Click HERE to download LM35 datasheet.
Connections in LM35
Go to ADC1 config in configuration tab and make sure your settings are as follows
Scan Conversion- Enabled Continuous conv- Enabled DMA request – Emabled Sampling time – Highest(480 cycles)
Go to DMA setting and select the following
That’s it for CubeMx setup. Generate the project and open it

Some Insight into the Code

create variables:-
uint32_t adc_buf is the ADC buffer, where values from LM35 will be stored.
int temp is the variable to store the temperature.
write a callback function:-

No comments:

Post a Comment

Back to Top