This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:iot-open:hardware2:sensors_electric [2023/10/02 14:18] – pczekalski | en:iot-open:hardware2:sensors_electric [2024/05/27 11:58] (current) – ktokarz | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== Electrical Characteristic Sensors ==== | + | ====== Electrical Characteristic Sensors ====== |
- | Electrical characteristic sensors measure the voltage and amperage of the electric current. When the voltage and current sensors are used concurrently, | + | {{: |
+ | Electrical characteristic sensors measure the voltage and amperage of the electric current. When the voltage and current sensors are used concurrently, | ||
- | ===Voltage Sensor=== | + | == Potentiometer == |
+ | A potentiometer is a type of resistor whose resistance 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); | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | == Voltage Sensor == | ||
A voltage sensor is a device or circuit for voltage measurement. A simple DC (direct current) voltage sensor consists of a voltage divider circuit with an optional amplifier for a tiny voltage measure. For measuring the AC (alternating current), the input is connected to the rectifier diode or bridge to rectify AC to DC and a capacitor to flatten the voltage. The resulting voltage can be measured with an analogue digital converter of the microcontroller. For safety, while measuring the mains voltage, an optoelectrical isolator should be added at the output, or a transformer should lower the voltage at the input.\\ | A voltage sensor is a device or circuit for voltage measurement. A simple DC (direct current) voltage sensor consists of a voltage divider circuit with an optional amplifier for a tiny voltage measure. For measuring the AC (alternating current), the input is connected to the rectifier diode or bridge to rectify AC to DC and a capacitor to flatten the voltage. The resulting voltage can be measured with an analogue digital converter of the microcontroller. For safety, while measuring the mains voltage, an optoelectrical isolator should be added at the output, or a transformer should lower the voltage at the input.\\ | ||
A voltage sensor can detect a power failure and measure if the voltage is in the range required. IoT applications include monitoring appliances, power lines, and power supplies.\\ | A voltage sensor can detect a power failure and measure if the voltage is in the range required. IoT applications include monitoring appliances, power lines, and power supplies.\\ | ||
Line 8: | Line 52: | ||
<figure sensor_voltage1> | <figure sensor_voltage1> | ||
- | {{ : | + | {{ : |
< | < | ||
</ | </ | ||
Line 16: | Line 60: | ||
< | < | ||
</ | </ | ||
- | |||
The example code: | The example code: | ||
Line 53: | Line 96: | ||
</ | </ | ||
- | ===Current Sensor=== | + | == Current Sensor == |
A current sensor is a device or a circuit for current measurement. A simple DC sensor consists of a high-power resistor with low resistance. The current value is obtained by measuring the voltage on the resistor and applying a formula derived from Ohm's law. Other non-invasive measurement methods involve hall effect sensors for DC and AC and inductive coils (current transformer) for AC.\\ | A current sensor is a device or a circuit for current measurement. A simple DC sensor consists of a high-power resistor with low resistance. The current value is obtained by measuring the voltage on the resistor and applying a formula derived from Ohm's law. Other non-invasive measurement methods involve hall effect sensors for DC and AC and inductive coils (current transformer) for AC.\\ | ||
Line 60: | Line 103: | ||
<figure sensor_current1> | <figure sensor_current1> | ||
- | {{ : | + | {{ : |
< | < | ||
</ | </ | ||
<figure sensor_current2> | <figure sensor_current2> | ||
- | {{ : | + | {{ : |
< | < | ||
</ | </ | ||
<figure sensor_current3> | <figure sensor_current3> | ||
- | {{ : | + | {{ : |
< | < | ||
</ | </ |