// References for the code taken from: http://www.learningaboutelectronics.com/Articles/LM335-temperature-sensor-circuit.php and https://simple-circuit.com/arduino-lm335-sensor-thermometer/ // Choose the analog pin used int analogPin= 0; void setup() { Serial.begin(9600); } void loop() { // comparing different ways to calculate Celcius Serial.println(analogRead(analogPin)); // (Voltage * analogRead) / 1024.0 * 100.0 - 273.15 float celsius1 = (5.0 * analogRead(analogPin)) / 1024.0 * 100.0 - 273.15; Serial.print(celsius1); Serial.println(" degrees Celsius"); // first calculate kelvin and then celcius float kelvin = analogRead(analogPin) * 0.489; float celsius2 = kelvin - 273.15; Serial.print(celsius2); Serial.println(" degrees Celsius"); // first calculate millivolts, then kelvin and at last celcius int voltage = analogRead(analogPin); float celsius3 = ((voltage/1024.0)*5000)/10-273.15; Serial.print(celsius3); Serial.println(" degrees Celsius"); Serial.println(); // This makes loop to start every 5 seconds delay(5000); }