Analog Input

Most Arduino boards, including the Uno have six pins that can be used as analog inputs, A0 through A5.

The sample project uses A0 and A1.

The value the program receives when it reads an analog input pin is proportionate to the voltage at the pin.

The voltage at the pin is contiuously variable between 0 and the supply voltage, usually +5V.

The program receives a value in the range 0 through 1023. The value is an approxiamation with ten bits resolution. Good enough for lots of things.

Potentiometer Input


In this circuit, R is 10kΩ. But it can be almost any value. The voltage at the Arduino input pin will be proportionate to the position of the wiper of the potentiometer.

Photoresistor input


Here the voltage is divided by resistor R and the photoresistor. Often when you buy a photoresistor, you don't know the value of its resistance. So you don't know the optimal value for R in this circuit.

One of our sketches comes to the rescue. You tell the sketch the when the cell is dark and when bright light shines on it. You also indicate the value of the resistor.

The skecth calculates the optimal value for the resistor. Even with the best choice of R, the range of values delivered on this circuit will be constranined. In the final version of the program, we will clip the range to get the most variation of values to be displayed.