Community

LM35 sensor readings

Using the sample code from here - https://www.hackster.io/wilderness-labs/build-your-own-temperature-monitor-with-meadow-edc696 as a starting point with the current Meadow.Foundation (0.25.0) and Meadow.Foundation.Displays.TftSpi (0.7.44) packages.

In the TemperatureUpdated event handler of the AnalogTemperature object, the values for Celsius and Fahrenheit aren’t what I would expect.

 private void AnalogTemperature_TemperatureUpdated(object sender, IChangeResult<Meadow.Units.Temperature> e)
            {
                Console.WriteLine($"c:{e.Old?.Celsius}");
                Console.WriteLine($"c:{e.New.Celsius}");

                Console.WriteLine($"f:{e.Old?.Fahrenheit}");
                Console.WriteLine($"f:{e.New.Fahrenheit}");
    }

Sample values:
Celsius values: 226.063…
Fahrenheit values: 439.05…

The AnalogTemperature class is mapping the voltage to temperature, and the Temperature class has the conversion from Celsius to Fahrenheit. Is their some other math needed to get the appropriate values?

Thanks,

In the sample, the wiring diagrams are different between the photo and the drawing. I utilized the drawing diagram.

It helps if the sensor is put in correctly :slight_smile: