This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revision | |||
en:iot-open:hardware2:sensors_angle [2024/05/23 09:00] – pczekalski | en:iot-open:hardware2:sensors_angle [2024/05/23 19:44] (current) – pczekalski | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Angle & Orientation Sensors ====== | ====== Angle & Orientation Sensors ====== | ||
{{: | {{: | ||
- | == Potentiometer == | ||
- | A potentiometer is a type of resistor, the resistance of which can be adjusted using a mechanical lever. The device consists of three terminals. The resistor between the first and the third terminal has a fixed value, but the second terminal is connected to the lever. Whenever the lever is turned, a slider of the resistor is moved; it changes the resistance between the second terminal and side terminals. Variable resistance causes the change of the voltage, which can be measured to determine the position of the lever. Thus, the potentiometer output is an analogue value.\\ | ||
- | Potentiometers are commonly used as a control level, for example, a volume level for the sound and joystick position. They can also be used to determine the angle in feedback loops with motors, such as servo motors. The potentiometer symbol is present in figure {{ref> | ||
- | |||
- | <figure potentiometer1> | ||
- | {{ : | ||
- | < | ||
- | </ | ||
- | |||
- | <figure potentiometer2> | ||
- | {{ : | ||
- | < | ||
- | </ | ||
- | |||
- | <figure potentiometer3> | ||
- | {{ : | ||
- | < | ||
- | </ | ||
- | |||
- | An example code: | ||
- | <code c> | ||
- | |||
- | // | ||
- | int potentioPin = A0; | ||
- | //The analogue reading from the potentiometer output | ||
- | int potentioReading; | ||
- | |||
- | void setup(void) { | ||
- | //Begin serial communication | ||
- | Serial.begin(9600); | ||
- | // | ||
- | pinMode(potentioPin, | ||
- | } | ||
- | |||
- | void loop(void) { | ||
- | //Read the analogue value of the potentiometer sensor | ||
- | potentioReading = analogRead(potentioPin); | ||
- | Serial.print(" | ||
- | Serial.println(potentioReading); | ||
- | delay(10); | ||
- | } | ||
- | </ | ||
- | |||
== The Inertial Measurement Unit (IMU) == | == The Inertial Measurement Unit (IMU) == | ||
- | An IMU is an electronic device | + | An IMU is an electronic device |
* moving forward/ | * moving forward/ | ||
* moving left/right, | * moving left/right, |