Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
en:extensions:extanalog [2018/05/07 13:52] kniwwelino |
en:extensions:extanalog [2018/05/24 09:53] (current) kniwwelino [Adding external Analog Sensors] |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ===== 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 " | ||
+ | |||
+ | {{gallery> | ||
+ | |||
+ | {{: | ||
+ | |||
+ | ==== Connecting an external potentiometer with alligator clips ==== | ||
+ | You need: | ||
+ | * 1 Potentiometer (rotary or sliding) | ||
+ | * 3 Alligator clips in red, black and a third color | ||
+ | |||
+ | {{: | ||
+ | |||
+ | 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. | ||
+ | |||
+ | {{: | ||
+ | |||
+ | 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, | ||
+ | |||
+ | {{: | ||
+ | |||
+ | ==== Connecting an external potentiometer with wire ==== | ||
+ | |||
+ | You can also connect your potentiometer with wire, by adopting the same approach as for [[en: | ||
+ | |||
+ | {{: | ||
+ | ==== Programming external analog sensors ==== | ||
+ | |||
+ | You can read the current value of the analog sensor with the following block. | ||
+ | |||
+ | {{: |