===== Adding external Analog Sensors ===== One external analog sensor can be connected to the Kniwwelino through the A0 pin available on the outer area. The analog A0 pin is capable of measuring voltages from 0-5v. To work with such a Sensor, you need additional material: an analog sensor (potentiometer e.g.), as well as wire to create a closed circuit using the pins of the Kniwwelino. With the Kniwwelino Blocks, you can read an analog voltage value (0-5v) on pin A0 which will be available as values from 0-1023 in . In the following we describe how to connect an external potentiometer to the Kniwwelino to read an analog value. ==== Preparing the Kniwwelino Board for an external analog sensor ==== Take a scrap piece of wire and solder it to the outer two of the three pads below the "enable AD" label of the Kniwwelino Board. After the two pads are connected by the soldered wire, cut of the rest of the wire. Check if both pads are connected and the third inner pad is left open. {{gallery>en:extensions?analog_in*.jpg&100x100}} {{:en:extensions:analog_in_4.jpg?600|}} ==== Connecting an external potentiometer with alligator clips ==== You need: * 1 Potentiometer (rotary or sliding) * 3 Alligator clips in red, black and a third color {{:en:extensions:analogsensor_4.jpg?600|}} To connect the Potentiometer: * Take a **black alligator clip** and attach it to the **GND pin** at the top. * The other side of the black clip goes to one of the **outer pins** of the potentiometer. * Take a **red alligator clip** and attach it to the **3.3v pin** at the top. * The other side of the red clip goes to the other one of the **outer pins** of the potentiometer. * Take a **third alligator clip**, and connect it to the **A0 pin** of the Kniwwelino. * The other side goes to the **center pin** of the potentiometer. {{:en:extensions:analogsensor_1.jpg?600|}} Now your potentiometer as acting as a voltage divider which provides 0-3.3v on the center pin - depending of the rotation of the potentiometer axis. As soon as you program Kniwwelino read an analog value on pin A0 (see below), you will retrieve the analog voltage from 0-5v as a numeric value from 0-1023. Instead of using a rotary potentiometer, you can also use a sliding potentiometer: {{:en:extensions:analogsensor_2.jpg?600|}} ==== Connecting an external potentiometer with wire ==== You can also connect your potentiometer with wire, by adopting the same approach as for [[en:extensions:extled|connecting external LEDs]] (winding and tape), or by soldering them. {{:en:extensions:analogsensor_3.jpg?600|}} ==== Programming external analog sensors ==== You can read the current value of the analog sensor with the following block. {{:en:extensions:analog_read_block_1.jpg|}}