วันอังคารที่ 30 เมษายน พ.ศ. 2556

1 GPIO Input


.1 GPIO Input

GPIO peripherals vary quite widely. In some cases, they are very simple, a group of pins that can be switched as a group to either input or output. The input and output voltages are typically, though not universally limited to the supply voltage of the device with the GPIOs on, and may be damaged by greater voltages.
Some GPIOs have 5 V tolerant inputs: even on low supply voltages, the device can accept 5V without damage.
For Raspberry Pi, we present an examples of how to adapt the voltage level of a 5V sensor measure to prevent possible damage. 
Components for this examples and voltage adaptation circuit can be founded in the Starter Kit for Raspberry Pi (A/V Edition) 
When a GPIO pin is set as an input with a basic push button example, we can have these voltages incompatibility problems. 
 This circuit is wrong because when you press the button the GPIO input is connected to 5 volts, so our device may be damaged.
 However, this can be avoided by simply using a resistor in the push-button cable. The value of the resistor is determined by the leakage current of the GPIO pin (the current used by the circuit to read the pin) and the amount of voltage drop it creates as a result. With the 5K resistor we obtain 3.3V in the GPIO input.
Vgpio = 5V·(10K/(10K+5K)) = 3.3V

ไม่มีความคิดเห็น:

แสดงความคิดเห็น