Built-in project · no microcontroller

BSS138 level shifter

One channel of the bi-directional 3.3 V to 5 V level shifter: a BSS138 and two 10k pull-ups. Pull either side low and the other follows. There is no microcontroller in it: the simulator solves the 7 parts as a circuit, so it runs the moment you press Run, and nothing needs compiling.

Teaching? Assign it to your class in one click.

Intermediate Runs in your browser. Free, and no account needed.

The parts retail for about $5.90. On Mokxi they're free.

BSS138 level shifterlive0.000 s 0.00x
Press Run, then pull one side low with its switch
The circuit itself, running here on the simulator. Press what can be pressed; click anything else to open it in the editor.

How it works

There is no microcontroller in this one, so nothing is compiled: the simulator solves the circuit itself. The file in the editor is the notes that come with it.

sketch.ino
// One channel of a BSS138 level shifter. Left meter: the 3.3 V side (the
// source); right meter: the 5 V side (the drain); a 10k pull-up on each.
//
// Both switches open, each side sits at its own supply and the BSS138 is
// off. Pull the 3.3 V side low and the channel pulls the 5 V side down with
// it. Pull the 5 V side low instead: the body diode drags the source down
// until the channel turns on, so it works both ways.

Parts list

8 parts, plus the jumper wires and 2 bench instruments. The parts retail for about $5.90; on Mokxi they're free, and so are the instruments.

How it is wired

5 connections, pin by pin, read from the circuit itself. Each line is one set of pins joined together, by a jumper wire or a breadboard strip.

  • 3.3 V: MOSFET pin G; Resistor, 10k Ω (1) pin 2
  • 5 V: Resistor, 10k Ω (2) pin 1
  • Ground: Slide switch (1) pin 3; Slide switch (2) pin 3; Multimeter (1) pin COM; Multimeter (2) pin COM
  • MOSFET pin S; Resistor, 10k Ω (1) pin 1; Slide switch (1) pin 2; Multimeter (1) pin V
  • MOSFET pin D; Resistor, 10k Ω (2) pin 2; Slide switch (2) pin 2; Multimeter (2) pin V

Change it and keep it

Open it in the editor, change the circuit or the code, and keep your version in a free account.