element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      • Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Vietnam
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum Logic Level Shifters for GPIO
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 16 replies
  • Subscribers 676 subscribers
  • Views 4230 views
  • Users 0 members are here
  • gpio
  • raspberry_pi
  • raspberry pi
  • levelshifter
  • arduino
Related

Logic Level Shifters for GPIO

muthukmk
muthukmk over 8 years ago

Hi,

 

I have accumulated drivers and sensors for Arduino over a period of time. IR proximity, ultrasonic sensor , 4-channel relay module, handful of L293N motor driver modules, A4988 stepper sticks and corresponding CNC shield etc.

 

I have been successful in using them with Arduino (Mega and UNO). I have taken enough care in using those items which are power-hungry to be supplied with separate power sources and that approach worked well in Arduino context (eg. always power motors separately). Now, I want to use above sensors and actuators with Raspberry Pi 3 model B which I recently purchased. Now I need to find a proper way of dealing with logic-level related issues when I connect to RPi GPIO.

 

I have some doubts after going through experiences on Google on various Instructables / DIY projects if its good to use level shifters particularly while interfacing above components with RPi GPIO.

Many articles/discussions what I have read on internet seem to indicate that it should be ok to use them directly with RPi GPIO. But I wanted to confirm with those who would had been in similar situation. There may be more costly options (eg. a common adapter which lets such interfacing seamlessly possible without additional components )  which I want to avoid.

 

So, specific questions

a) Is it imperative to use logic level shifters to deal with 3.3v and 5v differences always for input as well as output ?

b) Or its more of experimenting and finding what works best for each of standard modules like relay / motor drivers / ultrasonic sensors / PIR sensors etc?

 

If I have missed any specific points to be added to the question, please let me know so that I can add the same

 

Regards

 

Muthu

  • Sign in to reply
  • Cancel
Parents
  • rew
    rew over 8 years ago

    For signals going into the raspberry pi, if the signal is really 5V then it is best to use some sort of level shifter. It depends a bit on how fast your signal is going to be changing on what approach is necessary. The simplest is to just put a big resistor in series with the signal. When the signal drives "5V" and the pi has an internal diode to 3.3V on the signal, a 100k resistor will allow a current of max 17 micro amps to flow into the raspberry pi gpio. Some manufaturers specify an allowed current of 10mA, staying below 1mA should be safe. The downside here is that capacitance on the GPIO pin might cause slower response on the raspberry pi side.

     

    Slightly more complex: I use a 1k resistor, together with a scottky diode to 3.3V. This allows quite quick signal changes and keeps the current into the broadcom CPU to a minimum.

     

    Even more complex would be to have a special level shifter chip and configure that for 5V on one side and 3.3 on the other.

     

    For signals going the other direction, a raspberry pi output going into some other chip, you again have several options. Do nothing is one. Many older chips are TTL compatible. They have a threshold voltage that is compatible with the 3.3V signal levels of the raspberry. (Threshold is: below this voltage a 0, or low will be seen, above that high, or one. )

     

    The L293 is an example, it will detect "high" above 2.3V, where the raspberry can deliver 3.3V, officially minus 10% or 3.0V without any issue.

     

    Modern chips will be 3.3V of themselves. The trickiest are the medium-old chips. (An example is: the AVR that is on your arduino).  Those are 5V CMOS. In practise they switch above VCC/2, or at 2.5V. But the manufacturers take some margin and specify "between 0.3VCC and 0.7VCC". This calculates as: The switch will happen between 1.5V and 3.5V. If you drive it with 3.3V, you are still not guaranteed to be detected as a "1" or "high". In practice, this almost never happens. For hobby projects, it is acceptable to hook it up and "see if it works". But not acceptable if you're designing the next-generation space shuttle...

    • Cancel
    • Vote Up +6 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • rew
    rew over 8 years ago

    For signals going into the raspberry pi, if the signal is really 5V then it is best to use some sort of level shifter. It depends a bit on how fast your signal is going to be changing on what approach is necessary. The simplest is to just put a big resistor in series with the signal. When the signal drives "5V" and the pi has an internal diode to 3.3V on the signal, a 100k resistor will allow a current of max 17 micro amps to flow into the raspberry pi gpio. Some manufaturers specify an allowed current of 10mA, staying below 1mA should be safe. The downside here is that capacitance on the GPIO pin might cause slower response on the raspberry pi side.

     

    Slightly more complex: I use a 1k resistor, together with a scottky diode to 3.3V. This allows quite quick signal changes and keeps the current into the broadcom CPU to a minimum.

     

    Even more complex would be to have a special level shifter chip and configure that for 5V on one side and 3.3 on the other.

     

    For signals going the other direction, a raspberry pi output going into some other chip, you again have several options. Do nothing is one. Many older chips are TTL compatible. They have a threshold voltage that is compatible with the 3.3V signal levels of the raspberry. (Threshold is: below this voltage a 0, or low will be seen, above that high, or one. )

     

    The L293 is an example, it will detect "high" above 2.3V, where the raspberry can deliver 3.3V, officially minus 10% or 3.0V without any issue.

     

    Modern chips will be 3.3V of themselves. The trickiest are the medium-old chips. (An example is: the AVR that is on your arduino).  Those are 5V CMOS. In practise they switch above VCC/2, or at 2.5V. But the manufacturers take some margin and specify "between 0.3VCC and 0.7VCC". This calculates as: The switch will happen between 1.5V and 3.5V. If you drive it with 3.3V, you are still not guaranteed to be detected as a "1" or "high". In practice, this almost never happens. For hobby projects, it is acceptable to hook it up and "see if it works". But not acceptable if you're designing the next-generation space shuttle...

    • Cancel
    • Vote Up +6 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube