LM 35 DZ ARDUINO equation
Répondre à la discussion
Affichage des résultats 1 à 8 sur 8

LM 35 DZ ARDUINO equation



  1. #1
    chakibcubee

    LM 35 DZ ARDUINO equation


    ------

    Bonjour
    je vais bientôt réaliser mon thermomètre a base d'un LM35DZ sur arduino

    j cherché sur beaucoup de liens sur internet et j'ai trouvé cette équation temp = (5.0 * analogRead(tempPin) * 100.0) / 1024;

    ce qui fait X = analogRead(tempPin);
    temp = X * 0.48828125;
    Serial.print("TEMPRATURE = ");
    Serial.print(temp);
    alors j'arrive pas a voir comment ils l'ont dédui ni comment on peut calculer cette temperature si on veut utiliser une calculatrice sachant que c'est un capteur qui donne 10mv/1C

    par exemple pour 5C on fait 50/1000 * 0,48 ??? ce n'est pas du tout 5C en resulats ,

    pouriez vous m'expliquer comment calculer cette valeur , et comment obtenir une equation de nimporte quel capteur analogique qui a une reponse lineaire bien sur ,

    Merci

    -----

  2. #2
    freepicbasic

    Re : LM 35 DZ ARDUINO equation

    La référence est de 5V !
    Si on divise 5V par 1024 on a 0.00488 V par chiffre binaire

    Si on élève d'un degré on augmente de 10 mv = 0.01V
    Donc 1 dégré = 10mv / 4.88mv ~ 2 binaire

    la formule sera Vadc * 0.488 = t en degré
    A+, pat

  3. #3
    chakibcubee

    Re : LM 35 DZ ARDUINO equation

    Merci pour la reponse
    Vadc c'est bien la valeur numerique en bits c ça ?

  4. #4
    chakibcubee

    Re : LM 35 DZ ARDUINO equation

    Citation Envoyé par chakibcubee Voir le message
    Merci pour la reponse
    Vadc c'est bien la valeur numerique en bits c ça ?
    je veux dire ANALOGREAD cest bien la valeur numerique correspondante a la tension fournit par le capteur

  5. A voir en vidéo sur Futura
  6. #5
    freepicbasic

    Re : LM 35 DZ ARDUINO equation

    c est ça !
    Avec la référence à 5V , normalement par défaut
    A+, pat

  7. #6
    chakibcubee

    Re : LM 35 DZ ARDUINO equation

    la conversion analogique-numerique se fait toute seule sur l'arduino ?

    voici le programme
    float temp;
    int tempPin = 0;

    void setup()
    {
    Serial.begin(9600);
    }

    void loop()
    {
    temp = analogRead(tempPin);
    temp = temp * 0.48828125;
    Serial.print("TEMPRATURE = ");
    Serial.print(temp);
    Serial.print("*C");
    Serial.println();
    delay(1000);
    }




    NOW SEE THE SERIAL MONITOR IN THE ARDUINO SOFTWERE ,
    ITS DONE.



    We have a be nice comment policy.
    Please be positive and constructive.
    1-40 of 47 Next »
    spradana110 months agoReply

    We can get value magic number 0.48828125 from following expression:

    (SUPPLY_VOLTAGE x 1000 / 1024) / 10 where SUPPLY_VOLTAGE is 5.0V (the voltage used to power LM35)

    1024 is 2^10, value where the analog value can be represented by ATmega (cmiiw) or the maximum value it can be represented is 1023. The actual voltage obtained by VOLTAGE_GET / 1024.

    1000 is used to change the unit from V to mV

    10 is constant. Each 10 mV is directly proportional to 1 Celcius.

    By doing simple math: (5.0 * 1000 / 1024) / 10 = 0.48828125
    minimadmalc spradana13 months agoReply

    Hi Please can you tell me if I was to run this program through a Attiny85 on 4.5 volts what formula would I need to use to get the correct results?
    spradana1 minimadmalc3 months agoReply

    you can substitute the SUPPLY_VOLTAGE part which result in

    (SUPPLY_VOLTAGE x 1000 / 1024) / 10 = (4.5 x 1000 / 1024) / 10 =

    0.439453125
    sghosh21 spradana12 months agoReply

    the supply voltage doesn't really matter , i think the analog to digital converter matters though, coz see we can even power the LM35 with a 20 v power supply, if we do that and still read the analog value from arduino, your equation will not hold,
    spradana1 sghosh212 months agoReply

    Indeed the supply voltage can ranging from +35V to -0.2V. Well, I got the equation from the LM35 datasheet and never done things outside the datasheet.
    atifa16 days agoReply

    Can someone help me in this problem.

    Design a device powered by a 3,3V battery that measures temperature (in a range from -40°C to 100°C) using an external sensor and transmits the temperature values to a PC using the RS232 communication system (do not use flow control – 3 wires connection). Temperature values in °C are required to be transmitted to the PC, using ASCII characters.
    SidA222 days agoReply

    Hello. I'm somewhat new to Arduino and I have a box of random sensors, one of which was the temp sensor. I tried out this program but the sensor kept on giving me high values ranging from 180*C to sometimes at the 400s. I am using an Arduino Mega and I have tried all possible configurations. There is only one that works, the other ways two heat up my sensor...

    And it's nothing wrong with my Arduino because I tried it with two of the same board.

    How can I get this to work?
    DeanP2 SidA210 days agoReply

    I had that happen the other night with a project that was just fine minutes before. I had accidentally knocked a wire loose. I reconnected it and the sensor felt like it really WAS 440 degrees. I reversed it and it was fine. Can't explain all that, but I tried to reset my Arduino several times first, and this was the only thing that worked.
    Asheer Usmani7 months agoReply

    Any one Plz help me

    i want to use LM35 and make a thermametor look like in following picture can any one plz give me code
    images (2).jpg
    TAPAN MOJIDRA (author) Asheer Usmani6 months agoReply

    @Asheer Usmani : you can follow this link
    http://dc262.4shared.com/doc/HB5pJmHY/preview.html
    Asheer Usmani TAPAN MOJIDRA6 months agoReply

    sir plz check that if this code is ok or it need some changes (Kindly mention changes.)

    int led = 13;

    int led2 = 12;

    int led3 = 11;

    int led4 = 10;

    int led5 = 9;

    int led6 = 8;

    int led7 = 7;

    int led8 = 6;

    int led9 = 5;

    int led10 = 4;

    float tempC;

    int reading;

    int tempPin = 0;

    // the setup routine runs once when you press reset:

    void setup() {

    Serial.begin(9600);

    analogReference(INTERNAL);

    // initialize the
    digital pin as an output.

    pinMode(led,
    OUTPUT);

    pinMode(led2,
    OUTPUT);

    pinMode(led3, OUTPUT);

    pinMode(led4,OUTPUT);

    pinMode(led5,OUTPUT);

    pinMode(led6,OUTPUT);

    pinMode(led7,OUTPUT);

    pinMode(led8,OUTPUT);

    pinMode(led9,OUTPUT);

    pinMode(led10,OUTPUT);

    digitalWrite(led,
    HIGH); // turn the LED on (HIGH is the
    voltage level)

    delay(100); // wait for a second

    digitalWrite(led,
    LOW); // turn the LED off by making
    the voltage LOW

    delay(100);

    {digitalWrite(led2,
    HIGH);

    delay(100);

    digitalWrite(led2, LOW);

    delay(100);}

    {digitalWrite(led3, HIGH);

    delay(100);

    digitalWrite(led3, LOW);

    delay(100);}// wait for a second

    {digitalWrite(led4,
    HIGH);

    delay(100);

    digitalWrite(led4, LOW);

    delay(100);}

    {digitalWrite(led5,
    HIGH);

    delay(100);

    digitalWrite(led5, LOW);

    delay(100);}

    {digitalWrite(led6,
    HIGH);

    delay(100);

    digitalWrite(led6, LOW);

    delay(100);}

    {digitalWrite(led7,
    HIGH);

    delay(100);

    digitalWrite(led7, LOW);

    delay(100);}

    {digitalWrite(led8,
    HIGH);

    delay(100);

    digitalWrite(led8, LOW);

    delay(100);}

    {digitalWrite(led9,
    HIGH);

    delay(100);

    digitalWrite(led9, LOW);

    delay(100);}

    {digitalWrite(led10,
    HIGH);

    delay(100);

    digitalWrite(led10, LOW);

    delay(100);}}

    void loop()

    {

    reading = analogRead(tempPin);

    tempC = reading / 9.31;

    }
    rockers.raghu.31 Asheer Usmani19 days agoReply

    Your program is correct. But make it simple and short. Try this.

    int i;

    float reading, tempC;

    void setup()

    {

    for(i=4;i<=13;i++)

    {

    pinMode(i,OUTPUT); //To initialize the LED from pin 4 to pin 13

    }

    pinMode(A0,INPUT); //To initalize the Thermistor Analog pin 0

    Serial.begin(9600);

    for(i=4;i<=13;i++)

    {

    digitalWrite(i,HIGH); //LED's ON one by one

    delay(1000);

    digitalWrite(i,LOW); //LED's OFF one by one

    delay(1000);

    }

    }

    void loop()

    {

    reading = analogRead(A0);

    tempC = reading / 9.31;

    Serial.println(tempC);

    delay(100);

    }
    farid.adi.prabowo21 days agoReply

    Hi, anyone can make an sketch that controling/ showing 2 analouge temperature in same time?

    I mean, at 1st Line ( 0,0 ) show the first analouge temp. sensor

    And the 2nd Line ( 0,1 ) show the other analouge temp. sensor
    NileshG1 month agoReply

    Thanks it's very helpful and yet simple

    My Program with Three LED indicator & LM 35.

    // Quick Read Thermometer

    // Define Pins

    #define HOT 6

    #define NORMAL 4

    #define COOL 2

    float voltage = 0;

    float celcius = 0;

    float hotTemp = 26;

    float coldTemp = 20;

    float sensor = 0;

    void setup(){

    pinMode (HOT, OUTPUT);

    pinMode (NORMAL, OUTPUT);

    pinMode (COOL, OUTPUT);

    Serial.begin(9600);}

    void loop(){

    // convert raw sensor value into milli volt & result into degree celcius

    sensor = analogRead(0);

    voltage = sensor * 0.48828125; //convert raw sensor value into milli volt

    celcius = voltage ;

    Serial.println(celcius , 2);

    // act on temprature variation

    if (celcius < coldTemp)

    {digitalWrite (COOL, HIGH);

    delay(1000);

    digitalWrite (COOL, LOW);}

    else if (celcius > coldTemp && celcius <= hotTemp)

    {digitalWrite (NORMAL, HIGH);

    delay (1000);

    digitalWrite (NORMAL, LOW);}

    else

    {//celcius is > HOT Temprature

    digitalWrite (HOT, HIGH);

    delay(1000);

    digitalWrite(HOT, LOW);}

    }
    NileshG1 month agoReply

    // Quick Read Thermometer

    // Define Pins

    #define HOT 6

    #define NORMAL 4

    #define COOL 2

    float voltage = 0;

    float celcius = 0;

    float hotTemp = 26;

    float coldTemp = 20;

    float sensor = 0;

    void setup(){

    pinMode (HOT, OUTPUT);

    pinMode (NORMAL, OUTPUT);

    pinMode (COOL, OUTPUT);

    Serial.begin(9600);}

    void loop(){

    // convert raw sensor value into milli volt & result into degree celcius

    sensor = analogRead(0);

    voltage = sensor * 0.48828125; //convert raw sensor value into milli volt

    celcius = voltage ;

    Serial.println(celcius , 2);

    // act on temprature variation

    if (celcius < coldTemp)

    {digitalWrite (COOL, HIGH);

    delay(1000);

    digitalWrite (COOL, LOW);}

    else if (celcius > coldTemp && celcius <= hotTemp)

    {digitalWrite (NORMAL, HIGH);

    delay (1000);

    digitalWrite (NORMAL, LOW);}

    else

    {//celcius is > HOT Temprature

    digitalWrite (HOT, HIGH);

    delay(1000);

    digitalWrite(HOT, LOW);}

    }
    particlep1 month agoReply

    i'm new to arduino and using sensors. i found this instruct able once i knew i had a lm 35.

    to start with i was getting read outs in the several hundreds and went through the :

    avrdude: stk500_getsync(): not in sync: resp=0x00

    senario.

    i eventually got it all working again and calibrated the code relative to local temperature and what the sensor outputted with no additional maths.

    here's the code:

    /* orginal code from http://www.instructables.com/id/ARDUINO-TEMPERATU...

    uses an lm 35 temperature sensor http://www.electroschematics.com/6393/lm35-datash...

    27.3 was the result of the maths : serial reading from sensor / current temperature in the room by room thermostat

    particlep

    30-12-14

    */

    float temp;

    int tempPin = 0;

    void setup()

    {

    Serial.begin(9600);

    }

    void loop()

    {

    temp = analogRead(tempPin)/27.3; //code added

    //temp = temp * 0.48828125; removed

    Serial.print("temperature = "); //spelling and capitalisation editted

    Serial.print(temp);

    Serial.print("*C");

    Serial.println();

    delay(1000);

    }
    karengrace.victor2 months agoReply

    please help me... the temperatures are unrealistic
    IMG_1916.JPG
    particlep karengrace.victor1 month agoReply

    i'm getting readings of around 222
    TAPAN MOJIDRA (author) karengrace.victor2 months agoReply

    maybe you have connected LM35 incorrectly. please check wiring once again.
    TAPAN MOJIDRA (author) karengrace.victor2 months agoReply

    maybe you have connected LM35 incorrectly. please check wiring once again.
    TAPAN MOJIDRA (author) karengrace.victor2 months agoReply

    maybe you have connected LM35 incorrectly. please check wiring once again.
    kira.san31 month agoReply
    kira.san31 month agoReply
    limbo2 months agoReply

    Nice Work!

    I created a simple executable file (available here: http://goo.gl/4KVIsr ) and altered the arduino source code to get a temperature value only if the new measurement is different.This way I have less serial traffic. Additionally the code was pruned a bit on the text in order to send only the TEMP value.
    Feel free to download and test the program.
    Serial temperature.jpg
    srao10 limbo1 month agoReply

    Neat work dude! how didya make that? Not Processing of course!
    raghavsharma0182 months agoReply

    i am getting an error in the output. The temperature shown by the circuit is really high.Please help to solve this problem.
    cterengganu3 months agoReply

    because you connect to wrong pin

    connect the middle pin lm35 to pin 0 on arduino
    Kaustubh_k_tube10 months agoReply

    Hey i wanna interface PIR and web cam with arduino uno how to do that.

    i wanna give output of PIR to web cam as triggering pulse to start my cam recording can u help me out with it please..
    pir.jpgpir2.jpg
    Kaustubh_k_tube Kaustubh_k_tube10 months agoReply

    please sir help me out after 3 days i have to present the project in my college
    RakeshK1 Kaustubh_k_tube3 months agoReply

    Do try Processing software...
    toky9994 months agoReply

    Can someone tell me why I get 450*C? Is my sensor broken or did I do it wrong?
    TAPAN MOJIDRA (author) 8 months agoReply

    http://playground.arduino.cc/Main/LM35HigherResolution
    affiaymen12 months agoReply

    Hi , I want to use your ins in my 3d printer home made ..

    Can you tell me the max temperature it can supporT?

    Thanks! good job
    TAPAN MOJIDRA (author) affiaymen8 months agoReply

    -55 to +150 *c
    Rifath made it!9 months agoReply

    I've made this one with some code editing for extra accuracy.

    The code is given below:

    float temp;

    int tempPin = 0;

    void setup()

    {

    Serial.begin(9600);

    }

    void loop()

    {

    temp = analogRead(tempPin)/9.31;

    Serial.print("TEMPRATURE = ");

    Serial.print(temp);

    Serial.print("*C");

    Serial.println();

    delay(500);

    }
    lm 35.jpgPhoto0011.jpgPhoto0012.j pg
    smotešický10 months agoReply

    My sensor shows temperature 23°C as 154.79°C.
    Rifath smotešický9 months agoReply

    I am also faced the same problem, then i edited the code and it is working fine for me. The code is given below:

    float temp;

    int tempPin = 0;

    void setup()

    {

    Serial.begin(9600);

    }

    void loop()

    {

    temp = analogRead(tempPin)/9.31;

    Serial.print("TEMPRATURE = ");

    Serial.print(temp);

    Serial.print("*C");

    Serial.println();

    delay(1000);

    }
    dbarnes5310 months agoReply

    I think I have the same sensor, but Where did you get that number for conversion? the 0.48828125 I mean.
    nithyaa9210 months agoReply

    Can you please explain the logic behind this program????
    nofeel1 year agoReply
    i have problem: avrdude: stk500_getsync(): not in sync: resp=0x00
    why??
    1-40 of 47 Next »

    We have a be nice comment policy.
    Please be positive and constructive.

  8. #7
    jiherve

    Re : LM 35 DZ ARDUINO equation

    Bonsoir,
    autant de baratin pour une équation du premier degré, l'avenir s'annonce sombre.
    JR
    l'électronique c'est pas du vaudou!

  9. #8
    freepicbasic

    Re : LM 35 DZ ARDUINO equation

    temp = analogRead(tempPin);

    Le C fait appel à une routine "analogRead" qui lit la pin "tempPin"
    et met le résultat dans la variable float "temp"

    Serial.print(temp);
    fait appel à une routine qui convertie le float "temp" en une chaine de caractères ASCII et l'envoie sur la console RS232

    la console RS232 peut être le logiciel ARDUINO écrit COM en bleu sur la petite fenêtre
    http://www.instructables.com/id/ARDU...E-SENSOR-LM35/
    A+, pat

Discussions similaires

  1. Arduino anti rebond avec arduino
    Par sari12 dans le forum Électronique
    Réponses: 13
    Dernier message: 23/10/2014, 17h04
  2. Communication arduino-arduino avec module Xbee
    Par TPESI22012 dans le forum Électronique
    Réponses: 2
    Dernier message: 23/12/2013, 17h24
  3. Arduino usb
    Par Janosch dans le forum Électronique
    Réponses: 1
    Dernier message: 21/05/2012, 07h07
  4. Arduino
    Par askico dans le forum Électronique
    Réponses: 1
    Dernier message: 24/01/2012, 21h31
  5. Arduino
    Par invite85ff08e6 dans le forum Électronique
    Réponses: 8
    Dernier message: 17/03/2010, 11h49
Découvrez nos comparatifs produits sur l'informatique et les technologies.