Hello,
I am a student working on a project using an ESP32 running RIOT OS. The project uses RIOT’s ADC driver to read temperature data from an LM35 sensor.
My question is: what equation should be used to convert the ADC raw value into a temperature value (in °C) when using the LM35 with RIOT OS?
Any guidance or examples would be appreciated.
Thank you.
Hello,
this is not really a question related to RIOT I think, but the ADC reading is usually converted to a voltage by this formula:
V_ADC = V_Ref * (ADC Value / Full Range)
V_ADC is the voltage at the input pin of the ADC.
V_Ref is probably 3.3V in your case,
ADC Value is what’s returned from `adc_read`,
Full Range is what you configured to ADC to in the initialization (for example 12-bit would be 2^12 = 4096).
Then you multiply it with the factor given in the LM35 datasheet to get the temperature:
T = V_ADC * 25 °C/mV
Best Regards,
Chris