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]
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:-
1
2
3
4
|
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)
{
temp = adc_buf*.322; // convert value from adc buffer to temperature in Centigrade
}
|
No comments:
Post a Comment