Skip to content

input hardware

doomke edited this page Jul 11, 2023 · 17 revisions

The input module offers extensive support for measuring and converting voltages.

  • pin limitations (ADC2 and WiFi)
  • averaging

Conversions

Voltage Divider

The input pins of the ESP32 can only measure up 3.3 V, which means that higher voltages need to be "broken down" before they can be measured correctly. For this purpose a voltage divider with two resistors of known resistance, $R_1$ and $R_2$, can be used to bring down the wanted voltage $U_0$ to the actually measured voltage $U$.
$U_0$ can then be calculated via $U_0 = \frac{R_1 + R_2}{R_2} U = \left( 1 + \frac{R_1}{R_2} \right) U$.

     U0  o
         |
     R1  █
     U   ├----o input pin
     R2  █
    GND  ⏚

It is a good idea to limit the current to about 10 mA and the maximum pin voltage measured to 3 V, which yields a value of about 300 Ω for $R_2$. $R_1$ can then be chosen using the maximum expected voltage $U_{\mathrm{max}}$ via $R_1 = \frac{U_\mathrm{max} - 3\mathrm{V}}{10\mathrm{mA}}$

Measuring Resistance

As the input is limited to measuring voltages, a variable resistance can only be evaluated indirectly, by using both a reference voltage and a reference resistor.

  • U_0 = 3.3V
  • R_2 = wanted
  • R_1 = R_ref
  • $R_\mathrm{ref} = \sqrt{R_\mathrm{max} - R_\mathrm{min}}$

General

Guides

Principle of Operation

Modules

Software Hardware
camera camera
infoLED infoLED
input input
macro macro
output output
servo servo
socket socket
stepper stepper
WiFi wifi

Clone this wiki locally