1
\$\begingroup\$

I try to learn I2C with this diagram as an exercise. I want to read my ESP8266 IO events from my 5V adafruit trinket.

I2C MASTER ESP8266ex

Operating Voltage 2.5 V ~ 3.6 V
Operating Current Average value: 80 mA

I2C SLAVE TRINKET 5V

On-board 3.3V or 5.0V power regulator with 150mA output capability and ultra-low dropout. 
Up to 16V input, reverse-polarity protection, thermal and current-limit protection.

I read on i2c-bus.org voltage-level

Since I2C is an open drain concept the VCC level as such is not critical for the operation as long as all components on the bus can accept the voltage on the IO pins and are able to detect the logic levels.

It's seems to be not the case here, the ESP8266 only accept 3.6V max and trinket use 5V, then I search a solution : bi-directional-logic-level-converter-hookup-guide With my Raspberry as 3.3V power source for LV and the Trinket 5V OUT pin as 5V powersource for HV.

This tutorial use the N-channel BSS138 but i have not this MOSTFET only the N-channel 5ln01sp

This my schematic for the moment : enter image description here

Can I use the 5ln01sp MOSFET instance of the BSS138 ? (I suppose that yes after having consulted the data sheet of each one but I am not sure because of my low level of knowledge.)

As a beginner, could my scheme work without drawbacks, did I forget something ?

Thank you for your help and your time.

\$\endgroup\$

2 Answers 2

1
\$\begingroup\$

Short Answer:
Looks definitely Okay


Long answer:

Here is the reference design or solution for the similar case from NXP:
https://www.nxp.com/docs/en/application-note/AN10441.pdf

enter image description here


One option was to look for the high voltage tolerant I2C Pins. Normally, in most of the MCUs you can find that information. The I2C pins will be tolerant to higher voltage than the VDD of the system. Example: STM32F405 MCU:

enter image description here In your case, I could not find the related information in the datasheet.


Looking into the datasheet of the part 5LN01SP:

enter image description here

  • The maximum gate threshold voltage is 1.3 V (we have a good buffer of 3.3 V - 1.3 V = 2V)

  • Forward voltage drop of the body diode is 0.85 V typical (1.2 V maximum), still we have guaranteed buffer 2.1 V (3.3 V - 1.2 V).

  • The series resistance hardly matters if this is the only device on the I2C bus.

  • at 100 Hz or even a few 10s of KHz of clock frequency, I do not expect any problems as such.

\$\endgroup\$
1
  • \$\begingroup\$ thank you very much for all this informations. \$\endgroup\$
    – Ephemeral
    Commented Dec 23, 2019 at 14:26
0
\$\begingroup\$

You don't need the level shifters with the ESP8266; there are two different ways to do it directly (SDA connected to SDA, SCL connected to SCL):

  1. connect the I2C pull-up resistors to 3.3V from the ESP8266. This works because the I2C bus is open-drain, so the signal swing will be 0V to 3.3V. The Vih (input high threshold) of the ATTiny85 is 0.6 x VCC, so Vih is 3.0V, and it will work (just barely). I'd use around 2K to 4.7K pull-up resistors on the I2C bus to make the risetime faster. You'll only have 0.3V of margin above the Vih threshold, so you may get erratic results due to fluctuations in power from the WiFi section.

  2. Connect the pull-up resistors to 5V. The ESP8266 I/O pins are 5V-tolerant EXCEPT FOR THE PINS CONNECTED TO THE FLASH. The Espressif CEO said that ESP8266 I/Os are 5V-tolerant back in 2016, but the Flash chips on the modules are NOT 5V-tolerant. I've run 5V signals into an ESP8266 GPIO and it handled it fine.

Here's the post from the Espressif CEO stating the ESP8266 has 5V-tolerant pins: https://www.facebook.com/groups/1499045113679103/permalink/1731855033731442/

I don't know if the Ras Pi has 5V-tolerant pins, so I'd only attempt the first solution for direct-wiring a 5V I2C device to the Pi.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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