Beginner : How to plug the TI LM35 to the photon?


I just received my photon and the TI LM 35. Do you know how to plug the TI LM35 to the photon ? Do I need additional elements such as a resistance ?


The output is analog 10mV per centigrade, so its not likely to get high enough to exceed the 3.3V max on alaog photon pins.

+Vs to photon Vin
Gnd to Gnd
Output to a analog photon pin

Its a bit more complicated if you require negative centigrade readings.

If you need that, it may be better to use a DS18B20, which is more complicated in terms of code, but requires no external components other than a pull up resistor.

1 Like

Thanks a lot, I’ve just tried your suggested set up. It works nice, but analogRead returns an unexpected value of 313 :sweat:.

Am I supposed to manually adjust this value in the code to get the correct temperature in degrees?

Yes analogread gives 0-4095 to represent 0-3.3v

3.3V = 3300mV
3300 / 4096 = 0.8056640625mV per analog read step
10mV per centigrade = 10 / 0.8056640625 = 12.41212121…
So analog read value / 12.412 = degrees celcius
Which would put your reading of 313 at 25.22c (313/12.412)

1 Like