简体   繁体   中英

LM35 temp sesnor equation for arduino uno which connected to matlab GUI

Hi I'm new in matlab GUI

I am trying to create an axes plot the temperature which comes from LM35 through arduino uno to matlab

I used the following code to read the analog voltage, readVoltage(a,0) I get a values about 0.28 - 0.30 but I don't know exactly what this values exactly means is it the the real temperature/100 or what? I know there is an ADC inside arduino converts the input voltage to another range (0-1023) when I use analogRead() on the arduino side. Does it also work here or not? I confused about this thing when I should assume it is 0-1023 or directly get the reading.

The arduino ADC reads a voltage and outputs a number according to

  1. the reference voltage
  2. the bit width of the ADC

in this case I suppose that you are using the 5V reference and 10 bit mode, so

Vmeasured = NumberFromADC * 5V / 1024

Now, according to the LM35 datasheet the output voltage is

Vout = 10mV/°C * T

inverting the equation:

T = Vout / (10mV/°C) = NumberFromADC * 5V / 1024 / (10mV/°C) = NumberFromADC * 500 / 1024

(of course expressed in °C)

BTW I suggest you to change the voltage reference to an internal one, since the 5V are not stable and precise enough to have a good measuring system. More info here .

And, of course, if you change the reference voltage you will need to change the equation since the reference itself will not be 5V anymore.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM