Blynk simple temperature sensor lm35

This simple sketch measure the temperature using an LM35 connected to analog pin 1 .
and showing the value from the virtual pin 10.

    #define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
    #include <SPI.h>
    #include <Ethernet.h>
    #include <BlynkSimpleEthernet.h>
    #include <SimpleTimer.h>
    
    // You should get Auth Token in the Blynk App.
    // Go to the Project Settings (nut icon).
    char auth[] = "xxxxxxxxx";
    
    float temp;
    int tempPin = 1; //analog pin 1
    
    SimpleTimer timer;
    
    void setup()
    {
      Serial.begin(9600); // See the connection status in Serial Monitor
      Blynk.begin(auth);
    
      // Setup a function to be called every second
      timer.setInterval(1000L, sendUptime);
    }
    
    // that you define how often to send data to Blynk App.
    void sendUptime()
    {
     // shows the value temp on virtual pin 10
      Blynk.virtualWrite(10, temp); 
    }
    
    void loop()
    {
      Blynk.run(); // Initiates Blynk
      timer.run(); // Initiates SimpleTimer
      
       temp = analogRead(tempPin);
       temp = temp * 0.48828125;  
      
    }

5 Likes

Just what ive been looking for and it works! Thanks. Any tips on how to convert to degrees??

Yes, subtract 32 from the Fahrenheit and divide that by 1,8. That will give you Celsius :slight_smile:

LM35 output is already in Centigrade no need to convert.

LM35 topic is already in retrograde no need to fix :stuck_out_tongue:

Please take note of the time/date stamps before responding to posts… anything over 6+ months is probably not worth reviving.

Thank you.