• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer

KaliTut

Kali Linux tutorial and Linux Tips

  • Home
  • Raspberry Pi
  • Privacy Policy
  • About us
  • Affiliate disclaimer

Connect Raspberry Pi GPIO input with 5 or 12 volts

November 26, 2017 by Walid Salame

Raspberry Pi Connect GPIO input with 5 or 12 volts

Connect Raspberry Pi GPIO input

The input and output level of a GPIO of Raspberry Pi for “High” is at a voltage of 3.3 volts. But if you have a larger input level then you can not apply this voltage directly to a GPIO. The GPIO would be overloaded and broken.

With a simple voltage divider, you can divide down too much input voltage to 3.3 volts. In this example, we use the common voltages of 5 and 12 volts.
Circuit for an input signal of 5 or 12 volts

Raspberry-Pi-input-signal

Since a GPIO input only tolerates a maximum of +3.3 V, the input voltage must be reduced. For this purpose, a voltage divider of two or more resistors is suitable. A voltage divider consists in the simplest case of two resistors. It is a series connection.

Since the current in the series circuit is the same everywhere, cause the unequal resistors different voltage drops. These partial voltages (U1, U2, …) behave like the associated resistors (R1, R2, …). This means that the greatest resistance falls off most of the total voltage. At the smallest resistance, the smallest part of the total voltage drops.

R1, R2,

This means that if one has the ratio of the two partial stresses, one can, if one resistance is given, calculate the other in proportion.

Calculate the resistance R 1 with an R 2 of 10k Ohm

Task

  • Calculate the resistance R 1 with an R 2 of 10k Ohm and a total voltage of 5 volts.
  • Calculate the resistance R 2 at an R 2 of 10k Ohm and a total voltage of 12 volts.

Solution for an input level of 5 volts
Given are:

  • Total voltage U tot = 5V
  • Partial voltage U 2 = 3.3V
  • Resistance R 2 = 10k Ohm

We are looking for:

  • Partial voltage U1 =?
  • Resistance R1 =?

Calculation of the partial voltage U1 :

Calculation of the partial voltage U1

Solution for an input level of 12 volts
Given are:

  • Total voltage U tot = 12V
  • Partial voltage U 2 = 3.3V
  • Resistance R 2 = 10k Ohm

We are looking for:

  • Partial voltage U 1 =?
  • Resistance R 1 =?

Calculation of the partial voltage U 1 :

Calculation of the partial voltage U 1

Calculation of resistance R 1 :

Calculation of resistance R 1

Solution: Choosing the right resistor
However, there is a problem with the calculated resistance. The exact resistance value does not exist. He is not necessary. Since Raspberry Pi detects at most 3.3 volts at a GPIO input, but also less than 3.3 volts as a logical “high”, the resistance may also be slightly larger.

For a calculated resistance R 1 of 5.677k ohms we choose a resistance value of 5.6k Ohm (E12 or E24).

For a calculated resistance R 1 of 26.364k Ohm we choose a resistance value of 27k Ohm (E12 or E24).

Solution: offset
In order to check whether the input level for the GPIO is not too small due to the voltage divider, we calculate the voltage U 2 with the calculated values. The voltage U 2 must not be less than 1.3 volts.

offset
Post Views: 59

Filed Under: Raspberry Pi Tagged With: Raspberry Pi GPIO

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

Follow us

  • Facebook
  • Twitter
  • YouTube

Categories

  • algorithm
  • Android Ai coding
  • Android pentesting tools
  • Arduino
  • Artificial Intelligence
  • Books
  • ChatGPT Prompt
  • Darknet
  • database
  • General
  • Github Tools
  • Hacking
  • Kali Linux
  • Linux
  • Linux Commands
  • Network Administrator
  • Penetration Testing
  • Penetration Testing Tools
  • PowerShell
  • Raspberry Pi
  • resources
  • Review
  • Termux
  • Tutorials
  • Ubuntu
  • Uncategorized
  • Video Tutorials
  • vmware
  • WiFi Adapter
  • WiFi Pentesting
  • Wireless Router
  • Wireshark

Recent Posts

  • Transforming Photos with ChatGPT Prompt : A Cinematic Double Exposure in a Post-Apocalyptic World
  • Stryker Android App: Your Mobile Pentesting Powerhouse
  • Alfa awus036ach review
  • Alfa AWUS1900 for Wireless Penetration Testing
  • How to Run DeepSeek AI Locally on Kali Linux – Step-by-Step Guide

Footer

Kalitut

Kalitut.com goal is to share the knowledge for free, help you find the best tools on the web and provides tutorials

Find us on social media

  • Facebook
  • Pinterest
  • Reddit
  • Twitter
  • YouTube

Copyright © 2025

  • Home
  • About us
  • Privacy Policy
  • Affiliate disclaimer