I have a level shift circuit to get 3.3V digital signals from 5V digital signals.
The circuit works fine when I apply 3.3V from an Arduino DUE, but it gives a 1.74V output when I apply 3.3V from an Arduino MEGA.
The circuit works fine with any power source (tested with 5V, 7.5V, and 18V sources) to the drain except the MEGA's 3.3V and 5V power pins. The PSPICE circuit works perfectly. For drain voltages up to 60V, I get nearly 3.3V output.
Indeed I don't need the level shifter for reading feedback with MEGA. I am facing other issues with the DUE. One of them I posted here. So, I was thinking of using MEGA instead of DUE.
If I work with MEGA, I will need the level shifter to interface with a humidity sensor (SHT41-AD1B-R2).
Any help understanding why it is not working with the MEGA 3.3V and 5V would be appreciated.
...that is completely wrong from the outset. Your MOSFET is placed in common drain configuration. Have you studied transistors? It makes a "source follower" where the output voltage roughly tracks the input voltage. But the catch, is that it also drops the gate-source voltage. That's what you see.
Did you look at any existing level shifter designs before setting out? The answer to your question is really, to go look at those. You can find the schematics for the level shifter modules on line. They all use similar if not identical circuits. It works.
In the schematic, PIN 1 of the MOSFET is the source, and pin 3 is the drain.
This circuit works properly. When the MOS saturates, the drain current becomes proportional to the square of the Gate-Source voltage. A small amount of the drain current is contributed by the Drain to Source voltage.
The SPICE outputs show the same. For different drain voltage values (3.3V, 5V, 7.5V, and 15V), the output is nearly 3.3V. The reason is the MOSFET has saturated, and the drain current is proportional to the square of the 5V digital input to the Gate. To be exact, the output voltage is
3.23V for Vd = 3.3V
3.24V for Vd = 5V
3.27V for Vd = 7.5V
3.3V for Vd = 15V
Changing the drain voltage is not affecting the output much. I got the same results when I tested the circuit.
I am not getting the output when I apply the drain voltage from an Arduino MEGA.
There is voltage feedback from the source to the gate, in common drain configuration. You are very "sure of yourself" but I think you must be wrong. The MOS never saturates in that circuit, because the source negative feedback from the load limits the drain current.
I don't care much that it works in the simulation, I don't know why it does, but your circuit can not work without dropping voltage to the load.
Your claims are surprising, because you are contradicting knowledge that is "EE 101, MOSFET fundamentals".
I must be missing something. Can you help me point out how it is becoming a common drain configuration? The drain is connected to a power supply, nothing else.
Also, the circuit works fine with Arduino DUE with the drain voltage given from DUE or any other source. It is not working with the MEGA.
If you are in an EE program, you are supposed to learn how to do research. In the old days you might open a reference book. Now, people often use Google and such search tools. Just look for "MOSFET common drain". Or talk to your instructors about providing text books.
The three terminal configurations of transistors are fundamental knowledge. You shouldn't even pick up a MOSFET or a BJT without knowing them.
The typical GS threshold voltage of the BSS138 is 1.3V. So in your circuit if you apply 5V at the gate, it should be possible to get 3.3V at the output so long as enough current gets through to bring the resistor up to 3.3V. If you're only getting 1.7V, then current through the mosfet must be severely restricted, and that's probably because you aren't applying 5V to the gate.
But I2C is bidirectional, and GolamMosta is right about bidirectional level shifting in I2C.
Reducing "signal" voltage only requires a Voltage Divider (2 resistors). Choose resistors that sum-up to between 1K and 10K.
Note that this is for low-current signals and high-impedance inputs, not for power. And you need active circuitry (transistor, MOSFET, chip) if you want to boost from from 3.3 to 5V, etc.