I am currently designing a circuit that can record data from a sensor and save the data recorded into an EEPROM. My two devices (EEPROM and for testing purpose a RTC) are connected via an I2C bus to a PIC16F887 µC. However, the two devices voltage operating range is not the same (5v for the EEPROM, 3.3 for the RTC), and my battery is a 9V battery.

Therefore I designed an electronic circuit with a level shifter composed of MOSFETs for the SDA/SDL wiring. On top of that I added two LM317 voltage regulator to power the devices (9V->3.3V and 9V->5V). As I am not an expert in designing such things, I would appreciate if you could glance at what I made and tell me if I did something horribly wrong!

enter image description here


Despite other comments, the solution itself is fine. I see a few minor issues though.

  1. 10k pull-up resistors on the bus are not nearly stiff enough, especially if you want to use higher bus speeds.

  2. You need input and output decoupling capacitors on your linear regulators and digital ICs. 100nF is a good start for the digital ICs, and for the linear regulators, 100nF on the inputs and 1μF on the outputs.

  • \$\begingroup\$ Thanks for the decoupling capacitor tip, actually it is shown on most linear regulator schematic but I completely skipped this part ! For the decoupling capacitor for the digital ICs, you mean one capacitor between their input voltage and ground, that's all right ? (Just to be sure I understood what you meant !) Last thing, you say that 10k pull-up resistors are far away from being stiff enough, but on the datasheet they recommand these values for 400kHz bus speed. Is there an issue with level shifter ? Anyway, that piece of advice was great ! \$\endgroup\$ – Al_th Apr 19 '13 at 17:31
  • 1
    \$\begingroup\$ Correct - keep the decoupling capacitors as close as possible to the power and return pins. If there's any significant capacitance on the I2C lines, you will need to lower those pullups to keep the edges sharp. I usually start with 1.8k and evaluate from there. \$\endgroup\$ – Adam Lawrence Apr 19 '13 at 18:26
  • \$\begingroup\$ Okay, thanks for everything, I hope it will help people playing around with different I2C devices ! \$\endgroup\$ – Al_th Apr 19 '13 at 18:42

Yes, you have done things on your schematic that are horribly wrong. To properly level shift your voltage levels, see I2C slave address not acknowledged (sometimes) The MAX3373E IC is used for level shifting. Please note that, pull up resistors are shown on the SDA & SCK lines. However, when using MAX3373E, pull up resistors are not required as the MAX3373E has built in pull ups on both sides of the I/O lines. There are other ICs available for level shifting as well. You can go to Digi Key or Mouser and search.

  • 5
    \$\begingroup\$ OP's approach is fine! NXP even has an app note on the topic. Don't be so quick to judge. \$\endgroup\$ – Adam Lawrence Apr 19 '13 at 14:46
  • \$\begingroup\$ I see where I went wrong. The symbol for the FETs is not shown correctly, the diode is missing. \$\endgroup\$ – Suirnder Apr 19 '13 at 15:21
  • 1
    \$\begingroup\$ @Suirnder There's risks inherent in coming across too strong with limited knowledge. Not the first such post by you, I believe. \$\endgroup\$ – Anindo Ghosh Apr 19 '13 at 15:39
  • 1
    \$\begingroup\$ @Gosh I am learning my lessons. I should have checked the datasheet on the FETs first. \$\endgroup\$ – Suirnder Apr 19 '13 at 15:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.