I'm reading temperaure with a TMP36 module.
I connect the module to an analogue input pin, read the value, convert to a voltage and then convert to a temperature - as shown.....
temp1 = analogRead(temp1Pin); // Get the input value (0-1013) from the analog pin temp1 = map(temp1,0,1023,0,regVolt); // Convert to millivolts (0-5000mv assuming 5v supply) temp1 = temp1 - conversion1; // Convert from millivolts to tenths of degrees
This all works fine, but it does require knowing the regulator voltage (regVolt - hardcoded to 5000mv)
Here's my question - how consistent will the regulator voltage be? how consistent will it be when I start changing the load (switching on other instruments or leds etc). and how consistent will it be if I swap arduinos?
My understand of analogRead() is that it returns a value proportional to both the internal voltage and the voltage applied to the pin. So if the regulator voltage is 5v and the voltage on the analogue pin is 2.5 volts then it will return a value of 512, but if the regulator voltage drops by 10% then the value read from the analogue pin will also drop by 10% even if actual voltage applied remains at 2.5v?