Go Down

Topic: 3.3v to 5v inverter by bc547 (Read 3 times) previous topic - next topic


i was wondering is there any method convert the 3.3 v logic of  sdcard to 5 v of arduino bu using NPN or PNP transistors like bc547 and bc557. do we need to use level shifter ic and so then to use which ic
i have an SD breakout board

Tom Carpenter

You can indeed.
The diagram attached works for both BJT's and MOSFETs (though for FETs you omit the 4.7k resistor).
It is also bidirectional so can shift up and shift down.
It is non-inverting so won't mess around with the signal.

For SD cards though you can just get away with a 1.8k and 3.3k resistor forming a potential divider to shift the signals from the Arduino down to 3.3ish volts. For the MISO signal, you can just connect it directly to the arduino as it will happily register 3.3V as a logic 1.

(P.S. Sorry for the zigzzaggy resistors, the program I drew that in favours those to the box ones)


Mind that for fast signals (ie sdcard's one) you need to drive the CMOS inputs (ie sdcard's inputs) with low impedance output drivers (ie push-pull as it is with atmega). The transistor level shifter might work with TTL logic, but with high impedance CMOS inputs (ie 10Meg || 10pF) it will not maintain the fast edges (because ie low->high transition will be done by 10k push only)..
Better you use low value resistors dividers or a none-inverting driver..

Tom Carpenter

Yeah, that circuit works best when you replace the BJT with a MOSFET. But it shows that it is possible to use BC547s for this purpose.

I have use just resistors in the past with no issues at all.


Resistors fail for some newer SD cards that have edge detectors. The SD specification requires clock rise time and fall time to be less than 10 ns.

Worse is the fact that the errors in write data won't be detected.  There is no CRC by default since Arduino has no hardware support.

The latest version of SdFat supports software CRC but this slows transfers.

Go Up