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 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
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • 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 Is level shifting really needed for I2C?
  • 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 3 replies
  • Subscribers 672 subscribers
  • Views 3779 views
  • Users 0 members are here
  • i2c
  • raspberry_pi
  • rpi
Related

Is level shifting really needed for I2C?

fustini
fustini over 13 years ago

Howdy, I've written a blog post on interfacing the 5V DS1307 RTC via I2C, and I'd like to verify whether a logic level converter (e.g. level shifter) is really needed.   I became aware that it may not be needed after reading this comment in simon.monk LED Clock using Raspberry Pi blog post:

Gordon Henderson said...

Not quite sure why you're using a level convertor here... I2C is driven by open collector outputs with the master providing the pull-ups - which the Pi does via on-board 1.8K ohm resistors... The display should never drive the bus back to the Pi, so there really shouldn't be a need...

 

-Gordon

August 21, 2012 3:51 PM

Simon responded:

Simon Monk said...

@Gordon. I think you are right I don't think it is necessary. I had a level converter anyway and did the wiring before finding out about the protocol. I thought their may be some 'acks' going on.

 

No, the display should never be driving the bus.

August 22, 2012 12:40 AM

and then later:

Simon Monk said...

@Gordon, I just checked that the display doesn't do any nasty pulling up of the bus to 5V, and it doesn't. So I took the level converter out and it works just fine without it.

August 24, 2012 1:06 AM

This left me wondering if this should be the case for all I2C modules.  Anyone have thoughts on this?

 

Thanks,

Drew

  • Sign in to reply
  • Cancel
Parents
  • johnbeetem
    johnbeetem over 13 years ago

    Since I2C drivers are open drain, you should be able to connect them without worrying about damaging anything.  However, correct functionality depends on the individual I2C device.  According to the DS1307 data sheet, the DS1307 has TTL input thresholds: 0.8V for Vil and 2.2V for Vih.  So the DS1307 should work fine with either a 3.3V or 5.0V pull-up.  OTOH, the I2C standard only requires a fixed Vih to be 3.0V, so pulling up to 3.3V would not leave a safe margin.  So it depends on the specific I2C device and how it implements the standard.

     

    Supplementing Luc Cool's comments, watch out for rogue pull-ups.  RasPi's built-in 3.3V pull-ups should be the only ones on the bus.  5V pull-ups will result in unnecessary DC currents and any parallel pull-ups make it harder for I2C devices to pull down SCL and SDA.  For example, the DS1307 can only sink 5 mA, so at 3.3V the total pull-up must not be less than 660 Ohms.  The 1.8K value used by RasPi is a good choice.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • johnbeetem
    johnbeetem over 13 years ago

    Since I2C drivers are open drain, you should be able to connect them without worrying about damaging anything.  However, correct functionality depends on the individual I2C device.  According to the DS1307 data sheet, the DS1307 has TTL input thresholds: 0.8V for Vil and 2.2V for Vih.  So the DS1307 should work fine with either a 3.3V or 5.0V pull-up.  OTOH, the I2C standard only requires a fixed Vih to be 3.0V, so pulling up to 3.3V would not leave a safe margin.  So it depends on the specific I2C device and how it implements the standard.

     

    Supplementing Luc Cool's comments, watch out for rogue pull-ups.  RasPi's built-in 3.3V pull-ups should be the only ones on the bus.  5V pull-ups will result in unnecessary DC currents and any parallel pull-ups make it harder for I2C devices to pull down SCL and SDA.  For example, the DS1307 can only sink 5 mA, so at 3.3V the total pull-up must not be less than 660 Ohms.  The 1.8K value used by RasPi is a good choice.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Cancel
Children
  • fustini
    fustini over 13 years ago in reply to johnbeetem

    Thanks for the advice, Luc and John. 

     

    Coincidently, Adafruit just posted their own DS1307 RTC tutorial for the Raspberry Pi and Ladyada warns:

     

    When building the kit, leave out the 2.2K ohm resistors - by leaving them out, we force the RTC to communicate at 3.3V instead of 5V, which is better for the Pi!

    • Cancel
    • Vote Up 0 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