Show Posts
Pages: 1 ... 5 6 [7]
91  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: How does analogRead know minimum and maximum value on: January 11, 2009, 04:09:36 pm
Thanks for all the answers.. I think I acutally got most of it. Well except for the binary part. But then again I didn't even try to understand that.

My initial reason for asking was trying to figure out why some tutorials online used a resistor between ground and the sensor, and I certainly understand why and how that works now. Even more actually.

Big thanks to everyone who chipped in with advise!
92  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: How does analogRead know minimum and maximum value on: January 11, 2009, 06:29:23 am
Ok I got the voltage divider concept figured out. But that raises further questions. Actually theories, would this assumption be correct?

Lets say I use a potentiometer I have +5V in the first pin and ground in the third and in the middle I have a voltage divider connected to my analog in pin.

R1 = 0Ohm to 1KOhm, I´ll use 500Ohm for this calculation = 500Ohm
R2 = Full potentiometer resistance pin 1 and pin 3 = 1KOhm
Vin = +5V

Vout = (R1 / (R1+R2)) * Vin = (1000 / 1500) * 5 = 3,3333

But if I have a CdS resistor I have the first pin in +5 and the second one in ground/analog in. But I then I would be measuring after only one resistor. That would give +5V constantly. So therefore I must use a resistor with the highest resistance of the CdS resistor to connect the circuit to ground.

R1 = CdS resistor 2-5 KOhm, I'll go with 4KOhm here
R2 = 5 KOhm ordinary resistor
Vin = +5V

Vout = (R1 / (R1+R2)) * Vin = (5000 / 9000) * 5 = 2,7

In a sence I could make the CdS resistor more or less sensitive by using a smaller or larger resistor as R2.

Have I got it right?
93  Forum 2005-2010 (read only) / Frequently-Asked Questions / Re: How does analogRead know minimum and maximum value on: January 11, 2009, 04:39:49 am
So in a sense it doesn't know what max and min are?

I think I should read up on voltage divider before I ask any more questions.

Thanks for the quick reply.
94  Forum 2005-2010 (read only) / Frequently-Asked Questions / How does analogRead know minimum and maximum value on: January 11, 2009, 03:26:49 am
Maybe it's because I don't have enough experience with electronics but I have a hard time understanding how the analogRead values are set. I understand what it measures and how. But how on earth does it know what the minimum and maximum values are of different parts like a potentiometer, CdS resistor and so on?

Ofcourse a zero resistance would be a good minimum value but it still doesen't explain how it knows when it hits max.

Best regards
Markus
Pages: 1 ... 5 6 [7]