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 4233 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
  • DAB
    DAB over 8 years ago

    The easiest way to do level shifting is to use a PSOC 4000 board (about 5 USD) as an interface to the RPi GPIO.

     

    The PSOC provides you with all kinds of easy level shifting for IO and provides a wealth of programmable Digital and IO blocks to simplify control and sampling.

     

    Take a look.

     

    DAB

    • Cancel
    • Vote Up +5 Vote Down
    • Sign in to reply
    • Cancel
  • koudelad
    koudelad over 8 years ago in reply to DAB

    Hello @DAB,

     

    Just out of curiosity, could you, please, be a bit more specific about using the PSoC?

     

    I can imagine, it is perfect for performing a sensor hub in this case. It can even perform some real-time applications that the Raspberry Pi can't. The data from the PSoC can be sent to Pi upon request from the Pi. However, how to do the level shifting? The PSoC would have to be running at 3.3 V to comply with the Pi. How to interface the sensors that run at 5 V? Is it possible to do the level shifting internally?

    According to the datasheet, maximum voltage at GPIO is -0.5 V to Vdd + 0.5 V and the maximum GPIO injection current for input voltage higherer that Vddd (or lower that Vss) is -0.5 to 0.5 mA.

     

    Thanks, David

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • rew
    rew over 8 years ago in reply to koudelad

    I stepped away from the PSOC devices.

    Cypress promised me configurable analog circuitry. Sounds interesting... So I bought a device....

     

    * Bootloader support means that you can buy a $90 programmer, write your own bootloader and put that in the device.

    * Analog configurability is only avialable on the 40xx devices with xx > 20, while I had bought the 00 or 10. The analog configurability was advertized as "for the 4xxx series".

    * analog configurability means not much more than that you can select which input pin goes to the ADC. A standard feature on all microcontrollers. Nothing special.

    * They promised to send me a 4020 stick when it became available, but didn't.

     

    So... the development sticks are really cheap, but not as useful as the nucleo boards from ST. Those have the programmer on board, and "bootloader" means you can actually program an otherwise empty chip.

     

    For someone getting into electronics, using an embedded processor to do level shifting is a bit too difficult to make it easy. For others who have the hardware and lots of experience in working with the chip, it'll be a 5 minute job, but not when you're new.

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Cancel
  • koudelad
    koudelad over 8 years ago in reply to rew

    You made some good points, although my experience is better.

     

    I tried to list the new "USB stick" kits here: https://www.element14.com/community/docs/DOC-54414/l/cypress-linecard#comment-103831

     

    The cheapest kits don't have a dedicated programmer, but cost about $ 4 / € 4 (excluding VAT). I got one of the kits with a 42xx device on Embedded World exhibition a few years ago. I use this kit quite often and the only inconvenience is the bootloader. On the other hand, no other programmer is required (I programmed it hundreds of times), the device comes pre-programmed with the bootloader. There is basically no analog configurability, just the ADC.

     

    Cypress heard the community and the newer versions of these kits with PSoC 4 M / S / L devices feature a KitProg programmer (that can be snapped away and used separately) and cost about $ 10.

     

    I think you might like the PSoC Analog Coprocessor or PSoC 5 LP devices, which feature the analog parts you were missing: programmable op-amps, comparators, ADCs, DAC, analog multiplexer, filter block.

     

    I am just an amateur who previously programmed 8-bit PICs, but I have to say, there are a few things that the competition can't offer. On the other hand, my lack of digital and especially analog circuitry design is what prevents me from using the full potential of these devices. (Huge downside of not being an EE.) That is why I asked, whether there is some obvious way to do this level shifting using a PSoC, to learn something new image However, using a level shifter with one the TLE291 etc. is the simplest way to go.

     

    EDIT: Crossed out "USB stick" like 4200 L kit, the only available is CY8CKIT-046 PSoCRegistered 4 L-Series Pioneer Kit.

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

    You made some good points, although my experience is better.

     

    I tried to list the new "USB stick" kits here: https://www.element14.com/community/docs/DOC-54414/l/cypress-linecard#comment-103831

     

    The cheapest kits don't have a dedicated programmer, but cost about $ 4 / € 4 (excluding VAT). I got one of the kits with a 42xx device on Embedded World exhibition a few years ago. I use this kit quite often and the only inconvenience is the bootloader. On the other hand, no other programmer is required (I programmed it hundreds of times), the device comes pre-programmed with the bootloader. There is basically no analog configurability, just the ADC.

     

    Cypress heard the community and the newer versions of these kits with PSoC 4 M / S / L devices feature a KitProg programmer (that can be snapped away and used separately) and cost about $ 10.

     

    I think you might like the PSoC Analog Coprocessor or PSoC 5 LP devices, which feature the analog parts you were missing: programmable op-amps, comparators, ADCs, DAC, analog multiplexer, filter block.

     

    I am just an amateur who previously programmed 8-bit PICs, but I have to say, there are a few things that the competition can't offer. On the other hand, my lack of digital and especially analog circuitry design is what prevents me from using the full potential of these devices. (Huge downside of not being an EE.) That is why I asked, whether there is some obvious way to do this level shifting using a PSoC, to learn something new image However, using a level shifter with one the TLE291 etc. is the simplest way to go.

     

    EDIT: Crossed out "USB stick" like 4200 L kit, the only available is CY8CKIT-046 PSoCRegistered 4 L-Series Pioneer Kit.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
