-->
Page 1 of 5

analogRead(A0)

PostPosted: Sun Jan 31, 2016 4:14 am
by pomelo
Hi Guys,
i just mad a simple program .

Code: Select allloop()
{
int adcvalue = 0;
 adcvalue = analogRead(A0);
serial.print("VALUE: "+String(adcvalue));
delay(1000);
}


When started it gives an value between 6 and 8.
I plugged Different sensors into this analog port (thay give 1v / 5v as an output) and never got 1024 value,
it seems like i cannot reach 1024 - the max i have seen was 115...? why?

Re: analogRead(A0)

PostPosted: Sun Jan 31, 2016 5:46 am
by WereCatf
It sounds like you don't know how your sensors work. If the sensors did output 1.0V then you'd get 1024, anything less means the sensor is putting out less than that.

Re: analogRead(A0)

PostPosted: Sun Jan 31, 2016 5:51 am
by pomelo
WereCatf wrote:It sounds like you don't know how your sensors work. If the sensors did output 1.0V then you'd get 1024, anything less means the sensor is putting out less than that.


Thank you,
i am using https://www.google.pl/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwiV_b7K8NPKAhWFbRQKHV4kBHwQFggeMAA&url=http%3A%2F%2Fwww.waveshare.com%2Fdust-sensor.htm&usg=AFQjCNGxzlsxbU67tCgkthXLYHxNFlCLrg&sig2=f4eUkI-98nxXBqPlyRmTng&bvm=bv.113034660,d.d24

WaveShare Dust Sensor.

They claim it outputs 0v to 5v,
ESP8266 has AD0 for 1v.
What value should i expect on AD0 if SHARP MAXES OUT(5v)?

Re: analogRead(A0)

PostPosted: Sun Jan 31, 2016 6:30 am
by WereCatf
pomelo wrote:They claim it outputs 0v to 5v,
ESP8266 has AD0 for 1v.
What value should i expect on AD0 if SHARP MAXES OUT(5v)?


Anything above 1.0V would obviously result in a reading of 1024, you need a voltage divider to bring the sensor's voltage-output into 0V-1.0V - range.