-->
Page 1 of 2

ESP12f ADC readings

PostPosted: Tue Feb 06, 2018 1:22 am
by Moose2
Hi. I have connected a tmp36 analog sensor to the ADC of the ESP12f. The actual voltage reading on a voltmeter is .7v but the chip outputs 2.6v in the serial monitor. Please help....I have no hair left

void loop(){
int reading = analogRead(temperaturePin);
float voltage = reading * 3.3;
voltage /= 1024.0;
float temperatureC = (voltage - 0.5) * 100;
Serial.print(voltage); Serial.println(" volts");
Serial.print(temperatureC); Serial.println(" degrees C");

Re: ESP12f ADC readings

PostPosted: Tue Feb 06, 2018 11:52 pm
by trackerj

Re: ESP12f ADC readings

PostPosted: Wed Feb 07, 2018 1:17 am
by Moose2
thanks for the reply, but I'm a real noobie.... I need code sample please

Re: ESP12f ADC readings

PostPosted: Wed Feb 07, 2018 7:03 am
by btidey
It is good to understand the ADC but if you are trying to measure temperature then you are much better of using a digital temperature sensor like a ds18b20 instead of an analog device like the tmp36.

Advantages are easy to use with library support, high accuracy, very cheap.