Pull up and Bidirectional level shifter

hi, recently I wanted to make a PCB board that connects an Arduino Uno with a micro sd, a spi flash and a mpu6050 sensor. I was wondering if to interface i2c and spi I have to use pull-up resistors as well as a circuit with MOSFETs to make a bidirectional level shifter

No. If you use the classic MOSFET design level shifter, the resistors also act as pull up resistors for the rest of the circuit.

No. SPI bus does not use pull-up resistors.

However, Uno is 5V and SD cards/readers are 3.3V, so you do need to use voltage level shifters.

The simple MOSFET-based level shifters use pull-up resistors and so will not be fast enough to keep up with the high clock speeds of SPI unless you use very slow speeds, which cancels out the advantage of using SPI over i2c.

With SPI bus, the voltage level shifters do not need to be bi-directional (like they do with i2c bus) so you can use high-speed, push-pull, unidirectional drivers like 74hct125.

Unfortunately, many SD card reader modules designed for use with Arduino have a design fault. This fault means they must be the only device on the SPI bus, which cancels the advantage of using a bus.

perfect thanks :slight_smile:

so i have to use only bidirectional for mpu6050 while for flash and microsd i use only voltage dividers and pull up?

Voltage dividers only work one way. You'll still need level shifters for bidirectional communication with flash and sd.

1 Like

so in conclusion I only use bidirectional both for mpu6050 and for the sd card + flash memory?

yes.

Yes, it is an i2c device.

You can use voltage dividers to shift from 5V to 3.3V, but not from 3.3V to 5V. You need an active shifting circuit for that.

No, please read post #3 carefully and ask if there is anything you don't understand. Using pull-ups between 5V power and a 3.3V pin could damage the 3.3V device and will not be fast enough for SPI devices. Using simple MOSFET level shifter circuits removes the danger of damage, but, again, will not be fast enough for reliable SPI communication.

For theSD card, you really only need to level shift the three lines that are outputs of the Nano and inputs of the SD card - MOSI, CLK and CS. You need to take them from 5V to 3.3V. But the 3.3V MISO output of the SD card can go directly to the Nano, and it will read 3.3V as "high". Adafruit makes a microSD card module that does it that way, and it works fine.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.