Raspberry Pi GPIO connect

Basically you can operate a GPIO pin either as input or output. As an input, it can evaluate the states “High” and “Low”. For example, from a switch, button or other signal-emitting circuit. As output, a GPIO can assume the states “High” and “Low”. This means that either a voltage of +3.3 V for “High” or 0 V for “Low” is applied to the input or applied to the output.
What to pay attention to when connecting raspberry pi gpio
- In addition to the possibility of using GPIOs as inputs and outputs, there are also parallel functions, such as SPI, I2C, UART, PWM and PCM. The configuration of a GPIO must be set at startup or during the runtime of Raspberry Pi. The parallel functions must be activated separately. For example, by loading modules.
- The GPIOs have certain current and voltage limits. When wiring you have to observe these limits, because otherwise not only the single GPIO, but the whole Raspberry Pi can be affected.
- The voltage levels at the GPIO input and output are +3.3V for High and 0V for Low. However, these states are defined as ranges and therefore deviations are permitted here. Depending on the load, the level at a GPIO output may deviate from its ideal values of 0V and + 3.3V.
- In general, the GPIO inputs are wired with resistors to set them to a defined level (+ VCC or GND) or to limit the current.
- The current draw at a GPIO output must be limited in any case. If a GPIO output is to switch something, amplify the output signal with a transistor stage or driver circuit to relieve the GPIO.
- The fixed voltage GPIO pins are less suitable for power. Especially not the + 3.3V pins and only limited to the + 5V pins. These live pins are only suitable to provide a fixed level. External circuit parts, especially relays and motors, should be powered by their own power supply. In exceptional cases it may be possible that a relay or a fan may work directly on the + 3.3V or + 5V circuit. But that should not be the rule. And you can not go out of a permanently safe operation.
- The use of the TXD-marked GPIO (parallel function with a serial interface) as a GPIO output can be problematic because at boot time a bit sequence is output which can lead to undesired effects.
What is the safe current?
First of all , the total current of all GPIOs should not exceed 50 mA . Because this is the largest current (with reserve of course) that a bond (the thin wire of the “little bit” of the circuit to the actual internal circuit) can withstand.
The entire electronics of a (single) connection is designed for a maximum of 16 mA. This means that no damage occurs up to 16 mA. Everything about it is uncertain. Even if one or the other hobbyist gets much more from a GPIO.
The range in which the output end stages of a GPIO work safely ranges from 2 to 16 mA . The optimum is between 3 and 8 mA. With more than 8 mA you should not expect. But not less than 2 mA .
If you need more, you must use a transistor as a switch with an external power supply for a GPIO output. For a stable output current then 2 to 3 mA are sufficient for the transistor . Then you will not get more than 50 mA in all GPIOs in total.
Note: There is no clear information on minimum and maximum permitted or possible GPIO current values. These current values are empirical values of Raspberry Pi users who have found out by experimenting which current enables stable operation. Often, higher values are possible. But then nobody can guarantee stable and safe operation anymore.
Assignment and wiring of Raspberry Pi GPIOs
Before each project, it is worth considering which pins should be connected. If you connect any GPIO, then you may have to rebuild later, because you want to use a certain function, which is occupied by a GPIO already connected.
Connect Raspberry Pi GPIO as input
If a GPIO is defined as an input, then it accepts switching states of external circuit components. In the simplest case this can be a button or switch. In any case, a potential or level (voltage) must be applied so that the GPIO input can evaluate the applied state. These states are referred to as “high” and “low” or “1” and “0”. This expresses the applied level or voltage, which must be +3.3 V or 0 V. It is important that no more than +3.3 V may be applied to a GPIO input. That would destroy the entrance.
The levels or voltage values are not carved in stone. They are subject to a tolerance. A GPIO input will detect voltages below 0.8V as “low” and voltages above 1.3V as “high”.
If no defined voltage is applied, then the inputs tend to oscillate in any direction. That is, they alternately assume the state “high” or “low”. This happens, for example, when the GPIO input is not connected. That should be avoided.
Using pull-up or pull-down resistors, one can influence which ground state a GPIO input should have.
- Connect Raspberry Pi GPIO with pull-up or pull-down resistor?
- Connect Raspberry Pi GPIO input with pushbutton/switch
- Connect Raspberry Pi GPIO input with 5 and 12 volts
Connect Raspberry Pi GPIO as output
If a GPIO is defined as output, then switching states can be passed on to external circuit parts. If a GPIO is connected as an output, then you should consider a few limits. If you do not stick to these limits, then you run the risk that Raspberry Pi will be destroyed in whole or in part.
- The GPIO connectors have a maximum control voltage of +3.3 volts.
- The removable current from a GPIO is a maximum of 16 mA.
- From all GPIOs together a maximum current of 51 mA may be taken.
- The recommendation per GPIO is 2 or 3 mA. For more you have to work with a “driver”.
- At a GPIO you can not operate any kind of load.
If a GPIO is defined as an output, then in the simplest case, an LED can be lit or controlled via a transistor, a relay or a motor.
- GPIO output connected to a transistor
- Connect the GPIO output with a relay
- Connect GPIO output to a motor
Control and program GPIO
Leave a Reply