Children
  • johnbeetem
    johnbeetem over 8 years ago in reply to koudelad

    David Koudela wrote:

     

    Cypress heard the community and the newer versions of these kits with PSoC 4 M / S / L devices feature a KitProg programmer (that can be snapped away and used separately) and cost about $ 10.

    As far as I know, Cypress doesn't have a cheap "prototyping board" for the PSoC 4200L.  You have to get a PSoC 4200L Pioneer board for around US$50.  I like the 4200L specs, especially since it has USB and more programmable logic than the 4200.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
  • koudelad
    koudelad over 8 years ago in reply to johnbeetem

    You are right, I corrected my previous reply. But who knows, maybe there will be one in the future.

    BTW Cypress promised this "USB stick" like kit for the upcoming PSoC6, but this will take a while. The "big" kit is supposed to be available by the end of September and the smaller has only been confirmed as planned.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
  • Jan Cumps
    Jan Cumps over 8 years ago in reply to koudelad

    I'm using strategy 1 and 3 of this blog post.

     

     

    5V to 3.3V Logic Level Shifting Stragety Notes | James Reuben Knowles

     

     

    #1 works well if you need to drop a few data lines.

    For #3, you *have* to order the right IC because not all manufacturers have a chip with this desired (side) effect of being a level shifter.

    The chip I use (and also Gadgetfactory, who use it as a I/0 buffer for their Papillio boards) is the SN74CBT16245DGGR .

     

    I've done a few videos on the subject:

     

    You don't have permission to edit metadata of this video.
    Edit media
    x
    image
    Upload Preview
    image

     

     

    You don't have permission to edit metadata of this video.
    Edit media
    x
    image
    Upload Preview
    image

    • Cancel
    • Vote Up +3 Vote Down
    • Sign in to reply
    • Cancel
  • Jan Cumps
    Jan Cumps over 8 years ago in reply to johnbeetem

    True. I'm a fan of the Cypress PSoC family.

    At the same time I also throw my hands in the air when someone (hey, Don) promotes them as logic level shifter, replacement for all FPGA or replacement for all ARM controllers.

     

    I like them, but they are just what they are: ARM microcontrollers with a little FPGA and analog configurable fabric. No magic. Just that.

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
  • DAB
    DAB over 8 years ago in reply to Jan Cumps

    Hi Jan,

     

    I agree, for a simple level shifter, the PSOC is maximum overkill.

     

    I am just trying to promote the device to people and make them aware that it is a truly versatile little board that can be paired with an RPi or other computer to handle many I/O issues with just a bit of wiring and software.

     

    As for FPGA, now there you have misunderstood.  A complex project that requires fast response and a lot of logic will always need a FPGA.

    The PSOC can help provide many simple digital and analog blocks with FPGA like capability, but there are just too few of them on each board to consider using them for a complex project. image

     

    Magic is in the eyes of the viewer.  It may not be magic, but at times, it certainly looks close enough. image

     

    DAB

    • Cancel
    • Vote Up +4 Vote Down
    • Sign in to reply
    • Cancel
  • koudelad
    koudelad over 8 years ago in reply to DAB

    Could you, please, share the schematics or principles how to do the level shifting? I would love to be the outcome of this dicussion, so even beginners (including me) will be able to perform this task using a PSoC.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
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