1 - potentiometer circuit

• More suggestions on the same topic with the boards: Prop-BoE-Prop-AB - BASIC Stamp - Raspberry Pi

The Arduino Board has a 10-bit six-channel analog-to-digital converter. Input voltages between 0 to 5 volts are mapped to a range from 0 to 1023. The resolution is then 5 volts / 1024 = 4.9 mV per level. The read-in process for an analog voltage value is 100 µs (0.0001 s); 10,000 measurements can be carried out per second.

The connections of the six AD converters are on the Arduino UNO Board marked with ANALOG IN and are labeled A0 ... A5.

Figure 1 - AD converter inputs A0 ... A5

A number of the type int (integer) between 0 and 1023 output.

2 - A first voltage measurement

 A first voltage measurement with an AD converter material 1x Arduino UNO board1x USB connection cable1x power supply1x potentiometer, 10 kOhm tasks Set up the circuit according to the circuit diagram on the breadboard.Broadcast the program Poti_1.ino into the editor and save it.Start the program and open the serial monitor.Check whether the displayed values ​​change when the slider is moved on the potentiometer.Determine if values ​​are between 0 and 1023.

Circuit diagram and circuit structure

Figure 2 - Circuit diagram (left) and circuit structure on the breadboard and connection to the Arduino board (right)

TIP: If the potentiometer is not firmly seated on the breadboard, straighten the three connection legs of the potentiometer with flat-nose pliers.

The program Poti_1.ino

In the terminal, the values ​​0 and 1023 should be displayed for the left stop position or right stop for the potentiometer. At each intermediate position of the grinder, a value between the two extremes is displayed (see Fig. 3).

3 - Conversion of the values ​​into voltage quantities

The values ​​returned by the AD converter are between 0 and 1023; they are a measure of the position of the wiper at the used potentiometer and they are a measure of the voltage that is tapped by the wiper.

In one extreme position (left stop) a value 0 is output and in the right stop a value 1023 is output in the terminal. This highest value corresponds to the applied voltage and that is 5 volts here. With the help of the rule of three we can say:

• 1023 corresponds to 5 volts1 corresponds to 5/1023 volt value corresponds to 5 * value / 1023 volts

The conversion can be carried out with this formula:

The associated program poti_1.ino has been supplemented by a few lines and it became the floating point variable tension of type float introduced.

The program poti_2.ino

The associated terminal output is shown in the following figure. The value output by the AD converter is displayed in the left column, with the converted voltage value to the right.